function Lb(i,l){for(var d=0;d<l.length;d++){const u=l[d];if(typeof u!="string"&&!Array.isArray(u)){for(const c in u)if(c!=="default"&&!(c in i)){const m=Object.getOwnPropertyDescriptor(u,c);m&&Object.defineProperty(i,c,m.get?m:{enumerable:!0,get:()=>u[c]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))u(c);new MutationObserver(c=>{for(const m of c)if(m.type==="childList")for(const v of m.addedNodes)v.tagName==="LINK"&&v.rel==="modulepreload"&&u(v)}).observe(document,{childList:!0,subtree:!0});function d(c){const m={};return c.integrity&&(m.integrity=c.integrity),c.referrerPolicy&&(m.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?m.credentials="include":c.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function u(c){if(c.ep)return;c.ep=!0;const m=d(c);fetch(c.href,m)}})();function gv(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var _u={exports:{}},rl={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var gp;function qb(){if(gp)return rl;gp=1;var i=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function d(u,c,m){var v=null;if(m!==void 0&&(v=""+m),c.key!==void 0&&(v=""+c.key),"key"in c){m={};for(var y in c)y!=="key"&&(m[y]=c[y])}else m=c;return c=m.ref,{$$typeof:i,type:u,key:v,ref:c!==void 0?c:null,props:m}}return rl.Fragment=l,rl.jsx=d,rl.jsxs=d,rl}var bp;function Hb(){return bp||(bp=1,_u.exports=qb()),_u.exports}var a=Hb(),Tu={exports:{}},Le={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var xp;function Vb(){if(xp)return Le;xp=1;var i=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),v=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),D=Symbol.iterator;function R(z){return z===null||typeof z!="object"?null:(z=D&&z[D]||z["@@iterator"],typeof z=="function"?z:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,_={};function O(z,T,ee){this.props=z,this.context=T,this.refs=_,this.updater=ee||k}O.prototype.isReactComponent={},O.prototype.setState=function(z,T){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,T,"setState")},O.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function q(){}q.prototype=O.prototype;function E(z,T,ee){this.props=z,this.context=T,this.refs=_,this.updater=ee||k}var j=E.prototype=new q;j.constructor=E,b(j,O.prototype),j.isPureReactComponent=!0;var N=Array.isArray;function G(){}var w={H:null,A:null,T:null,S:null},ae=Object.prototype.hasOwnProperty;function oe(z,T,ee){var ne=ee.ref;return{$$typeof:i,type:z,key:T,ref:ne!==void 0?ne:null,props:ee}}function W(z,T){return oe(z.type,T,z.props)}function V(z){return typeof z=="object"&&z!==null&&z.$$typeof===i}function P(z){var T={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(ee){return T[ee]})}var ce=/\/+/g;function ye(z,T){return typeof z=="object"&&z!==null&&z.key!=null?P(""+z.key):T.toString(36)}function je(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(G,G):(z.status="pending",z.then(function(T){z.status==="pending"&&(z.status="fulfilled",z.value=T)},function(T){z.status==="pending"&&(z.status="rejected",z.reason=T)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function F(z,T,ee,ne,he){var me=typeof z;(me==="undefined"||me==="boolean")&&(z=null);var xe=!1;if(z===null)xe=!0;else switch(me){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(z.$$typeof){case i:case l:xe=!0;break;case S:return xe=z._init,F(xe(z._payload),T,ee,ne,he)}}if(xe)return he=he(z),xe=ne===""?"."+ye(z,0):ne,N(he)?(ee="",xe!=null&&(ee=xe.replace(ce,"$&/")+"/"),F(he,T,ee,"",function(ie){return ie})):he!=null&&(V(he)&&(he=W(he,ee+(he.key==null||z&&z.key===he.key?"":(""+he.key).replace(ce,"$&/")+"/")+xe)),T.push(he)),1;xe=0;var Ue=ne===""?".":ne+":";if(N(z))for(var ke=0;ke<z.length;ke++)ne=z[ke],me=Ue+ye(ne,ke),xe+=F(ne,T,ee,me,he);else if(ke=R(z),typeof ke=="function")for(z=ke.call(z),ke=0;!(ne=z.next()).done;)ne=ne.value,me=Ue+ye(ne,ke++),xe+=F(ne,T,ee,me,he);else if(me==="object"){if(typeof z.then=="function")return F(je(z),T,ee,ne,he);throw T=String(z),Error("Objects are not valid as a React child (found: "+(T==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":T)+"). If you meant to render a collection of children, use an array instead.")}return xe}function K(z,T,ee){if(z==null)return z;var ne=[],he=0;return F(z,ne,"","",function(me){return T.call(ee,me,he++)}),ne}function fe(z){if(z._status===-1){var T=z._result;T=T(),T.then(function(ee){(z._status===0||z._status===-1)&&(z._status=1,z._result=ee)},function(ee){(z._status===0||z._status===-1)&&(z._status=2,z._result=ee)}),z._status===-1&&(z._status=0,z._result=T)}if(z._status===1)return z._result.default;throw z._result}var Te=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var T=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(T))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},de={map:K,forEach:function(z,T,ee){K(z,function(){T.apply(this,arguments)},ee)},count:function(z){var T=0;return K(z,function(){T++}),T},toArray:function(z){return K(z,function(T){return T})||[]},only:function(z){if(!V(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return Le.Activity=C,Le.Children=de,Le.Component=O,Le.Fragment=d,Le.Profiler=c,Le.PureComponent=E,Le.StrictMode=u,Le.Suspense=h,Le.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,Le.__COMPILER_RUNTIME={__proto__:null,c:function(z){return w.H.useMemoCache(z)}},Le.cache=function(z){return function(){return z.apply(null,arguments)}},Le.cacheSignal=function(){return null},Le.cloneElement=function(z,T,ee){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var ne=b({},z.props),he=z.key;if(T!=null)for(me in T.key!==void 0&&(he=""+T.key),T)!ae.call(T,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&T.ref===void 0||(ne[me]=T[me]);var me=arguments.length-2;if(me===1)ne.children=ee;else if(1<me){for(var xe=Array(me),Ue=0;Ue<me;Ue++)xe[Ue]=arguments[Ue+2];ne.children=xe}return oe(z.type,he,ne)},Le.createContext=function(z){return z={$$typeof:v,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:m,_context:z},z},Le.createElement=function(z,T,ee){var ne,he={},me=null;if(T!=null)for(ne in T.key!==void 0&&(me=""+T.key),T)ae.call(T,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(he[ne]=T[ne]);var xe=arguments.length-2;if(xe===1)he.children=ee;else if(1<xe){for(var Ue=Array(xe),ke=0;ke<xe;ke++)Ue[ke]=arguments[ke+2];he.children=Ue}if(z&&z.defaultProps)for(ne in xe=z.defaultProps,xe)he[ne]===void 0&&(he[ne]=xe[ne]);return oe(z,me,he)},Le.createRef=function(){return{current:null}},Le.forwardRef=function(z){return{$$typeof:y,render:z}},Le.isValidElement=V,Le.lazy=function(z){return{$$typeof:S,_payload:{_status:-1,_result:z},_init:fe}},Le.memo=function(z,T){return{$$typeof:p,type:z,compare:T===void 0?null:T}},Le.startTransition=function(z){var T=w.T,ee={};w.T=ee;try{var ne=z(),he=w.S;he!==null&&he(ee,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(G,Te)}catch(me){Te(me)}finally{T!==null&&ee.types!==null&&(T.types=ee.types),w.T=T}},Le.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},Le.use=function(z){return w.H.use(z)},Le.useActionState=function(z,T,ee){return w.H.useActionState(z,T,ee)},Le.useCallback=function(z,T){return w.H.useCallback(z,T)},Le.useContext=function(z){return w.H.useContext(z)},Le.useDebugValue=function(){},Le.useDeferredValue=function(z,T){return w.H.useDeferredValue(z,T)},Le.useEffect=function(z,T){return w.H.useEffect(z,T)},Le.useEffectEvent=function(z){return w.H.useEffectEvent(z)},Le.useId=function(){return w.H.useId()},Le.useImperativeHandle=function(z,T,ee){return w.H.useImperativeHandle(z,T,ee)},Le.useInsertionEffect=function(z,T){return w.H.useInsertionEffect(z,T)},Le.useLayoutEffect=function(z,T){return w.H.useLayoutEffect(z,T)},Le.useMemo=function(z,T){return w.H.useMemo(z,T)},Le.useOptimistic=function(z,T){return w.H.useOptimistic(z,T)},Le.useReducer=function(z,T,ee){return w.H.useReducer(z,T,ee)},Le.useRef=function(z){return w.H.useRef(z)},Le.useState=function(z){return w.H.useState(z)},Le.useSyncExternalStore=function(z,T,ee){return w.H.useSyncExternalStore(z,T,ee)},Le.useTransition=function(){return w.H.useTransition()},Le.version="19.2.3",Le}var yp;function ud(){return yp||(yp=1,Tu.exports=Vb()),Tu.exports}var g=ud();const ct=gv(g),jp=Lb({__proto__:null,default:ct},[g]);var Ou={exports:{}},ol={},Eu={exports:{}},zu={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Sp;function Bb(){return Sp||(Sp=1,(function(i){function l(F,K){var fe=F.length;F.push(K);e:for(;0<fe;){var Te=fe-1>>>1,de=F[Te];if(0<c(de,K))F[Te]=K,F[fe]=de,fe=Te;else break e}}function d(F){return F.length===0?null:F[0]}function u(F){if(F.length===0)return null;var K=F[0],fe=F.pop();if(fe!==K){F[0]=fe;e:for(var Te=0,de=F.length,z=de>>>1;Te<z;){var T=2*(Te+1)-1,ee=F[T],ne=T+1,he=F[ne];if(0>c(ee,fe))ne<de&&0>c(he,ee)?(F[Te]=he,F[ne]=fe,Te=ne):(F[Te]=ee,F[T]=fe,Te=T);else if(ne<de&&0>c(he,fe))F[Te]=he,F[ne]=fe,Te=ne;else break e}}return K}function c(F,K){var fe=F.sortIndex-K.sortIndex;return fe!==0?fe:F.id-K.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;i.unstable_now=function(){return m.now()}}else{var v=Date,y=v.now();i.unstable_now=function(){return v.now()-y}}var h=[],p=[],S=1,C=null,D=3,R=!1,k=!1,b=!1,_=!1,O=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function j(F){for(var K=d(p);K!==null;){if(K.callback===null)u(p);else if(K.startTime<=F)u(p),K.sortIndex=K.expirationTime,l(h,K);else break;K=d(p)}}function N(F){if(b=!1,j(F),!k)if(d(h)!==null)k=!0,G||(G=!0,P());else{var K=d(p);K!==null&&je(N,K.startTime-F)}}var G=!1,w=-1,ae=5,oe=-1;function W(){return _?!0:!(i.unstable_now()-oe<ae)}function V(){if(_=!1,G){var F=i.unstable_now();oe=F;var K=!0;try{e:{k=!1,b&&(b=!1,q(w),w=-1),R=!0;var fe=D;try{t:{for(j(F),C=d(h);C!==null&&!(C.expirationTime>F&&W());){var Te=C.callback;if(typeof Te=="function"){C.callback=null,D=C.priorityLevel;var de=Te(C.expirationTime<=F);if(F=i.unstable_now(),typeof de=="function"){C.callback=de,j(F),K=!0;break t}C===d(h)&&u(h),j(F)}else u(h);C=d(h)}if(C!==null)K=!0;else{var z=d(p);z!==null&&je(N,z.startTime-F),K=!1}}break e}finally{C=null,D=fe,R=!1}K=void 0}}finally{K?P():G=!1}}}var P;if(typeof E=="function")P=function(){E(V)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,ye=ce.port2;ce.port1.onmessage=V,P=function(){ye.postMessage(null)}}else P=function(){O(V,0)};function je(F,K){w=O(function(){F(i.unstable_now())},K)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(F){F.callback=null},i.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ae=0<F?Math.floor(1e3/F):5},i.unstable_getCurrentPriorityLevel=function(){return D},i.unstable_next=function(F){switch(D){case 1:case 2:case 3:var K=3;break;default:K=D}var fe=D;D=K;try{return F()}finally{D=fe}},i.unstable_requestPaint=function(){_=!0},i.unstable_runWithPriority=function(F,K){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var fe=D;D=F;try{return K()}finally{D=fe}},i.unstable_scheduleCallback=function(F,K,fe){var Te=i.unstable_now();switch(typeof fe=="object"&&fe!==null?(fe=fe.delay,fe=typeof fe=="number"&&0<fe?Te+fe:Te):fe=Te,F){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=fe+de,F={id:S++,callback:K,priorityLevel:F,startTime:fe,expirationTime:de,sortIndex:-1},fe>Te?(F.sortIndex=fe,l(p,F),d(h)===null&&F===d(p)&&(b?(q(w),w=-1):b=!0,je(N,fe-Te))):(F.sortIndex=de,l(h,F),k||R||(k=!0,G||(G=!0,P()))),F},i.unstable_shouldYield=W,i.unstable_wrapCallback=function(F){var K=D;return function(){var fe=D;D=K;try{return F.apply(this,arguments)}finally{D=fe}}}})(zu)),zu}var Np;function $b(){return Np||(Np=1,Eu.exports=Bb()),Eu.exports}var Mu={exports:{}},Pt={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Cp;function Fb(){if(Cp)return Pt;Cp=1;var i=ud();function l(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)p+="&args[]="+encodeURIComponent(arguments[S])}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 d(){}var u={d:{f:d,r:function(){throw Error(l(522))},D:d,C:d,L:d,m:d,X:d,S:d,M:d},p:0,findDOMNode:null},c=Symbol.for("react.portal");function m(h,p,S){var C=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:C==null?null:""+C,children:h,containerInfo:p,implementation:S}}var v=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function y(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Pt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=u,Pt.createPortal=function(h,p){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(l(299));return m(h,p,null,S)},Pt.flushSync=function(h){var p=v.T,S=u.p;try{if(v.T=null,u.p=2,h)return h()}finally{v.T=p,u.p=S,u.d.f()}},Pt.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,u.d.C(h,p))},Pt.prefetchDNS=function(h){typeof h=="string"&&u.d.D(h)},Pt.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var S=p.as,C=y(S,p.crossOrigin),D=typeof p.integrity=="string"?p.integrity:void 0,R=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;S==="style"?u.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:C,integrity:D,fetchPriority:R}):S==="script"&&u.d.X(h,{crossOrigin:C,integrity:D,fetchPriority:R,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Pt.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var S=y(p.as,p.crossOrigin);u.d.M(h,{crossOrigin:S,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&u.d.M(h)},Pt.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var S=p.as,C=y(S,p.crossOrigin);u.d.L(h,S,{crossOrigin:C,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})}},Pt.preloadModule=function(h,p){if(typeof h=="string")if(p){var S=y(p.as,p.crossOrigin);u.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:S,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else u.d.m(h)},Pt.requestFormReset=function(h){u.d.r(h)},Pt.unstable_batchedUpdates=function(h,p){return h(p)},Pt.useFormState=function(h,p,S){return v.H.useFormState(h,p,S)},Pt.useFormStatus=function(){return v.H.useHostTransitionStatus()},Pt.version="19.2.3",Pt}var _p;function bv(){if(_p)return Mu.exports;_p=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(l){console.error(l)}}return i(),Mu.exports=Fb(),Mu.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Tp;function Pb(){if(Tp)return ol;Tp=1;var i=$b(),l=ud(),d=bv();function u(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function m(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function v(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function y(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(m(e)!==e)throw Error(u(188))}function p(e){var t=e.alternate;if(!t){if(t=m(e),t===null)throw Error(u(188));return t!==e?null:e}for(var n=e,s=t;;){var r=n.return;if(r===null)break;var o=r.alternate;if(o===null){if(s=r.return,s!==null){n=s;continue}break}if(r.child===o.child){for(o=r.child;o;){if(o===n)return h(r),e;if(o===s)return h(r),t;o=o.sibling}throw Error(u(188))}if(n.return!==s.return)n=r,s=o;else{for(var f=!1,x=r.child;x;){if(x===n){f=!0,n=r,s=o;break}if(x===s){f=!0,s=r,n=o;break}x=x.sibling}if(!f){for(x=o.child;x;){if(x===n){f=!0,n=o,s=r;break}if(x===s){f=!0,s=o,n=r;break}x=x.sibling}if(!f)throw Error(u(189))}}if(n.alternate!==s)throw Error(u(190))}if(n.tag!==3)throw Error(u(188));return n.stateNode.current===n?e:t}function S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var C=Object.assign,D=Symbol.for("react.element"),R=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),E=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),ae=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),W=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function P(e){return e===null||typeof e!="object"?null:(e=V&&e[V]||e["@@iterator"],typeof e=="function"?e:null)}var ce=Symbol.for("react.client.reference");function ye(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case O:return"Profiler";case _:return"StrictMode";case N:return"Suspense";case G:return"SuspenseList";case oe:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case E:return e.displayName||"Context";case q:return(e._context.displayName||"Context")+".Consumer";case j:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case w:return t=e.displayName||null,t!==null?t:ye(e.type)||"Memo";case ae:t=e._payload,e=e._init;try{return ye(e(t))}catch{}}return null}var je=Array.isArray,F=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=d.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},Te=[],de=-1;function z(e){return{current:e}}function T(e){0>de||(e.current=Te[de],Te[de]=null,de--)}function ee(e,t){de++,Te[de]=e.current,e.current=t}var ne=z(null),he=z(null),me=z(null),xe=z(null);function Ue(e,t){switch(ee(me,t),ee(he,e),ee(ne,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vh(t),e=Bh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}T(ne),ee(ne,e)}function ke(){T(ne),T(he),T(me)}function ie(e){e.memoizedState!==null&&ee(xe,e);var t=ne.current,n=Bh(t,e.type);t!==n&&(ee(he,e),ee(ne,n))}function B(e){he.current===e&&(T(ne),T(he)),xe.current===e&&(T(xe),nl._currentValue=fe)}var pe,H;function ue(e){if(pe===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);pe=t&&t[1]||"",H=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+pe+e+H}var I=!1;function Se(e,t){if(!e||I)return"";I=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(te){var Z=te}Reflect.construct(e,[],re)}else{try{re.call()}catch(te){Z=te}e.call(re.prototype)}}else{try{throw Error()}catch(te){Z=te}(re=e())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(te){if(te&&Z&&typeof te.stack=="string")return[te.stack,Z.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=s.DetermineComponentFrameRoot(),f=o[0],x=o[1];if(f&&x){var M=f.split(`
`),X=x.split(`
`);for(r=s=0;s<M.length&&!M[s].includes("DetermineComponentFrameRoot");)s++;for(;r<X.length&&!X[r].includes("DetermineComponentFrameRoot");)r++;if(s===M.length||r===X.length)for(s=M.length-1,r=X.length-1;1<=s&&0<=r&&M[s]!==X[r];)r--;for(;1<=s&&0<=r;s--,r--)if(M[s]!==X[r]){if(s!==1||r!==1)do if(s--,r--,0>r||M[s]!==X[r]){var se=`
`+M[s].replace(" at new "," at ");return e.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",e.displayName)),se}while(1<=s&&0<=r);break}}}finally{I=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ue(n):""}function Mt(e,t){switch(e.tag){case 26:case 27:case 5:return ue(e.type);case 16:return ue("Lazy");case 13:return e.child!==t&&t!==null?ue("Suspense Fallback"):ue("Suspense");case 19:return ue("SuspenseList");case 0:case 15:return Se(e.type,!1);case 11:return Se(e.type.render,!1);case 1:return Se(e.type,!0);case 31:return ue("Activity");default:return""}}function Ot(e){try{var t="",n=null;do t+=Mt(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
Error generating stack: `+s.message+`
`+s.stack}}var Dt=Object.prototype.hasOwnProperty,pa=i.unstable_scheduleCallback,sa=i.unstable_cancelCallback,Xn=i.unstable_shouldYield,Ma=i.unstable_requestPaint,ft=i.unstable_now,Pa=i.unstable_getCurrentPriorityLevel,Aa=i.unstable_ImmediatePriority,wa=i.unstable_UserBlockingPriority,Et=i.unstable_NormalPriority,In=i.unstable_LowPriority,pt=i.unstable_IdlePriority,gn=i.log,J=i.unstable_setDisableYieldValue,be=null,ve=null;function qe(e){if(typeof gn=="function"&&J(e),ve&&typeof ve.setStrictMode=="function")try{ve.setStrictMode(be,e)}catch{}}var Xe=Math.clz32?Math.clz32:At,ia=Math.log,Ga=Math.LN2;function At(e){return e>>>=0,e===0?32:31-(ia(e)/Ga|0)|0}var bn=256,xn=262144,Ya=4194304;function Q(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ne(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var r=0,o=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var x=s&134217727;return x!==0?(s=x&~o,s!==0?r=Q(s):(f&=x,f!==0?r=Q(f):n||(n=x&~e,n!==0&&(r=Q(n))))):(x=s&~o,x!==0?r=Q(x):f!==0?r=Q(f):n||(n=s&~e,n!==0&&(r=Q(n)))),r===0?0:t!==0&&t!==r&&(t&o)===0&&(o=r&-r,n=t&-t,o>=n||o===32&&(n&4194048)!==0)?t:r}function U(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ge(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 _e(){var e=Ya;return Ya<<=1,(Ya&62914560)===0&&(Ya=4194304),e}function ze(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ie(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function st(e,t,n,s,r,o){var f=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var x=e.entanglements,M=e.expirationTimes,X=e.hiddenUpdates;for(n=f&~n;0<n;){var se=31-Xe(n),re=1<<se;x[se]=0,M[se]=-1;var Z=X[se];if(Z!==null)for(X[se]=null,se=0;se<Z.length;se++){var te=Z[se];te!==null&&(te.lane&=-536870913)}n&=~re}s!==0&&vt(e,s,0),o!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=o&~(f&~t))}function vt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Xe(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function Nl(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Xe(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}function gi(e,t){var n=t&-t;return n=(n&42)!==0?1:Ns(n),(n&(e.suspendedLanes|t))!==0?0:n}function Ns(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Qn(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function yn(){var e=K.p;return e!==0?e:(e=window.event,e===void 0?32:up(e.type))}function _d(e,t){var n=K.p;try{return K.p=e,t()}finally{K.p=n}}var jn=Math.random().toString(36).slice(2),Rt="__reactFiber$"+jn,Qt="__reactProps$"+jn,Cs="__reactContainer$"+jn,vo="__reactEvents$"+jn,Tg="__reactListeners$"+jn,Og="__reactHandles$"+jn,Td="__reactResources$"+jn,bi="__reactMarker$"+jn;function go(e){delete e[Rt],delete e[Qt],delete e[vo],delete e[Tg],delete e[Og]}function _s(e){var t=e[Rt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Cs]||n[Rt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ih(e);e!==null;){if(n=e[Rt])return n;e=Ih(e)}return t}e=n,n=e.parentNode}return null}function Ts(e){if(e=e[Rt]||e[Cs]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function xi(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(u(33))}function Os(e){var t=e[Td];return t||(t=e[Td]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function wt(e){e[bi]=!0}var Od=new Set,Ed={};function Zn(e,t){Es(e,t),Es(e+"Capture",t)}function Es(e,t){for(Ed[e]=t,e=0;e<t.length;e++)Od.add(t[e])}var Eg=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]*$"),zd={},Md={};function zg(e){return Dt.call(Md,e)?!0:Dt.call(zd,e)?!1:Eg.test(e)?Md[e]=!0:(zd[e]=!0,!1)}function Cl(e,t,n){if(zg(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function _l(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Xa(e,t,n,s){if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+s)}}function va(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ad(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Mg(e,t,n){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var r=s.get,o=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(f){n=""+f,o.call(this,f)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(f){n=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function bo(e){if(!e._valueTracker){var t=Ad(e)?"checked":"value";e._valueTracker=Mg(e,t,""+e[t])}}function wd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=Ad(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Tl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Ag=/[\n"\\]/g;function ga(e){return e.replace(Ag,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function xo(e,t,n,s,r,o,f,x){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+va(t)):e.value!==""+va(t)&&(e.value=""+va(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?yo(e,f,va(t)):n!=null?yo(e,f,va(n)):s!=null&&e.removeAttribute("value"),r==null&&o!=null&&(e.defaultChecked=!!o),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.name=""+va(x):e.removeAttribute("name")}function kd(e,t,n,s,r,o,f,x){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.type=o),t!=null||n!=null){if(!(o!=="submit"&&o!=="reset"||t!=null)){bo(e);return}n=n!=null?""+va(n):"",t=t!=null?""+va(t):n,x||t===e.value||(e.value=t),e.defaultValue=t}s=s??r,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=x?e.checked:!!s,e.defaultChecked=!!s,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),bo(e)}function yo(e,t,n){t==="number"&&Tl(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function zs(e,t,n,s){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&s&&(e[n].defaultSelected=!0)}else{for(n=""+va(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,s&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function Dd(e,t,n){if(t!=null&&(t=""+va(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+va(n):""}function Rd(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(u(92));if(je(s)){if(1<s.length)throw Error(u(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=va(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),bo(e)}function Ms(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var wg=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 Ud(e,t,n){var s=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,n):typeof n!="number"||n===0||wg.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Ld(e,t,n){if(t!=null&&typeof t!="object")throw Error(u(62));if(e=e.style,n!=null){for(var s in n)!n.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var r in t)s=t[r],t.hasOwnProperty(r)&&n[r]!==s&&Ud(e,r,s)}else for(var o in t)t.hasOwnProperty(o)&&Ud(e,o,t[o])}function jo(e){if(e.indexOf("-")===-1)return!1;switch(e){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 kg=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"]]),Dg=/^[\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 Ol(e){return Dg.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ia(){}var So=null;function No(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var As=null,ws=null;function qd(e){var t=Ts(e);if(t&&(e=t.stateNode)){var n=e[Qt]||null;e:switch(e=t.stateNode,t.type){case"input":if(xo(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+ga(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var r=s[Qt]||null;if(!r)throw Error(u(90));xo(s,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)s=n[t],s.form===e.form&&wd(s)}break e;case"textarea":Dd(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&zs(e,!!n.multiple,t,!1)}}}var Co=!1;function Hd(e,t,n){if(Co)return e(t,n);Co=!0;try{var s=e(t);return s}finally{if(Co=!1,(As!==null||ws!==null)&&(hr(),As&&(t=As,e=ws,ws=As=null,qd(t),e)))for(t=0;t<e.length;t++)qd(e[t])}}function yi(e,t){var n=e.stateNode;if(n===null)return null;var s=n[Qt]||null;if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(u(231,t,typeof n));return n}var Qa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_o=!1;if(Qa)try{var ji={};Object.defineProperty(ji,"passive",{get:function(){_o=!0}}),window.addEventListener("test",ji,ji),window.removeEventListener("test",ji,ji)}catch{_o=!1}var Sn=null,To=null,El=null;function Vd(){if(El)return El;var e,t=To,n=t.length,s,r="value"in Sn?Sn.value:Sn.textContent,o=r.length;for(e=0;e<n&&t[e]===r[e];e++);var f=n-e;for(s=1;s<=f&&t[n-s]===r[o-s];s++);return El=r.slice(e,1<s?1-s:void 0)}function zl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ml(){return!0}function Bd(){return!1}function Zt(e){function t(n,s,r,o,f){this._reactName=n,this._targetInst=r,this.type=s,this.nativeEvent=o,this.target=f,this.currentTarget=null;for(var x in e)e.hasOwnProperty(x)&&(n=e[x],this[x]=n?n(o):o[x]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Ml:Bd,this.isPropagationStopped=Bd,this}return C(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ml)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ml)},persist:function(){},isPersistent:Ml}),t}var Jn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Al=Zt(Jn),Si=C({},Jn,{view:0,detail:0}),Rg=Zt(Si),Oo,Eo,Ni,wl=C({},Si,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mo,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ni&&(Ni&&e.type==="mousemove"?(Oo=e.screenX-Ni.screenX,Eo=e.screenY-Ni.screenY):Eo=Oo=0,Ni=e),Oo)},movementY:function(e){return"movementY"in e?e.movementY:Eo}}),$d=Zt(wl),Ug=C({},wl,{dataTransfer:0}),Lg=Zt(Ug),qg=C({},Si,{relatedTarget:0}),zo=Zt(qg),Hg=C({},Jn,{animationName:0,elapsedTime:0,pseudoElement:0}),Vg=Zt(Hg),Bg=C({},Jn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),$g=Zt(Bg),Fg=C({},Jn,{data:0}),Fd=Zt(Fg),Pg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gg={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"},Yg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Xg(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Yg[e])?!!t[e]:!1}function Mo(){return Xg}var Ig=C({},Si,{key:function(e){if(e.key){var t=Pg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=zl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Gg[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mo,charCode:function(e){return e.type==="keypress"?zl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?zl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qg=Zt(Ig),Zg=C({},wl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pd=Zt(Zg),Jg=C({},Si,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mo}),Kg=Zt(Jg),Wg=C({},Jn,{propertyName:0,elapsedTime:0,pseudoElement:0}),e0=Zt(Wg),t0=C({},wl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),a0=Zt(t0),n0=C({},Jn,{newState:0,oldState:0}),s0=Zt(n0),i0=[9,13,27,32],Ao=Qa&&"CompositionEvent"in window,Ci=null;Qa&&"documentMode"in document&&(Ci=document.documentMode);var l0=Qa&&"TextEvent"in window&&!Ci,Gd=Qa&&(!Ao||Ci&&8<Ci&&11>=Ci),Yd=" ",Xd=!1;function Id(e,t){switch(e){case"keyup":return i0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Qd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ks=!1;function r0(e,t){switch(e){case"compositionend":return Qd(t);case"keypress":return t.which!==32?null:(Xd=!0,Yd);case"textInput":return e=t.data,e===Yd&&Xd?null:e;default:return null}}function o0(e,t){if(ks)return e==="compositionend"||!Ao&&Id(e,t)?(e=Vd(),El=To=Sn=null,ks=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Gd&&t.locale!=="ko"?null:t.data;default:return null}}var c0={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 Zd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!c0[e.type]:t==="textarea"}function Jd(e,t,n,s){As?ws?ws.push(s):ws=[s]:As=s,t=jr(t,"onChange"),0<t.length&&(n=new Al("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var _i=null,Ti=null;function u0(e){Dh(e,0)}function kl(e){var t=xi(e);if(wd(t))return e}function Kd(e,t){if(e==="change")return t}var Wd=!1;if(Qa){var wo;if(Qa){var ko="oninput"in document;if(!ko){var ef=document.createElement("div");ef.setAttribute("oninput","return;"),ko=typeof ef.oninput=="function"}wo=ko}else wo=!1;Wd=wo&&(!document.documentMode||9<document.documentMode)}function tf(){_i&&(_i.detachEvent("onpropertychange",af),Ti=_i=null)}function af(e){if(e.propertyName==="value"&&kl(Ti)){var t=[];Jd(t,Ti,e,No(e)),Hd(u0,t)}}function d0(e,t,n){e==="focusin"?(tf(),_i=t,Ti=n,_i.attachEvent("onpropertychange",af)):e==="focusout"&&tf()}function f0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return kl(Ti)}function m0(e,t){if(e==="click")return kl(t)}function h0(e,t){if(e==="input"||e==="change")return kl(t)}function p0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var la=typeof Object.is=="function"?Object.is:p0;function Oi(e,t){if(la(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var r=n[s];if(!Dt.call(t,r)||!la(e[r],t[r]))return!1}return!0}function nf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function sf(e,t){var n=nf(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=nf(n)}}function lf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?lf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function rf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Tl(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Tl(e.document)}return t}function Do(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var v0=Qa&&"documentMode"in document&&11>=document.documentMode,Ds=null,Ro=null,Ei=null,Uo=!1;function of(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Uo||Ds==null||Ds!==Tl(s)||(s=Ds,"selectionStart"in s&&Do(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Ei&&Oi(Ei,s)||(Ei=s,s=jr(Ro,"onSelect"),0<s.length&&(t=new Al("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=Ds)))}function Kn(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Rs={animationend:Kn("Animation","AnimationEnd"),animationiteration:Kn("Animation","AnimationIteration"),animationstart:Kn("Animation","AnimationStart"),transitionrun:Kn("Transition","TransitionRun"),transitionstart:Kn("Transition","TransitionStart"),transitioncancel:Kn("Transition","TransitionCancel"),transitionend:Kn("Transition","TransitionEnd")},Lo={},cf={};Qa&&(cf=document.createElement("div").style,"AnimationEvent"in window||(delete Rs.animationend.animation,delete Rs.animationiteration.animation,delete Rs.animationstart.animation),"TransitionEvent"in window||delete Rs.transitionend.transition);function Wn(e){if(Lo[e])return Lo[e];if(!Rs[e])return e;var t=Rs[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in cf)return Lo[e]=t[n];return e}var uf=Wn("animationend"),df=Wn("animationiteration"),ff=Wn("animationstart"),g0=Wn("transitionrun"),b0=Wn("transitionstart"),x0=Wn("transitioncancel"),mf=Wn("transitionend"),hf=new Map,qo="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(" ");qo.push("scrollEnd");function Ta(e,t){hf.set(e,t),Zn(t,[e])}var Dl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},ba=[],Us=0,Ho=0;function Rl(){for(var e=Us,t=Ho=Us=0;t<e;){var n=ba[t];ba[t++]=null;var s=ba[t];ba[t++]=null;var r=ba[t];ba[t++]=null;var o=ba[t];if(ba[t++]=null,s!==null&&r!==null){var f=s.pending;f===null?r.next=r:(r.next=f.next,f.next=r),s.pending=r}o!==0&&pf(n,r,o)}}function Ul(e,t,n,s){ba[Us++]=e,ba[Us++]=t,ba[Us++]=n,ba[Us++]=s,Ho|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Vo(e,t,n,s){return Ul(e,t,n,s),Ll(e)}function es(e,t){return Ul(e,null,null,t),Ll(e)}function pf(e,t,n){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n);for(var r=!1,o=e.return;o!==null;)o.childLanes|=n,s=o.alternate,s!==null&&(s.childLanes|=n),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(r=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,r&&t!==null&&(r=31-Xe(n),e=o.hiddenUpdates,s=e[r],s===null?e[r]=[t]:s.push(t),t.lane=n|536870912),o):null}function Ll(e){if(50<Zi)throw Zi=0,Qc=null,Error(u(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ls={};function y0(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ra(e,t,n,s){return new y0(e,t,n,s)}function Bo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Za(e,t){var n=e.alternate;return n===null?(n=ra(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function vf(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ql(e,t,n,s,r,o){var f=0;if(s=e,typeof e=="function")Bo(e)&&(f=1);else if(typeof e=="string")f=_b(e,n,ne.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case oe:return e=ra(31,n,t,r),e.elementType=oe,e.lanes=o,e;case b:return ts(n.children,r,o,t);case _:f=8,r|=24;break;case O:return e=ra(12,n,t,r|2),e.elementType=O,e.lanes=o,e;case N:return e=ra(13,n,t,r),e.elementType=N,e.lanes=o,e;case G:return e=ra(19,n,t,r),e.elementType=G,e.lanes=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case E:f=10;break e;case q:f=9;break e;case j:f=11;break e;case w:f=14;break e;case ae:f=16,s=null;break e}f=29,n=Error(u(130,e===null?"null":typeof e,"")),s=null}return t=ra(f,n,t,r),t.elementType=e,t.type=s,t.lanes=o,t}function ts(e,t,n,s){return e=ra(7,e,s,t),e.lanes=n,e}function $o(e,t,n){return e=ra(6,e,null,t),e.lanes=n,e}function gf(e){var t=ra(18,null,null,0);return t.stateNode=e,t}function Fo(e,t,n){return t=ra(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var bf=new WeakMap;function xa(e,t){if(typeof e=="object"&&e!==null){var n=bf.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Ot(t)},bf.set(e,t),t)}return{value:e,source:t,stack:Ot(t)}}var qs=[],Hs=0,Hl=null,zi=0,ya=[],ja=0,Nn=null,ka=1,Da="";function Ja(e,t){qs[Hs++]=zi,qs[Hs++]=Hl,Hl=e,zi=t}function xf(e,t,n){ya[ja++]=ka,ya[ja++]=Da,ya[ja++]=Nn,Nn=e;var s=ka;e=Da;var r=32-Xe(s)-1;s&=~(1<<r),n+=1;var o=32-Xe(t)+r;if(30<o){var f=r-r%5;o=(s&(1<<f)-1).toString(32),s>>=f,r-=f,ka=1<<32-Xe(t)+r|n<<r|s,Da=o+e}else ka=1<<o|n<<r|s,Da=e}function Po(e){e.return!==null&&(Ja(e,1),xf(e,1,0))}function Go(e){for(;e===Hl;)Hl=qs[--Hs],qs[Hs]=null,zi=qs[--Hs],qs[Hs]=null;for(;e===Nn;)Nn=ya[--ja],ya[ja]=null,Da=ya[--ja],ya[ja]=null,ka=ya[--ja],ya[ja]=null}function yf(e,t){ya[ja++]=ka,ya[ja++]=Da,ya[ja++]=Nn,ka=t.id,Da=t.overflow,Nn=e}var Ut=null,ut=null,Ye=!1,Cn=null,Sa=!1,Yo=Error(u(519));function _n(e){var t=Error(u(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Mi(xa(t,e)),Yo}function jf(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[Rt]=e,t[Qt]=s,n){case"dialog":Fe("cancel",t),Fe("close",t);break;case"iframe":case"object":case"embed":Fe("load",t);break;case"video":case"audio":for(n=0;n<Ki.length;n++)Fe(Ki[n],t);break;case"source":Fe("error",t);break;case"img":case"image":case"link":Fe("error",t),Fe("load",t);break;case"details":Fe("toggle",t);break;case"input":Fe("invalid",t),kd(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Fe("invalid",t);break;case"textarea":Fe("invalid",t),Rd(t,s.value,s.defaultValue,s.children)}n=s.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||s.suppressHydrationWarning===!0||qh(t.textContent,n)?(s.popover!=null&&(Fe("beforetoggle",t),Fe("toggle",t)),s.onScroll!=null&&Fe("scroll",t),s.onScrollEnd!=null&&Fe("scrollend",t),s.onClick!=null&&(t.onclick=Ia),t=!0):t=!1,t||_n(e,!0)}function Sf(e){for(Ut=e.return;Ut;)switch(Ut.tag){case 5:case 31:case 13:Sa=!1;return;case 27:case 3:Sa=!0;return;default:Ut=Ut.return}}function Vs(e){if(e!==Ut)return!1;if(!Ye)return Sf(e),Ye=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||uu(e.type,e.memoizedProps)),n=!n),n&&ut&&_n(e),Sf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));ut=Xh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));ut=Xh(e)}else t===27?(t=ut,Hn(e.type)?(e=pu,pu=null,ut=e):ut=t):ut=Ut?Ca(e.stateNode.nextSibling):null;return!0}function as(){ut=Ut=null,Ye=!1}function Xo(){var e=Cn;return e!==null&&(ea===null?ea=e:ea.push.apply(ea,e),Cn=null),e}function Mi(e){Cn===null?Cn=[e]:Cn.push(e)}var Io=z(null),ns=null,Ka=null;function Tn(e,t,n){ee(Io,t._currentValue),t._currentValue=n}function Wa(e){e._currentValue=Io.current,T(Io)}function Qo(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function Zo(e,t,n,s){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var o=r.dependencies;if(o!==null){var f=r.child;o=o.firstContext;e:for(;o!==null;){var x=o;o=r;for(var M=0;M<t.length;M++)if(x.context===t[M]){o.lanes|=n,x=o.alternate,x!==null&&(x.lanes|=n),Qo(o.return,n,e),s||(f=null);break e}o=x.next}}else if(r.tag===18){if(f=r.return,f===null)throw Error(u(341));f.lanes|=n,o=f.alternate,o!==null&&(o.lanes|=n),Qo(f,n,e),f=null}else f=r.child;if(f!==null)f.return=r;else for(f=r;f!==null;){if(f===e){f=null;break}if(r=f.sibling,r!==null){r.return=f.return,f=r;break}f=f.return}r=f}}function Bs(e,t,n,s){e=null;for(var r=t,o=!1;r!==null;){if(!o){if((r.flags&524288)!==0)o=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var f=r.alternate;if(f===null)throw Error(u(387));if(f=f.memoizedProps,f!==null){var x=r.type;la(r.pendingProps.value,f.value)||(e!==null?e.push(x):e=[x])}}else if(r===xe.current){if(f=r.alternate,f===null)throw Error(u(387));f.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(nl):e=[nl])}r=r.return}e!==null&&Zo(t,e,n,s),t.flags|=262144}function Vl(e){for(e=e.firstContext;e!==null;){if(!la(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ss(e){ns=e,Ka=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Lt(e){return Nf(ns,e)}function Bl(e,t){return ns===null&&ss(e),Nf(e,t)}function Nf(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ka===null){if(e===null)throw Error(u(308));Ka=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ka=Ka.next=t;return n}var j0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},S0=i.unstable_scheduleCallback,N0=i.unstable_NormalPriority,St={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Jo(){return{controller:new j0,data:new Map,refCount:0}}function Ai(e){e.refCount--,e.refCount===0&&S0(N0,function(){e.controller.abort()})}var wi=null,Ko=0,$s=0,Fs=null;function C0(e,t){if(wi===null){var n=wi=[];Ko=0,$s=tu(),Fs={status:"pending",value:void 0,then:function(s){n.push(s)}}}return Ko++,t.then(Cf,Cf),t}function Cf(){if(--Ko===0&&wi!==null){Fs!==null&&(Fs.status="fulfilled");var e=wi;wi=null,$s=0,Fs=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function _0(e,t){var n=[],s={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){for(s.status="rejected",s.reason=r,r=0;r<n.length;r++)(0,n[r])(void 0)}),s}var _f=F.S;F.S=function(e,t){oh=ft(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&C0(e,t),_f!==null&&_f(e,t)};var is=z(null);function Wo(){var e=is.current;return e!==null?e:ot.pooledCache}function $l(e,t){t===null?ee(is,is.current):ee(is,t.pool)}function Tf(){var e=Wo();return e===null?null:{parent:St._currentValue,pool:e}}var Ps=Error(u(460)),ec=Error(u(474)),Fl=Error(u(542)),Pl={then:function(){}};function Of(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ef(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ia,Ia),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Mf(e),e;default:if(typeof t.status=="string")t.then(Ia,Ia);else{if(e=ot,e!==null&&100<e.shellSuspendCounter)throw Error(u(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=s}},function(s){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Mf(e),e}throw rs=t,Ps}}function ls(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(rs=n,Ps):n}}var rs=null;function zf(){if(rs===null)throw Error(u(459));var e=rs;return rs=null,e}function Mf(e){if(e===Ps||e===Fl)throw Error(u(483))}var Gs=null,ki=0;function Gl(e){var t=ki;return ki+=1,Gs===null&&(Gs=[]),Ef(Gs,e,t)}function Di(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Yl(e,t){throw t.$$typeof===D?Error(u(525)):(e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Af(e){function t($,L){if(e){var Y=$.deletions;Y===null?($.deletions=[L],$.flags|=16):Y.push(L)}}function n($,L){if(!e)return null;for(;L!==null;)t($,L),L=L.sibling;return null}function s($){for(var L=new Map;$!==null;)$.key!==null?L.set($.key,$):L.set($.index,$),$=$.sibling;return L}function r($,L){return $=Za($,L),$.index=0,$.sibling=null,$}function o($,L,Y){return $.index=Y,e?(Y=$.alternate,Y!==null?(Y=Y.index,Y<L?($.flags|=67108866,L):Y):($.flags|=67108866,L)):($.flags|=1048576,L)}function f($){return e&&$.alternate===null&&($.flags|=67108866),$}function x($,L,Y,le){return L===null||L.tag!==6?(L=$o(Y,$.mode,le),L.return=$,L):(L=r(L,Y),L.return=$,L)}function M($,L,Y,le){var Me=Y.type;return Me===b?se($,L,Y.props.children,le,Y.key):L!==null&&(L.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===ae&&ls(Me)===L.type)?(L=r(L,Y.props),Di(L,Y),L.return=$,L):(L=ql(Y.type,Y.key,Y.props,null,$.mode,le),Di(L,Y),L.return=$,L)}function X($,L,Y,le){return L===null||L.tag!==4||L.stateNode.containerInfo!==Y.containerInfo||L.stateNode.implementation!==Y.implementation?(L=Fo(Y,$.mode,le),L.return=$,L):(L=r(L,Y.children||[]),L.return=$,L)}function se($,L,Y,le,Me){return L===null||L.tag!==7?(L=ts(Y,$.mode,le,Me),L.return=$,L):(L=r(L,Y),L.return=$,L)}function re($,L,Y){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=$o(""+L,$.mode,Y),L.return=$,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case R:return Y=ql(L.type,L.key,L.props,null,$.mode,Y),Di(Y,L),Y.return=$,Y;case k:return L=Fo(L,$.mode,Y),L.return=$,L;case ae:return L=ls(L),re($,L,Y)}if(je(L)||P(L))return L=ts(L,$.mode,Y,null),L.return=$,L;if(typeof L.then=="function")return re($,Gl(L),Y);if(L.$$typeof===E)return re($,Bl($,L),Y);Yl($,L)}return null}function Z($,L,Y,le){var Me=L!==null?L.key:null;if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Me!==null?null:x($,L,""+Y,le);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case R:return Y.key===Me?M($,L,Y,le):null;case k:return Y.key===Me?X($,L,Y,le):null;case ae:return Y=ls(Y),Z($,L,Y,le)}if(je(Y)||P(Y))return Me!==null?null:se($,L,Y,le,null);if(typeof Y.then=="function")return Z($,L,Gl(Y),le);if(Y.$$typeof===E)return Z($,L,Bl($,Y),le);Yl($,Y)}return null}function te($,L,Y,le,Me){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return $=$.get(Y)||null,x(L,$,""+le,Me);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case R:return $=$.get(le.key===null?Y:le.key)||null,M(L,$,le,Me);case k:return $=$.get(le.key===null?Y:le.key)||null,X(L,$,le,Me);case ae:return le=ls(le),te($,L,Y,le,Me)}if(je(le)||P(le))return $=$.get(Y)||null,se(L,$,le,Me,null);if(typeof le.then=="function")return te($,L,Y,Gl(le),Me);if(le.$$typeof===E)return te($,L,Y,Bl(L,le),Me);Yl(L,le)}return null}function Ce($,L,Y,le){for(var Me=null,Qe=null,Ee=L,Ve=L=0,Ge=null;Ee!==null&&Ve<Y.length;Ve++){Ee.index>Ve?(Ge=Ee,Ee=null):Ge=Ee.sibling;var Ze=Z($,Ee,Y[Ve],le);if(Ze===null){Ee===null&&(Ee=Ge);break}e&&Ee&&Ze.alternate===null&&t($,Ee),L=o(Ze,L,Ve),Qe===null?Me=Ze:Qe.sibling=Ze,Qe=Ze,Ee=Ge}if(Ve===Y.length)return n($,Ee),Ye&&Ja($,Ve),Me;if(Ee===null){for(;Ve<Y.length;Ve++)Ee=re($,Y[Ve],le),Ee!==null&&(L=o(Ee,L,Ve),Qe===null?Me=Ee:Qe.sibling=Ee,Qe=Ee);return Ye&&Ja($,Ve),Me}for(Ee=s(Ee);Ve<Y.length;Ve++)Ge=te(Ee,$,Ve,Y[Ve],le),Ge!==null&&(e&&Ge.alternate!==null&&Ee.delete(Ge.key===null?Ve:Ge.key),L=o(Ge,L,Ve),Qe===null?Me=Ge:Qe.sibling=Ge,Qe=Ge);return e&&Ee.forEach(function(Pn){return t($,Pn)}),Ye&&Ja($,Ve),Me}function De($,L,Y,le){if(Y==null)throw Error(u(151));for(var Me=null,Qe=null,Ee=L,Ve=L=0,Ge=null,Ze=Y.next();Ee!==null&&!Ze.done;Ve++,Ze=Y.next()){Ee.index>Ve?(Ge=Ee,Ee=null):Ge=Ee.sibling;var Pn=Z($,Ee,Ze.value,le);if(Pn===null){Ee===null&&(Ee=Ge);break}e&&Ee&&Pn.alternate===null&&t($,Ee),L=o(Pn,L,Ve),Qe===null?Me=Pn:Qe.sibling=Pn,Qe=Pn,Ee=Ge}if(Ze.done)return n($,Ee),Ye&&Ja($,Ve),Me;if(Ee===null){for(;!Ze.done;Ve++,Ze=Y.next())Ze=re($,Ze.value,le),Ze!==null&&(L=o(Ze,L,Ve),Qe===null?Me=Ze:Qe.sibling=Ze,Qe=Ze);return Ye&&Ja($,Ve),Me}for(Ee=s(Ee);!Ze.done;Ve++,Ze=Y.next())Ze=te(Ee,$,Ve,Ze.value,le),Ze!==null&&(e&&Ze.alternate!==null&&Ee.delete(Ze.key===null?Ve:Ze.key),L=o(Ze,L,Ve),Qe===null?Me=Ze:Qe.sibling=Ze,Qe=Ze);return e&&Ee.forEach(function(Ub){return t($,Ub)}),Ye&&Ja($,Ve),Me}function rt($,L,Y,le){if(typeof Y=="object"&&Y!==null&&Y.type===b&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case R:e:{for(var Me=Y.key;L!==null;){if(L.key===Me){if(Me=Y.type,Me===b){if(L.tag===7){n($,L.sibling),le=r(L,Y.props.children),le.return=$,$=le;break e}}else if(L.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===ae&&ls(Me)===L.type){n($,L.sibling),le=r(L,Y.props),Di(le,Y),le.return=$,$=le;break e}n($,L);break}else t($,L);L=L.sibling}Y.type===b?(le=ts(Y.props.children,$.mode,le,Y.key),le.return=$,$=le):(le=ql(Y.type,Y.key,Y.props,null,$.mode,le),Di(le,Y),le.return=$,$=le)}return f($);case k:e:{for(Me=Y.key;L!==null;){if(L.key===Me)if(L.tag===4&&L.stateNode.containerInfo===Y.containerInfo&&L.stateNode.implementation===Y.implementation){n($,L.sibling),le=r(L,Y.children||[]),le.return=$,$=le;break e}else{n($,L);break}else t($,L);L=L.sibling}le=Fo(Y,$.mode,le),le.return=$,$=le}return f($);case ae:return Y=ls(Y),rt($,L,Y,le)}if(je(Y))return Ce($,L,Y,le);if(P(Y)){if(Me=P(Y),typeof Me!="function")throw Error(u(150));return Y=Me.call(Y),De($,L,Y,le)}if(typeof Y.then=="function")return rt($,L,Gl(Y),le);if(Y.$$typeof===E)return rt($,L,Bl($,Y),le);Yl($,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,L!==null&&L.tag===6?(n($,L.sibling),le=r(L,Y),le.return=$,$=le):(n($,L),le=$o(Y,$.mode,le),le.return=$,$=le),f($)):n($,L)}return function($,L,Y,le){try{ki=0;var Me=rt($,L,Y,le);return Gs=null,Me}catch(Ee){if(Ee===Ps||Ee===Fl)throw Ee;var Qe=ra(29,Ee,null,$.mode);return Qe.lanes=le,Qe.return=$,Qe}finally{}}}var os=Af(!0),wf=Af(!1),On=!1;function tc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ac(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function En(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function zn(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Je&2)!==0){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,t=Ll(e),pf(e,null,n),t}return Ul(e,s,t,n),Ll(e)}function Ri(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Nl(e,n)}}function nc(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var r=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var f={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};o===null?r=o=f:o=o.next=f,n=n.next}while(n!==null);o===null?r=o=t:o=o.next=t}else r=o=t;n={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:o,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var sc=!1;function Ui(){if(sc){var e=Fs;if(e!==null)throw e}}function Li(e,t,n,s){sc=!1;var r=e.updateQueue;On=!1;var o=r.firstBaseUpdate,f=r.lastBaseUpdate,x=r.shared.pending;if(x!==null){r.shared.pending=null;var M=x,X=M.next;M.next=null,f===null?o=X:f.next=X,f=M;var se=e.alternate;se!==null&&(se=se.updateQueue,x=se.lastBaseUpdate,x!==f&&(x===null?se.firstBaseUpdate=X:x.next=X,se.lastBaseUpdate=M))}if(o!==null){var re=r.baseState;f=0,se=X=M=null,x=o;do{var Z=x.lane&-536870913,te=Z!==x.lane;if(te?(Pe&Z)===Z:(s&Z)===Z){Z!==0&&Z===$s&&(sc=!0),se!==null&&(se=se.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});e:{var Ce=e,De=x;Z=t;var rt=n;switch(De.tag){case 1:if(Ce=De.payload,typeof Ce=="function"){re=Ce.call(rt,re,Z);break e}re=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=De.payload,Z=typeof Ce=="function"?Ce.call(rt,re,Z):Ce,Z==null)break e;re=C({},re,Z);break e;case 2:On=!0}}Z=x.callback,Z!==null&&(e.flags|=64,te&&(e.flags|=8192),te=r.callbacks,te===null?r.callbacks=[Z]:te.push(Z))}else te={lane:Z,tag:x.tag,payload:x.payload,callback:x.callback,next:null},se===null?(X=se=te,M=re):se=se.next=te,f|=Z;if(x=x.next,x===null){if(x=r.shared.pending,x===null)break;te=x,x=te.next,te.next=null,r.lastBaseUpdate=te,r.shared.pending=null}}while(!0);se===null&&(M=re),r.baseState=M,r.firstBaseUpdate=X,r.lastBaseUpdate=se,o===null&&(r.shared.lanes=0),Dn|=f,e.lanes=f,e.memoizedState=re}}function kf(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function Df(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)kf(n[e],t)}var Ys=z(null),Xl=z(0);function Rf(e,t){e=cn,ee(Xl,e),ee(Ys,t),cn=e|t.baseLanes}function ic(){ee(Xl,cn),ee(Ys,Ys.current)}function lc(){cn=Xl.current,T(Ys),T(Xl)}var oa=z(null),Na=null;function Mn(e){var t=e.alternate;ee(yt,yt.current&1),ee(oa,e),Na===null&&(t===null||Ys.current!==null||t.memoizedState!==null)&&(Na=e)}function rc(e){ee(yt,yt.current),ee(oa,e),Na===null&&(Na=e)}function Uf(e){e.tag===22?(ee(yt,yt.current),ee(oa,e),Na===null&&(Na=e)):An()}function An(){ee(yt,yt.current),ee(oa,oa.current)}function ca(e){T(oa),Na===e&&(Na=null),T(yt)}var yt=z(0);function Il(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||mu(n)||hu(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var en=0,He=null,it=null,Nt=null,Ql=!1,Xs=!1,cs=!1,Zl=0,qi=0,Is=null,T0=0;function gt(){throw Error(u(321))}function oc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!la(e[n],t[n]))return!1;return!0}function cc(e,t,n,s,r,o){return en=o,He=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,F.H=e===null||e.memoizedState===null?xm:Cc,cs=!1,o=n(s,r),cs=!1,Xs&&(o=qf(t,n,s,r)),Lf(e),o}function Lf(e){F.H=Bi;var t=it!==null&&it.next!==null;if(en=0,Nt=it=He=null,Ql=!1,qi=0,Is=null,t)throw Error(u(300));e===null||Ct||(e=e.dependencies,e!==null&&Vl(e)&&(Ct=!0))}function qf(e,t,n,s){He=e;var r=0;do{if(Xs&&(Is=null),qi=0,Xs=!1,25<=r)throw Error(u(301));if(r+=1,Nt=it=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}F.H=ym,o=t(n,s)}while(Xs);return o}function O0(){var e=F.H,t=e.useState()[0];return t=typeof t.then=="function"?Hi(t):t,e=e.useState()[0],(it!==null?it.memoizedState:null)!==e&&(He.flags|=1024),t}function uc(){var e=Zl!==0;return Zl=0,e}function dc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function fc(e){if(Ql){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ql=!1}en=0,Nt=it=He=null,Xs=!1,qi=Zl=0,Is=null}function Xt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Nt===null?He.memoizedState=Nt=e:Nt=Nt.next=e,Nt}function jt(){if(it===null){var e=He.alternate;e=e!==null?e.memoizedState:null}else e=it.next;var t=Nt===null?He.memoizedState:Nt.next;if(t!==null)Nt=t,it=e;else{if(e===null)throw He.alternate===null?Error(u(467)):Error(u(310));it=e,e={memoizedState:it.memoizedState,baseState:it.baseState,baseQueue:it.baseQueue,queue:it.queue,next:null},Nt===null?He.memoizedState=Nt=e:Nt=Nt.next=e}return Nt}function Jl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Hi(e){var t=qi;return qi+=1,Is===null&&(Is=[]),e=Ef(Is,e,t),t=He,(Nt===null?t.memoizedState:Nt.next)===null&&(t=t.alternate,F.H=t===null||t.memoizedState===null?xm:Cc),e}function Kl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Hi(e);if(e.$$typeof===E)return Lt(e)}throw Error(u(438,String(e)))}function mc(e){var t=null,n=He.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=He.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Jl(),He.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),s=0;s<e;s++)n[s]=W;return t.index++,n}function tn(e,t){return typeof t=="function"?t(e):t}function Wl(e){var t=jt();return hc(t,it,e)}function hc(e,t,n){var s=e.queue;if(s===null)throw Error(u(311));s.lastRenderedReducer=n;var r=e.baseQueue,o=s.pending;if(o!==null){if(r!==null){var f=r.next;r.next=o.next,o.next=f}t.baseQueue=r=o,s.pending=null}if(o=e.baseState,r===null)e.memoizedState=o;else{t=r.next;var x=f=null,M=null,X=t,se=!1;do{var re=X.lane&-536870913;if(re!==X.lane?(Pe&re)===re:(en&re)===re){var Z=X.revertLane;if(Z===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null}),re===$s&&(se=!0);else if((en&Z)===Z){X=X.next,Z===$s&&(se=!0);continue}else re={lane:0,revertLane:X.revertLane,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},M===null?(x=M=re,f=o):M=M.next=re,He.lanes|=Z,Dn|=Z;re=X.action,cs&&n(o,re),o=X.hasEagerState?X.eagerState:n(o,re)}else Z={lane:re,revertLane:X.revertLane,gesture:X.gesture,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},M===null?(x=M=Z,f=o):M=M.next=Z,He.lanes|=re,Dn|=re;X=X.next}while(X!==null&&X!==t);if(M===null?f=o:M.next=x,!la(o,e.memoizedState)&&(Ct=!0,se&&(n=Fs,n!==null)))throw n;e.memoizedState=o,e.baseState=f,e.baseQueue=M,s.lastRenderedState=o}return r===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function pc(e){var t=jt(),n=t.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=e;var s=n.dispatch,r=n.pending,o=t.memoizedState;if(r!==null){n.pending=null;var f=r=r.next;do o=e(o,f.action),f=f.next;while(f!==r);la(o,t.memoizedState)||(Ct=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,s]}function Hf(e,t,n){var s=He,r=jt(),o=Ye;if(o){if(n===void 0)throw Error(u(407));n=n()}else n=t();var f=!la((it||r).memoizedState,n);if(f&&(r.memoizedState=n,Ct=!0),r=r.queue,bc($f.bind(null,s,r,e),[e]),r.getSnapshot!==t||f||Nt!==null&&Nt.memoizedState.tag&1){if(s.flags|=2048,Qs(9,{destroy:void 0},Bf.bind(null,s,r,n,t),null),ot===null)throw Error(u(349));o||(en&127)!==0||Vf(s,t,n)}return n}function Vf(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=He.updateQueue,t===null?(t=Jl(),He.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Bf(e,t,n,s){t.value=n,t.getSnapshot=s,Ff(t)&&Pf(e)}function $f(e,t,n){return n(function(){Ff(t)&&Pf(e)})}function Ff(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!la(e,n)}catch{return!0}}function Pf(e){var t=es(e,2);t!==null&&ta(t,e,2)}function vc(e){var t=Xt();if(typeof e=="function"){var n=e;if(e=n(),cs){qe(!0);try{n()}finally{qe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:e},t}function Gf(e,t,n,s){return e.baseState=n,hc(e,it,typeof s=="function"?s:tn)}function E0(e,t,n,s,r){if(ar(e))throw Error(u(485));if(e=t.action,e!==null){var o={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){o.listeners.push(f)}};F.T!==null?n(!0):o.isTransition=!1,s(o),n=t.pending,n===null?(o.next=t.pending=o,Yf(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Yf(e,t){var n=t.action,s=t.payload,r=e.state;if(t.isTransition){var o=F.T,f={};F.T=f;try{var x=n(r,s),M=F.S;M!==null&&M(f,x),Xf(e,t,x)}catch(X){gc(e,t,X)}finally{o!==null&&f.types!==null&&(o.types=f.types),F.T=o}}else try{o=n(r,s),Xf(e,t,o)}catch(X){gc(e,t,X)}}function Xf(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){If(e,t,s)},function(s){return gc(e,t,s)}):If(e,t,n)}function If(e,t,n){t.status="fulfilled",t.value=n,Qf(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Yf(e,n)))}function gc(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,Qf(t),t=t.next;while(t!==s)}e.action=null}function Qf(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Zf(e,t){return t}function Jf(e,t){if(Ye){var n=ot.formState;if(n!==null){e:{var s=He;if(Ye){if(ut){t:{for(var r=ut,o=Sa;r.nodeType!==8;){if(!o){r=null;break t}if(r=Ca(r.nextSibling),r===null){r=null;break t}}o=r.data,r=o==="F!"||o==="F"?r:null}if(r){ut=Ca(r.nextSibling),s=r.data==="F!";break e}}_n(s)}s=!1}s&&(t=n[0])}}return n=Xt(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zf,lastRenderedState:t},n.queue=s,n=vm.bind(null,He,s),s.dispatch=n,s=vc(!1),o=Nc.bind(null,He,!1,s.queue),s=Xt(),r={state:t,dispatch:null,action:e,pending:null},s.queue=r,n=E0.bind(null,He,r,o,n),r.dispatch=n,s.memoizedState=e,[t,n,!1]}function Kf(e){var t=jt();return Wf(t,it,e)}function Wf(e,t,n){if(t=hc(e,t,Zf)[0],e=Wl(tn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Hi(t)}catch(f){throw f===Ps?Fl:f}else s=t;t=jt();var r=t.queue,o=r.dispatch;return n!==t.memoizedState&&(He.flags|=2048,Qs(9,{destroy:void 0},z0.bind(null,r,n),null)),[s,o,e]}function z0(e,t){e.action=t}function em(e){var t=jt(),n=it;if(n!==null)return Wf(t,n,e);jt(),t=t.memoizedState,n=jt();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function Qs(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=He.updateQueue,t===null&&(t=Jl(),He.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e),e}function tm(){return jt().memoizedState}function er(e,t,n,s){var r=Xt();He.flags|=e,r.memoizedState=Qs(1|t,{destroy:void 0},n,s===void 0?null:s)}function tr(e,t,n,s){var r=jt();s=s===void 0?null:s;var o=r.memoizedState.inst;it!==null&&s!==null&&oc(s,it.memoizedState.deps)?r.memoizedState=Qs(t,o,n,s):(He.flags|=e,r.memoizedState=Qs(1|t,o,n,s))}function am(e,t){er(8390656,8,e,t)}function bc(e,t){tr(2048,8,e,t)}function M0(e){He.flags|=4;var t=He.updateQueue;if(t===null)t=Jl(),He.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function nm(e){var t=jt().memoizedState;return M0({ref:t,nextImpl:e}),function(){if((Je&2)!==0)throw Error(u(440));return t.impl.apply(void 0,arguments)}}function sm(e,t){return tr(4,2,e,t)}function im(e,t){return tr(4,4,e,t)}function lm(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function rm(e,t,n){n=n!=null?n.concat([e]):null,tr(4,4,lm.bind(null,t,e),n)}function xc(){}function om(e,t){var n=jt();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&oc(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function cm(e,t){var n=jt();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&oc(t,s[1]))return s[0];if(s=e(),cs){qe(!0);try{e()}finally{qe(!1)}}return n.memoizedState=[s,t],s}function yc(e,t,n){return n===void 0||(en&1073741824)!==0&&(Pe&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=uh(),He.lanes|=e,Dn|=e,n)}function um(e,t,n,s){return la(n,t)?n:Ys.current!==null?(e=yc(e,n,s),la(e,t)||(Ct=!0),e):(en&42)===0||(en&1073741824)!==0&&(Pe&261930)===0?(Ct=!0,e.memoizedState=n):(e=uh(),He.lanes|=e,Dn|=e,t)}function dm(e,t,n,s,r){var o=K.p;K.p=o!==0&&8>o?o:8;var f=F.T,x={};F.T=x,Nc(e,!1,t,n);try{var M=r(),X=F.S;if(X!==null&&X(x,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var se=_0(M,s);Vi(e,t,se,fa(e))}else Vi(e,t,s,fa(e))}catch(re){Vi(e,t,{then:function(){},status:"rejected",reason:re},fa())}finally{K.p=o,f!==null&&x.types!==null&&(f.types=x.types),F.T=f}}function A0(){}function jc(e,t,n,s){if(e.tag!==5)throw Error(u(476));var r=fm(e).queue;dm(e,r,t,fe,n===null?A0:function(){return mm(e),n(s)})}function fm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:fe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function mm(e){var t=fm(e);t.next===null&&(t=e.alternate.memoizedState),Vi(e,t.next.queue,{},fa())}function Sc(){return Lt(nl)}function hm(){return jt().memoizedState}function pm(){return jt().memoizedState}function w0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=fa();e=En(n);var s=zn(t,e,n);s!==null&&(ta(s,t,n),Ri(s,t,n)),t={cache:Jo()},e.payload=t;return}t=t.return}}function k0(e,t,n){var s=fa();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ar(e)?gm(t,n):(n=Vo(e,t,n,s),n!==null&&(ta(n,e,s),bm(n,t,s)))}function vm(e,t,n){var s=fa();Vi(e,t,n,s)}function Vi(e,t,n,s){var r={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ar(e))gm(t,r);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var f=t.lastRenderedState,x=o(f,n);if(r.hasEagerState=!0,r.eagerState=x,la(x,f))return Ul(e,t,r,0),ot===null&&Rl(),!1}catch{}finally{}if(n=Vo(e,t,r,s),n!==null)return ta(n,e,s),bm(n,t,s),!0}return!1}function Nc(e,t,n,s){if(s={lane:2,revertLane:tu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},ar(e)){if(t)throw Error(u(479))}else t=Vo(e,n,s,2),t!==null&&ta(t,e,2)}function ar(e){var t=e.alternate;return e===He||t!==null&&t===He}function gm(e,t){Xs=Ql=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function bm(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Nl(e,n)}}var Bi={readContext:Lt,use:Kl,useCallback:gt,useContext:gt,useEffect:gt,useImperativeHandle:gt,useLayoutEffect:gt,useInsertionEffect:gt,useMemo:gt,useReducer:gt,useRef:gt,useState:gt,useDebugValue:gt,useDeferredValue:gt,useTransition:gt,useSyncExternalStore:gt,useId:gt,useHostTransitionStatus:gt,useFormState:gt,useActionState:gt,useOptimistic:gt,useMemoCache:gt,useCacheRefresh:gt};Bi.useEffectEvent=gt;var xm={readContext:Lt,use:Kl,useCallback:function(e,t){return Xt().memoizedState=[e,t===void 0?null:t],e},useContext:Lt,useEffect:am,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,er(4194308,4,lm.bind(null,t,e),n)},useLayoutEffect:function(e,t){return er(4194308,4,e,t)},useInsertionEffect:function(e,t){er(4,2,e,t)},useMemo:function(e,t){var n=Xt();t=t===void 0?null:t;var s=e();if(cs){qe(!0);try{e()}finally{qe(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=Xt();if(n!==void 0){var r=n(t);if(cs){qe(!0);try{n(t)}finally{qe(!1)}}}else r=t;return s.memoizedState=s.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},s.queue=e,e=e.dispatch=k0.bind(null,He,e),[s.memoizedState,e]},useRef:function(e){var t=Xt();return e={current:e},t.memoizedState=e},useState:function(e){e=vc(e);var t=e.queue,n=vm.bind(null,He,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:xc,useDeferredValue:function(e,t){var n=Xt();return yc(n,e,t)},useTransition:function(){var e=vc(!1);return e=dm.bind(null,He,e.queue,!0,!1),Xt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=He,r=Xt();if(Ye){if(n===void 0)throw Error(u(407));n=n()}else{if(n=t(),ot===null)throw Error(u(349));(Pe&127)!==0||Vf(s,t,n)}r.memoizedState=n;var o={value:n,getSnapshot:t};return r.queue=o,am($f.bind(null,s,o,e),[e]),s.flags|=2048,Qs(9,{destroy:void 0},Bf.bind(null,s,o,n,t),null),n},useId:function(){var e=Xt(),t=ot.identifierPrefix;if(Ye){var n=Da,s=ka;n=(s&~(1<<32-Xe(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Zl++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=T0++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Sc,useFormState:Jf,useActionState:Jf,useOptimistic:function(e){var t=Xt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Nc.bind(null,He,!0,n),n.dispatch=t,[e,t]},useMemoCache:mc,useCacheRefresh:function(){return Xt().memoizedState=w0.bind(null,He)},useEffectEvent:function(e){var t=Xt(),n={impl:e};return t.memoizedState=n,function(){if((Je&2)!==0)throw Error(u(440));return n.impl.apply(void 0,arguments)}}},Cc={readContext:Lt,use:Kl,useCallback:om,useContext:Lt,useEffect:bc,useImperativeHandle:rm,useInsertionEffect:sm,useLayoutEffect:im,useMemo:cm,useReducer:Wl,useRef:tm,useState:function(){return Wl(tn)},useDebugValue:xc,useDeferredValue:function(e,t){var n=jt();return um(n,it.memoizedState,e,t)},useTransition:function(){var e=Wl(tn)[0],t=jt().memoizedState;return[typeof e=="boolean"?e:Hi(e),t]},useSyncExternalStore:Hf,useId:hm,useHostTransitionStatus:Sc,useFormState:Kf,useActionState:Kf,useOptimistic:function(e,t){var n=jt();return Gf(n,it,e,t)},useMemoCache:mc,useCacheRefresh:pm};Cc.useEffectEvent=nm;var ym={readContext:Lt,use:Kl,useCallback:om,useContext:Lt,useEffect:bc,useImperativeHandle:rm,useInsertionEffect:sm,useLayoutEffect:im,useMemo:cm,useReducer:pc,useRef:tm,useState:function(){return pc(tn)},useDebugValue:xc,useDeferredValue:function(e,t){var n=jt();return it===null?yc(n,e,t):um(n,it.memoizedState,e,t)},useTransition:function(){var e=pc(tn)[0],t=jt().memoizedState;return[typeof e=="boolean"?e:Hi(e),t]},useSyncExternalStore:Hf,useId:hm,useHostTransitionStatus:Sc,useFormState:em,useActionState:em,useOptimistic:function(e,t){var n=jt();return it!==null?Gf(n,it,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:mc,useCacheRefresh:pm};ym.useEffectEvent=nm;function _c(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:C({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Tc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=fa(),r=En(s);r.payload=t,n!=null&&(r.callback=n),t=zn(e,r,s),t!==null&&(ta(t,e,s),Ri(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=fa(),r=En(s);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=zn(e,r,s),t!==null&&(ta(t,e,s),Ri(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=fa(),s=En(n);s.tag=2,t!=null&&(s.callback=t),t=zn(e,s,n),t!==null&&(ta(t,e,n),Ri(t,e,n))}};function jm(e,t,n,s,r,o,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,o,f):t.prototype&&t.prototype.isPureReactComponent?!Oi(n,s)||!Oi(r,o):!0}function Sm(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&Tc.enqueueReplaceState(t,t.state,null)}function us(e,t){var n=t;if("ref"in t){n={};for(var s in t)s!=="ref"&&(n[s]=t[s])}if(e=e.defaultProps){n===t&&(n=C({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function Nm(e){Dl(e)}function Cm(e){console.error(e)}function _m(e){Dl(e)}function nr(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Tm(e,t,n){try{var s=e.onCaughtError;s(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function Oc(e,t,n){return n=En(n),n.tag=3,n.payload={element:null},n.callback=function(){nr(e,t)},n}function Om(e){return e=En(e),e.tag=3,e}function Em(e,t,n,s){var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var o=s.value;e.payload=function(){return r(o)},e.callback=function(){Tm(t,n,s)}}var f=n.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){Tm(t,n,s),typeof r!="function"&&(Rn===null?Rn=new Set([this]):Rn.add(this));var x=s.stack;this.componentDidCatch(s.value,{componentStack:x!==null?x:""})})}function D0(e,t,n,s,r){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&Bs(t,n,r,!0),n=oa.current,n!==null){switch(n.tag){case 31:case 13:return Na===null?pr():n.alternate===null&&bt===0&&(bt=3),n.flags&=-257,n.flags|=65536,n.lanes=r,s===Pl?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),Kc(e,s,r)),!1;case 22:return n.flags|=65536,s===Pl?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([s]):n.add(s)),Kc(e,s,r)),!1}throw Error(u(435,n.tag))}return Kc(e,s,r),pr(),!1}if(Ye)return t=oa.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,s!==Yo&&(e=Error(u(422),{cause:s}),Mi(xa(e,n)))):(s!==Yo&&(t=Error(u(423),{cause:s}),Mi(xa(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,s=xa(s,n),r=Oc(e.stateNode,s,r),nc(e,r),bt!==4&&(bt=2)),!1;var o=Error(u(520),{cause:s});if(o=xa(o,n),Qi===null?Qi=[o]:Qi.push(o),bt!==4&&(bt=2),t===null)return!0;s=xa(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=Oc(n.stateNode,s,e),nc(n,e),!1;case 1:if(t=n.type,o=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||o!==null&&typeof o.componentDidCatch=="function"&&(Rn===null||!Rn.has(o))))return n.flags|=65536,r&=-r,n.lanes|=r,r=Om(r),Em(r,e,n,s),nc(n,r),!1}n=n.return}while(n!==null);return!1}var Ec=Error(u(461)),Ct=!1;function qt(e,t,n,s){t.child=e===null?wf(t,null,n,s):os(t,e.child,n,s)}function zm(e,t,n,s,r){n=n.render;var o=t.ref;if("ref"in s){var f={};for(var x in s)x!=="ref"&&(f[x]=s[x])}else f=s;return ss(t),s=cc(e,t,n,f,o,r),x=uc(),e!==null&&!Ct?(dc(e,t,r),an(e,t,r)):(Ye&&x&&Po(t),t.flags|=1,qt(e,t,s,r),t.child)}function Mm(e,t,n,s,r){if(e===null){var o=n.type;return typeof o=="function"&&!Bo(o)&&o.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=o,Am(e,t,o,s,r)):(e=ql(n.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!Uc(e,r)){var f=o.memoizedProps;if(n=n.compare,n=n!==null?n:Oi,n(f,s)&&e.ref===t.ref)return an(e,t,r)}return t.flags|=1,e=Za(o,s),e.ref=t.ref,e.return=t,t.child=e}function Am(e,t,n,s,r){if(e!==null){var o=e.memoizedProps;if(Oi(o,s)&&e.ref===t.ref)if(Ct=!1,t.pendingProps=s=o,Uc(e,r))(e.flags&131072)!==0&&(Ct=!0);else return t.lanes=e.lanes,an(e,t,r)}return zc(e,t,n,s,r)}function wm(e,t,n,s){var r=s.children,o=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(o=o!==null?o.baseLanes|n:n,e!==null){for(s=t.child=e.child,r=0;s!==null;)r=r|s.lanes|s.childLanes,s=s.sibling;s=r&~o}else s=0,t.child=null;return km(e,t,o,n,s)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&$l(t,o!==null?o.cachePool:null),o!==null?Rf(t,o):ic(),Uf(t);else return s=t.lanes=536870912,km(e,t,o!==null?o.baseLanes|n:n,n,s)}else o!==null?($l(t,o.cachePool),Rf(t,o),An(),t.memoizedState=null):(e!==null&&$l(t,null),ic(),An());return qt(e,t,r,n),t.child}function $i(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function km(e,t,n,s,r){var o=Wo();return o=o===null?null:{parent:St._currentValue,pool:o},t.memoizedState={baseLanes:n,cachePool:o},e!==null&&$l(t,null),ic(),Uf(t),e!==null&&Bs(e,t,s,!0),t.childLanes=r,null}function sr(e,t){return t=lr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Dm(e,t,n){return os(t,e.child,null,n),e=sr(t,t.pendingProps),e.flags|=2,ca(t),t.memoizedState=null,e}function R0(e,t,n){var s=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ye){if(s.mode==="hidden")return e=sr(t,s),t.lanes=536870912,$i(null,e);if(rc(t),(e=ut)?(e=Yh(e,Sa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Nn!==null?{id:ka,overflow:Da}:null,retryLane:536870912,hydrationErrors:null},n=gf(e),n.return=t,t.child=n,Ut=t,ut=null)):e=null,e===null)throw _n(t);return t.lanes=536870912,null}return sr(t,s)}var o=e.memoizedState;if(o!==null){var f=o.dehydrated;if(rc(t),r)if(t.flags&256)t.flags&=-257,t=Dm(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(u(558));else if(Ct||Bs(e,t,n,!1),r=(n&e.childLanes)!==0,Ct||r){if(s=ot,s!==null&&(f=gi(s,n),f!==0&&f!==o.retryLane))throw o.retryLane=f,es(e,f),ta(s,e,f),Ec;pr(),t=Dm(e,t,n)}else e=o.treeContext,ut=Ca(f.nextSibling),Ut=t,Ye=!0,Cn=null,Sa=!1,e!==null&&yf(t,e),t=sr(t,s),t.flags|=4096;return t}return e=Za(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ir(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(u(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function zc(e,t,n,s,r){return ss(t),n=cc(e,t,n,s,void 0,r),s=uc(),e!==null&&!Ct?(dc(e,t,r),an(e,t,r)):(Ye&&s&&Po(t),t.flags|=1,qt(e,t,n,r),t.child)}function Rm(e,t,n,s,r,o){return ss(t),t.updateQueue=null,n=qf(t,s,n,r),Lf(e),s=uc(),e!==null&&!Ct?(dc(e,t,o),an(e,t,o)):(Ye&&s&&Po(t),t.flags|=1,qt(e,t,n,o),t.child)}function Um(e,t,n,s,r){if(ss(t),t.stateNode===null){var o=Ls,f=n.contextType;typeof f=="object"&&f!==null&&(o=Lt(f)),o=new n(s,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Tc,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=s,o.state=t.memoizedState,o.refs={},tc(t),f=n.contextType,o.context=typeof f=="object"&&f!==null?Lt(f):Ls,o.state=t.memoizedState,f=n.getDerivedStateFromProps,typeof f=="function"&&(_c(t,n,f,s),o.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(f=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),f!==o.state&&Tc.enqueueReplaceState(o,o.state,null),Li(t,s,o,r),Ui(),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){o=t.stateNode;var x=t.memoizedProps,M=us(n,x);o.props=M;var X=o.context,se=n.contextType;f=Ls,typeof se=="object"&&se!==null&&(f=Lt(se));var re=n.getDerivedStateFromProps;se=typeof re=="function"||typeof o.getSnapshotBeforeUpdate=="function",x=t.pendingProps!==x,se||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(x||X!==f)&&Sm(t,o,s,f),On=!1;var Z=t.memoizedState;o.state=Z,Li(t,s,o,r),Ui(),X=t.memoizedState,x||Z!==X||On?(typeof re=="function"&&(_c(t,n,re,s),X=t.memoizedState),(M=On||jm(t,n,M,s,Z,X,f))?(se||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=X),o.props=s,o.state=X,o.context=f,s=M):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{o=t.stateNode,ac(e,t),f=t.memoizedProps,se=us(n,f),o.props=se,re=t.pendingProps,Z=o.context,X=n.contextType,M=Ls,typeof X=="object"&&X!==null&&(M=Lt(X)),x=n.getDerivedStateFromProps,(X=typeof x=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(f!==re||Z!==M)&&Sm(t,o,s,M),On=!1,Z=t.memoizedState,o.state=Z,Li(t,s,o,r),Ui();var te=t.memoizedState;f!==re||Z!==te||On||e!==null&&e.dependencies!==null&&Vl(e.dependencies)?(typeof x=="function"&&(_c(t,n,x,s),te=t.memoizedState),(se=On||jm(t,n,se,s,Z,te,M)||e!==null&&e.dependencies!==null&&Vl(e.dependencies))?(X||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(s,te,M),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(s,te,M)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||f===e.memoizedProps&&Z===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&Z===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=te),o.props=s,o.state=te,o.context=M,s=se):(typeof o.componentDidUpdate!="function"||f===e.memoizedProps&&Z===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&Z===e.memoizedState||(t.flags|=1024),s=!1)}return o=s,ir(e,t),s=(t.flags&128)!==0,o||s?(o=t.stateNode,n=s&&typeof n.getDerivedStateFromError!="function"?null:o.render(),t.flags|=1,e!==null&&s?(t.child=os(t,e.child,null,r),t.child=os(t,null,n,r)):qt(e,t,n,r),t.memoizedState=o.state,e=t.child):e=an(e,t,r),e}function Lm(e,t,n,s){return as(),t.flags|=256,qt(e,t,n,s),t.child}var Mc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ac(e){return{baseLanes:e,cachePool:Tf()}}function wc(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=da),e}function qm(e,t,n){var s=t.pendingProps,r=!1,o=(t.flags&128)!==0,f;if((f=o)||(f=e!==null&&e.memoizedState===null?!1:(yt.current&2)!==0),f&&(r=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ye){if(r?Mn(t):An(),(e=ut)?(e=Yh(e,Sa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Nn!==null?{id:ka,overflow:Da}:null,retryLane:536870912,hydrationErrors:null},n=gf(e),n.return=t,t.child=n,Ut=t,ut=null)):e=null,e===null)throw _n(t);return hu(e)?t.lanes=32:t.lanes=536870912,null}var x=s.children;return s=s.fallback,r?(An(),r=t.mode,x=lr({mode:"hidden",children:x},r),s=ts(s,r,n,null),x.return=t,s.return=t,x.sibling=s,t.child=x,s=t.child,s.memoizedState=Ac(n),s.childLanes=wc(e,f,n),t.memoizedState=Mc,$i(null,s)):(Mn(t),kc(t,x))}var M=e.memoizedState;if(M!==null&&(x=M.dehydrated,x!==null)){if(o)t.flags&256?(Mn(t),t.flags&=-257,t=Dc(e,t,n)):t.memoizedState!==null?(An(),t.child=e.child,t.flags|=128,t=null):(An(),x=s.fallback,r=t.mode,s=lr({mode:"visible",children:s.children},r),x=ts(x,r,n,null),x.flags|=2,s.return=t,x.return=t,s.sibling=x,t.child=s,os(t,e.child,null,n),s=t.child,s.memoizedState=Ac(n),s.childLanes=wc(e,f,n),t.memoizedState=Mc,t=$i(null,s));else if(Mn(t),hu(x)){if(f=x.nextSibling&&x.nextSibling.dataset,f)var X=f.dgst;f=X,s=Error(u(419)),s.stack="",s.digest=f,Mi({value:s,source:null,stack:null}),t=Dc(e,t,n)}else if(Ct||Bs(e,t,n,!1),f=(n&e.childLanes)!==0,Ct||f){if(f=ot,f!==null&&(s=gi(f,n),s!==0&&s!==M.retryLane))throw M.retryLane=s,es(e,s),ta(f,e,s),Ec;mu(x)||pr(),t=Dc(e,t,n)}else mu(x)?(t.flags|=192,t.child=e.child,t=null):(e=M.treeContext,ut=Ca(x.nextSibling),Ut=t,Ye=!0,Cn=null,Sa=!1,e!==null&&yf(t,e),t=kc(t,s.children),t.flags|=4096);return t}return r?(An(),x=s.fallback,r=t.mode,M=e.child,X=M.sibling,s=Za(M,{mode:"hidden",children:s.children}),s.subtreeFlags=M.subtreeFlags&65011712,X!==null?x=Za(X,x):(x=ts(x,r,n,null),x.flags|=2),x.return=t,s.return=t,s.sibling=x,t.child=s,$i(null,s),s=t.child,x=e.child.memoizedState,x===null?x=Ac(n):(r=x.cachePool,r!==null?(M=St._currentValue,r=r.parent!==M?{parent:M,pool:M}:r):r=Tf(),x={baseLanes:x.baseLanes|n,cachePool:r}),s.memoizedState=x,s.childLanes=wc(e,f,n),t.memoizedState=Mc,$i(e.child,s)):(Mn(t),n=e.child,e=n.sibling,n=Za(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=n,t.memoizedState=null,n)}function kc(e,t){return t=lr({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function lr(e,t){return e=ra(22,e,null,t),e.lanes=0,e}function Dc(e,t,n){return os(t,e.child,null,n),e=kc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Hm(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Qo(e.return,t,n)}function Rc(e,t,n,s,r,o){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:r,treeForkCount:o}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=s,f.tail=n,f.tailMode=r,f.treeForkCount=o)}function Vm(e,t,n){var s=t.pendingProps,r=s.revealOrder,o=s.tail;s=s.children;var f=yt.current,x=(f&2)!==0;if(x?(f=f&1|2,t.flags|=128):f&=1,ee(yt,f),qt(e,t,s,n),s=Ye?zi:0,!x&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Hm(e,n,t);else if(e.tag===19)Hm(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&Il(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),Rc(t,!1,r,n,o,s);break;case"backwards":case"unstable_legacy-backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Il(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}Rc(t,!0,n,null,o,s);break;case"together":Rc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function an(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Dn|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Bs(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(u(153));if(t.child!==null){for(e=t.child,n=Za(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Za(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Uc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Vl(e)))}function U0(e,t,n){switch(t.tag){case 3:Ue(t,t.stateNode.containerInfo),Tn(t,St,e.memoizedState.cache),as();break;case 27:case 5:ie(t);break;case 4:Ue(t,t.stateNode.containerInfo);break;case 10:Tn(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,rc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Mn(t),t.flags|=128,null):(n&t.child.childLanes)!==0?qm(e,t,n):(Mn(t),e=an(e,t,n),e!==null?e.sibling:null);Mn(t);break;case 19:var r=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(Bs(e,t,n,!1),s=(n&t.childLanes)!==0),r){if(s)return Vm(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ee(yt,yt.current),s)break;return null;case 22:return t.lanes=0,wm(e,t,n,t.pendingProps);case 24:Tn(t,St,e.memoizedState.cache)}return an(e,t,n)}function Bm(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ct=!0;else{if(!Uc(e,n)&&(t.flags&128)===0)return Ct=!1,U0(e,t,n);Ct=(e.flags&131072)!==0}else Ct=!1,Ye&&(t.flags&1048576)!==0&&xf(t,zi,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=ls(t.elementType),t.type=e,typeof e=="function")Bo(e)?(s=us(e,s),t.tag=1,t=Um(null,t,e,s,n)):(t.tag=0,t=zc(null,t,e,s,n));else{if(e!=null){var r=e.$$typeof;if(r===j){t.tag=11,t=zm(null,t,e,s,n);break e}else if(r===w){t.tag=14,t=Mm(null,t,e,s,n);break e}}throw t=ye(e)||e,Error(u(306,t,""))}}return t;case 0:return zc(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,r=us(s,t.pendingProps),Um(e,t,s,r,n);case 3:e:{if(Ue(t,t.stateNode.containerInfo),e===null)throw Error(u(387));s=t.pendingProps;var o=t.memoizedState;r=o.element,ac(e,t),Li(t,s,null,n);var f=t.memoizedState;if(s=f.cache,Tn(t,St,s),s!==o.cache&&Zo(t,[St],n,!0),Ui(),s=f.element,o.isDehydrated)if(o={element:s,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Lm(e,t,s,n);break e}else if(s!==r){r=xa(Error(u(424)),t),Mi(r),t=Lm(e,t,s,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ut=Ca(e.firstChild),Ut=t,Ye=!0,Cn=null,Sa=!0,n=wf(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(as(),s===r){t=an(e,t,n);break e}qt(e,t,s,n)}t=t.child}return t;case 26:return ir(e,t),e===null?(n=Kh(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ye||(n=t.type,e=t.pendingProps,s=Sr(me.current).createElement(n),s[Rt]=t,s[Qt]=e,Ht(s,n,e),wt(s),t.stateNode=s):t.memoizedState=Kh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ie(t),e===null&&Ye&&(s=t.stateNode=Qh(t.type,t.pendingProps,me.current),Ut=t,Sa=!0,r=ut,Hn(t.type)?(pu=r,ut=Ca(s.firstChild)):ut=r),qt(e,t,t.pendingProps.children,n),ir(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ye&&((r=s=ut)&&(s=fb(s,t.type,t.pendingProps,Sa),s!==null?(t.stateNode=s,Ut=t,ut=Ca(s.firstChild),Sa=!1,r=!0):r=!1),r||_n(t)),ie(t),r=t.type,o=t.pendingProps,f=e!==null?e.memoizedProps:null,s=o.children,uu(r,o)?s=null:f!==null&&uu(r,f)&&(t.flags|=32),t.memoizedState!==null&&(r=cc(e,t,O0,null,null,n),nl._currentValue=r),ir(e,t),qt(e,t,s,n),t.child;case 6:return e===null&&Ye&&((e=n=ut)&&(n=mb(n,t.pendingProps,Sa),n!==null?(t.stateNode=n,Ut=t,ut=null,e=!0):e=!1),e||_n(t)),null;case 13:return qm(e,t,n);case 4:return Ue(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=os(t,null,s,n):qt(e,t,s,n),t.child;case 11:return zm(e,t,t.type,t.pendingProps,n);case 7:return qt(e,t,t.pendingProps,n),t.child;case 8:return qt(e,t,t.pendingProps.children,n),t.child;case 12:return qt(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,Tn(t,t.type,s.value),qt(e,t,s.children,n),t.child;case 9:return r=t.type._context,s=t.pendingProps.children,ss(t),r=Lt(r),s=s(r),t.flags|=1,qt(e,t,s,n),t.child;case 14:return Mm(e,t,t.type,t.pendingProps,n);case 15:return Am(e,t,t.type,t.pendingProps,n);case 19:return Vm(e,t,n);case 31:return R0(e,t,n);case 22:return wm(e,t,n,t.pendingProps);case 24:return ss(t),s=Lt(St),e===null?(r=Wo(),r===null&&(r=ot,o=Jo(),r.pooledCache=o,o.refCount++,o!==null&&(r.pooledCacheLanes|=n),r=o),t.memoizedState={parent:s,cache:r},tc(t),Tn(t,St,r)):((e.lanes&n)!==0&&(ac(e,t),Li(t,null,null,n),Ui()),r=e.memoizedState,o=t.memoizedState,r.parent!==s?(r={parent:s,cache:s},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),Tn(t,St,s)):(s=o.cache,Tn(t,St,s),s!==r.cache&&Zo(t,[St],n,!0))),qt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function nn(e){e.flags|=4}function Lc(e,t,n,s,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(hh())e.flags|=8192;else throw rs=Pl,ec}else e.flags&=-16777217}function $m(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!np(t))if(hh())e.flags|=8192;else throw rs=Pl,ec}function rr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?_e():536870912,e.lanes|=t,Ws|=t)}function Fi(e,t){if(!Ye)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function dt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags&65011712,s|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function L0(e,t,n){var s=t.pendingProps;switch(Go(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dt(t),null;case 1:return dt(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Wa(St),ke(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Vs(t)?nn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Xo())),dt(t),null;case 26:var r=t.type,o=t.memoizedState;return e===null?(nn(t),o!==null?(dt(t),$m(t,o)):(dt(t),Lc(t,r,null,s,n))):o?o!==e.memoizedState?(nn(t),dt(t),$m(t,o)):(dt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&nn(t),dt(t),Lc(t,r,e,s,n)),null;case 27:if(B(t),n=me.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&nn(t);else{if(!s){if(t.stateNode===null)throw Error(u(166));return dt(t),null}e=ne.current,Vs(t)?jf(t):(e=Qh(r,s,n),t.stateNode=e,nn(t))}return dt(t),null;case 5:if(B(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&nn(t);else{if(!s){if(t.stateNode===null)throw Error(u(166));return dt(t),null}if(o=ne.current,Vs(t))jf(t);else{var f=Sr(me.current);switch(o){case 1:o=f.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:o=f.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":o=f.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":o=f.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":o=f.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof s.is=="string"?f.createElement("select",{is:s.is}):f.createElement("select"),s.multiple?o.multiple=!0:s.size&&(o.size=s.size);break;default:o=typeof s.is=="string"?f.createElement(r,{is:s.is}):f.createElement(r)}}o[Rt]=t,o[Qt]=s;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)o.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=o;e:switch(Ht(o,r,s),r){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&nn(t)}}return dt(t),Lc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&nn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(u(166));if(e=me.current,Vs(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,r=Ut,r!==null)switch(r.tag){case 27:case 5:s=r.memoizedProps}e[Rt]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||qh(e.nodeValue,n)),e||_n(t,!0)}else e=Sr(e).createTextNode(s),e[Rt]=t,t.stateNode=e}return dt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=Vs(t),n!==null){if(e===null){if(!s)throw Error(u(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(557));e[Rt]=t}else as(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;dt(t),e=!1}else n=Xo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ca(t),t):(ca(t),null);if((t.flags&128)!==0)throw Error(u(558))}return dt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Vs(t),s!==null&&s.dehydrated!==null){if(e===null){if(!r)throw Error(u(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(u(317));r[Rt]=t}else as(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;dt(t),r=!1}else r=Xo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(ca(t),t):(ca(t),null)}return ca(t),(t.flags&128)!==0?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,r=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(r=s.alternate.memoizedState.cachePool.pool),o=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),o!==r&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),rr(t,t.updateQueue),dt(t),null);case 4:return ke(),e===null&&iu(t.stateNode.containerInfo),dt(t),null;case 10:return Wa(t.type),dt(t),null;case 19:if(T(yt),s=t.memoizedState,s===null)return dt(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)Fi(s,!1);else{if(bt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(o=Il(e),o!==null){for(t.flags|=128,Fi(s,!1),e=o.updateQueue,t.updateQueue=e,rr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)vf(n,e),n=n.sibling;return ee(yt,yt.current&1|2),Ye&&Ja(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&ft()>fr&&(t.flags|=128,r=!0,Fi(s,!1),t.lanes=4194304)}else{if(!r)if(e=Il(o),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,rr(t,e),Fi(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Ye)return dt(t),null}else 2*ft()-s.renderingStartTime>fr&&n!==536870912&&(t.flags|=128,r=!0,Fi(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(e=s.last,e!==null?e.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=ft(),e.sibling=null,n=yt.current,ee(yt,r?n&1|2:n&1),Ye&&Ja(t,s.treeForkCount),e):(dt(t),null);case 22:case 23:return ca(t),lc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(n&536870912)!==0&&(t.flags&128)===0&&(dt(t),t.subtreeFlags&6&&(t.flags|=8192)):dt(t),n=t.updateQueue,n!==null&&rr(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&T(is),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Wa(St),dt(t),null;case 25:return null;case 30:return null}throw Error(u(156,t.tag))}function q0(e,t){switch(Go(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wa(St),ke(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return B(t),null;case 31:if(t.memoizedState!==null){if(ca(t),t.alternate===null)throw Error(u(340));as()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ca(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));as()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return T(yt),null;case 4:return ke(),null;case 10:return Wa(t.type),null;case 22:case 23:return ca(t),lc(),e!==null&&T(is),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Wa(St),null;case 25:return null;default:return null}}function Fm(e,t){switch(Go(t),t.tag){case 3:Wa(St),ke();break;case 26:case 27:case 5:B(t);break;case 4:ke();break;case 31:t.memoizedState!==null&&ca(t);break;case 13:ca(t);break;case 19:T(yt);break;case 10:Wa(t.type);break;case 22:case 23:ca(t),lc(),e!==null&&T(is);break;case 24:Wa(St)}}function Pi(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var r=s.next;n=r;do{if((n.tag&e)===e){s=void 0;var o=n.create,f=n.inst;s=o(),f.destroy=s}n=n.next}while(n!==r)}}catch(x){nt(t,t.return,x)}}function wn(e,t,n){try{var s=t.updateQueue,r=s!==null?s.lastEffect:null;if(r!==null){var o=r.next;s=o;do{if((s.tag&e)===e){var f=s.inst,x=f.destroy;if(x!==void 0){f.destroy=void 0,r=t;var M=n,X=x;try{X()}catch(se){nt(r,M,se)}}}s=s.next}while(s!==o)}}catch(se){nt(t,t.return,se)}}function Pm(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Df(t,n)}catch(s){nt(e,e.return,s)}}}function Gm(e,t,n){n.props=us(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){nt(e,t,s)}}function Gi(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(r){nt(e,t,r)}}function Ra(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(r){nt(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(r){nt(e,t,r)}else n.current=null}function Ym(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(r){nt(e,e.return,r)}}function qc(e,t,n){try{var s=e.stateNode;lb(s,e.type,n,t),s[Qt]=t}catch(r){nt(e,e.return,r)}}function Xm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Hn(e.type)||e.tag===4}function Hc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Hn(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Vc(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ia));else if(s!==4&&(s===27&&Hn(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Vc(e,t,n),e=e.sibling;e!==null;)Vc(e,t,n),e=e.sibling}function or(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&Hn(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(or(e,t,n),e=e.sibling;e!==null;)or(e,t,n),e=e.sibling}function Im(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);Ht(t,s,n),t[Rt]=e,t[Qt]=n}catch(o){nt(e,e.return,o)}}var sn=!1,_t=!1,Bc=!1,Qm=typeof WeakSet=="function"?WeakSet:Set,kt=null;function H0(e,t){if(e=e.containerInfo,ou=zr,e=rf(e),Do(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var r=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var f=0,x=-1,M=-1,X=0,se=0,re=e,Z=null;t:for(;;){for(var te;re!==n||r!==0&&re.nodeType!==3||(x=f+r),re!==o||s!==0&&re.nodeType!==3||(M=f+s),re.nodeType===3&&(f+=re.nodeValue.length),(te=re.firstChild)!==null;)Z=re,re=te;for(;;){if(re===e)break t;if(Z===n&&++X===r&&(x=f),Z===o&&++se===s&&(M=f),(te=re.nextSibling)!==null)break;re=Z,Z=re.parentNode}re=te}n=x===-1||M===-1?null:{start:x,end:M}}else n=null}n=n||{start:0,end:0}}else n=null;for(cu={focusedElem:e,selectionRange:n},zr=!1,kt=t;kt!==null;)if(t=kt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,kt=e;else for(;kt!==null;){switch(t=kt,o=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)r=e[n],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&o!==null){e=void 0,n=t,r=o.memoizedProps,o=o.memoizedState,s=n.stateNode;try{var Ce=us(n.type,r);e=s.getSnapshotBeforeUpdate(Ce,o),s.__reactInternalSnapshotBeforeUpdate=e}catch(De){nt(n,n.return,De)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)fu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":fu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(u(163))}if(e=t.sibling,e!==null){e.return=t.return,kt=e;break}kt=t.return}}function Zm(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:rn(e,n),s&4&&Pi(5,n);break;case 1:if(rn(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(f){nt(n,n.return,f)}else{var r=us(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){nt(n,n.return,f)}}s&64&&Pm(n),s&512&&Gi(n,n.return);break;case 3:if(rn(e,n),s&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Df(e,t)}catch(f){nt(n,n.return,f)}}break;case 27:t===null&&s&4&&Im(n);case 26:case 5:rn(e,n),t===null&&s&4&&Ym(n),s&512&&Gi(n,n.return);break;case 12:rn(e,n);break;case 31:rn(e,n),s&4&&Wm(e,n);break;case 13:rn(e,n),s&4&&eh(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=I0.bind(null,n),hb(e,n))));break;case 22:if(s=n.memoizedState!==null||sn,!s){t=t!==null&&t.memoizedState!==null||_t,r=sn;var o=_t;sn=s,(_t=t)&&!o?on(e,n,(n.subtreeFlags&8772)!==0):rn(e,n),sn=r,_t=o}break;case 30:break;default:rn(e,n)}}function Jm(e){var t=e.alternate;t!==null&&(e.alternate=null,Jm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&go(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var mt=null,Jt=!1;function ln(e,t,n){for(n=n.child;n!==null;)Km(e,t,n),n=n.sibling}function Km(e,t,n){if(ve&&typeof ve.onCommitFiberUnmount=="function")try{ve.onCommitFiberUnmount(be,n)}catch{}switch(n.tag){case 26:_t||Ra(n,t),ln(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:_t||Ra(n,t);var s=mt,r=Jt;Hn(n.type)&&(mt=n.stateNode,Jt=!1),ln(e,t,n),el(n.stateNode),mt=s,Jt=r;break;case 5:_t||Ra(n,t);case 6:if(s=mt,r=Jt,mt=null,ln(e,t,n),mt=s,Jt=r,mt!==null)if(Jt)try{(mt.nodeType===9?mt.body:mt.nodeName==="HTML"?mt.ownerDocument.body:mt).removeChild(n.stateNode)}catch(o){nt(n,t,o)}else try{mt.removeChild(n.stateNode)}catch(o){nt(n,t,o)}break;case 18:mt!==null&&(Jt?(e=mt,Ph(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),ri(e)):Ph(mt,n.stateNode));break;case 4:s=mt,r=Jt,mt=n.stateNode.containerInfo,Jt=!0,ln(e,t,n),mt=s,Jt=r;break;case 0:case 11:case 14:case 15:wn(2,n,t),_t||wn(4,n,t),ln(e,t,n);break;case 1:_t||(Ra(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&Gm(n,t,s)),ln(e,t,n);break;case 21:ln(e,t,n);break;case 22:_t=(s=_t)||n.memoizedState!==null,ln(e,t,n),_t=s;break;default:ln(e,t,n)}}function Wm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ri(e)}catch(n){nt(t,t.return,n)}}}function eh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ri(e)}catch(n){nt(t,t.return,n)}}function V0(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Qm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Qm),t;default:throw Error(u(435,e.tag))}}function cr(e,t){var n=V0(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var r=Q0.bind(null,e,s);s.then(r,r)}})}function Kt(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var r=n[s],o=e,f=t,x=f;e:for(;x!==null;){switch(x.tag){case 27:if(Hn(x.type)){mt=x.stateNode,Jt=!1;break e}break;case 5:mt=x.stateNode,Jt=!1;break e;case 3:case 4:mt=x.stateNode.containerInfo,Jt=!0;break e}x=x.return}if(mt===null)throw Error(u(160));Km(o,f,r),mt=null,Jt=!1,o=r.alternate,o!==null&&(o.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)th(t,e),t=t.sibling}var Oa=null;function th(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Kt(t,e),Wt(e),s&4&&(wn(3,e,e.return),Pi(3,e),wn(5,e,e.return));break;case 1:Kt(t,e),Wt(e),s&512&&(_t||n===null||Ra(n,n.return)),s&64&&sn&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?s:n.concat(s))));break;case 26:var r=Oa;if(Kt(t,e),Wt(e),s&512&&(_t||n===null||Ra(n,n.return)),s&4){var o=n!==null?n.memoizedState:null;if(s=e.memoizedState,n===null)if(s===null)if(e.stateNode===null){e:{s=e.type,n=e.memoizedProps,r=r.ownerDocument||r;t:switch(s){case"title":o=r.getElementsByTagName("title")[0],(!o||o[bi]||o[Rt]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=r.createElement(s),r.head.insertBefore(o,r.querySelector("head > title"))),Ht(o,s,n),o[Rt]=e,wt(o),s=o;break e;case"link":var f=tp("link","href",r).get(s+(n.href||""));if(f){for(var x=0;x<f.length;x++)if(o=f[x],o.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&o.getAttribute("rel")===(n.rel==null?null:n.rel)&&o.getAttribute("title")===(n.title==null?null:n.title)&&o.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){f.splice(x,1);break t}}o=r.createElement(s),Ht(o,s,n),r.head.appendChild(o);break;case"meta":if(f=tp("meta","content",r).get(s+(n.content||""))){for(x=0;x<f.length;x++)if(o=f[x],o.getAttribute("content")===(n.content==null?null:""+n.content)&&o.getAttribute("name")===(n.name==null?null:n.name)&&o.getAttribute("property")===(n.property==null?null:n.property)&&o.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute("charset")===(n.charSet==null?null:n.charSet)){f.splice(x,1);break t}}o=r.createElement(s),Ht(o,s,n),r.head.appendChild(o);break;default:throw Error(u(468,s))}o[Rt]=e,wt(o),s=o}e.stateNode=s}else ap(r,e.type,e.stateNode);else e.stateNode=ep(r,s,e.memoizedProps);else o!==s?(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,s===null?ap(r,e.type,e.stateNode):ep(r,s,e.memoizedProps)):s===null&&e.stateNode!==null&&qc(e,e.memoizedProps,n.memoizedProps)}break;case 27:Kt(t,e),Wt(e),s&512&&(_t||n===null||Ra(n,n.return)),n!==null&&s&4&&qc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Kt(t,e),Wt(e),s&512&&(_t||n===null||Ra(n,n.return)),e.flags&32){r=e.stateNode;try{Ms(r,"")}catch(Ce){nt(e,e.return,Ce)}}s&4&&e.stateNode!=null&&(r=e.memoizedProps,qc(e,r,n!==null?n.memoizedProps:r)),s&1024&&(Bc=!0);break;case 6:if(Kt(t,e),Wt(e),s&4){if(e.stateNode===null)throw Error(u(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(Ce){nt(e,e.return,Ce)}}break;case 3:if(_r=null,r=Oa,Oa=Nr(t.containerInfo),Kt(t,e),Oa=r,Wt(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{ri(t.containerInfo)}catch(Ce){nt(e,e.return,Ce)}Bc&&(Bc=!1,ah(e));break;case 4:s=Oa,Oa=Nr(e.stateNode.containerInfo),Kt(t,e),Wt(e),Oa=s;break;case 12:Kt(t,e),Wt(e);break;case 31:Kt(t,e),Wt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,cr(e,s)));break;case 13:Kt(t,e),Wt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(dr=ft()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,cr(e,s)));break;case 22:r=e.memoizedState!==null;var M=n!==null&&n.memoizedState!==null,X=sn,se=_t;if(sn=X||r,_t=se||M,Kt(t,e),_t=se,sn=X,Wt(e),s&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||M||sn||_t||ds(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){M=n=t;try{if(o=M.stateNode,r)f=o.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none";else{x=M.stateNode;var re=M.memoizedProps.style,Z=re!=null&&re.hasOwnProperty("display")?re.display:null;x.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(Ce){nt(M,M.return,Ce)}}}else if(t.tag===6){if(n===null){M=t;try{M.stateNode.nodeValue=r?"":M.memoizedProps}catch(Ce){nt(M,M.return,Ce)}}}else if(t.tag===18){if(n===null){M=t;try{var te=M.stateNode;r?Gh(te,!0):Gh(M.stateNode,!1)}catch(Ce){nt(M,M.return,Ce)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,cr(e,n))));break;case 19:Kt(t,e),Wt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,cr(e,s)));break;case 30:break;case 21:break;default:Kt(t,e),Wt(e)}}function Wt(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(Xm(s)){n=s;break}s=s.return}if(n==null)throw Error(u(160));switch(n.tag){case 27:var r=n.stateNode,o=Hc(e);or(e,o,r);break;case 5:var f=n.stateNode;n.flags&32&&(Ms(f,""),n.flags&=-33);var x=Hc(e);or(e,x,f);break;case 3:case 4:var M=n.stateNode.containerInfo,X=Hc(e);Vc(e,X,M);break;default:throw Error(u(161))}}catch(se){nt(e,e.return,se)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ah(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ah(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function rn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Zm(e,t.alternate,t),t=t.sibling}function ds(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:wn(4,t,t.return),ds(t);break;case 1:Ra(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Gm(t,t.return,n),ds(t);break;case 27:el(t.stateNode);case 26:case 5:Ra(t,t.return),ds(t);break;case 22:t.memoizedState===null&&ds(t);break;case 30:ds(t);break;default:ds(t)}e=e.sibling}}function on(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,r=e,o=t,f=o.flags;switch(o.tag){case 0:case 11:case 15:on(r,o,n),Pi(4,o);break;case 1:if(on(r,o,n),s=o,r=s.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(X){nt(s,s.return,X)}if(s=o,r=s.updateQueue,r!==null){var x=s.stateNode;try{var M=r.shared.hiddenCallbacks;if(M!==null)for(r.shared.hiddenCallbacks=null,r=0;r<M.length;r++)kf(M[r],x)}catch(X){nt(s,s.return,X)}}n&&f&64&&Pm(o),Gi(o,o.return);break;case 27:Im(o);case 26:case 5:on(r,o,n),n&&s===null&&f&4&&Ym(o),Gi(o,o.return);break;case 12:on(r,o,n);break;case 31:on(r,o,n),n&&f&4&&Wm(r,o);break;case 13:on(r,o,n),n&&f&4&&eh(r,o);break;case 22:o.memoizedState===null&&on(r,o,n),Gi(o,o.return);break;case 30:break;default:on(r,o,n)}t=t.sibling}}function $c(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Ai(n))}function Fc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ai(e))}function Ea(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)nh(e,t,n,s),t=t.sibling}function nh(e,t,n,s){var r=t.flags;switch(t.tag){case 0:case 11:case 15:Ea(e,t,n,s),r&2048&&Pi(9,t);break;case 1:Ea(e,t,n,s);break;case 3:Ea(e,t,n,s),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ai(e)));break;case 12:if(r&2048){Ea(e,t,n,s),e=t.stateNode;try{var o=t.memoizedProps,f=o.id,x=o.onPostCommit;typeof x=="function"&&x(f,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){nt(t,t.return,M)}}else Ea(e,t,n,s);break;case 31:Ea(e,t,n,s);break;case 13:Ea(e,t,n,s);break;case 23:break;case 22:o=t.stateNode,f=t.alternate,t.memoizedState!==null?o._visibility&2?Ea(e,t,n,s):Yi(e,t):o._visibility&2?Ea(e,t,n,s):(o._visibility|=2,Zs(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),r&2048&&$c(f,t);break;case 24:Ea(e,t,n,s),r&2048&&Fc(t.alternate,t);break;default:Ea(e,t,n,s)}}function Zs(e,t,n,s,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var o=e,f=t,x=n,M=s,X=f.flags;switch(f.tag){case 0:case 11:case 15:Zs(o,f,x,M,r),Pi(8,f);break;case 23:break;case 22:var se=f.stateNode;f.memoizedState!==null?se._visibility&2?Zs(o,f,x,M,r):Yi(o,f):(se._visibility|=2,Zs(o,f,x,M,r)),r&&X&2048&&$c(f.alternate,f);break;case 24:Zs(o,f,x,M,r),r&&X&2048&&Fc(f.alternate,f);break;default:Zs(o,f,x,M,r)}t=t.sibling}}function Yi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,s=t,r=s.flags;switch(s.tag){case 22:Yi(n,s),r&2048&&$c(s.alternate,s);break;case 24:Yi(n,s),r&2048&&Fc(s.alternate,s);break;default:Yi(n,s)}t=t.sibling}}var Xi=8192;function Js(e,t,n){if(e.subtreeFlags&Xi)for(e=e.child;e!==null;)sh(e,t,n),e=e.sibling}function sh(e,t,n){switch(e.tag){case 26:Js(e,t,n),e.flags&Xi&&e.memoizedState!==null&&Tb(n,Oa,e.memoizedState,e.memoizedProps);break;case 5:Js(e,t,n);break;case 3:case 4:var s=Oa;Oa=Nr(e.stateNode.containerInfo),Js(e,t,n),Oa=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Xi,Xi=16777216,Js(e,t,n),Xi=s):Js(e,t,n));break;default:Js(e,t,n)}}function ih(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ii(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];kt=s,rh(s,e)}ih(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)lh(e),e=e.sibling}function lh(e){switch(e.tag){case 0:case 11:case 15:Ii(e),e.flags&2048&&wn(9,e,e.return);break;case 3:Ii(e);break;case 12:Ii(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ur(e)):Ii(e);break;default:Ii(e)}}function ur(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];kt=s,rh(s,e)}ih(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:wn(8,t,t.return),ur(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,ur(t));break;default:ur(t)}e=e.sibling}}function rh(e,t){for(;kt!==null;){var n=kt;switch(n.tag){case 0:case 11:case 15:wn(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var s=n.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Ai(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,kt=s;else e:for(n=e;kt!==null;){s=kt;var r=s.sibling,o=s.return;if(Jm(s),s===n){kt=null;break e}if(r!==null){r.return=o,kt=r;break e}kt=o}}}var B0={getCacheForType:function(e){var t=Lt(St),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Lt(St).controller.signal}},$0=typeof WeakMap=="function"?WeakMap:Map,Je=0,ot=null,$e=null,Pe=0,at=0,ua=null,kn=!1,Ks=!1,Pc=!1,cn=0,bt=0,Dn=0,fs=0,Gc=0,da=0,Ws=0,Qi=null,ea=null,Yc=!1,dr=0,oh=0,fr=1/0,mr=null,Rn=null,zt=0,Un=null,ei=null,un=0,Xc=0,Ic=null,ch=null,Zi=0,Qc=null;function fa(){return(Je&2)!==0&&Pe!==0?Pe&-Pe:F.T!==null?tu():yn()}function uh(){if(da===0)if((Pe&536870912)===0||Ye){var e=xn;xn<<=1,(xn&3932160)===0&&(xn=262144),da=e}else da=536870912;return e=oa.current,e!==null&&(e.flags|=32),da}function ta(e,t,n){(e===ot&&(at===2||at===9)||e.cancelPendingCommit!==null)&&(ti(e,0),Ln(e,Pe,da,!1)),Ie(e,n),((Je&2)===0||e!==ot)&&(e===ot&&((Je&2)===0&&(fs|=n),bt===4&&Ln(e,Pe,da,!1)),Ua(e))}function dh(e,t,n){if((Je&6)!==0)throw Error(u(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||U(e,t),r=s?G0(e,t):Jc(e,t,!0),o=s;do{if(r===0){Ks&&!s&&Ln(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!F0(n)){r=Jc(e,t,!1),o=!1;continue}if(r===2){if(o=t,e.errorRecoveryDisabledLanes&o)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var x=e;r=Qi;var M=x.current.memoizedState.isDehydrated;if(M&&(ti(x,f).flags|=256),f=Jc(x,f,!1),f!==2){if(Pc&&!M){x.errorRecoveryDisabledLanes|=o,fs|=o,r=4;break e}o=ea,ea=r,o!==null&&(ea===null?ea=o:ea.push.apply(ea,o))}r=f}if(o=!1,r!==2)continue}}if(r===1){ti(e,0),Ln(e,t,0,!0);break}e:{switch(s=e,o=r,o){case 0:case 1:throw Error(u(345));case 4:if((t&4194048)!==t)break;case 6:Ln(s,t,da,!kn);break e;case 2:ea=null;break;case 3:case 5:break;default:throw Error(u(329))}if((t&62914560)===t&&(r=dr+300-ft(),10<r)){if(Ln(s,t,da,!kn),Ne(s,0,!0)!==0)break e;un=t,s.timeoutHandle=$h(fh.bind(null,s,n,ea,mr,Yc,t,da,fs,Ws,kn,o,"Throttled",-0,0),r);break e}fh(s,n,ea,mr,Yc,t,da,fs,Ws,kn,o,null,-0,0)}}break}while(!0);Ua(e)}function fh(e,t,n,s,r,o,f,x,M,X,se,re,Z,te){if(e.timeoutHandle=-1,re=t.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ia},sh(t,o,re);var Ce=(o&62914560)===o?dr-ft():(o&4194048)===o?oh-ft():0;if(Ce=Ob(re,Ce),Ce!==null){un=o,e.cancelPendingCommit=Ce(yh.bind(null,e,t,o,n,s,r,f,x,M,se,re,null,Z,te)),Ln(e,o,f,!X);return}}yh(e,t,o,n,s,r,f,x,M)}function F0(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var s=0;s<n.length;s++){var r=n[s],o=r.getSnapshot;r=r.value;try{if(!la(o(),r))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ln(e,t,n,s){t&=~Gc,t&=~fs,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var r=t;0<r;){var o=31-Xe(r),f=1<<o;s[o]=-1,r&=~f}n!==0&&vt(e,n,t)}function hr(){return(Je&6)===0?(Ji(0),!1):!0}function Zc(){if($e!==null){if(at===0)var e=$e.return;else e=$e,Ka=ns=null,fc(e),Gs=null,ki=0,e=$e;for(;e!==null;)Fm(e.alternate,e),e=e.return;$e=null}}function ti(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,cb(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),un=0,Zc(),ot=e,$e=n=Za(e.current,null),Pe=t,at=0,ua=null,kn=!1,Ks=U(e,t),Pc=!1,Ws=da=Gc=fs=Dn=bt=0,ea=Qi=null,Yc=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var r=31-Xe(s),o=1<<r;t|=e[r],s&=~o}return cn=t,Rl(),n}function mh(e,t){He=null,F.H=Bi,t===Ps||t===Fl?(t=zf(),at=3):t===ec?(t=zf(),at=4):at=t===Ec?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ua=t,$e===null&&(bt=1,nr(e,xa(t,e.current)))}function hh(){var e=oa.current;return e===null?!0:(Pe&4194048)===Pe?Na===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?e===Na:!1}function ph(){var e=F.H;return F.H=Bi,e===null?Bi:e}function vh(){var e=F.A;return F.A=B0,e}function pr(){bt=4,kn||(Pe&4194048)!==Pe&&oa.current!==null||(Ks=!0),(Dn&134217727)===0&&(fs&134217727)===0||ot===null||Ln(ot,Pe,da,!1)}function Jc(e,t,n){var s=Je;Je|=2;var r=ph(),o=vh();(ot!==e||Pe!==t)&&(mr=null,ti(e,t)),t=!1;var f=bt;e:do try{if(at!==0&&$e!==null){var x=$e,M=ua;switch(at){case 8:Zc(),f=6;break e;case 3:case 2:case 9:case 6:oa.current===null&&(t=!0);var X=at;if(at=0,ua=null,ai(e,x,M,X),n&&Ks){f=0;break e}break;default:X=at,at=0,ua=null,ai(e,x,M,X)}}P0(),f=bt;break}catch(se){mh(e,se)}while(!0);return t&&e.shellSuspendCounter++,Ka=ns=null,Je=s,F.H=r,F.A=o,$e===null&&(ot=null,Pe=0,Rl()),f}function P0(){for(;$e!==null;)gh($e)}function G0(e,t){var n=Je;Je|=2;var s=ph(),r=vh();ot!==e||Pe!==t?(mr=null,fr=ft()+500,ti(e,t)):Ks=U(e,t);e:do try{if(at!==0&&$e!==null){t=$e;var o=ua;t:switch(at){case 1:at=0,ua=null,ai(e,t,o,1);break;case 2:case 9:if(Of(o)){at=0,ua=null,bh(t);break}t=function(){at!==2&&at!==9||ot!==e||(at=7),Ua(e)},o.then(t,t);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:Of(o)?(at=0,ua=null,bh(t)):(at=0,ua=null,ai(e,t,o,7));break;case 5:var f=null;switch($e.tag){case 26:f=$e.memoizedState;case 5:case 27:var x=$e;if(f?np(f):x.stateNode.complete){at=0,ua=null;var M=x.sibling;if(M!==null)$e=M;else{var X=x.return;X!==null?($e=X,vr(X)):$e=null}break t}}at=0,ua=null,ai(e,t,o,5);break;case 6:at=0,ua=null,ai(e,t,o,6);break;case 8:Zc(),bt=6;break e;default:throw Error(u(462))}}Y0();break}catch(se){mh(e,se)}while(!0);return Ka=ns=null,F.H=s,F.A=r,Je=n,$e!==null?0:(ot=null,Pe=0,Rl(),bt)}function Y0(){for(;$e!==null&&!Xn();)gh($e)}function gh(e){var t=Bm(e.alternate,e,cn);e.memoizedProps=e.pendingProps,t===null?vr(e):$e=t}function bh(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Rm(n,t,t.pendingProps,t.type,void 0,Pe);break;case 11:t=Rm(n,t,t.pendingProps,t.type.render,t.ref,Pe);break;case 5:fc(t);default:Fm(n,t),t=$e=vf(t,cn),t=Bm(n,t,cn)}e.memoizedProps=e.pendingProps,t===null?vr(e):$e=t}function ai(e,t,n,s){Ka=ns=null,fc(t),Gs=null,ki=0;var r=t.return;try{if(D0(e,r,t,n,Pe)){bt=1,nr(e,xa(n,e.current)),$e=null;return}}catch(o){if(r!==null)throw $e=r,o;bt=1,nr(e,xa(n,e.current)),$e=null;return}t.flags&32768?(Ye||s===1?e=!0:Ks||(Pe&536870912)!==0?e=!1:(kn=e=!0,(s===2||s===9||s===3||s===6)&&(s=oa.current,s!==null&&s.tag===13&&(s.flags|=16384))),xh(t,e)):vr(t)}function vr(e){var t=e;do{if((t.flags&32768)!==0){xh(t,kn);return}e=t.return;var n=L0(t.alternate,t,cn);if(n!==null){$e=n;return}if(t=t.sibling,t!==null){$e=t;return}$e=t=e}while(t!==null);bt===0&&(bt=5)}function xh(e,t){do{var n=q0(e.alternate,e);if(n!==null){n.flags&=32767,$e=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){$e=e;return}$e=e=n}while(e!==null);bt=6,$e=null}function yh(e,t,n,s,r,o,f,x,M){e.cancelPendingCommit=null;do gr();while(zt!==0);if((Je&6)!==0)throw Error(u(327));if(t!==null){if(t===e.current)throw Error(u(177));if(o=t.lanes|t.childLanes,o|=Ho,st(e,n,o,f,x,M),e===ot&&($e=ot=null,Pe=0),ei=t,Un=e,un=n,Xc=o,Ic=r,ch=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Z0(Et,function(){return _h(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=F.T,F.T=null,r=K.p,K.p=2,f=Je,Je|=4;try{H0(e,t,n)}finally{Je=f,K.p=r,F.T=s}}zt=1,jh(),Sh(),Nh()}}function jh(){if(zt===1){zt=0;var e=Un,t=ei,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=F.T,F.T=null;var s=K.p;K.p=2;var r=Je;Je|=4;try{th(t,e);var o=cu,f=rf(e.containerInfo),x=o.focusedElem,M=o.selectionRange;if(f!==x&&x&&x.ownerDocument&&lf(x.ownerDocument.documentElement,x)){if(M!==null&&Do(x)){var X=M.start,se=M.end;if(se===void 0&&(se=X),"selectionStart"in x)x.selectionStart=X,x.selectionEnd=Math.min(se,x.value.length);else{var re=x.ownerDocument||document,Z=re&&re.defaultView||window;if(Z.getSelection){var te=Z.getSelection(),Ce=x.textContent.length,De=Math.min(M.start,Ce),rt=M.end===void 0?De:Math.min(M.end,Ce);!te.extend&&De>rt&&(f=rt,rt=De,De=f);var $=sf(x,De),L=sf(x,rt);if($&&L&&(te.rangeCount!==1||te.anchorNode!==$.node||te.anchorOffset!==$.offset||te.focusNode!==L.node||te.focusOffset!==L.offset)){var Y=re.createRange();Y.setStart($.node,$.offset),te.removeAllRanges(),De>rt?(te.addRange(Y),te.extend(L.node,L.offset)):(Y.setEnd(L.node,L.offset),te.addRange(Y))}}}}for(re=[],te=x;te=te.parentNode;)te.nodeType===1&&re.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<re.length;x++){var le=re[x];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}zr=!!ou,cu=ou=null}finally{Je=r,K.p=s,F.T=n}}e.current=t,zt=2}}function Sh(){if(zt===2){zt=0;var e=Un,t=ei,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=F.T,F.T=null;var s=K.p;K.p=2;var r=Je;Je|=4;try{Zm(e,t.alternate,t)}finally{Je=r,K.p=s,F.T=n}}zt=3}}function Nh(){if(zt===4||zt===3){zt=0,Ma();var e=Un,t=ei,n=un,s=ch;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?zt=5:(zt=0,ei=Un=null,Ch(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Rn=null),Qn(n),t=t.stateNode,ve&&typeof ve.onCommitFiberRoot=="function")try{ve.onCommitFiberRoot(be,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=F.T,r=K.p,K.p=2,F.T=null;try{for(var o=e.onRecoverableError,f=0;f<s.length;f++){var x=s[f];o(x.value,{componentStack:x.stack})}}finally{F.T=t,K.p=r}}(un&3)!==0&&gr(),Ua(e),r=e.pendingLanes,(n&261930)!==0&&(r&42)!==0?e===Qc?Zi++:(Zi=0,Qc=e):Zi=0,Ji(0)}}function Ch(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ai(t)))}function gr(){return jh(),Sh(),Nh(),_h()}function _h(){if(zt!==5)return!1;var e=Un,t=Xc;Xc=0;var n=Qn(un),s=F.T,r=K.p;try{K.p=32>n?32:n,F.T=null,n=Ic,Ic=null;var o=Un,f=un;if(zt=0,ei=Un=null,un=0,(Je&6)!==0)throw Error(u(331));var x=Je;if(Je|=4,lh(o.current),nh(o,o.current,f,n),Je=x,Ji(0,!1),ve&&typeof ve.onPostCommitFiberRoot=="function")try{ve.onPostCommitFiberRoot(be,o)}catch{}return!0}finally{K.p=r,F.T=s,Ch(e,t)}}function Th(e,t,n){t=xa(n,t),t=Oc(e.stateNode,t,2),e=zn(e,t,2),e!==null&&(Ie(e,2),Ua(e))}function nt(e,t,n){if(e.tag===3)Th(e,e,n);else for(;t!==null;){if(t.tag===3){Th(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Rn===null||!Rn.has(s))){e=xa(n,e),n=Om(2),s=zn(t,n,2),s!==null&&(Em(n,s,t,e),Ie(s,2),Ua(s));break}}t=t.return}}function Kc(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new $0;var r=new Set;s.set(t,r)}else r=s.get(t),r===void 0&&(r=new Set,s.set(t,r));r.has(n)||(Pc=!0,r.add(n),e=X0.bind(null,e,t,n),t.then(e,e))}function X0(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ot===e&&(Pe&n)===n&&(bt===4||bt===3&&(Pe&62914560)===Pe&&300>ft()-dr?(Je&2)===0&&ti(e,0):Gc|=n,Ws===Pe&&(Ws=0)),Ua(e)}function Oh(e,t){t===0&&(t=_e()),e=es(e,t),e!==null&&(Ie(e,t),Ua(e))}function I0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Oh(e,n)}function Q0(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(u(314))}s!==null&&s.delete(t),Oh(e,n)}function Z0(e,t){return pa(e,t)}var br=null,ni=null,Wc=!1,xr=!1,eu=!1,qn=0;function Ua(e){e!==ni&&e.next===null&&(ni===null?br=ni=e:ni=ni.next=e),xr=!0,Wc||(Wc=!0,K0())}function Ji(e,t){if(!eu&&xr){eu=!0;do for(var n=!1,s=br;s!==null;){if(e!==0){var r=s.pendingLanes;if(r===0)var o=0;else{var f=s.suspendedLanes,x=s.pingedLanes;o=(1<<31-Xe(42|e)+1)-1,o&=r&~(f&~x),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(n=!0,Ah(s,o))}else o=Pe,o=Ne(s,s===ot?o:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(o&3)===0||U(s,o)||(n=!0,Ah(s,o));s=s.next}while(n);eu=!1}}function J0(){Eh()}function Eh(){xr=Wc=!1;var e=0;qn!==0&&ob()&&(e=qn);for(var t=ft(),n=null,s=br;s!==null;){var r=s.next,o=zh(s,t);o===0?(s.next=null,n===null?br=r:n.next=r,r===null&&(ni=n)):(n=s,(e!==0||(o&3)!==0)&&(xr=!0)),s=r}zt!==0&&zt!==5||Ji(e),qn!==0&&(qn=0)}function zh(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var f=31-Xe(o),x=1<<f,M=r[f];M===-1?((x&n)===0||(x&s)!==0)&&(r[f]=ge(x,t)):M<=t&&(e.expiredLanes|=x),o&=~x}if(t=ot,n=Pe,n=Ne(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(at===2||at===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&sa(s),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||U(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&sa(s),Qn(n)){case 2:case 8:n=wa;break;case 32:n=Et;break;case 268435456:n=pt;break;default:n=Et}return s=Mh.bind(null,e),n=pa(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&sa(s),e.callbackPriority=2,e.callbackNode=null,2}function Mh(e,t){if(zt!==0&&zt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(gr()&&e.callbackNode!==n)return null;var s=Pe;return s=Ne(e,e===ot?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(dh(e,s,t),zh(e,ft()),e.callbackNode!=null&&e.callbackNode===n?Mh.bind(null,e):null)}function Ah(e,t){if(gr())return null;dh(e,t,!0)}function K0(){ub(function(){(Je&6)!==0?pa(Aa,J0):Eh()})}function tu(){if(qn===0){var e=$s;e===0&&(e=bn,bn<<=1,(bn&261888)===0&&(bn=256)),qn=e}return qn}function wh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ol(""+e)}function kh(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function W0(e,t,n,s,r){if(t==="submit"&&n&&n.stateNode===r){var o=wh((r[Qt]||null).action),f=s.submitter;f&&(t=(t=f[Qt]||null)?wh(t.formAction):f.getAttribute("formAction"),t!==null&&(o=t,f=null));var x=new Al("action","action",null,s,r);e.push({event:x,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(qn!==0){var M=f?kh(r,f):new FormData(r);jc(n,{pending:!0,data:M,method:r.method,action:o},null,M)}}else typeof o=="function"&&(x.preventDefault(),M=f?kh(r,f):new FormData(r),jc(n,{pending:!0,data:M,method:r.method,action:o},o,M))},currentTarget:r}]})}}for(var au=0;au<qo.length;au++){var nu=qo[au],eb=nu.toLowerCase(),tb=nu[0].toUpperCase()+nu.slice(1);Ta(eb,"on"+tb)}Ta(uf,"onAnimationEnd"),Ta(df,"onAnimationIteration"),Ta(ff,"onAnimationStart"),Ta("dblclick","onDoubleClick"),Ta("focusin","onFocus"),Ta("focusout","onBlur"),Ta(g0,"onTransitionRun"),Ta(b0,"onTransitionStart"),Ta(x0,"onTransitionCancel"),Ta(mf,"onTransitionEnd"),Es("onMouseEnter",["mouseout","mouseover"]),Es("onMouseLeave",["mouseout","mouseover"]),Es("onPointerEnter",["pointerout","pointerover"]),Es("onPointerLeave",["pointerout","pointerover"]),Zn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Zn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Zn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Zn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Zn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Zn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ki="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(" "),ab=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ki));function Dh(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],r=s.event;s=s.listeners;e:{var o=void 0;if(t)for(var f=s.length-1;0<=f;f--){var x=s[f],M=x.instance,X=x.currentTarget;if(x=x.listener,M!==o&&r.isPropagationStopped())break e;o=x,r.currentTarget=X;try{o(r)}catch(se){Dl(se)}r.currentTarget=null,o=M}else for(f=0;f<s.length;f++){if(x=s[f],M=x.instance,X=x.currentTarget,x=x.listener,M!==o&&r.isPropagationStopped())break e;o=x,r.currentTarget=X;try{o(r)}catch(se){Dl(se)}r.currentTarget=null,o=M}}}}function Fe(e,t){var n=t[vo];n===void 0&&(n=t[vo]=new Set);var s=e+"__bubble";n.has(s)||(Rh(t,e,2,!1),n.add(s))}function su(e,t,n){var s=0;t&&(s|=4),Rh(n,e,s,t)}var yr="_reactListening"+Math.random().toString(36).slice(2);function iu(e){if(!e[yr]){e[yr]=!0,Od.forEach(function(n){n!=="selectionchange"&&(ab.has(n)||su(n,!1,e),su(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[yr]||(t[yr]=!0,su("selectionchange",!1,t))}}function Rh(e,t,n,s){switch(up(t)){case 2:var r=Mb;break;case 8:r=Ab;break;default:r=yu}n=r.bind(null,t,n,e),r=void 0,!_o||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),s?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function lu(e,t,n,s,r){var o=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var f=s.tag;if(f===3||f===4){var x=s.stateNode.containerInfo;if(x===r)break;if(f===4)for(f=s.return;f!==null;){var M=f.tag;if((M===3||M===4)&&f.stateNode.containerInfo===r)return;f=f.return}for(;x!==null;){if(f=_s(x),f===null)return;if(M=f.tag,M===5||M===6||M===26||M===27){s=o=f;continue e}x=x.parentNode}}s=s.return}Hd(function(){var X=o,se=No(n),re=[];e:{var Z=hf.get(e);if(Z!==void 0){var te=Al,Ce=e;switch(e){case"keypress":if(zl(n)===0)break e;case"keydown":case"keyup":te=Qg;break;case"focusin":Ce="focus",te=zo;break;case"focusout":Ce="blur",te=zo;break;case"beforeblur":case"afterblur":te=zo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":te=$d;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":te=Lg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":te=Kg;break;case uf:case df:case ff:te=Vg;break;case mf:te=e0;break;case"scroll":case"scrollend":te=Rg;break;case"wheel":te=a0;break;case"copy":case"cut":case"paste":te=$g;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":te=Pd;break;case"toggle":case"beforetoggle":te=s0}var De=(t&4)!==0,rt=!De&&(e==="scroll"||e==="scrollend"),$=De?Z!==null?Z+"Capture":null:Z;De=[];for(var L=X,Y;L!==null;){var le=L;if(Y=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||Y===null||$===null||(le=yi(L,$),le!=null&&De.push(Wi(L,le,Y))),rt)break;L=L.return}0<De.length&&(Z=new te(Z,Ce,null,n,se),re.push({event:Z,listeners:De}))}}if((t&7)===0){e:{if(Z=e==="mouseover"||e==="pointerover",te=e==="mouseout"||e==="pointerout",Z&&n!==So&&(Ce=n.relatedTarget||n.fromElement)&&(_s(Ce)||Ce[Cs]))break e;if((te||Z)&&(Z=se.window===se?se:(Z=se.ownerDocument)?Z.defaultView||Z.parentWindow:window,te?(Ce=n.relatedTarget||n.toElement,te=X,Ce=Ce?_s(Ce):null,Ce!==null&&(rt=m(Ce),De=Ce.tag,Ce!==rt||De!==5&&De!==27&&De!==6)&&(Ce=null)):(te=null,Ce=X),te!==Ce)){if(De=$d,le="onMouseLeave",$="onMouseEnter",L="mouse",(e==="pointerout"||e==="pointerover")&&(De=Pd,le="onPointerLeave",$="onPointerEnter",L="pointer"),rt=te==null?Z:xi(te),Y=Ce==null?Z:xi(Ce),Z=new De(le,L+"leave",te,n,se),Z.target=rt,Z.relatedTarget=Y,le=null,_s(se)===X&&(De=new De($,L+"enter",Ce,n,se),De.target=Y,De.relatedTarget=rt,le=De),rt=le,te&&Ce)t:{for(De=nb,$=te,L=Ce,Y=0,le=$;le;le=De(le))Y++;le=0;for(var Me=L;Me;Me=De(Me))le++;for(;0<Y-le;)$=De($),Y--;for(;0<le-Y;)L=De(L),le--;for(;Y--;){if($===L||L!==null&&$===L.alternate){De=$;break t}$=De($),L=De(L)}De=null}else De=null;te!==null&&Uh(re,Z,te,De,!1),Ce!==null&&rt!==null&&Uh(re,rt,Ce,De,!0)}}e:{if(Z=X?xi(X):window,te=Z.nodeName&&Z.nodeName.toLowerCase(),te==="select"||te==="input"&&Z.type==="file")var Qe=Kd;else if(Zd(Z))if(Wd)Qe=h0;else{Qe=f0;var Ee=d0}else te=Z.nodeName,!te||te.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?X&&jo(X.elementType)&&(Qe=Kd):Qe=m0;if(Qe&&(Qe=Qe(e,X))){Jd(re,Qe,n,se);break e}Ee&&Ee(e,Z,X),e==="focusout"&&X&&Z.type==="number"&&X.memoizedProps.value!=null&&yo(Z,"number",Z.value)}switch(Ee=X?xi(X):window,e){case"focusin":(Zd(Ee)||Ee.contentEditable==="true")&&(Ds=Ee,Ro=X,Ei=null);break;case"focusout":Ei=Ro=Ds=null;break;case"mousedown":Uo=!0;break;case"contextmenu":case"mouseup":case"dragend":Uo=!1,of(re,n,se);break;case"selectionchange":if(v0)break;case"keydown":case"keyup":of(re,n,se)}var Ve;if(Ao)e:{switch(e){case"compositionstart":var Ge="onCompositionStart";break e;case"compositionend":Ge="onCompositionEnd";break e;case"compositionupdate":Ge="onCompositionUpdate";break e}Ge=void 0}else ks?Id(e,n)&&(Ge="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ge="onCompositionStart");Ge&&(Gd&&n.locale!=="ko"&&(ks||Ge!=="onCompositionStart"?Ge==="onCompositionEnd"&&ks&&(Ve=Vd()):(Sn=se,To="value"in Sn?Sn.value:Sn.textContent,ks=!0)),Ee=jr(X,Ge),0<Ee.length&&(Ge=new Fd(Ge,e,null,n,se),re.push({event:Ge,listeners:Ee}),Ve?Ge.data=Ve:(Ve=Qd(n),Ve!==null&&(Ge.data=Ve)))),(Ve=l0?r0(e,n):o0(e,n))&&(Ge=jr(X,"onBeforeInput"),0<Ge.length&&(Ee=new Fd("onBeforeInput","beforeinput",null,n,se),re.push({event:Ee,listeners:Ge}),Ee.data=Ve)),W0(re,e,X,n,se)}Dh(re,t)})}function Wi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function jr(e,t){for(var n=t+"Capture",s=[];e!==null;){var r=e,o=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||o===null||(r=yi(e,n),r!=null&&s.unshift(Wi(e,r,o)),r=yi(e,t),r!=null&&s.push(Wi(e,r,o))),e.tag===3)return s;e=e.return}return[]}function nb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Uh(e,t,n,s,r){for(var o=t._reactName,f=[];n!==null&&n!==s;){var x=n,M=x.alternate,X=x.stateNode;if(x=x.tag,M!==null&&M===s)break;x!==5&&x!==26&&x!==27||X===null||(M=X,r?(X=yi(n,o),X!=null&&f.unshift(Wi(n,X,M))):r||(X=yi(n,o),X!=null&&f.push(Wi(n,X,M)))),n=n.return}f.length!==0&&e.push({event:t,listeners:f})}var sb=/\r\n?/g,ib=/\u0000|\uFFFD/g;function Lh(e){return(typeof e=="string"?e:""+e).replace(sb,`
`).replace(ib,"")}function qh(e,t){return t=Lh(t),Lh(e)===t}function lt(e,t,n,s,r,o){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Ms(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Ms(e,""+s);break;case"className":_l(e,"class",s);break;case"tabIndex":_l(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":_l(e,n,s);break;case"style":Ld(e,s,o);break;case"data":if(t!=="object"){_l(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=Ol(""+s),e.setAttribute(n,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(n,"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 o=="function"&&(n==="formAction"?(t!=="input"&&lt(e,t,"name",r.name,r,null),lt(e,t,"formEncType",r.formEncType,r,null),lt(e,t,"formMethod",r.formMethod,r,null),lt(e,t,"formTarget",r.formTarget,r,null)):(lt(e,t,"encType",r.encType,r,null),lt(e,t,"method",r.method,r,null),lt(e,t,"target",r.target,r,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=Ol(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=Ia);break;case"onScroll":s!=null&&Fe("scroll",e);break;case"onScrollEnd":s!=null&&Fe("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(u(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(u(60));e.innerHTML=n}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}n=Ol(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""+s):e.removeAttribute(n);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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":s===!0?e.setAttribute(n,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,s):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(n,s):e.removeAttribute(n);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(n):e.setAttribute(n,s);break;case"popover":Fe("beforetoggle",e),Fe("toggle",e),Cl(e,"popover",s);break;case"xlinkActuate":Xa(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Xa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Xa(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Xa(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Xa(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Xa(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Xa(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Xa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Xa(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Cl(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=kg.get(n)||n,Cl(e,n,s))}}function ru(e,t,n,s,r,o){switch(n){case"style":Ld(e,s,o);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(u(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(u(60));e.innerHTML=n}}break;case"children":typeof s=="string"?Ms(e,s):(typeof s=="number"||typeof s=="bigint")&&Ms(e,""+s);break;case"onScroll":s!=null&&Fe("scroll",e);break;case"onScrollEnd":s!=null&&Fe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Ia);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ed.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),t=n.slice(2,r?n.length-7:void 0),o=e[Qt]||null,o=o!=null?o[n]:null,typeof o=="function"&&e.removeEventListener(t,o,r),typeof s=="function")){typeof o!="function"&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,s,r);break e}n in e?e[n]=s:s===!0?e.setAttribute(n,""):Cl(e,n,s)}}}function Ht(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Fe("error",e),Fe("load",e);var s=!1,r=!1,o;for(o in n)if(n.hasOwnProperty(o)){var f=n[o];if(f!=null)switch(o){case"src":s=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:lt(e,t,o,f,n,null)}}r&&lt(e,t,"srcSet",n.srcSet,n,null),s&&lt(e,t,"src",n.src,n,null);return;case"input":Fe("invalid",e);var x=o=f=r=null,M=null,X=null;for(s in n)if(n.hasOwnProperty(s)){var se=n[s];if(se!=null)switch(s){case"name":r=se;break;case"type":f=se;break;case"checked":M=se;break;case"defaultChecked":X=se;break;case"value":o=se;break;case"defaultValue":x=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(u(137,t));break;default:lt(e,t,s,se,n,null)}}kd(e,o,x,M,X,f,r,!1);return;case"select":Fe("invalid",e),s=f=o=null;for(r in n)if(n.hasOwnProperty(r)&&(x=n[r],x!=null))switch(r){case"value":o=x;break;case"defaultValue":f=x;break;case"multiple":s=x;default:lt(e,t,r,x,n,null)}t=o,n=f,e.multiple=!!s,t!=null?zs(e,!!s,t,!1):n!=null&&zs(e,!!s,n,!0);return;case"textarea":Fe("invalid",e),o=r=s=null;for(f in n)if(n.hasOwnProperty(f)&&(x=n[f],x!=null))switch(f){case"value":s=x;break;case"defaultValue":r=x;break;case"children":o=x;break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(u(91));break;default:lt(e,t,f,x,n,null)}Rd(e,s,r,o);return;case"option":for(M in n)if(n.hasOwnProperty(M)&&(s=n[M],s!=null))switch(M){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:lt(e,t,M,s,n,null)}return;case"dialog":Fe("beforetoggle",e),Fe("toggle",e),Fe("cancel",e),Fe("close",e);break;case"iframe":case"object":Fe("load",e);break;case"video":case"audio":for(s=0;s<Ki.length;s++)Fe(Ki[s],e);break;case"image":Fe("error",e),Fe("load",e);break;case"details":Fe("toggle",e);break;case"embed":case"source":case"link":Fe("error",e),Fe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(X in n)if(n.hasOwnProperty(X)&&(s=n[X],s!=null))switch(X){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:lt(e,t,X,s,n,null)}return;default:if(jo(t)){for(se in n)n.hasOwnProperty(se)&&(s=n[se],s!==void 0&&ru(e,t,se,s,n,void 0));return}}for(x in n)n.hasOwnProperty(x)&&(s=n[x],s!=null&&lt(e,t,x,s,n,null))}function lb(e,t,n,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,o=null,f=null,x=null,M=null,X=null,se=null;for(te in n){var re=n[te];if(n.hasOwnProperty(te)&&re!=null)switch(te){case"checked":break;case"value":break;case"defaultValue":M=re;default:s.hasOwnProperty(te)||lt(e,t,te,null,s,re)}}for(var Z in s){var te=s[Z];if(re=n[Z],s.hasOwnProperty(Z)&&(te!=null||re!=null))switch(Z){case"type":o=te;break;case"name":r=te;break;case"checked":X=te;break;case"defaultChecked":se=te;break;case"value":f=te;break;case"defaultValue":x=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(u(137,t));break;default:te!==re&&lt(e,t,Z,te,s,re)}}xo(e,f,x,M,X,se,o,r);return;case"select":te=f=x=Z=null;for(o in n)if(M=n[o],n.hasOwnProperty(o)&&M!=null)switch(o){case"value":break;case"multiple":te=M;default:s.hasOwnProperty(o)||lt(e,t,o,null,s,M)}for(r in s)if(o=s[r],M=n[r],s.hasOwnProperty(r)&&(o!=null||M!=null))switch(r){case"value":Z=o;break;case"defaultValue":x=o;break;case"multiple":f=o;default:o!==M&&lt(e,t,r,o,s,M)}t=x,n=f,s=te,Z!=null?zs(e,!!n,Z,!1):!!s!=!!n&&(t!=null?zs(e,!!n,t,!0):zs(e,!!n,n?[]:"",!1));return;case"textarea":te=Z=null;for(x in n)if(r=n[x],n.hasOwnProperty(x)&&r!=null&&!s.hasOwnProperty(x))switch(x){case"value":break;case"children":break;default:lt(e,t,x,null,s,r)}for(f in s)if(r=s[f],o=n[f],s.hasOwnProperty(f)&&(r!=null||o!=null))switch(f){case"value":Z=r;break;case"defaultValue":te=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(u(91));break;default:r!==o&&lt(e,t,f,r,s,o)}Dd(e,Z,te);return;case"option":for(var Ce in n)if(Z=n[Ce],n.hasOwnProperty(Ce)&&Z!=null&&!s.hasOwnProperty(Ce))switch(Ce){case"selected":e.selected=!1;break;default:lt(e,t,Ce,null,s,Z)}for(M in s)if(Z=s[M],te=n[M],s.hasOwnProperty(M)&&Z!==te&&(Z!=null||te!=null))switch(M){case"selected":e.selected=Z&&typeof Z!="function"&&typeof Z!="symbol";break;default:lt(e,t,M,Z,s,te)}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 De in n)Z=n[De],n.hasOwnProperty(De)&&Z!=null&&!s.hasOwnProperty(De)&&lt(e,t,De,null,s,Z);for(X in s)if(Z=s[X],te=n[X],s.hasOwnProperty(X)&&Z!==te&&(Z!=null||te!=null))switch(X){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(u(137,t));break;default:lt(e,t,X,Z,s,te)}return;default:if(jo(t)){for(var rt in n)Z=n[rt],n.hasOwnProperty(rt)&&Z!==void 0&&!s.hasOwnProperty(rt)&&ru(e,t,rt,void 0,s,Z);for(se in s)Z=s[se],te=n[se],!s.hasOwnProperty(se)||Z===te||Z===void 0&&te===void 0||ru(e,t,se,Z,s,te);return}}for(var $ in n)Z=n[$],n.hasOwnProperty($)&&Z!=null&&!s.hasOwnProperty($)&&lt(e,t,$,null,s,Z);for(re in s)Z=s[re],te=n[re],!s.hasOwnProperty(re)||Z===te||Z==null&&te==null||lt(e,t,re,Z,s,te)}function Hh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function rb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),s=0;s<n.length;s++){var r=n[s],o=r.transferSize,f=r.initiatorType,x=r.duration;if(o&&x&&Hh(f)){for(f=0,x=r.responseEnd,s+=1;s<n.length;s++){var M=n[s],X=M.startTime;if(X>x)break;var se=M.transferSize,re=M.initiatorType;se&&Hh(re)&&(M=M.responseEnd,f+=se*(M<x?1:(x-X)/(M-X)))}if(--s,t+=8*(o+f)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var ou=null,cu=null;function Sr(e){return e.nodeType===9?e:e.ownerDocument}function Vh(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Bh(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function uu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var du=null;function ob(){var e=window.event;return e&&e.type==="popstate"?e===du?!1:(du=e,!0):(du=null,!1)}var $h=typeof setTimeout=="function"?setTimeout:void 0,cb=typeof clearTimeout=="function"?clearTimeout:void 0,Fh=typeof Promise=="function"?Promise:void 0,ub=typeof queueMicrotask=="function"?queueMicrotask:typeof Fh<"u"?function(e){return Fh.resolve(null).then(e).catch(db)}:$h;function db(e){setTimeout(function(){throw e})}function Hn(e){return e==="head"}function Ph(e,t){var n=t,s=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"||n==="/&"){if(s===0){e.removeChild(r),ri(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")el(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,el(n);for(var o=n.firstChild;o;){var f=o.nextSibling,x=o.nodeName;o[bi]||x==="SCRIPT"||x==="STYLE"||x==="LINK"&&o.rel.toLowerCase()==="stylesheet"||n.removeChild(o),o=f}}else n==="body"&&el(e.ownerDocument.body);n=r}while(n);ri(t)}function Gh(e,t){var n=e;e=0;do{var s=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=s}while(n)}function fu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":fu(n),go(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function fb(e,t,n,s){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[bi])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(o!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var o=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;if(e=Ca(e.nextSibling),e===null)break}return null}function mb(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ca(e.nextSibling),e===null))return null;return e}function Yh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ca(e.nextSibling),e===null))return null;return e}function mu(e){return e.data==="$?"||e.data==="$~"}function hu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function hb(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var s=function(){t(),n.removeEventListener("DOMContentLoaded",s)};n.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function Ca(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var pu=null;function Xh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Ca(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Ih(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Qh(e,t,n){switch(t=Sr(n),e){case"html":if(e=t.documentElement,!e)throw Error(u(452));return e;case"head":if(e=t.head,!e)throw Error(u(453));return e;case"body":if(e=t.body,!e)throw Error(u(454));return e;default:throw Error(u(451))}}function el(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);go(e)}var _a=new Map,Zh=new Set;function Nr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var dn=K.d;K.d={f:pb,r:vb,D:gb,C:bb,L:xb,m:yb,X:Sb,S:jb,M:Nb};function pb(){var e=dn.f(),t=hr();return e||t}function vb(e){var t=Ts(e);t!==null&&t.tag===5&&t.type==="form"?mm(t):dn.r(e)}var si=typeof document>"u"?null:document;function Jh(e,t,n){var s=si;if(s&&typeof t=="string"&&t){var r=ga(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),Zh.has(r)||(Zh.add(r),e={rel:e,crossOrigin:n,href:t},s.querySelector(r)===null&&(t=s.createElement("link"),Ht(t,"link",e),wt(t),s.head.appendChild(t)))}}function gb(e){dn.D(e),Jh("dns-prefetch",e,null)}function bb(e,t){dn.C(e,t),Jh("preconnect",e,t)}function xb(e,t,n){dn.L(e,t,n);var s=si;if(s&&e&&t){var r='link[rel="preload"][as="'+ga(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+ga(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+ga(n.imageSizes)+'"]')):r+='[href="'+ga(e)+'"]';var o=r;switch(t){case"style":o=ii(e);break;case"script":o=li(e)}_a.has(o)||(e=C({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),_a.set(o,e),s.querySelector(r)!==null||t==="style"&&s.querySelector(tl(o))||t==="script"&&s.querySelector(al(o))||(t=s.createElement("link"),Ht(t,"link",e),wt(t),s.head.appendChild(t)))}}function yb(e,t){dn.m(e,t);var n=si;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+ga(s)+'"][href="'+ga(e)+'"]',o=r;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=li(e)}if(!_a.has(o)&&(e=C({rel:"modulepreload",href:e},t),_a.set(o,e),n.querySelector(r)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(al(o)))return}s=n.createElement("link"),Ht(s,"link",e),wt(s),n.head.appendChild(s)}}}function jb(e,t,n){dn.S(e,t,n);var s=si;if(s&&e){var r=Os(s).hoistableStyles,o=ii(e);t=t||"default";var f=r.get(o);if(!f){var x={loading:0,preload:null};if(f=s.querySelector(tl(o)))x.loading=5;else{e=C({rel:"stylesheet",href:e,"data-precedence":t},n),(n=_a.get(o))&&vu(e,n);var M=f=s.createElement("link");wt(M),Ht(M,"link",e),M._p=new Promise(function(X,se){M.onload=X,M.onerror=se}),M.addEventListener("load",function(){x.loading|=1}),M.addEventListener("error",function(){x.loading|=2}),x.loading|=4,Cr(f,t,s)}f={type:"stylesheet",instance:f,count:1,state:x},r.set(o,f)}}}function Sb(e,t){dn.X(e,t);var n=si;if(n&&e){var s=Os(n).hoistableScripts,r=li(e),o=s.get(r);o||(o=n.querySelector(al(r)),o||(e=C({src:e,async:!0},t),(t=_a.get(r))&&gu(e,t),o=n.createElement("script"),wt(o),Ht(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},s.set(r,o))}}function Nb(e,t){dn.M(e,t);var n=si;if(n&&e){var s=Os(n).hoistableScripts,r=li(e),o=s.get(r);o||(o=n.querySelector(al(r)),o||(e=C({src:e,async:!0,type:"module"},t),(t=_a.get(r))&&gu(e,t),o=n.createElement("script"),wt(o),Ht(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},s.set(r,o))}}function Kh(e,t,n,s){var r=(r=me.current)?Nr(r):null;if(!r)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=ii(n.href),n=Os(r).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=ii(n.href);var o=Os(r).hoistableStyles,f=o.get(e);if(f||(r=r.ownerDocument||r,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,f),(o=r.querySelector(tl(e)))&&!o._p&&(f.instance=o,f.state.loading=5),_a.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},_a.set(e,n),o||Cb(r,e,n,f.state))),t&&s===null)throw Error(u(528,""));return f}if(t&&s!==null)throw Error(u(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=li(n),n=Os(r).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function ii(e){return'href="'+ga(e)+'"'}function tl(e){return'link[rel="stylesheet"]['+e+"]"}function Wh(e){return C({},e,{"data-precedence":e.precedence,precedence:null})}function Cb(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Ht(t,"link",n),wt(t),e.head.appendChild(t))}function li(e){return'[src="'+ga(e)+'"]'}function al(e){return"script[async]"+e}function ep(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+ga(n.href)+'"]');if(s)return t.instance=s,wt(s),s;var r=C({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),wt(s),Ht(s,"style",r),Cr(s,n.precedence,e),t.instance=s;case"stylesheet":r=ii(n.href);var o=e.querySelector(tl(r));if(o)return t.state.loading|=4,t.instance=o,wt(o),o;s=Wh(n),(r=_a.get(r))&&vu(s,r),o=(e.ownerDocument||e).createElement("link"),wt(o);var f=o;return f._p=new Promise(function(x,M){f.onload=x,f.onerror=M}),Ht(o,"link",s),t.state.loading|=4,Cr(o,n.precedence,e),t.instance=o;case"script":return o=li(n.src),(r=e.querySelector(al(o)))?(t.instance=r,wt(r),r):(s=n,(r=_a.get(o))&&(s=C({},n),gu(s,r)),e=e.ownerDocument||e,r=e.createElement("script"),wt(r),Ht(r,"link",s),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(u(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,Cr(s,n.precedence,e));return t.instance}function Cr(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=s.length?s[s.length-1]:null,o=r,f=0;f<s.length;f++){var x=s[f];if(x.dataset.precedence===t)o=x;else if(o!==r)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function vu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function gu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var _r=null;function tp(e,t,n){if(_r===null){var s=new Map,r=_r=new Map;r.set(n,s)}else r=_r,s=r.get(n),s||(s=new Map,r.set(n,s));if(s.has(e))return s;for(s.set(e,null),n=n.getElementsByTagName(e),r=0;r<n.length;r++){var o=n[r];if(!(o[bi]||o[Rt]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var f=o.getAttribute(t)||"";f=e+f;var x=s.get(f);x?x.push(o):s.set(f,[o])}}return s}function ap(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function _b(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function np(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Tb(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var r=ii(s.href),o=t.querySelector(tl(r));if(o){t=o._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Tr.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=o,wt(o);return}o=t.ownerDocument||t,s=Wh(s),(r=_a.get(r))&&vu(s,r),o=o.createElement("link"),wt(o);var f=o;f._p=new Promise(function(x,M){f.onload=x,f.onerror=M}),Ht(o,"link",s),n.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Tr.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var bu=0;function Ob(e,t){return e.stylesheets&&e.count===0&&Er(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&Er(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},6e4+t);0<e.imgBytes&&bu===0&&(bu=62500*rb());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Er(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>bu?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(r)}}:null}function Tr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Er(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Or=null;function Er(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Or=new Map,t.forEach(Eb,e),Or=null,Tr.call(e))}function Eb(e,t){if(!(t.state.loading&4)){var n=Or.get(e);if(n)var s=n.get(null);else{n=new Map,Or.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<r.length;o++){var f=r[o];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(n.set(f.dataset.precedence,f),s=f)}s&&n.set(null,s)}r=t.instance,f=r.getAttribute("data-precedence"),o=n.get(f)||s,o===s&&n.set(null,r),n.set(f,r),this.count++,s=Tr.bind(this),r.addEventListener("load",s),r.addEventListener("error",s),o?o.parentNode.insertBefore(r,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var nl={$$typeof:E,Provider:null,Consumer:null,_currentValue:fe,_currentValue2:fe,_threadCount:0};function zb(e,t,n,s,r,o,f,x,M){this.tag=1,this.containerInfo=e,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=ze(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ze(0),this.hiddenUpdates=ze(null),this.identifierPrefix=s,this.onUncaughtError=r,this.onCaughtError=o,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function sp(e,t,n,s,r,o,f,x,M,X,se,re){return e=new zb(e,t,n,f,M,X,se,re,x),t=1,o===!0&&(t|=24),o=ra(3,null,null,t),e.current=o,o.stateNode=e,t=Jo(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:s,isDehydrated:n,cache:t},tc(o),e}function ip(e){return e?(e=Ls,e):Ls}function lp(e,t,n,s,r,o){r=ip(r),s.context===null?s.context=r:s.pendingContext=r,s=En(t),s.payload={element:n},o=o===void 0?null:o,o!==null&&(s.callback=o),n=zn(e,s,t),n!==null&&(ta(n,e,t),Ri(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xu(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function op(e){if(e.tag===13||e.tag===31){var t=es(e,67108864);t!==null&&ta(t,e,67108864),xu(e,67108864)}}function cp(e){if(e.tag===13||e.tag===31){var t=fa();t=Ns(t);var n=es(e,t);n!==null&&ta(n,e,t),xu(e,t)}}var zr=!0;function Mb(e,t,n,s){var r=F.T;F.T=null;var o=K.p;try{K.p=2,yu(e,t,n,s)}finally{K.p=o,F.T=r}}function Ab(e,t,n,s){var r=F.T;F.T=null;var o=K.p;try{K.p=8,yu(e,t,n,s)}finally{K.p=o,F.T=r}}function yu(e,t,n,s){if(zr){var r=ju(s);if(r===null)lu(e,t,s,Mr,n),dp(e,s);else if(kb(r,e,t,n,s))s.stopPropagation();else if(dp(e,s),t&4&&-1<wb.indexOf(e)){for(;r!==null;){var o=Ts(r);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var f=Q(o.pendingLanes);if(f!==0){var x=o;for(x.pendingLanes|=2,x.entangledLanes|=2;f;){var M=1<<31-Xe(f);x.entanglements[1]|=M,f&=~M}Ua(o),(Je&6)===0&&(fr=ft()+500,Ji(0))}}break;case 31:case 13:x=es(o,2),x!==null&&ta(x,o,2),hr(),xu(o,2)}if(o=ju(s),o===null&&lu(e,t,s,Mr,n),o===r)break;r=o}r!==null&&s.stopPropagation()}else lu(e,t,s,null,n)}}function ju(e){return e=No(e),Su(e)}var Mr=null;function Su(e){if(Mr=null,e=_s(e),e!==null){var t=m(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=v(t),e!==null)return e;e=null}else if(n===31){if(e=y(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Mr=e,null}function up(e){switch(e){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(Pa()){case Aa:return 2;case wa:return 8;case Et:case In:return 32;case pt:return 268435456;default:return 32}default:return 32}}var Nu=!1,Vn=null,Bn=null,$n=null,sl=new Map,il=new Map,Fn=[],wb="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 dp(e,t){switch(e){case"focusin":case"focusout":Vn=null;break;case"dragenter":case"dragleave":Bn=null;break;case"mouseover":case"mouseout":$n=null;break;case"pointerover":case"pointerout":sl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":il.delete(t.pointerId)}}function ll(e,t,n,s,r,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:o,targetContainers:[r]},t!==null&&(t=Ts(t),t!==null&&op(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function kb(e,t,n,s,r){switch(t){case"focusin":return Vn=ll(Vn,e,t,n,s,r),!0;case"dragenter":return Bn=ll(Bn,e,t,n,s,r),!0;case"mouseover":return $n=ll($n,e,t,n,s,r),!0;case"pointerover":var o=r.pointerId;return sl.set(o,ll(sl.get(o)||null,e,t,n,s,r)),!0;case"gotpointercapture":return o=r.pointerId,il.set(o,ll(il.get(o)||null,e,t,n,s,r)),!0}return!1}function fp(e){var t=_s(e.target);if(t!==null){var n=m(t);if(n!==null){if(t=n.tag,t===13){if(t=v(n),t!==null){e.blockedOn=t,_d(e.priority,function(){cp(n)});return}}else if(t===31){if(t=y(n),t!==null){e.blockedOn=t,_d(e.priority,function(){cp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ar(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ju(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);So=s,n.target.dispatchEvent(s),So=null}else return t=Ts(n),t!==null&&op(t),e.blockedOn=n,!1;t.shift()}return!0}function mp(e,t,n){Ar(e)&&n.delete(t)}function Db(){Nu=!1,Vn!==null&&Ar(Vn)&&(Vn=null),Bn!==null&&Ar(Bn)&&(Bn=null),$n!==null&&Ar($n)&&($n=null),sl.forEach(mp),il.forEach(mp)}function wr(e,t){e.blockedOn===t&&(e.blockedOn=null,Nu||(Nu=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Db)))}var kr=null;function hp(e){kr!==e&&(kr=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){kr===e&&(kr=null);for(var t=0;t<e.length;t+=3){var n=e[t],s=e[t+1],r=e[t+2];if(typeof s!="function"){if(Su(s||n)===null)continue;break}var o=Ts(n);o!==null&&(e.splice(t,3),t-=3,jc(o,{pending:!0,data:r,method:n.method,action:s},s,r))}}))}function ri(e){function t(M){return wr(M,e)}Vn!==null&&wr(Vn,e),Bn!==null&&wr(Bn,e),$n!==null&&wr($n,e),sl.forEach(t),il.forEach(t);for(var n=0;n<Fn.length;n++){var s=Fn[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Fn.length&&(n=Fn[0],n.blockedOn===null);)fp(n),n.blockedOn===null&&Fn.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(s=0;s<n.length;s+=3){var r=n[s],o=n[s+1],f=r[Qt]||null;if(typeof o=="function")f||hp(n);else if(f){var x=null;if(o&&o.hasAttribute("formAction")){if(r=o,f=o[Qt]||null)x=f.formAction;else if(Su(r)!==null)continue}else x=f.action;typeof x=="function"?n[s+1]=x:(n.splice(s,3),s-=3),hp(n)}}}function pp(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(f){return r=f})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),s||setTimeout(n,20)}function n(){if(!s&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function Cu(e){this._internalRoot=e}Dr.prototype.render=Cu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));var n=t.current,s=fa();lp(n,s,e,t,null,null)},Dr.prototype.unmount=Cu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;lp(e.current,2,null,e,null,null),hr(),t[Cs]=null}};function Dr(e){this._internalRoot=e}Dr.prototype.unstable_scheduleHydration=function(e){if(e){var t=yn();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Fn.length&&t!==0&&t<Fn[n].priority;n++);Fn.splice(n,0,e),n===0&&fp(e)}};var vp=l.version;if(vp!=="19.2.3")throw Error(u(527,vp,"19.2.3"));K.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(u(188)):(e=Object.keys(e).join(","),Error(u(268,e)));return e=p(t),e=e!==null?S(e):null,e=e===null?null:e.stateNode,e};var Rb={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Rr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Rr.isDisabled&&Rr.supportsFiber)try{be=Rr.inject(Rb),ve=Rr}catch{}}return ol.createRoot=function(e,t){if(!c(e))throw Error(u(299));var n=!1,s="",r=Nm,o=Cm,f=_m;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=sp(e,1,!1,null,null,n,s,null,r,o,f,pp),e[Cs]=t.current,iu(e),new Cu(t)},ol.hydrateRoot=function(e,t,n){if(!c(e))throw Error(u(299));var s=!1,r="",o=Nm,f=Cm,x=_m,M=null;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onUncaughtError!==void 0&&(o=n.onUncaughtError),n.onCaughtError!==void 0&&(f=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError),n.formState!==void 0&&(M=n.formState)),t=sp(e,1,!0,t,n??null,s,r,M,o,f,x,pp),t.context=ip(null),n=t.current,s=fa(),s=Ns(s),r=En(s),r.callback=null,zn(n,r,s),n=s,t.current.lanes=n,Ie(t,n),Ua(t),e[Cs]=t.current,iu(e),new Dr(t)},ol.version="19.2.3",ol}var Op;function Gb(){if(Op)return Ou.exports;Op=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(l){console.error(l)}}return i(),Ou.exports=Pb(),Ou.exports}var Yb=Gb();const Xb=gv(Yb),Ep="pos_config",Au={apiUrl:"http://localhost/api_torti/api.php",sucursal:"",caja:""},Be={getAll(){try{const i=localStorage.getItem(Ep);if(i)return{...Au,...JSON.parse(i)}}catch(i){console.error("Error al leer configuración:",i)}return Au},get(i){return this.getAll()[i]||Au[i]},getApiUrl(){return this.get("apiUrl")},getSucursal(){return this.get("sucursal")},getCaja(){return this.get("caja")},save(i){try{const d={...this.getAll(),...i};return localStorage.setItem(Ep,JSON.stringify(d)),!0}catch(l){return console.error("Error al guardar configuración:",l),!1}},async testConnection(i){try{const d=await(await fetch(i,{method:"GET",headers:{"Content-Type":"application/json"}})).json();return{success:d.success!==!1,message:d.message||"Conexión exitosa"}}catch{return{success:!1,message:"No se pudo conectar a la API"}}}},zp=()=>Be.getApiUrl(),xv=g.createContext();function Ib({children:i}){const[l,d]=g.useState(null),[u,c]=g.useState([]),[m,v]=g.useState(!0),[y,h]=g.useState(!1);g.useEffect(()=>{localStorage.removeItem("pos_torti_user"),v(!1)},[]);const k={user:l,permisos:u,loading:m,isAuthenticated:y,login:async(b,_)=>{try{const q=await(await fetch(zp(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"login",username:b,password:_})})).json();if(q.success){const E=q.data;return d(E),c(E.permisos||[]),h(!0),{success:!0,message:"Login exitoso"}}else return{success:!1,message:q.message}}catch(O){return console.error("Error en login:",O),{success:!1,message:"Error de conexion con el servidor"}}},logout:()=>{d(null),c([]),h(!1),localStorage.removeItem("pos_torti_user")},tienePermiso:b=>u.includes(b),tieneAccesoModulo:b=>{const _=`ver_${b}`;return u.includes(_)},cambiarPassword:async(b,_)=>{if(!l)return{success:!1,message:"Usuario no autenticado"};try{const q=await(await fetch(zp(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"cambiarPassword",usuario_id:l.id,password_actual:b,password_nuevo:_})})).json();return{success:q.success,message:q.message}}catch(O){return console.error("Error al cambiar password:",O),{success:!1,message:"Error de conexion"}}}};return a.jsx(xv.Provider,{value:k,children:i})}function Fa(){const i=g.useContext(xv);if(!i)throw new Error("useAuth debe usarse dentro de AuthProvider");return i}const Mp=()=>Be.getApiUrl(),yv=g.createContext(),jv="pos_sync_config",Qb=50;function Zb(){try{const i=localStorage.getItem(jv);if(i)return JSON.parse(i)}catch{}return{intervalo:5}}function Jb(i){localStorage.setItem(jv,JSON.stringify(i))}function Kb({children:i}){const[l,d]=g.useState({activa:!1,conectada:!1}),[u,c]=g.useState(!1),[m,v]=g.useState(null),[y,h]=g.useState(!1),[p,S]=g.useState(Zb().intervalo),[C,D]=g.useState([]),R=g.useRef(null),k=g.useRef(null),b=g.useCallback(N=>{D(G=>[N,...G].slice(0,Qb))},[]),_=g.useCallback(async()=>{try{const G=await(await fetch(Mp(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"estadoSync"})})).json();G.success&&(d(G.data),h(!1))}catch{d(G=>({...G,conectada:!1})),h(!0)}},[]),O=g.useCallback(async(N=!1)=>{var w;if(u)return{success:!1,message:"Ya se está sincronizando"};c(!0),h(!1);const G=Date.now();try{const oe=await(await fetch(Mp(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"sincronizar"})})).json(),W=((Date.now()-G)/1e3).toFixed(1);return oe.success?(v(new Date),await _(),b({fecha:new Date,exito:!0,mensaje:oe.message,stats:((w=oe.data)==null?void 0:w.stats)||null,duracion:W,tipo:N?"manual":"auto"}),{success:!0,message:oe.message}):(h(!0),b({fecha:new Date,exito:!1,mensaje:oe.message,stats:null,duracion:W,tipo:N?"manual":"auto"}),{success:!1,message:oe.message})}catch{const oe=((Date.now()-G)/1e3).toFixed(1);return h(!0),b({fecha:new Date,exito:!1,mensaje:"Error de conexión al sincronizar",stats:null,duracion:oe,tipo:N?"manual":"auto"}),{success:!1,message:"Error de conexión al sincronizar"}}finally{c(!1)}},[u,_,b]);g.useEffect(()=>{k.current=O},[O]);const q=g.useCallback(N=>{S(N),Jb({intervalo:N})},[]);g.useEffect(()=>{_()},[_]),g.useEffect(()=>{var N;return R.current&&(clearInterval(R.current),R.current=null),l.activa&&p>0&&(m||(N=k.current)==null||N.call(k,!1),R.current=setInterval(()=>{var G;(G=k.current)==null||G.call(k,!1)},p*60*1e3)),()=>{R.current&&clearInterval(R.current)}},[l.activa,p]);const E=g.useCallback(()=>{D([])},[]),j={syncStatus:l,sincronizando:u,ultimaSync:m,syncError:y,intervalo:p,logs:C,ejecutarSync:O,cargarEstadoSync:_,setIntervalo:q,limpiarLogs:E};return a.jsx(yv.Provider,{value:j,children:i})}function dd(){const i=g.useContext(yv);if(!i)throw new Error("useSync debe usarse dentro de SyncProvider");return i}/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wb=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Sv=(...i)=>i.filter((l,d,u)=>!!l&&l.trim()!==""&&u.indexOf(l)===d).join(" ").trim();/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var ex={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"};/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tx=g.forwardRef(({color:i="currentColor",size:l=24,strokeWidth:d=2,absoluteStrokeWidth:u,className:c="",children:m,iconNode:v,...y},h)=>g.createElement("svg",{ref:h,...ex,width:l,height:l,stroke:i,strokeWidth:u?Number(d)*24/Number(l):d,className:Sv("lucide",c),...y},[...v.map(([p,S])=>g.createElement(p,S)),...Array.isArray(m)?m:[m]]));/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Oe=(i,l)=>{const d=g.forwardRef(({className:u,...c},m)=>g.createElement(tx,{ref:m,iconNode:l,className:Sv(`lucide-${Wb(i)}`,u),...c}));return d.displayName=`${i}`,d};/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ax=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ap=Oe("Activity",ax);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nx=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],Nv=Oe("ArrowLeftRight",nx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sx=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]],ix=Oe("Calculator",sx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lx=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Yn=Oe("Calendar",lx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rx=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],ox=Oe("ChartColumn",rx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cx=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],gs=Oe("Check",cx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ux=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Cv=Oe("ChevronDown",ux);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dx=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],fx=Oe("ChevronLeft",dx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mx=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_v=Oe("ChevronRight",mx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hx=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],px=Oe("ChevronUp",hx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vx=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ba=Oe("CircleCheckBig",vx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],Ur=Oe("CirclePlus",gx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],vs=Oe("CircleX",bx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xx=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],mi=Oe("ClipboardList",xx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],fn=Oe("Clock",yx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jx=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Sx=Oe("CreditCard",jx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nx=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Cx=Oe("Database",Nx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _x=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],Tx=Oe("Delete",_x);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ox=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],fl=Oe("DollarSign",Ox);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ex=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],fd=Oe("EyeOff",Ex);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zx=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],xs=Oe("Eye",zx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mx=[["path",{d:"M2 20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8l-7 5V8l-7 5V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"159hny"}],["path",{d:"M17 18h1",key:"uldtlt"}],["path",{d:"M12 18h1",key:"s9uhes"}],["path",{d:"M7 18h1",key:"1neino"}]],hi=Oe("Factory",Mx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ax=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Iu=Oe("FileText",Ax);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wx=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Qu=Oe("FolderOpen",wx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kx=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Dx=Oe("Funnel",kx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rx=[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]],hl=Oe("Leaf",Rx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ux=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Lx=Oe("Lock",Ux);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qx=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],Hx=Oe("LogOut",qx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vx=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],Bx=Oe("MapPin",Vx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $x=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],Fx=Oe("Menu",$x);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Px=[["path",{d:"M5 12h14",key:"1ays0h"}]],Gx=Oe("Minus",Px);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yx=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Xx=Oe("Monitor",Yx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ix=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],$t=Oe("Package",Ix);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qx=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],Zx=Oe("Pause",Qx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jx=[["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"}]],ys=Oe("Pen",Jx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kx=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],Wx=Oe("Play",Kx);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ey=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],aa=Oe("Plus",ey);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ty=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],za=Oe("RefreshCw",ty);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ay=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],ny=Oe("RotateCcw",ay);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sy=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],iy=Oe("Save",sy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ly=[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]],wp=Oe("Scale",ly);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ry=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],ha=Oe("Search",ry);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oy=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],cy=Oe("Send",oy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uy=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],dy=Oe("Server",uy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fy=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Kr=Oe("Settings",fy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const my=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Zu=Oe("Shield",my);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hy=[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]],Tv=Oe("ShoppingBag",hy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const py=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],Ov=Oe("ShoppingCart",py);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vy=[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]],kp=Oe("Store",vy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gy=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],by=Oe("Sun",gy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xy=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],yy=Oe("Tag",xy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jy=[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]],Sy=Oe("Tags",jy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ny=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Dp=Oe("Target",Ny);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cy=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Yt=Oe("Trash2",Cy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _y=[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]],Ev=Oe("TrendingDown",_y);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ty=[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]],zv=Oe("TrendingUp",Ty);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Oy=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Mv=Oe("TriangleAlert",Oy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ey=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],zy=Oe("Truck",Ey);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const My=[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]],Ay=Oe("UserCog",My);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wy=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Ju=Oe("User",wy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ky=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],md=Oe("Users",ky);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dy=[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]],xl=Oe("Wheat",Dy);/**
 * @license lucide-react v0.483.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ry=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],tt=Oe("X",Ry),Uy=[{icon:Ov,label:"Ventas",id:"ventas",permiso:"ver_ventas"},{icon:Qu,label:"Catalogos",id:"_catalogos",group:!0,children:[{icon:$t,label:"Productos",id:"productos",permiso:"ver_productos"},{icon:Sy,label:"Categorias",id:"categorias",permiso:"ver_categorias"},{icon:xl,label:"Ingredientes",id:"ingredientes",permiso:"ver_ingredientes"},{icon:md,label:"Clientes",id:"clientes",permiso:"ver_clientes"}]},{icon:hi,label:"Produccion",id:"_produccion",group:!0,children:[{icon:hi,label:"Producciones",id:"producciones",permiso:"ver_producciones"},{icon:Tv,label:"Compras",id:"compras",permiso:"ver_compras"},{icon:Ev,label:"Merma",id:"merma",permiso:"ver_merma"},{icon:Nv,label:"Requisiciones",id:"requisiciones",permiso:"ver_requisiciones"},{icon:mi,label:"Inv. Ingredientes",id:"inventario_ingredientes",permiso:"ver_ingredientes"}]},{icon:fl,label:"Caja",id:"caja",permiso:"ver_caja"},{icon:ox,label:"Reportes",id:"_reportes",group:!0,children:[{icon:mi,label:"Reporte Producciones",id:"reporte_producciones",permiso:"ver_reporte_producciones"},{icon:$t,label:"Rastreo Inventario",id:"rastreo_inventario",permiso:"ver_reportes"}]},{icon:Kr,label:"Administracion",id:"_admin",group:!0,children:[{icon:Ay,label:"Usuarios",id:"usuarios",permiso:"ver_usuarios"},{icon:Zu,label:"Perfiles",id:"perfiles",permiso:"ver_perfiles"},{icon:Kr,label:"Configuracion",id:"configuracion",permiso:"ver_configuracion"}]}];function Ly({isOpen:i,setIsOpen:l,activeMenu:d,setActiveMenu:u}){const{user:c,permisos:m,logout:v,tienePermiso:y}=Fa(),[h,p]=g.useState({}),S=R=>{p(k=>({...k,[R]:!k[R]}))},C=R=>R.some(k=>k.id===d),D=()=>{v(),l(!1)};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`sidebar-overlay ${i?"active":""}`,onClick:()=>l(!1)}),a.jsxs("aside",{className:`sidebar ${i?"open":""}`,children:[a.jsxs("div",{className:"sidebar-header",children:[a.jsx("h2",{className:"sidebar-title",children:"POS Torti"}),a.jsx("button",{className:"sidebar-close",onClick:()=>l(!1),children:a.jsx(tt,{size:24})})]}),c&&a.jsxs("div",{className:"sidebar-user",children:[a.jsx("div",{className:"user-avatar",children:c.nombre.charAt(0).toUpperCase()}),a.jsxs("div",{className:"user-info",children:[a.jsx("span",{className:"user-name",children:c.nombre}),a.jsx("span",{className:"user-role",children:c.perfil})]})]}),a.jsx("nav",{className:"sidebar-nav",children:Uy.map(R=>{if(R.group){const k=R.children.filter(_=>y(_.permiso));if(k.length===0)return null;const b=h[R.id]||C(R.children);return a.jsxs("div",{className:"sidebar-group",children:[a.jsxs("button",{className:`sidebar-item sidebar-group-toggle ${b?"group-open":""}`,onClick:()=>S(R.id),children:[a.jsx(R.icon,{size:20}),a.jsx("span",{children:R.label}),a.jsx(Cv,{size:16,className:`sidebar-chevron ${b?"rotated":""}`})]}),a.jsx("div",{className:`sidebar-group-children ${b?"expanded":""}`,children:k.map(_=>a.jsxs("button",{className:`sidebar-item sidebar-child ${d===_.id?"active":""}`,onClick:()=>{u(_.id),l(!1)},children:[a.jsx(_.icon,{size:16}),a.jsx("span",{children:_.label})]},_.id))})]},R.id)}return y(R.permiso)?a.jsxs("button",{className:`sidebar-item ${d===R.id?"active":""}`,onClick:()=>{u(R.id),l(!1)},children:[a.jsx(R.icon,{size:20}),a.jsx("span",{children:R.label})]},R.id):null})}),a.jsx("div",{className:"sidebar-footer",children:a.jsxs("button",{className:"sidebar-item logout",onClick:D,children:[a.jsx(Hx,{size:20}),a.jsx("span",{children:"Cerrar Sesion"})]})})]})]})}function qy({onClick:i}){return a.jsx("button",{className:"menu-button",onClick:i,children:a.jsx(Fx,{size:24})})}function Av(i){var l,d,u="";if(typeof i=="string"||typeof i=="number")u+=i;else if(typeof i=="object")if(Array.isArray(i)){var c=i.length;for(l=0;l<c;l++)i[l]&&(d=Av(i[l]))&&(u&&(u+=" "),u+=d)}else for(d in i)i[d]&&(u&&(u+=" "),u+=d);return u}function bs(){for(var i,l,d=0,u="",c=arguments.length;d<c;d++)(i=arguments[d])&&(l=Av(i))&&(u&&(u+=" "),u+=l);return u}function Hy(i){if(typeof document>"u")return;let l=document.head||document.getElementsByTagName("head")[0],d=document.createElement("style");d.type="text/css",l.firstChild?l.insertBefore(d,l.firstChild):l.appendChild(d),d.styleSheet?d.styleSheet.cssText=i:d.appendChild(document.createTextNode(i))}Hy(`:root{--toastify-color-light: #fff;--toastify-color-dark: #121212;--toastify-color-info: #3498db;--toastify-color-success: #07bc0c;--toastify-color-warning: #f1c40f;--toastify-color-error: hsl(6, 78%, 57%);--toastify-color-transparent: rgba(255, 255, 255, .7);--toastify-icon-color-info: var(--toastify-color-info);--toastify-icon-color-success: var(--toastify-color-success);--toastify-icon-color-warning: var(--toastify-color-warning);--toastify-icon-color-error: var(--toastify-color-error);--toastify-container-width: fit-content;--toastify-toast-width: 320px;--toastify-toast-offset: 16px;--toastify-toast-top: max(var(--toastify-toast-offset), env(safe-area-inset-top));--toastify-toast-right: max(var(--toastify-toast-offset), env(safe-area-inset-right));--toastify-toast-left: max(var(--toastify-toast-offset), env(safe-area-inset-left));--toastify-toast-bottom: max(var(--toastify-toast-offset), env(safe-area-inset-bottom));--toastify-toast-background: #fff;--toastify-toast-padding: 14px;--toastify-toast-min-height: 64px;--toastify-toast-max-height: 800px;--toastify-toast-bd-radius: 6px;--toastify-toast-shadow: 0px 4px 12px rgba(0, 0, 0, .1);--toastify-font-family: sans-serif;--toastify-z-index: 9999;--toastify-text-color-light: #757575;--toastify-text-color-dark: #fff;--toastify-text-color-info: #fff;--toastify-text-color-success: #fff;--toastify-text-color-warning: #fff;--toastify-text-color-error: #fff;--toastify-spinner-color: #616161;--toastify-spinner-color-empty-area: #e0e0e0;--toastify-color-progress-light: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55);--toastify-color-progress-dark: #bb86fc;--toastify-color-progress-info: var(--toastify-color-info);--toastify-color-progress-success: var(--toastify-color-success);--toastify-color-progress-warning: var(--toastify-color-warning);--toastify-color-progress-error: var(--toastify-color-error);--toastify-color-progress-bgo: .2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translate3d(0,0,var(--toastify-z-index));position:fixed;width:var(--toastify-container-width);box-sizing:border-box;color:#fff;display:flex;flex-direction:column}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right);align-items:end}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right);align-items:end}.Toastify__toast{--y: 0;position:relative;touch-action:none;width:var(--toastify-toast-width);min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:var(--toastify-toast-padding);border-radius:var(--toastify-toast-bd-radius);box-shadow:var(--toastify-toast-shadow);max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);z-index:0;display:flex;flex:1 auto;align-items:center;word-break:break-word}@media only screen and (max-width: 480px){.Toastify__toast-container{width:100vw;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-left,.Toastify__toast-container--top-center,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translate(0)}.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translate(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:initial}.Toastify__toast{--toastify-toast-width: 100%;margin-bottom:0;border-radius:0}}.Toastify__toast-container[data-stacked=true]{width:var(--toastify-toast-width)}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body,.Toastify__toast--stacked[data-collapsed] .Toastify__close-button{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-icon{margin-inline-end:10px;width:22px;flex-shrink:0;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--light,.Toastify__toast-theme--colored.Toastify__toast--default{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;position:absolute;top:6px;right:6px;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;z-index:1}.Toastify__toast--rtl .Toastify__close-button{left:6px;right:unset}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:hover,.Toastify__close-button:focus{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:1;opacity:.7;transform-origin:left}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:initial;transform-origin:right;border-bottom-left-radius:initial}.Toastify__progress-bar--wrp{position:absolute;overflow:hidden;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius);border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--top-left,.Toastify__bounce-enter--bottom-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--top-right,.Toastify__bounce-enter--bottom-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--top-left,.Toastify__bounce-exit--bottom-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--top-right,.Toastify__bounce-exit--bottom-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--top-left,.Toastify__slide-enter--bottom-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--top-right,.Toastify__slide-enter--bottom-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--top-left,.Toastify__slide-exit--bottom-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-right,.Toastify__slide-exit--bottom-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
`);var yl=i=>typeof i=="number"&&!isNaN(i),js=i=>typeof i=="string",hn=i=>typeof i=="function",Vy=i=>js(i)||yl(i),Ku=i=>js(i)||hn(i)?i:null,By=(i,l)=>i===!1||yl(i)&&i>0?i:l,Wu=i=>g.isValidElement(i)||js(i)||hn(i)||yl(i);function $y(i,l,d=300){let{scrollHeight:u,style:c}=i;requestAnimationFrame(()=>{c.minHeight="initial",c.height=u+"px",c.transition=`all ${d}ms`,requestAnimationFrame(()=>{c.height="0",c.padding="0",c.margin="0",setTimeout(l,d)})})}function Fy({enter:i,exit:l,appendPosition:d=!1,collapse:u=!0,collapseDuration:c=300}){return function({children:m,position:v,preventExitTransition:y,done:h,nodeRef:p,isIn:S,playToast:C}){let D=d?`${i}--${v}`:i,R=d?`${l}--${v}`:l,k=g.useRef(0);return g.useLayoutEffect(()=>{let b=p.current,_=D.split(" "),O=q=>{q.target===p.current&&(C(),b.removeEventListener("animationend",O),b.removeEventListener("animationcancel",O),k.current===0&&q.type!=="animationcancel"&&b.classList.remove(..._))};b.classList.add(..._),b.addEventListener("animationend",O),b.addEventListener("animationcancel",O)},[]),g.useEffect(()=>{let b=p.current,_=()=>{b.removeEventListener("animationend",_),u?$y(b,h,c):h()};S||(y?_():(k.current=1,b.className+=` ${R}`,b.addEventListener("animationend",_)))},[S]),ct.createElement(ct.Fragment,null,m)}}function Rp(i,l){return{content:wv(i.content,i.props),containerId:i.props.containerId,id:i.props.toastId,theme:i.props.theme,type:i.props.type,data:i.props.data||{},isLoading:i.props.isLoading,icon:i.props.icon,reason:i.removalReason,status:l}}function wv(i,l,d=!1){return g.isValidElement(i)&&!js(i.type)?g.cloneElement(i,{closeToast:l.closeToast,toastProps:l,data:l.data,isPaused:d}):hn(i)?i({closeToast:l.closeToast,toastProps:l,data:l.data,isPaused:d}):i}function Py({closeToast:i,theme:l,ariaLabel:d="close"}){return ct.createElement("button",{className:`Toastify__close-button Toastify__close-button--${l}`,type:"button",onClick:u=>{u.stopPropagation(),i(!0)},"aria-label":d},ct.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},ct.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function Gy({delay:i,isRunning:l,closeToast:d,type:u="default",hide:c,className:m,controlledProgress:v,progress:y,rtl:h,isIn:p,theme:S}){let C=c||v&&y===0,D={animationDuration:`${i}ms`,animationPlayState:l?"running":"paused"};v&&(D.transform=`scaleX(${y})`);let R=bs("Toastify__progress-bar",v?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${S}`,`Toastify__progress-bar--${u}`,{"Toastify__progress-bar--rtl":h}),k=hn(m)?m({rtl:h,type:u,defaultClassName:R}):bs(R,m),b={[v&&y>=1?"onTransitionEnd":"onAnimationEnd"]:v&&y<1?null:()=>{p&&d()}};return ct.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":C},ct.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${S} Toastify__progress-bar--${u}`}),ct.createElement("div",{role:"progressbar","aria-hidden":C?"true":"false","aria-label":"notification timer",className:k,style:D,...b}))}var Yy=1,kv=()=>`${Yy++}`;function Xy(i,l,d){let u=1,c=0,m=[],v=[],y=l,h=new Map,p=new Set,S=q=>(p.add(q),()=>p.delete(q)),C=()=>{v=Array.from(h.values()),p.forEach(q=>q())},D=({containerId:q,toastId:E,updateId:j})=>{let N=q?q!==i:i!==1,G=h.has(E)&&j==null;return N||G},R=(q,E)=>{h.forEach(j=>{var N;(E==null||E===j.props.toastId)&&((N=j.toggle)==null||N.call(j,q))})},k=q=>{var E,j;(j=(E=q.props)==null?void 0:E.onClose)==null||j.call(E,q.removalReason),q.isActive=!1},b=q=>{if(q==null)h.forEach(k);else{let E=h.get(q);E&&k(E)}C()},_=()=>{c-=m.length,m=[]},O=q=>{var E,j;let{toastId:N,updateId:G}=q.props,w=G==null;q.staleId&&h.delete(q.staleId),q.isActive=!0,h.set(N,q),C(),d(Rp(q,w?"added":"updated")),w&&((j=(E=q.props).onOpen)==null||j.call(E))};return{id:i,props:y,observe:S,toggle:R,removeToast:b,toasts:h,clearQueue:_,buildToast:(q,E)=>{if(D(E))return;let{toastId:j,updateId:N,data:G,staleId:w,delay:ae}=E,oe=N==null;oe&&c++;let W={...y,style:y.toastStyle,key:u++,...Object.fromEntries(Object.entries(E).filter(([P,ce])=>ce!=null)),toastId:j,updateId:N,data:G,isIn:!1,className:Ku(E.className||y.toastClassName),progressClassName:Ku(E.progressClassName||y.progressClassName),autoClose:E.isLoading?!1:By(E.autoClose,y.autoClose),closeToast(P){h.get(j).removalReason=P,b(j)},deleteToast(){let P=h.get(j);if(P!=null){if(d(Rp(P,"removed")),h.delete(j),c--,c<0&&(c=0),m.length>0){O(m.shift());return}C()}}};W.closeButton=y.closeButton,E.closeButton===!1||Wu(E.closeButton)?W.closeButton=E.closeButton:E.closeButton===!0&&(W.closeButton=Wu(y.closeButton)?y.closeButton:!0);let V={content:q,props:W,staleId:w};y.limit&&y.limit>0&&c>y.limit&&oe?m.push(V):yl(ae)?setTimeout(()=>{O(V)},ae):O(V)},setProps(q){y=q},setToggle:(q,E)=>{let j=h.get(q);j&&(j.toggle=E)},isToastActive:q=>{var E;return(E=h.get(q))==null?void 0:E.isActive},getSnapshot:()=>v}}var It=new Map,pl=[],ed=new Set,Iy=i=>ed.forEach(l=>l(i)),Dv=()=>It.size>0;function Qy(){pl.forEach(i=>Uv(i.content,i.options)),pl=[]}var Zy=(i,{containerId:l})=>{var d;return(d=It.get(l||1))==null?void 0:d.toasts.get(i)};function Rv(i,l){var d;if(l)return!!((d=It.get(l))!=null&&d.isToastActive(i));let u=!1;return It.forEach(c=>{c.isToastActive(i)&&(u=!0)}),u}function Jy(i){if(!Dv()){pl=pl.filter(l=>i!=null&&l.options.toastId!==i);return}if(i==null||Vy(i))It.forEach(l=>{l.removeToast(i)});else if(i&&("containerId"in i||"id"in i)){let l=It.get(i.containerId);l?l.removeToast(i.id):It.forEach(d=>{d.removeToast(i.id)})}}var Ky=(i={})=>{It.forEach(l=>{l.props.limit&&(!i.containerId||l.id===i.containerId)&&l.clearQueue()})};function Uv(i,l){Wu(i)&&(Dv()||pl.push({content:i,options:l}),It.forEach(d=>{d.buildToast(i,l)}))}function Wy(i){var l;(l=It.get(i.containerId||1))==null||l.setToggle(i.id,i.fn)}function Lv(i,l){It.forEach(d=>{(l==null||!(l!=null&&l.containerId)||(l==null?void 0:l.containerId)===d.id)&&d.toggle(i,l==null?void 0:l.id)})}function ej(i){let l=i.containerId||1;return{subscribe(d){let u=Xy(l,i,Iy);It.set(l,u);let c=u.observe(d);return Qy(),()=>{c(),It.delete(l)}},setProps(d){var u;(u=It.get(l))==null||u.setProps(d)},getSnapshot(){var d;return(d=It.get(l))==null?void 0:d.getSnapshot()}}}function tj(i){return ed.add(i),()=>{ed.delete(i)}}function aj(i){return i&&(js(i.toastId)||yl(i.toastId))?i.toastId:kv()}function jl(i,l){return Uv(i,l),l.toastId}function ro(i,l){return{...l,type:l&&l.type||i,toastId:aj(l)}}function oo(i){return(l,d)=>jl(l,ro(i,d))}function A(i,l){return jl(i,ro("default",l))}A.loading=(i,l)=>jl(i,ro("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...l}));function nj(i,{pending:l,error:d,success:u},c){let m;l&&(m=js(l)?A.loading(l,c):A.loading(l.render,{...c,...l}));let v={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},y=(p,S,C)=>{if(S==null){A.dismiss(m);return}let D={type:p,...v,...c,data:C},R=js(S)?{render:S}:S;return m?A.update(m,{...D,...R}):A(R.render,{...D,...R}),C},h=hn(i)?i():i;return h.then(p=>y("success",u,p)).catch(p=>y("error",d,p)),h}A.promise=nj;A.success=oo("success");A.info=oo("info");A.error=oo("error");A.warning=oo("warning");A.warn=A.warning;A.dark=(i,l)=>jl(i,ro("default",{theme:"dark",...l}));function sj(i){Jy(i)}A.dismiss=sj;A.clearWaitingQueue=Ky;A.isActive=Rv;A.update=(i,l={})=>{let d=Zy(i,l);if(d){let{props:u,content:c}=d,m={delay:100,...u,...l,toastId:l.toastId||i,updateId:kv()};m.toastId!==i&&(m.staleId=i);let v=m.render||c;delete m.render,jl(v,m)}};A.done=i=>{A.update(i,{progress:1})};A.onChange=tj;A.play=i=>Lv(!0,i);A.pause=i=>Lv(!1,i);function ij(i){var l;let{subscribe:d,getSnapshot:u,setProps:c}=g.useRef(ej(i)).current;c(i);let m=(l=g.useSyncExternalStore(d,u,u))==null?void 0:l.slice();function v(y){if(!m)return[];let h=new Map;return i.newestOnTop&&m.reverse(),m.forEach(p=>{let{position:S}=p.props;h.has(S)||h.set(S,[]),h.get(S).push(p)}),Array.from(h,p=>y(p[0],p[1]))}return{getToastToRender:v,isToastActive:Rv,count:m==null?void 0:m.length}}function lj(i){let[l,d]=g.useState(!1),[u,c]=g.useState(!1),m=g.useRef(null),v=g.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:y,pauseOnHover:h,closeToast:p,onClick:S,closeOnClick:C}=i;Wy({id:i.toastId,containerId:i.containerId,fn:d}),g.useEffect(()=>{if(i.pauseOnFocusLoss)return D(),()=>{R()}},[i.pauseOnFocusLoss]);function D(){document.hasFocus()||O(),window.addEventListener("focus",_),window.addEventListener("blur",O)}function R(){window.removeEventListener("focus",_),window.removeEventListener("blur",O)}function k(w){if(i.draggable===!0||i.draggable===w.pointerType){q();let ae=m.current;v.canCloseOnClick=!0,v.canDrag=!0,ae.style.transition="none",i.draggableDirection==="x"?(v.start=w.clientX,v.removalDistance=ae.offsetWidth*(i.draggablePercent/100)):(v.start=w.clientY,v.removalDistance=ae.offsetHeight*(i.draggablePercent===80?i.draggablePercent*1.5:i.draggablePercent)/100)}}function b(w){let{top:ae,bottom:oe,left:W,right:V}=m.current.getBoundingClientRect();w.nativeEvent.type!=="touchend"&&i.pauseOnHover&&w.clientX>=W&&w.clientX<=V&&w.clientY>=ae&&w.clientY<=oe?O():_()}function _(){d(!0)}function O(){d(!1)}function q(){v.didMove=!1,document.addEventListener("pointermove",j),document.addEventListener("pointerup",N)}function E(){document.removeEventListener("pointermove",j),document.removeEventListener("pointerup",N)}function j(w){let ae=m.current;if(v.canDrag&&ae){v.didMove=!0,l&&O(),i.draggableDirection==="x"?v.delta=w.clientX-v.start:v.delta=w.clientY-v.start,v.start!==w.clientX&&(v.canCloseOnClick=!1);let oe=i.draggableDirection==="x"?`${v.delta}px, var(--y)`:`0, calc(${v.delta}px + var(--y))`;ae.style.transform=`translate3d(${oe},0)`,ae.style.opacity=`${1-Math.abs(v.delta/v.removalDistance)}`}}function N(){E();let w=m.current;if(v.canDrag&&v.didMove&&w){if(v.canDrag=!1,Math.abs(v.delta)>v.removalDistance){c(!0),i.closeToast(!0),i.collapseAll();return}w.style.transition="transform 0.2s, opacity 0.2s",w.style.removeProperty("transform"),w.style.removeProperty("opacity")}}let G={onPointerDown:k,onPointerUp:b};return y&&h&&(G.onMouseEnter=O,i.stacked||(G.onMouseLeave=_)),C&&(G.onClick=w=>{S&&S(w),v.canCloseOnClick&&p(!0)}),{playToast:_,pauseToast:O,isRunning:l,preventExitTransition:u,toastRef:m,eventHandlers:G}}var rj=typeof window<"u"?g.useLayoutEffect:g.useEffect,co=({theme:i,type:l,isLoading:d,...u})=>ct.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:i==="colored"?"currentColor":`var(--toastify-icon-color-${l})`,...u});function oj(i){return ct.createElement(co,{...i},ct.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function cj(i){return ct.createElement(co,{...i},ct.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function uj(i){return ct.createElement(co,{...i},ct.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function dj(i){return ct.createElement(co,{...i},ct.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function fj(){return ct.createElement("div",{className:"Toastify__spinner"})}var td={info:cj,warning:oj,success:uj,error:dj,spinner:fj},mj=i=>i in td;function hj({theme:i,type:l,isLoading:d,icon:u}){let c=null,m={theme:i,type:l};return u===!1||(hn(u)?c=u({...m,isLoading:d}):g.isValidElement(u)?c=g.cloneElement(u,m):d?c=td.spinner():mj(l)&&(c=td[l](m))),c}var pj=i=>{let{isRunning:l,preventExitTransition:d,toastRef:u,eventHandlers:c,playToast:m}=lj(i),{closeButton:v,children:y,autoClose:h,onClick:p,type:S,hideProgressBar:C,closeToast:D,transition:R,position:k,className:b,style:_,progressClassName:O,updateId:q,role:E,progress:j,rtl:N,toastId:G,deleteToast:w,isIn:ae,isLoading:oe,closeOnClick:W,theme:V,ariaLabel:P}=i,ce=bs("Toastify__toast",`Toastify__toast-theme--${V}`,`Toastify__toast--${S}`,{"Toastify__toast--rtl":N},{"Toastify__toast--close-on-click":W}),ye=hn(b)?b({rtl:N,position:k,type:S,defaultClassName:ce}):bs(ce,b),je=hj(i),F=!!j||!h,K={closeToast:D,type:S,theme:V},fe=null;return v===!1||(hn(v)?fe=v(K):g.isValidElement(v)?fe=g.cloneElement(v,K):fe=Py(K)),ct.createElement(R,{isIn:ae,done:w,position:k,preventExitTransition:d,nodeRef:u,playToast:m},ct.createElement("div",{id:G,tabIndex:0,onClick:p,"data-in":ae,className:ye,...c,style:_,ref:u,...ae&&{role:E,"aria-label":P}},je!=null&&ct.createElement("div",{className:bs("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!oe})},je),wv(y,i,!l),fe,!i.customProgressBar&&ct.createElement(Gy,{...q&&!F?{key:`p-${q}`}:{},rtl:N,theme:V,delay:h,isRunning:l,isIn:ae,closeToast:D,hide:C,type:S,className:O,controlledProgress:F,progress:j||0})))},vj=(i,l=!1)=>({enter:`Toastify--animate Toastify__${i}-enter`,exit:`Toastify--animate Toastify__${i}-exit`,appendPosition:l}),gj=Fy(vj("bounce",!0)),bj={position:"top-right",transition:gj,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light","aria-label":"Notifications Alt+T",hotKeys:i=>i.altKey&&i.code==="KeyT"};function Ft(i){let l={...bj,...i},d=i.stacked,[u,c]=g.useState(!0),m=g.useRef(null),{getToastToRender:v,isToastActive:y,count:h}=ij(l),{className:p,style:S,rtl:C,containerId:D,hotKeys:R}=l;function k(_){let O=bs("Toastify__toast-container",`Toastify__toast-container--${_}`,{"Toastify__toast-container--rtl":C});return hn(p)?p({position:_,rtl:C,defaultClassName:O}):bs(O,Ku(p))}function b(){d&&(c(!0),A.play())}return rj(()=>{var _;if(d){let O=m.current.querySelectorAll('[data-in="true"]'),q=12,E=(_=l.position)==null?void 0:_.includes("top"),j=0,N=0;Array.from(O).reverse().forEach((G,w)=>{let ae=G;ae.classList.add("Toastify__toast--stacked"),w>0&&(ae.dataset.collapsed=`${u}`),ae.dataset.pos||(ae.dataset.pos=E?"top":"bot");let oe=j*(u?.2:1)+(u?0:q*w);ae.style.setProperty("--y",`${E?oe:oe*-1}px`),ae.style.setProperty("--g",`${q}`),ae.style.setProperty("--s",`${1-(u?N:0)}`),j+=ae.offsetHeight,N+=.025})}},[u,h,d]),g.useEffect(()=>{function _(O){var q;let E=m.current;R(O)&&((q=E.querySelector('[tabIndex="0"]'))==null||q.focus(),c(!1),A.pause()),O.key==="Escape"&&(document.activeElement===E||E!=null&&E.contains(document.activeElement))&&(c(!0),A.play())}return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[R]),ct.createElement("section",{ref:m,className:"Toastify",id:D,onMouseEnter:()=>{d&&(c(!1),A.pause())},onMouseLeave:b,"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text","aria-label":l["aria-label"]},v((_,O)=>{let q=O.length?{...S}:{...S,pointerEvents:"none"};return ct.createElement("div",{tabIndex:-1,className:k(_),"data-stacked":d,style:q,key:`c-${_}`},O.map(({content:E,props:j})=>ct.createElement(pj,{...j,stacked:d,collapseAll:b,isIn:y(j.toastId,j.containerId),key:`t-${j.key}`},E)))}))}const xj=""+new URL("20 pesos-CUb7mBC6.jpeg",import.meta.url).href,yj=""+new URL("50 pesos-CWd8U7PQ.jpeg",import.meta.url).href,jj=""+new URL("100 pesos-D1GVNH0C.jpeg",import.meta.url).href,Sj=""+new URL("200 pesos-e7FYIHhe.jpeg",import.meta.url).href,Nj=""+new URL("500 pesos-By2-Zx2u.jpeg",import.meta.url).href,Cj=""+new URL("1000 pesos-C0SNOCZD.jpeg",import.meta.url).href,La=()=>Be.getApiUrl();function _j(){const{user:i}=Fa(),[l,d]=g.useState([]),[u,c]=g.useState([]),[m,v]=g.useState("todas"),[y,h]=g.useState([]),[p,S]=g.useState(""),[C,D]=g.useState("efectivo"),[R,k]=g.useState(!0),[b,_]=g.useState(!1),[O,q]=g.useState(null),[E,j]=g.useState(""),[N,G]=g.useState("cantidad"),[w,ae]=g.useState(null),[oe,W]=g.useState(!1),[V,P]=g.useState(null),[ce,ye]=g.useState([]),[je,F]=g.useState(!1),[K,fe]=g.useState(""),[Te,de]=g.useState([]),[z,T]=g.useState(null),[ee,ne]=g.useState(null),[he,me]=g.useState(void 0),[xe,Ue]=g.useState(""),[ke,ie]=g.useState([]),[B,pe]=g.useState({}),[H,ue]=g.useState(!1);g.useEffect(()=>{I()},[]);const I=async()=>{try{const Ne=await(await fetch(La(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getTurnoActivo",sucursal:Be.getSucursal(),caja:Be.getCaja()})})).json();Ne.success?Ne.data?(me(Ne.data),Ot(),pa(),Dt()):(me(null),Se()):me(null)}catch{me(null)}finally{k(!1)}},Se=async()=>{try{const Ne=await(await fetch(La(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductosContarInicio"})})).json();if(Ne.success){ie(Ne.data||[]);const U={};(Ne.data||[]).forEach(ge=>{U[ge.id]={stock_fisico:""}}),pe(U)}}catch(Q){console.error("Error al cargar productos para inicio:",Q)}},Mt=async()=>{const Q=parseFloat(xe);if(isNaN(Q)||Q<0){A.warning("Ingresa un fondo de caja valido");return}if(ke.length>0){const Ne=ke.filter(U=>{var ge;return((ge=B[U.id])==null?void 0:ge.stock_fisico)===""});if(Ne.length>0){A.warning(`Faltan ${Ne.length} producto(s) por contar`);return}}ue(!0);try{const Ne=ke.map(_e=>{var ze;return{producto_id:_e.id,nombre:_e.nombre,stock_sistema:_e.stock,stock_fisico:parseFloat((ze=B[_e.id])==null?void 0:ze.stock_fisico)||0,unidad:_e.unidad}}),ge=await(await fetch(La(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"iniciarTurno",usuario_id:(i==null?void 0:i.id)||null,sucursal:Be.getSucursal(),caja:Be.getCaja(),fondo_caja:Q,inventario:Ne})})).json();ge.success?(A.success("Turno iniciado correctamente"),me(ge.data),Ot(),pa(),Dt()):A.error(ge.message||"Error al iniciar turno")}catch{A.error("Error de conexion")}finally{ue(!1)}},Ot=async()=>{try{const Ne=await(await fetch(La(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductosPOS"})})).json();if(Ne.success){d(Ne.data||[]);const U=[...new Set(Ne.data.map(ge=>ge.categoria).filter(Boolean))];c(U)}}catch{A.error("Error al cargar productos")}finally{k(!1)}},Dt=async()=>{try{const Ne=await(await fetch(La(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getClientes"})})).json();Ne.success&&de(Ne.data||[])}catch(Q){console.error("Error al cargar clientes:",Q)}},pa=async()=>{try{const Ne=await(await fetch(La(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getPedidosPausados"})})).json();Ne.success&&ye(Ne.data||[])}catch(Q){console.error("Error al cargar pedidos pausados:",Q)}},sa=Te.filter(Q=>Q.nombre.toLowerCase().includes(K.toLowerCase())||Q.telefono&&Q.telefono.includes(K)),Xn=Q=>{P(Q),F(!1),fe("")},Ma=async()=>{if(!V){A.warning("Selecciona un cliente para pausar el pedido");return}if(y.length===0){A.warning("Agrega productos al carrito");return}try{const Ne=await(await fetch(La(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"pausarPedido",cliente_id:V.id,items:y,reemplazar:ee!==null,usuario_id:(i==null?void 0:i.id)||null,sucursal:Be.getSucursal(),caja:Be.getCaja()})})).json();Ne.success?(A.success(`Pedido pausado para ${V.nombre}`),h([]),P(null),ne(null),pa()):A.error(Ne.message||"Error al pausar pedido")}catch{A.error("Error de conexion")}},ft=async Q=>{try{const U=await(await fetch(La(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"retomarPedido",pedido_id:Q.id})})).json();U.success?(h(U.data.items),P({id:U.data.cliente_id,nombre:U.data.cliente_nombre}),ne(Q.id),A.info(`Pedido de ${U.data.cliente_nombre} cargado`)):A.error(U.message||"Error al retomar pedido")}catch{A.error("Error de conexion")}},Pa=Q=>{T(Q),h(Q.items),P({id:Q.cliente_id,nombre:Q.cliente_nombre}),W(!0)},Aa=async Q=>{A.warn(a.jsxs("div",{children:[a.jsx("p",{children:"¿Cancelar este pedido pausado?"}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const U=await(await fetch(La(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"cancelarPedidoPausado",pedido_id:Q})})).json();U.success?(A.dismiss(),A.success("Pedido cancelado"),pa()):A.error(U.message||"Error al cancelar")}catch{A.error("Error de conexion")}},style:{padding:"0.25rem 0.75rem",background:"#ef4444",color:"#fff",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Cancelar Pedido"}),a.jsx("button",{onClick:()=>A.dismiss(),style:{padding:"0.25rem 0.75rem",background:"#e2e8f0",color:"#1e293b",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"No"})]})]}),{autoClose:!1,closeOnClick:!1,draggable:!1,closeButton:!1})},wa=m==="todas"?l:l.filter(Q=>Q.categoria===m),Et=Q=>{var U;q(Q),j("");const Ne=["kg","g","litro","lt","l","ml"].includes((U=Q.unidad)==null?void 0:U.toLowerCase());G(Ne?"pesos":"cantidad")},In=()=>{const Q=parseFloat(E);if(!Q||Q<=0){A.warning(N==="pesos"?"Ingresa un monto valido":"Ingresa una cantidad valida");return}let Ne=Q;N==="pesos"&&(Ne=Q/O.precio,O.unidad==="kg"||O.unidad==="g"?Ne=Math.round(Ne*1e3)/1e3:Ne=Math.round(Ne)),h(U=>U.find(_e=>_e.id===O.id)?U.map(_e=>_e.id===O.id?{..._e,cantidad:_e.cantidad+Ne}:_e):[...U,{...O,cantidad:Ne}]),q(null),j("")},pt=()=>{const Q=parseFloat(E)||0;if(!O)return{cantidad:0,pesos:0};const Ne=O.unidad==="kg"||O.unidad==="g";if(N==="pesos"){let U=Q/O.precio;return Ne?U=Math.round(U*1e3)/1e3:U=Math.round(U),{cantidad:U,pesos:Q}}else return{cantidad:Q,pesos:Q*O.precio}},gn=(Q,Ne)=>{h(U=>U.map(ge=>{if(ge.id===Q){const _e=ge.cantidad+Ne;return _e<=0?null:{...ge,cantidad:_e}}return ge}).filter(Boolean))},J=Q=>{h(Ne=>Ne.filter(U=>U.id!==Q))},be=()=>{h([]),S("")},ve=()=>{if(y.length===0){A.warning("Agrega productos al carrito");return}S(""),D("efectivo"),W(!0)},qe=()=>{W(!1),S(""),T(null)},Xe=y.reduce((Q,Ne)=>Q+Ne.precio*Ne.cantidad,0),ia=parseFloat(p)||0,Ga=ia-Xe,At=Q=>{S(Ne=>{const U=parseFloat(Ne)||0;return String(U+Q)})},bn=()=>{S(String(Xe.toFixed(2)))},xn=async()=>{if(y.length===0){A.warning("Agrega productos al carrito");return}if(C==="efectivo"&&ia<Xe){A.warning("El pago es menor al total");return}_(!0);try{let Q;z?Q={tipo:"cobrarPedidoPausado",pedido_id:z.id,items:y,pago:C==="efectivo"?ia:Xe,metodo_pago:C,cobro_parcial:!1,usuario_id:(i==null?void 0:i.id)||null,sucursal:Be.getSucursal(),caja:Be.getCaja()}:Q={tipo:"crearVenta",items:y,pago:C==="efectivo"?ia:Xe,metodo_pago:C,cliente_id:(V==null?void 0:V.id)||null,usuario_id:(i==null?void 0:i.id)||null,sucursal:Be.getSucursal(),caja:Be.getCaja()};const U=await(await fetch(La(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Q)})).json();U.success?(W(!1),ae({folio:U.data.folio,items:[...y],total:U.data.total,pago:U.data.pago,cambio:U.data.cambio,metodoPago:C,fecha:new Date().toLocaleString()}),A.success(`Venta ${U.data.folio} completada`),h([]),S(""),P(null),T(null),Ot(),pa()):A.error(U.message||"Error al procesar venta")}catch{A.error("Error de conexion")}finally{_(!1)}},Ya=Q=>{if(O)if(Q==="C")j("");else{if(Q==="."&&E.includes("."))return;j(Ne=>Ne+Q)}else if(Q==="C")S("");else{if(Q==="."&&p.includes("."))return;S(Ne=>Ne+Q)}};return R||he===void 0?a.jsx("div",{className:"ventas-pos",children:a.jsx("p",{children:"Cargando..."})}):he===null?a.jsxs("div",{className:"ventas-pos",children:[a.jsxs("div",{className:"turno-inicio",children:[a.jsxs("div",{className:"turno-header",children:[a.jsx(by,{size:32}),a.jsx("h2",{children:"Iniciar Turno"}),a.jsxs("p",{children:[Be.getSucursal()," - ",Be.getCaja()]})]}),a.jsxs("div",{className:"turno-body",children:[a.jsxs("div",{className:"turno-seccion",children:[a.jsxs("h3",{children:[a.jsx(fl,{size:18})," Fondo de Caja"]}),a.jsxs("div",{className:"turno-fondo-row",children:[a.jsx("input",{type:"number",value:xe,onChange:Q=>Ue(Q.target.value),placeholder:"0.00",className:"turno-fondo-input",autoFocus:!0,min:"0",step:"0.01"}),a.jsx("div",{className:"turno-fondo-rapido",children:[500,1e3,1500,2e3].map(Q=>a.jsxs("button",{onClick:()=>Ue(String(Q)),className:"turno-fondo-btn",children:["$",Q]},Q))})]})]}),ke.length>0&&a.jsxs("div",{className:"turno-seccion",children:[a.jsxs("h3",{children:[a.jsx($t,{size:18})," Inventario Inicial (",ke.length," productos)"]}),a.jsxs("div",{className:"turno-inventario",children:[a.jsxs("div",{className:"turno-inv-header",children:[a.jsx("span",{children:"Producto"}),a.jsx("span",{children:"Sistema"}),a.jsx("span",{children:"Fisico"}),a.jsx("span",{children:"Dif"})]}),a.jsx("div",{className:"turno-inv-body",children:ke.map(Q=>{var ge,_e;const Ne=parseFloat((ge=B[Q.id])==null?void 0:ge.stock_fisico),U=isNaN(Ne)?null:Ne-Q.stock;return a.jsxs("div",{className:"turno-inv-row",children:[a.jsx("span",{className:"turno-inv-nombre",children:Q.nombre}),a.jsxs("span",{className:"turno-inv-sistema",children:[Q.stock," ",Q.unidad]}),a.jsx("input",{type:"number",value:((_e=B[Q.id])==null?void 0:_e.stock_fisico)??"",onChange:ze=>pe(Ie=>({...Ie,[Q.id]:{stock_fisico:ze.target.value}})),className:"turno-inv-input",placeholder:"0",min:"0",step:"0.01"}),a.jsx("span",{className:`turno-inv-dif ${U!==null?U<0?"negativa":U>0?"positiva":"":""}`,children:U!==null?(U>=0?"+":"")+U.toFixed(2):"-"})]},Q.id)})})]})]})]}),a.jsx("div",{className:"turno-footer",children:a.jsxs("button",{className:"turno-btn-iniciar",onClick:Mt,disabled:H,children:[a.jsx(fn,{size:20}),H?"Iniciando...":"INICIAR TURNO"]})})]}),a.jsx(Ft,{position:"top-right",autoClose:2e3,hideProgressBar:!0,newestOnTop:!0})]}):a.jsxs("div",{className:"ventas-pos",children:[a.jsxs("div",{className:"pos-productos",children:[a.jsxs("div",{className:"pos-categorias",children:[a.jsx("button",{className:`cat-btn ${m==="todas"?"activa":""}`,onClick:()=>v("todas"),children:"Todos"}),u.map(Q=>a.jsx("button",{className:`cat-btn ${m===Q?"activa":""}`,onClick:()=>v(Q),children:Q},Q))]}),a.jsx("div",{className:"pos-grid",children:wa.map(Q=>a.jsxs("button",{className:"pos-producto-btn",onClick:()=>Et(Q),children:[a.jsx("span",{className:"prod-nombre",children:Q.nombre}),a.jsxs("span",{className:"prod-precio",children:["$",Q.precio.toFixed(2)]}),a.jsxs("span",{className:"prod-unidad",children:["/",Q.unidad]})]},Q.id))})]}),a.jsxs("div",{className:"pos-carrito",children:[a.jsxs("div",{className:"carrito-header",children:[a.jsxs("h3",{children:[a.jsx(Ov,{size:20})," Venta Actual"]}),y.length>0&&a.jsxs("button",{className:"btn-limpiar",onClick:be,children:[a.jsx(Yt,{size:16})," Limpiar"]})]}),a.jsx("div",{className:"cliente-selector",children:V?a.jsxs("div",{className:"cliente-seleccionado",children:[a.jsx(Ju,{size:16}),a.jsx("span",{children:V.nombre}),a.jsx("button",{className:"btn-quitar-cliente",onClick:()=>P(null),children:a.jsx(tt,{size:14})})]}):a.jsxs("button",{className:"btn-seleccionar-cliente",onClick:()=>F(!0),children:[a.jsx(Ju,{size:16})," Seleccionar Cliente"]})}),a.jsx("div",{className:"carrito-items",children:y.length===0?a.jsx("p",{className:"carrito-vacio",children:"Sin productos"}):y.map(Q=>a.jsxs("div",{className:"carrito-item",children:[a.jsxs("div",{className:"item-info",children:[a.jsx("span",{className:"item-nombre",children:Q.nombre}),a.jsxs("span",{className:"item-precio",children:["$",Q.precio.toFixed(2)," x ",Q.cantidad," ",Q.unidad]})]}),a.jsxs("div",{className:"item-acciones",children:[a.jsxs("span",{className:"item-subtotal",children:["$",(Q.precio*Q.cantidad).toFixed(2)]}),a.jsx("button",{onClick:()=>gn(Q.id,Q.unidad==="kg"||Q.unidad==="g"?-.25:-1),className:"btn-cant",children:a.jsx(Gx,{size:14})}),a.jsx("button",{onClick:()=>gn(Q.id,Q.unidad==="kg"||Q.unidad==="g"?.25:1),className:"btn-cant",children:a.jsx(aa,{size:14})}),a.jsx("button",{onClick:()=>J(Q.id),className:"btn-cant btn-eliminar",children:a.jsx(tt,{size:14})})]})]},Q.id))}),a.jsxs("div",{className:"carrito-total",children:[a.jsx("span",{children:"TOTAL"}),a.jsxs("span",{className:"total-monto",children:["$",Xe.toFixed(2)]})]}),a.jsxs("div",{className:"pos-pago",children:[V&&y.length>0&&a.jsxs("button",{className:"btn-pausar",onClick:Ma,children:[a.jsx(Zx,{size:18})," PAUSAR"]}),a.jsxs("button",{className:"btn-cobrar",onClick:ve,disabled:y.length===0,children:[a.jsx(fl,{size:20}),"COBRAR $",Xe.toFixed(2)]})]})]}),ce.length>0&&a.jsxs("div",{className:"pedidos-pausados",children:[a.jsx("div",{className:"pedidos-pausados-header",children:a.jsxs("h4",{children:[a.jsx(md,{size:18})," Pedidos Pausados (",ce.length,")"]})}),a.jsx("div",{className:"pedidos-pausados-lista",children:ce.map(Q=>a.jsxs("div",{className:"pedido-pausado-item",children:[a.jsxs("div",{className:"pedido-info",children:[a.jsx("span",{className:"pedido-cliente",children:Q.cliente_nombre}),a.jsxs("span",{className:"pedido-total",children:["$",Q.total.toFixed(2)]}),a.jsxs("span",{className:"pedido-items",children:[Q.items.length," items"]})]}),a.jsxs("div",{className:"pedido-acciones",children:[a.jsx("button",{className:"btn-retomar",onClick:()=>ft(Q),title:"Retomar",children:a.jsx(Wx,{size:14})}),a.jsx("button",{className:"btn-cobrar-pausado",onClick:()=>Pa(Q),title:"Cobrar",children:a.jsx(fl,{size:14})}),a.jsx("button",{className:"btn-cancelar-pausado",onClick:()=>Aa(Q.id),title:"Cancelar",children:a.jsx(tt,{size:14})})]})]},Q.id))})]}),O&&a.jsx("div",{className:"modal-overlay",onClick:()=>q(null),children:a.jsxs("div",{className:"modal modal-cantidad",onClick:Q=>Q.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:O.nombre}),a.jsx("button",{className:"btn-icon",onClick:()=>q(null),children:a.jsx(tt,{size:20})})]}),a.jsxs("div",{className:"cantidad-content",children:[a.jsxs("p",{className:"cantidad-precio",children:["$",O.precio.toFixed(2)," / ",O.unidad]}),a.jsxs("div",{className:"modo-captura",children:[a.jsxs("button",{className:`modo-btn ${N==="cantidad"?"activo":""}`,onClick:()=>{G("cantidad"),j("")},children:["Por ",O.unidad]}),a.jsx("button",{className:`modo-btn ${N==="pesos"?"activo":""}`,onClick:()=>{G("pesos"),j("")},children:"Por $Pesos"})]}),a.jsx("input",{type:"text",value:E,onChange:Q=>j(Q.target.value),placeholder:N==="pesos"?"Monto en $":`Cantidad en ${O.unidad}`,className:"cantidad-input",autoFocus:!0}),a.jsx("div",{className:"cantidad-rapida",children:N==="pesos"?a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>j("10"),children:"$10"}),a.jsx("button",{onClick:()=>j("20"),children:"$20"}),a.jsx("button",{onClick:()=>j("50"),children:"$50"}),a.jsx("button",{onClick:()=>j("100"),children:"$100"})]}):O.unidad==="kg"||O.unidad==="g"?a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>j("0.25"),children:"0.25"}),a.jsx("button",{onClick:()=>j("0.5"),children:"0.5"}),a.jsx("button",{onClick:()=>j("1"),children:"1"}),a.jsx("button",{onClick:()=>j("2"),children:"2"}),a.jsx("button",{onClick:()=>j("5"),children:"5"})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>j("1"),children:"1"}),a.jsx("button",{onClick:()=>j("2"),children:"2"}),a.jsx("button",{onClick:()=>j("5"),children:"5"}),a.jsx("button",{onClick:()=>j("10"),children:"10"}),a.jsx("button",{onClick:()=>j("20"),children:"20"})]})}),a.jsx("div",{className:"numpad",children:["7","8","9","4","5","6","1","2","3","C","0","."].map(Q=>a.jsx("button",{onClick:()=>Ya(Q),className:"numpad-btn",children:Q},Q))}),E&&a.jsxs("div",{className:"cantidad-resultado",children:[a.jsxs("div",{className:"resultado-linea",children:[a.jsx("span",{children:"Cantidad:"}),a.jsxs("span",{className:"resultado-valor",children:[O.unidad==="kg"||O.unidad==="g"?pt().cantidad.toFixed(3):Math.round(pt().cantidad)," ",O.unidad]})]}),a.jsxs("div",{className:"resultado-linea resultado-total",children:[a.jsx("span",{children:"Total:"}),a.jsxs("span",{className:"resultado-valor",children:["$",pt().pesos.toFixed(2)]})]})]})]}),a.jsxs("div",{className:"modal-actions",children:[a.jsx("button",{className:"btn-secondary",onClick:()=>q(null),children:"Cancelar"}),a.jsx("button",{className:"btn-primary",onClick:In,children:"Agregar"})]})]})}),oe&&a.jsx("div",{className:"modal-overlay",onClick:qe,children:a.jsxs("div",{className:"modal modal-pago",onClick:Q=>Q.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:"Cobrar Venta"}),a.jsx("button",{className:"btn-icon",onClick:qe,children:a.jsx(tt,{size:20})})]}),a.jsxs("div",{className:"pago-content",children:[a.jsxs("div",{className:"metodo-pago",children:[a.jsxs("button",{className:`metodo-btn ${C==="efectivo"?"activo":""}`,onClick:()=>D("efectivo"),children:[a.jsx(fl,{size:18})," Efectivo"]}),a.jsxs("button",{className:`metodo-btn ${C==="tarjeta"?"activo":""}`,onClick:()=>D("tarjeta"),children:[a.jsx(Sx,{size:18})," Tarjeta"]})]}),C==="efectivo"?a.jsxs("div",{className:"pago-layout",children:[a.jsxs("div",{className:"pago-izquierda",children:[a.jsxs("div",{className:"pago-total",children:[a.jsx("span",{children:"Total:"}),a.jsxs("span",{className:"pago-total-monto",children:["$",Xe.toFixed(2)]})]}),a.jsxs("div",{className:"pago-input-row",children:[a.jsx("label",{children:"Recibido:"}),a.jsx("input",{type:"text",value:p,onChange:Q=>S(Q.target.value),placeholder:"0.00",className:"pago-input",autoFocus:!0})]}),a.jsx("div",{className:"numpad",children:["7","8","9","4","5","6","1","2","3","C","0","."].map(Q=>a.jsx("button",{onClick:()=>Ya(Q),className:"numpad-btn",children:Q},Q))}),a.jsx("button",{onClick:bn,className:"btn-exacto-full",children:"Pago Exacto"}),ia>0&&a.jsxs("div",{className:`cambio-display ${Ga>=0?"positivo":"negativo"}`,children:[a.jsx("span",{children:"Cambio:"}),a.jsxs("span",{className:"cambio-monto",children:["$",Ga.toFixed(2)]})]})]}),a.jsxs("div",{className:"pago-derecha",children:[a.jsxs("div",{className:"dinero-seccion",children:[a.jsx("span",{className:"dinero-label",children:"Billetes"}),a.jsxs("div",{className:"billetes-grid",children:[a.jsxs("button",{onClick:()=>At(20),className:"btn-billete b20",children:[a.jsx("img",{src:xj,alt:"$20",className:"billete-img"}),a.jsx("span",{className:"billete-valor",children:"$20"})]}),a.jsxs("button",{onClick:()=>At(50),className:"btn-billete b50",children:[a.jsx("img",{src:yj,alt:"$50",className:"billete-img"}),a.jsx("span",{className:"billete-valor",children:"$50"})]}),a.jsxs("button",{onClick:()=>At(100),className:"btn-billete b100",children:[a.jsx("img",{src:jj,alt:"$100",className:"billete-img"}),a.jsx("span",{className:"billete-valor",children:"$100"})]}),a.jsxs("button",{onClick:()=>At(200),className:"btn-billete b200",children:[a.jsx("img",{src:Sj,alt:"$200",className:"billete-img"}),a.jsx("span",{className:"billete-valor",children:"$200"})]}),a.jsxs("button",{onClick:()=>At(500),className:"btn-billete b500",children:[a.jsx("img",{src:Nj,alt:"$500",className:"billete-img"}),a.jsx("span",{className:"billete-valor",children:"$500"})]}),a.jsxs("button",{onClick:()=>At(1e3),className:"btn-billete b1000",children:[a.jsx("img",{src:Cj,alt:"$1000",className:"billete-img"}),a.jsx("span",{className:"billete-valor",children:"$1000"})]})]})]}),a.jsxs("div",{className:"dinero-seccion",children:[a.jsx("span",{className:"dinero-label",children:"Monedas"}),a.jsxs("div",{className:"monedas-grid",children:[a.jsx("button",{onClick:()=>At(1),className:"btn-moneda m1",children:"$1"}),a.jsx("button",{onClick:()=>At(2),className:"btn-moneda m2",children:"$2"}),a.jsx("button",{onClick:()=>At(5),className:"btn-moneda m5",children:"$5"}),a.jsx("button",{onClick:()=>At(10),className:"btn-moneda m10",children:"$10"})]})]})]})]}):a.jsxs("div",{className:"pago-tarjeta",children:[a.jsxs("div",{className:"pago-total pago-total-tarjeta",children:[a.jsx("span",{children:"Total a cobrar:"}),a.jsxs("span",{className:"pago-total-monto",children:["$",Xe.toFixed(2)]})]}),a.jsx("p",{className:"tarjeta-instruccion",children:"Procesa el pago con tarjeta y confirma"})]}),a.jsxs("button",{className:"btn-confirmar-pago",onClick:xn,disabled:b||C==="efectivo"&&ia<Xe,children:[a.jsx(gs,{size:20}),b?"Procesando...":"CONFIRMAR PAGO"]})]})]})}),w&&a.jsx("div",{className:"modal-overlay",onClick:()=>ae(null),children:a.jsxs("div",{className:"modal modal-cambio",onClick:Q=>Q.stopPropagation(),children:[a.jsxs("div",{className:"cambio-content",children:[w.metodoPago==="efectivo"&&w.cambio>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"cambio-titulo",children:"CAMBIO"}),a.jsxs("div",{className:"cambio-grande",children:["$",w.cambio.toFixed(2)]}),a.jsxs("div",{className:"cambio-detalle",children:[a.jsxs("div",{className:"detalle-linea",children:[a.jsx("span",{children:"Total:"}),a.jsxs("span",{children:["$",w.total.toFixed(2)]})]}),a.jsxs("div",{className:"detalle-linea",children:[a.jsx("span",{children:"Pagó con:"}),a.jsxs("span",{children:["$",w.pago.toFixed(2)]})]})]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"cambio-titulo exito",children:"¡VENTA COMPLETADA!"}),a.jsx("div",{className:"cambio-grande exito",children:a.jsx(gs,{size:64})}),a.jsx("div",{className:"cambio-detalle",children:a.jsxs("div",{className:"detalle-linea",children:[a.jsx("span",{children:"Total:"}),a.jsxs("span",{children:["$",w.total.toFixed(2)]})]})})]}),a.jsxs("div",{className:"cambio-folio",children:["Folio: ",w.folio]})]}),a.jsxs("button",{className:"btn-primary btn-cerrar-cambio",onClick:()=>ae(null),children:[a.jsx(gs,{size:18})," Listo"]})]})}),je&&a.jsx("div",{className:"modal-overlay",onClick:()=>F(!1),children:a.jsxs("div",{className:"modal modal-cliente",onClick:Q=>Q.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:"Seleccionar Cliente"}),a.jsx("button",{className:"btn-icon",onClick:()=>F(!1),children:a.jsx(tt,{size:20})})]}),a.jsx("div",{className:"cliente-busqueda",children:a.jsx("input",{type:"text",placeholder:"Buscar por nombre o telefono...",value:K,onChange:Q=>fe(Q.target.value),autoFocus:!0})}),a.jsx("div",{className:"clientes-lista",children:sa.length===0?a.jsx("p",{className:"sin-clientes",children:"No se encontraron clientes"}):sa.map(Q=>a.jsxs("button",{className:"cliente-item",onClick:()=>Xn(Q),children:[a.jsx("span",{className:"cliente-nombre",children:Q.nombre}),Q.telefono&&a.jsx("span",{className:"cliente-tel",children:Q.telefono})]},Q.id))})]})}),a.jsx(Ft,{position:"top-right",autoClose:2e3,hideProgressBar:!0,newestOnTop:!0})]})}var Bt=bv();function Ss(i){"@babel/helpers - typeof";return Ss=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},Ss(i)}function Tj(i,l){if(Ss(i)!="object"||!i)return i;var d=i[Symbol.toPrimitive];if(d!==void 0){var u=d.call(i,l);if(Ss(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(i)}function qv(i){var l=Tj(i,"string");return Ss(l)=="symbol"?l:l+""}function ml(i,l,d){return(l=qv(l))in i?Object.defineProperty(i,l,{value:d,enumerable:!0,configurable:!0,writable:!0}):i[l]=d,i}function Up(i,l){var d=Object.keys(i);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(i);l&&(u=u.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),d.push.apply(d,u)}return d}function we(i){for(var l=1;l<arguments.length;l++){var d=arguments[l]!=null?arguments[l]:{};l%2?Up(Object(d),!0).forEach(function(u){ml(i,u,d[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(d)):Up(Object(d)).forEach(function(u){Object.defineProperty(i,u,Object.getOwnPropertyDescriptor(d,u))})}return i}function Oj(i){if(Array.isArray(i))return i}function Ej(i,l){var d=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(d!=null){var u,c,m,v,y=[],h=!0,p=!1;try{if(m=(d=d.call(i)).next,l===0){if(Object(d)!==d)return;h=!1}else for(;!(h=(u=m.call(d)).done)&&(y.push(u.value),y.length!==l);h=!0);}catch(S){p=!0,c=S}finally{try{if(!h&&d.return!=null&&(v=d.return(),Object(v)!==v))return}finally{if(p)throw c}}return y}}function ad(i,l){(l==null||l>i.length)&&(l=i.length);for(var d=0,u=Array(l);d<l;d++)u[d]=i[d];return u}function Hv(i,l){if(i){if(typeof i=="string")return ad(i,l);var d={}.toString.call(i).slice(8,-1);return d==="Object"&&i.constructor&&(d=i.constructor.name),d==="Map"||d==="Set"?Array.from(i):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?ad(i,l):void 0}}function zj(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mn(i,l){return Oj(i)||Ej(i,l)||Hv(i,l)||zj()}function Mj(i,l){if(i==null)return{};var d={};for(var u in i)if({}.hasOwnProperty.call(i,u)){if(l.indexOf(u)!==-1)continue;d[u]=i[u]}return d}function vn(i,l){if(i==null)return{};var d,u,c=Mj(i,l);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(i);for(u=0;u<m.length;u++)d=m[u],l.indexOf(d)===-1&&{}.propertyIsEnumerable.call(i,d)&&(c[d]=i[d])}return c}var Aj=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function wj(i){var l=i.defaultInputValue,d=l===void 0?"":l,u=i.defaultMenuIsOpen,c=u===void 0?!1:u,m=i.defaultValue,v=m===void 0?null:m,y=i.inputValue,h=i.menuIsOpen,p=i.onChange,S=i.onInputChange,C=i.onMenuClose,D=i.onMenuOpen,R=i.value,k=vn(i,Aj),b=g.useState(y!==void 0?y:d),_=mn(b,2),O=_[0],q=_[1],E=g.useState(h!==void 0?h:c),j=mn(E,2),N=j[0],G=j[1],w=g.useState(R!==void 0?R:v),ae=mn(w,2),oe=ae[0],W=ae[1],V=g.useCallback(function(fe,Te){typeof p=="function"&&p(fe,Te),W(fe)},[p]),P=g.useCallback(function(fe,Te){var de;typeof S=="function"&&(de=S(fe,Te)),q(de!==void 0?de:fe)},[S]),ce=g.useCallback(function(){typeof D=="function"&&D(),G(!0)},[D]),ye=g.useCallback(function(){typeof C=="function"&&C(),G(!1)},[C]),je=y!==void 0?y:O,F=h!==void 0?h:N,K=R!==void 0?R:oe;return we(we({},k),{},{inputValue:je,menuIsOpen:F,onChange:V,onInputChange:P,onMenuClose:ye,onMenuOpen:ce,value:K})}function Re(){return Re=Object.assign?Object.assign.bind():function(i){for(var l=1;l<arguments.length;l++){var d=arguments[l];for(var u in d)({}).hasOwnProperty.call(d,u)&&(i[u]=d[u])}return i},Re.apply(null,arguments)}function kj(i,l){if(!(i instanceof l))throw new TypeError("Cannot call a class as a function")}function Lp(i,l){for(var d=0;d<l.length;d++){var u=l[d];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(i,qv(u.key),u)}}function Dj(i,l,d){return l&&Lp(i.prototype,l),d&&Lp(i,d),Object.defineProperty(i,"prototype",{writable:!1}),i}function nd(i,l){return nd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(d,u){return d.__proto__=u,d},nd(i,l)}function Rj(i,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(l&&l.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),l&&nd(i,l)}function Wr(i){return Wr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(l){return l.__proto__||Object.getPrototypeOf(l)},Wr(i)}function Vv(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Vv=function(){return!!i})()}function Uj(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Lj(i,l){if(l&&(Ss(l)=="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Uj(i)}function qj(i){var l=Vv();return function(){var d,u=Wr(i);if(l){var c=Wr(this).constructor;d=Reflect.construct(u,arguments,c)}else d=u.apply(this,arguments);return Lj(this,d)}}function Hj(i){if(Array.isArray(i))return ad(i)}function Vj(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Bj(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hd(i){return Hj(i)||Vj(i)||Hv(i)||Bj()}function $j(i){if(i.sheet)return i.sheet;for(var l=0;l<document.styleSheets.length;l++)if(document.styleSheets[l].ownerNode===i)return document.styleSheets[l]}function Fj(i){var l=document.createElement("style");return l.setAttribute("data-emotion",i.key),i.nonce!==void 0&&l.setAttribute("nonce",i.nonce),l.appendChild(document.createTextNode("")),l.setAttribute("data-s",""),l}var Pj=(function(){function i(d){var u=this;this._insertTag=function(c){var m;u.tags.length===0?u.insertionPoint?m=u.insertionPoint.nextSibling:u.prepend?m=u.container.firstChild:m=u.before:m=u.tags[u.tags.length-1].nextSibling,u.container.insertBefore(c,m),u.tags.push(c)},this.isSpeedy=d.speedy===void 0?!0:d.speedy,this.tags=[],this.ctr=0,this.nonce=d.nonce,this.key=d.key,this.container=d.container,this.prepend=d.prepend,this.insertionPoint=d.insertionPoint,this.before=null}var l=i.prototype;return l.hydrate=function(u){u.forEach(this._insertTag)},l.insert=function(u){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Fj(this));var c=this.tags[this.tags.length-1];if(this.isSpeedy){var m=$j(c);try{m.insertRule(u,m.cssRules.length)}catch{}}else c.appendChild(document.createTextNode(u));this.ctr++},l.flush=function(){this.tags.forEach(function(u){var c;return(c=u.parentNode)==null?void 0:c.removeChild(u)}),this.tags=[],this.ctr=0},i})(),Gt="-ms-",eo="-moz-",Ke="-webkit-",Bv="comm",pd="rule",vd="decl",Gj="@import",$v="@keyframes",Yj="@layer",Xj=Math.abs,uo=String.fromCharCode,Ij=Object.assign;function Qj(i,l){return Vt(i,0)^45?(((l<<2^Vt(i,0))<<2^Vt(i,1))<<2^Vt(i,2))<<2^Vt(i,3):0}function Fv(i){return i.trim()}function Zj(i,l){return(i=l.exec(i))?i[0]:i}function We(i,l,d){return i.replace(l,d)}function sd(i,l){return i.indexOf(l)}function Vt(i,l){return i.charCodeAt(l)|0}function vl(i,l,d){return i.slice(l,d)}function Ha(i){return i.length}function gd(i){return i.length}function Lr(i,l){return l.push(i),i}function Jj(i,l){return i.map(l).join("")}var fo=1,pi=1,Pv=0,na=0,Tt=0,vi="";function mo(i,l,d,u,c,m,v){return{value:i,root:l,parent:d,type:u,props:c,children:m,line:fo,column:pi,length:v,return:""}}function cl(i,l){return Ij(mo("",null,null,"",null,null,0),i,{length:-i.length},l)}function Kj(){return Tt}function Wj(){return Tt=na>0?Vt(vi,--na):0,pi--,Tt===10&&(pi=1,fo--),Tt}function ma(){return Tt=na<Pv?Vt(vi,na++):0,pi++,Tt===10&&(pi=1,fo++),Tt}function $a(){return Vt(vi,na)}function Ir(){return na}function Sl(i,l){return vl(vi,i,l)}function gl(i){switch(i){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Gv(i){return fo=pi=1,Pv=Ha(vi=i),na=0,[]}function Yv(i){return vi="",i}function Qr(i){return Fv(Sl(na-1,id(i===91?i+2:i===40?i+1:i)))}function e1(i){for(;(Tt=$a())&&Tt<33;)ma();return gl(i)>2||gl(Tt)>3?"":" "}function t1(i,l){for(;--l&&ma()&&!(Tt<48||Tt>102||Tt>57&&Tt<65||Tt>70&&Tt<97););return Sl(i,Ir()+(l<6&&$a()==32&&ma()==32))}function id(i){for(;ma();)switch(Tt){case i:return na;case 34:case 39:i!==34&&i!==39&&id(Tt);break;case 40:i===41&&id(i);break;case 92:ma();break}return na}function a1(i,l){for(;ma()&&i+Tt!==57;)if(i+Tt===84&&$a()===47)break;return"/*"+Sl(l,na-1)+"*"+uo(i===47?i:ma())}function n1(i){for(;!gl($a());)ma();return Sl(i,na)}function s1(i){return Yv(Zr("",null,null,null,[""],i=Gv(i),0,[0],i))}function Zr(i,l,d,u,c,m,v,y,h){for(var p=0,S=0,C=v,D=0,R=0,k=0,b=1,_=1,O=1,q=0,E="",j=c,N=m,G=u,w=E;_;)switch(k=q,q=ma()){case 40:if(k!=108&&Vt(w,C-1)==58){sd(w+=We(Qr(q),"&","&\f"),"&\f")!=-1&&(O=-1);break}case 34:case 39:case 91:w+=Qr(q);break;case 9:case 10:case 13:case 32:w+=e1(k);break;case 92:w+=t1(Ir()-1,7);continue;case 47:switch($a()){case 42:case 47:Lr(i1(a1(ma(),Ir()),l,d),h);break;default:w+="/"}break;case 123*b:y[p++]=Ha(w)*O;case 125*b:case 59:case 0:switch(q){case 0:case 125:_=0;case 59+S:O==-1&&(w=We(w,/\f/g,"")),R>0&&Ha(w)-C&&Lr(R>32?Hp(w+";",u,d,C-1):Hp(We(w," ","")+";",u,d,C-2),h);break;case 59:w+=";";default:if(Lr(G=qp(w,l,d,p,S,c,y,E,j=[],N=[],C),m),q===123)if(S===0)Zr(w,l,G,G,j,m,C,y,N);else switch(D===99&&Vt(w,3)===110?100:D){case 100:case 108:case 109:case 115:Zr(i,G,G,u&&Lr(qp(i,G,G,0,0,c,y,E,c,j=[],C),N),c,N,C,y,u?j:N);break;default:Zr(w,G,G,G,[""],N,0,y,N)}}p=S=R=0,b=O=1,E=w="",C=v;break;case 58:C=1+Ha(w),R=k;default:if(b<1){if(q==123)--b;else if(q==125&&b++==0&&Wj()==125)continue}switch(w+=uo(q),q*b){case 38:O=S>0?1:(w+="\f",-1);break;case 44:y[p++]=(Ha(w)-1)*O,O=1;break;case 64:$a()===45&&(w+=Qr(ma())),D=$a(),S=C=Ha(E=w+=n1(Ir())),q++;break;case 45:k===45&&Ha(w)==2&&(b=0)}}return m}function qp(i,l,d,u,c,m,v,y,h,p,S){for(var C=c-1,D=c===0?m:[""],R=gd(D),k=0,b=0,_=0;k<u;++k)for(var O=0,q=vl(i,C+1,C=Xj(b=v[k])),E=i;O<R;++O)(E=Fv(b>0?D[O]+" "+q:We(q,/&\f/g,D[O])))&&(h[_++]=E);return mo(i,l,d,c===0?pd:y,h,p,S)}function i1(i,l,d){return mo(i,l,d,Bv,uo(Kj()),vl(i,2,-2),0)}function Hp(i,l,d,u){return mo(i,l,d,vd,vl(i,0,u),vl(i,u+1,-1),u)}function fi(i,l){for(var d="",u=gd(i),c=0;c<u;c++)d+=l(i[c],c,i,l)||"";return d}function l1(i,l,d,u){switch(i.type){case Yj:if(i.children.length)break;case Gj:case vd:return i.return=i.return||i.value;case Bv:return"";case $v:return i.return=i.value+"{"+fi(i.children,u)+"}";case pd:i.value=i.props.join(",")}return Ha(d=fi(i.children,u))?i.return=i.value+"{"+d+"}":""}function r1(i){var l=gd(i);return function(d,u,c,m){for(var v="",y=0;y<l;y++)v+=i[y](d,u,c,m)||"";return v}}function o1(i){return function(l){l.root||(l=l.return)&&i(l)}}function c1(i){var l=Object.create(null);return function(d){return l[d]===void 0&&(l[d]=i(d)),l[d]}}var u1=function(l,d,u){for(var c=0,m=0;c=m,m=$a(),c===38&&m===12&&(d[u]=1),!gl(m);)ma();return Sl(l,na)},d1=function(l,d){var u=-1,c=44;do switch(gl(c)){case 0:c===38&&$a()===12&&(d[u]=1),l[u]+=u1(na-1,d,u);break;case 2:l[u]+=Qr(c);break;case 4:if(c===44){l[++u]=$a()===58?"&\f":"",d[u]=l[u].length;break}default:l[u]+=uo(c)}while(c=ma());return l},f1=function(l,d){return Yv(d1(Gv(l),d))},Vp=new WeakMap,m1=function(l){if(!(l.type!=="rule"||!l.parent||l.length<1)){for(var d=l.value,u=l.parent,c=l.column===u.column&&l.line===u.line;u.type!=="rule";)if(u=u.parent,!u)return;if(!(l.props.length===1&&d.charCodeAt(0)!==58&&!Vp.get(u))&&!c){Vp.set(l,!0);for(var m=[],v=f1(d,m),y=u.props,h=0,p=0;h<v.length;h++)for(var S=0;S<y.length;S++,p++)l.props[p]=m[h]?v[h].replace(/&\f/g,y[S]):y[S]+" "+v[h]}}},h1=function(l){if(l.type==="decl"){var d=l.value;d.charCodeAt(0)===108&&d.charCodeAt(2)===98&&(l.return="",l.value="")}};function Xv(i,l){switch(Qj(i,l)){case 5103:return Ke+"print-"+i+i;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ke+i+i;case 5349:case 4246:case 4810:case 6968:case 2756:return Ke+i+eo+i+Gt+i+i;case 6828:case 4268:return Ke+i+Gt+i+i;case 6165:return Ke+i+Gt+"flex-"+i+i;case 5187:return Ke+i+We(i,/(\w+).+(:[^]+)/,Ke+"box-$1$2"+Gt+"flex-$1$2")+i;case 5443:return Ke+i+Gt+"flex-item-"+We(i,/flex-|-self/,"")+i;case 4675:return Ke+i+Gt+"flex-line-pack"+We(i,/align-content|flex-|-self/,"")+i;case 5548:return Ke+i+Gt+We(i,"shrink","negative")+i;case 5292:return Ke+i+Gt+We(i,"basis","preferred-size")+i;case 6060:return Ke+"box-"+We(i,"-grow","")+Ke+i+Gt+We(i,"grow","positive")+i;case 4554:return Ke+We(i,/([^-])(transform)/g,"$1"+Ke+"$2")+i;case 6187:return We(We(We(i,/(zoom-|grab)/,Ke+"$1"),/(image-set)/,Ke+"$1"),i,"")+i;case 5495:case 3959:return We(i,/(image-set\([^]*)/,Ke+"$1$`$1");case 4968:return We(We(i,/(.+:)(flex-)?(.*)/,Ke+"box-pack:$3"+Gt+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ke+i+i;case 4095:case 3583:case 4068:case 2532:return We(i,/(.+)-inline(.+)/,Ke+"$1$2")+i;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Ha(i)-1-l>6)switch(Vt(i,l+1)){case 109:if(Vt(i,l+4)!==45)break;case 102:return We(i,/(.+:)(.+)-([^]+)/,"$1"+Ke+"$2-$3$1"+eo+(Vt(i,l+3)==108?"$3":"$2-$3"))+i;case 115:return~sd(i,"stretch")?Xv(We(i,"stretch","fill-available"),l)+i:i}break;case 4949:if(Vt(i,l+1)!==115)break;case 6444:switch(Vt(i,Ha(i)-3-(~sd(i,"!important")&&10))){case 107:return We(i,":",":"+Ke)+i;case 101:return We(i,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ke+(Vt(i,14)===45?"inline-":"")+"box$3$1"+Ke+"$2$3$1"+Gt+"$2box$3")+i}break;case 5936:switch(Vt(i,l+11)){case 114:return Ke+i+Gt+We(i,/[svh]\w+-[tblr]{2}/,"tb")+i;case 108:return Ke+i+Gt+We(i,/[svh]\w+-[tblr]{2}/,"tb-rl")+i;case 45:return Ke+i+Gt+We(i,/[svh]\w+-[tblr]{2}/,"lr")+i}return Ke+i+Gt+i+i}return i}var p1=function(l,d,u,c){if(l.length>-1&&!l.return)switch(l.type){case vd:l.return=Xv(l.value,l.length);break;case $v:return fi([cl(l,{value:We(l.value,"@","@"+Ke)})],c);case pd:if(l.length)return Jj(l.props,function(m){switch(Zj(m,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return fi([cl(l,{props:[We(m,/:(read-\w+)/,":"+eo+"$1")]})],c);case"::placeholder":return fi([cl(l,{props:[We(m,/:(plac\w+)/,":"+Ke+"input-$1")]}),cl(l,{props:[We(m,/:(plac\w+)/,":"+eo+"$1")]}),cl(l,{props:[We(m,/:(plac\w+)/,Gt+"input-$1")]})],c)}return""})}},v1=[p1],g1=function(l){var d=l.key;if(d==="css"){var u=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(u,function(b){var _=b.getAttribute("data-emotion");_.indexOf(" ")!==-1&&(document.head.appendChild(b),b.setAttribute("data-s",""))})}var c=l.stylisPlugins||v1,m={},v,y=[];v=l.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+d+' "]'),function(b){for(var _=b.getAttribute("data-emotion").split(" "),O=1;O<_.length;O++)m[_[O]]=!0;y.push(b)});var h,p=[m1,h1];{var S,C=[l1,o1(function(b){S.insert(b)})],D=r1(p.concat(c,C)),R=function(_){return fi(s1(_),D)};h=function(_,O,q,E){S=q,R(_?_+"{"+O.styles+"}":O.styles),E&&(k.inserted[O.name]=!0)}}var k={key:d,sheet:new Pj({key:d,container:v,nonce:l.nonce,speedy:l.speedy,prepend:l.prepend,insertionPoint:l.insertionPoint}),nonce:l.nonce,inserted:m,registered:{},insert:h};return k.sheet.hydrate(y),k},wu={exports:{}},et={};/** @license React v16.13.1
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Bp;function b1(){if(Bp)return et;Bp=1;var i=typeof Symbol=="function"&&Symbol.for,l=i?Symbol.for("react.element"):60103,d=i?Symbol.for("react.portal"):60106,u=i?Symbol.for("react.fragment"):60107,c=i?Symbol.for("react.strict_mode"):60108,m=i?Symbol.for("react.profiler"):60114,v=i?Symbol.for("react.provider"):60109,y=i?Symbol.for("react.context"):60110,h=i?Symbol.for("react.async_mode"):60111,p=i?Symbol.for("react.concurrent_mode"):60111,S=i?Symbol.for("react.forward_ref"):60112,C=i?Symbol.for("react.suspense"):60113,D=i?Symbol.for("react.suspense_list"):60120,R=i?Symbol.for("react.memo"):60115,k=i?Symbol.for("react.lazy"):60116,b=i?Symbol.for("react.block"):60121,_=i?Symbol.for("react.fundamental"):60117,O=i?Symbol.for("react.responder"):60118,q=i?Symbol.for("react.scope"):60119;function E(N){if(typeof N=="object"&&N!==null){var G=N.$$typeof;switch(G){case l:switch(N=N.type,N){case h:case p:case u:case m:case c:case C:return N;default:switch(N=N&&N.$$typeof,N){case y:case S:case k:case R:case v:return N;default:return G}}case d:return G}}}function j(N){return E(N)===p}return et.AsyncMode=h,et.ConcurrentMode=p,et.ContextConsumer=y,et.ContextProvider=v,et.Element=l,et.ForwardRef=S,et.Fragment=u,et.Lazy=k,et.Memo=R,et.Portal=d,et.Profiler=m,et.StrictMode=c,et.Suspense=C,et.isAsyncMode=function(N){return j(N)||E(N)===h},et.isConcurrentMode=j,et.isContextConsumer=function(N){return E(N)===y},et.isContextProvider=function(N){return E(N)===v},et.isElement=function(N){return typeof N=="object"&&N!==null&&N.$$typeof===l},et.isForwardRef=function(N){return E(N)===S},et.isFragment=function(N){return E(N)===u},et.isLazy=function(N){return E(N)===k},et.isMemo=function(N){return E(N)===R},et.isPortal=function(N){return E(N)===d},et.isProfiler=function(N){return E(N)===m},et.isStrictMode=function(N){return E(N)===c},et.isSuspense=function(N){return E(N)===C},et.isValidElementType=function(N){return typeof N=="string"||typeof N=="function"||N===u||N===p||N===m||N===c||N===C||N===D||typeof N=="object"&&N!==null&&(N.$$typeof===k||N.$$typeof===R||N.$$typeof===v||N.$$typeof===y||N.$$typeof===S||N.$$typeof===_||N.$$typeof===O||N.$$typeof===q||N.$$typeof===b)},et.typeOf=E,et}var $p;function x1(){return $p||($p=1,wu.exports=b1()),wu.exports}var ku,Fp;function y1(){if(Fp)return ku;Fp=1;var i=x1(),l={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},d={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},u={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},c={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},m={};m[i.ForwardRef]=u,m[i.Memo]=c;function v(k){return i.isMemo(k)?c:m[k.$$typeof]||l}var y=Object.defineProperty,h=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,S=Object.getOwnPropertyDescriptor,C=Object.getPrototypeOf,D=Object.prototype;function R(k,b,_){if(typeof b!="string"){if(D){var O=C(b);O&&O!==D&&R(k,O,_)}var q=h(b);p&&(q=q.concat(p(b)));for(var E=v(k),j=v(b),N=0;N<q.length;++N){var G=q[N];if(!d[G]&&!(_&&_[G])&&!(j&&j[G])&&!(E&&E[G])){var w=S(b,G);try{y(k,G,w)}catch{}}}}return k}return ku=R,ku}y1();var j1=!0;function S1(i,l,d){var u="";return d.split(" ").forEach(function(c){i[c]!==void 0?l.push(i[c]+";"):c&&(u+=c+" ")}),u}var Iv=function(l,d,u){var c=l.key+"-"+d.name;(u===!1||j1===!1)&&l.registered[c]===void 0&&(l.registered[c]=d.styles)},N1=function(l,d,u){Iv(l,d,u);var c=l.key+"-"+d.name;if(l.inserted[d.name]===void 0){var m=d;do l.insert(d===m?"."+c:"",m,l.sheet,!0),m=m.next;while(m!==void 0)}};function C1(i){for(var l=0,d,u=0,c=i.length;c>=4;++u,c-=4)d=i.charCodeAt(u)&255|(i.charCodeAt(++u)&255)<<8|(i.charCodeAt(++u)&255)<<16|(i.charCodeAt(++u)&255)<<24,d=(d&65535)*1540483477+((d>>>16)*59797<<16),d^=d>>>24,l=(d&65535)*1540483477+((d>>>16)*59797<<16)^(l&65535)*1540483477+((l>>>16)*59797<<16);switch(c){case 3:l^=(i.charCodeAt(u+2)&255)<<16;case 2:l^=(i.charCodeAt(u+1)&255)<<8;case 1:l^=i.charCodeAt(u)&255,l=(l&65535)*1540483477+((l>>>16)*59797<<16)}return l^=l>>>13,l=(l&65535)*1540483477+((l>>>16)*59797<<16),((l^l>>>15)>>>0).toString(36)}var _1={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},T1=/[A-Z]|^ms/g,O1=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Qv=function(l){return l.charCodeAt(1)===45},Pp=function(l){return l!=null&&typeof l!="boolean"},Du=c1(function(i){return Qv(i)?i:i.replace(T1,"-$&").toLowerCase()}),Gp=function(l,d){switch(l){case"animation":case"animationName":if(typeof d=="string")return d.replace(O1,function(u,c,m){return Va={name:c,styles:m,next:Va},c})}return _1[l]!==1&&!Qv(l)&&typeof d=="number"&&d!==0?d+"px":d};function bl(i,l,d){if(d==null)return"";var u=d;if(u.__emotion_styles!==void 0)return u;switch(typeof d){case"boolean":return"";case"object":{var c=d;if(c.anim===1)return Va={name:c.name,styles:c.styles,next:Va},c.name;var m=d;if(m.styles!==void 0){var v=m.next;if(v!==void 0)for(;v!==void 0;)Va={name:v.name,styles:v.styles,next:Va},v=v.next;var y=m.styles+";";return y}return E1(i,l,d)}case"function":{if(i!==void 0){var h=Va,p=d(i);return Va=h,bl(i,l,p)}break}}var S=d;return S}function E1(i,l,d){var u="";if(Array.isArray(d))for(var c=0;c<d.length;c++)u+=bl(i,l,d[c])+";";else for(var m in d){var v=d[m];if(typeof v!="object"){var y=v;Pp(y)&&(u+=Du(m)+":"+Gp(m,y)+";")}else if(Array.isArray(v)&&typeof v[0]=="string"&&l==null)for(var h=0;h<v.length;h++)Pp(v[h])&&(u+=Du(m)+":"+Gp(m,v[h])+";");else{var p=bl(i,l,v);switch(m){case"animation":case"animationName":{u+=Du(m)+":"+p+";";break}default:u+=m+"{"+p+"}"}}}return u}var Yp=/label:\s*([^\s;{]+)\s*(;|$)/g,Va;function Zv(i,l,d){if(i.length===1&&typeof i[0]=="object"&&i[0]!==null&&i[0].styles!==void 0)return i[0];var u=!0,c="";Va=void 0;var m=i[0];if(m==null||m.raw===void 0)u=!1,c+=bl(d,l,m);else{var v=m;c+=v[0]}for(var y=1;y<i.length;y++)if(c+=bl(d,l,i[y]),u){var h=m;c+=h[y]}Yp.lastIndex=0;for(var p="",S;(S=Yp.exec(c))!==null;)p+="-"+S[1];var C=C1(c)+p;return{name:C,styles:c,next:Va}}var z1=function(l){return l()},M1=jp.useInsertionEffect?jp.useInsertionEffect:!1,A1=M1||z1,Jv=g.createContext(typeof HTMLElement<"u"?g1({key:"css"}):null);Jv.Provider;var w1=function(l){return g.forwardRef(function(d,u){var c=g.useContext(Jv);return l(d,c,u)})},k1=g.createContext({}),bd={}.hasOwnProperty,ld="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",D1=function(l,d){var u={};for(var c in d)bd.call(d,c)&&(u[c]=d[c]);return u[ld]=l,u},R1=function(l){var d=l.cache,u=l.serialized,c=l.isStringTag;return Iv(d,u,c),A1(function(){return N1(d,u,c)}),null},U1=w1(function(i,l,d){var u=i.css;typeof u=="string"&&l.registered[u]!==void 0&&(u=l.registered[u]);var c=i[ld],m=[u],v="";typeof i.className=="string"?v=S1(l.registered,m,i.className):i.className!=null&&(v=i.className+" ");var y=Zv(m,void 0,g.useContext(k1));v+=l.key+"-"+y.name;var h={};for(var p in i)bd.call(i,p)&&p!=="css"&&p!==ld&&(h[p]=i[p]);return h.className=v,d&&(h.ref=d),g.createElement(g.Fragment,null,g.createElement(R1,{cache:l,serialized:y,isStringTag:typeof c=="string"}),g.createElement(c,h))}),L1=U1,Ae=function(l,d){var u=arguments;if(d==null||!bd.call(d,"css"))return g.createElement.apply(void 0,u);var c=u.length,m=new Array(c);m[0]=L1,m[1]=D1(l,d);for(var v=2;v<c;v++)m[v]=u[v];return g.createElement.apply(null,m)};(function(i){var l;l||(l=i.JSX||(i.JSX={}))})(Ae||(Ae={}));function xd(){for(var i=arguments.length,l=new Array(i),d=0;d<i;d++)l[d]=arguments[d];return Zv(l)}function q1(){var i=xd.apply(void 0,arguments),l="animation-"+i.name;return{name:l,styles:"@keyframes "+l+"{"+i.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}function H1(i,l){return l||(l=i.slice(0)),Object.freeze(Object.defineProperties(i,{raw:{value:Object.freeze(l)}}))}const V1=Math.min,B1=Math.max,to=Math.round,qr=Math.floor,ao=i=>({x:i,y:i});function $1(i){const{x:l,y:d,width:u,height:c}=i;return{width:u,height:c,top:d,left:l,right:l+u,bottom:d+c,x:l,y:d}}function ho(){return typeof window<"u"}function Kv(i){return eg(i)?(i.nodeName||"").toLowerCase():"#document"}function pn(i){var l;return(i==null||(l=i.ownerDocument)==null?void 0:l.defaultView)||window}function Wv(i){var l;return(l=(eg(i)?i.ownerDocument:i.document)||window.document)==null?void 0:l.documentElement}function eg(i){return ho()?i instanceof Node||i instanceof pn(i).Node:!1}function F1(i){return ho()?i instanceof Element||i instanceof pn(i).Element:!1}function yd(i){return ho()?i instanceof HTMLElement||i instanceof pn(i).HTMLElement:!1}function Xp(i){return!ho()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof pn(i).ShadowRoot}const P1=new Set(["inline","contents"]);function tg(i){const{overflow:l,overflowX:d,overflowY:u,display:c}=jd(i);return/auto|scroll|overlay|hidden|clip/.test(l+u+d)&&!P1.has(c)}function G1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Y1=new Set(["html","body","#document"]);function X1(i){return Y1.has(Kv(i))}function jd(i){return pn(i).getComputedStyle(i)}function I1(i){if(Kv(i)==="html")return i;const l=i.assignedSlot||i.parentNode||Xp(i)&&i.host||Wv(i);return Xp(l)?l.host:l}function ag(i){const l=I1(i);return X1(l)?i.ownerDocument?i.ownerDocument.body:i.body:yd(l)&&tg(l)?l:ag(l)}function no(i,l,d){var u;l===void 0&&(l=[]),d===void 0&&(d=!0);const c=ag(i),m=c===((u=i.ownerDocument)==null?void 0:u.body),v=pn(c);if(m){const y=rd(v);return l.concat(v,v.visualViewport||[],tg(c)?c:[],y&&d?no(y):[])}return l.concat(c,no(c,[],d))}function rd(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function Q1(i){const l=jd(i);let d=parseFloat(l.width)||0,u=parseFloat(l.height)||0;const c=yd(i),m=c?i.offsetWidth:d,v=c?i.offsetHeight:u,y=to(d)!==m||to(u)!==v;return y&&(d=m,u=v),{width:d,height:u,$:y}}function Sd(i){return F1(i)?i:i.contextElement}function Ip(i){const l=Sd(i);if(!yd(l))return ao(1);const d=l.getBoundingClientRect(),{width:u,height:c,$:m}=Q1(l);let v=(m?to(d.width):d.width)/u,y=(m?to(d.height):d.height)/c;return(!v||!Number.isFinite(v))&&(v=1),(!y||!Number.isFinite(y))&&(y=1),{x:v,y}}const Z1=ao(0);function J1(i){const l=pn(i);return!G1()||!l.visualViewport?Z1:{x:l.visualViewport.offsetLeft,y:l.visualViewport.offsetTop}}function K1(i,l,d){return!1}function Qp(i,l,d,u){l===void 0&&(l=!1);const c=i.getBoundingClientRect(),m=Sd(i);let v=ao(1);l&&(v=Ip(i));const y=K1()?J1(m):ao(0);let h=(c.left+y.x)/v.x,p=(c.top+y.y)/v.y,S=c.width/v.x,C=c.height/v.y;if(m){const D=pn(m),R=u;let k=D,b=rd(k);for(;b&&u&&R!==k;){const _=Ip(b),O=b.getBoundingClientRect(),q=jd(b),E=O.left+(b.clientLeft+parseFloat(q.paddingLeft))*_.x,j=O.top+(b.clientTop+parseFloat(q.paddingTop))*_.y;h*=_.x,p*=_.y,S*=_.x,C*=_.y,h+=E,p+=j,k=pn(b),b=rd(k)}}return $1({width:S,height:C,x:h,y:p})}function ng(i,l){return i.x===l.x&&i.y===l.y&&i.width===l.width&&i.height===l.height}function W1(i,l){let d=null,u;const c=Wv(i);function m(){var y;clearTimeout(u),(y=d)==null||y.disconnect(),d=null}function v(y,h){y===void 0&&(y=!1),h===void 0&&(h=1),m();const p=i.getBoundingClientRect(),{left:S,top:C,width:D,height:R}=p;if(y||l(),!D||!R)return;const k=qr(C),b=qr(c.clientWidth-(S+D)),_=qr(c.clientHeight-(C+R)),O=qr(S),E={rootMargin:-k+"px "+-b+"px "+-_+"px "+-O+"px",threshold:B1(0,V1(1,h))||1};let j=!0;function N(G){const w=G[0].intersectionRatio;if(w!==h){if(!j)return v();w?v(!1,w):u=setTimeout(()=>{v(!1,1e-7)},1e3)}w===1&&!ng(p,i.getBoundingClientRect())&&v(),j=!1}try{d=new IntersectionObserver(N,{...E,root:c.ownerDocument})}catch{d=new IntersectionObserver(N,E)}d.observe(i)}return v(!0),m}function e2(i,l,d,u){u===void 0&&(u={});const{ancestorScroll:c=!0,ancestorResize:m=!0,elementResize:v=typeof ResizeObserver=="function",layoutShift:y=typeof IntersectionObserver=="function",animationFrame:h=!1}=u,p=Sd(i),S=c||m?[...p?no(p):[],...no(l)]:[];S.forEach(O=>{c&&O.addEventListener("scroll",d,{passive:!0}),m&&O.addEventListener("resize",d)});const C=p&&y?W1(p,d):null;let D=-1,R=null;v&&(R=new ResizeObserver(O=>{let[q]=O;q&&q.target===p&&R&&(R.unobserve(l),cancelAnimationFrame(D),D=requestAnimationFrame(()=>{var E;(E=R)==null||E.observe(l)})),d()}),p&&!h&&R.observe(p),R.observe(l));let k,b=h?Qp(i):null;h&&_();function _(){const O=Qp(i);b&&!ng(b,O)&&d(),b=O,k=requestAnimationFrame(_)}return d(),()=>{var O;S.forEach(q=>{c&&q.removeEventListener("scroll",d),m&&q.removeEventListener("resize",d)}),C==null||C(),(O=R)==null||O.disconnect(),R=null,h&&cancelAnimationFrame(k)}}var od=g.useLayoutEffect,t2=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],so=function(){};function a2(i,l){return l?l[0]==="-"?i+l:i+"__"+l:i}function n2(i,l){for(var d=arguments.length,u=new Array(d>2?d-2:0),c=2;c<d;c++)u[c-2]=arguments[c];var m=[].concat(u);if(l&&i)for(var v in l)l.hasOwnProperty(v)&&l[v]&&m.push("".concat(a2(i,v)));return m.filter(function(y){return y}).map(function(y){return String(y).trim()}).join(" ")}var Zp=function(l){return f2(l)?l.filter(Boolean):Ss(l)==="object"&&l!==null?[l]:[]},sg=function(l){l.className,l.clearValue,l.cx,l.getStyles,l.getClassNames,l.getValue,l.hasValue,l.isMulti,l.isRtl,l.options,l.selectOption,l.selectProps,l.setValue,l.theme;var d=vn(l,t2);return we({},d)},xt=function(l,d,u){var c=l.cx,m=l.getStyles,v=l.getClassNames,y=l.className;return{css:m(d,l),className:c(u??{},v(d,l),y)}};function po(i){return[document.documentElement,document.body,window].indexOf(i)>-1}function s2(i){return po(i)?window.innerHeight:i.clientHeight}function ig(i){return po(i)?window.pageYOffset:i.scrollTop}function io(i,l){if(po(i)){window.scrollTo(0,l);return}i.scrollTop=l}function i2(i){var l=getComputedStyle(i),d=l.position==="absolute",u=/(auto|scroll)/;if(l.position==="fixed")return document.documentElement;for(var c=i;c=c.parentElement;)if(l=getComputedStyle(c),!(d&&l.position==="static")&&u.test(l.overflow+l.overflowY+l.overflowX))return c;return document.documentElement}function l2(i,l,d,u){return d*((i=i/u-1)*i*i+1)+l}function Hr(i,l){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:so,c=ig(i),m=l-c,v=10,y=0;function h(){y+=v;var p=l2(y,c,m,d);io(i,p),y<d?window.requestAnimationFrame(h):u(i)}h()}function Jp(i,l){var d=i.getBoundingClientRect(),u=l.getBoundingClientRect(),c=l.offsetHeight/3;u.bottom+c>d.bottom?io(i,Math.min(l.offsetTop+l.clientHeight-i.offsetHeight+c,i.scrollHeight)):u.top-c<d.top&&io(i,Math.max(l.offsetTop-c,0))}function r2(i){var l=i.getBoundingClientRect();return{bottom:l.bottom,height:l.height,left:l.left,right:l.right,top:l.top,width:l.width}}function Kp(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function o2(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var lg=!1,c2={get passive(){return lg=!0}},Vr=typeof window<"u"?window:{};Vr.addEventListener&&Vr.removeEventListener&&(Vr.addEventListener("p",so,c2),Vr.removeEventListener("p",so,!1));var u2=lg;function d2(i){return i!=null}function f2(i){return Array.isArray(i)}function Br(i,l,d){return i?l:d}var m2=function(l){for(var d=arguments.length,u=new Array(d>1?d-1:0),c=1;c<d;c++)u[c-1]=arguments[c];var m=Object.entries(l).filter(function(v){var y=mn(v,1),h=y[0];return!u.includes(h)});return m.reduce(function(v,y){var h=mn(y,2),p=h[0],S=h[1];return v[p]=S,v},{})},h2=["children","innerProps"],p2=["children","innerProps"];function v2(i){var l=i.maxHeight,d=i.menuEl,u=i.minHeight,c=i.placement,m=i.shouldScroll,v=i.isFixedPosition,y=i.controlHeight,h=i2(d),p={placement:"bottom",maxHeight:l};if(!d||!d.offsetParent)return p;var S=h.getBoundingClientRect(),C=S.height,D=d.getBoundingClientRect(),R=D.bottom,k=D.height,b=D.top,_=d.offsetParent.getBoundingClientRect(),O=_.top,q=v?window.innerHeight:s2(h),E=ig(h),j=parseInt(getComputedStyle(d).marginBottom,10),N=parseInt(getComputedStyle(d).marginTop,10),G=O-N,w=q-b,ae=G+E,oe=C-E-b,W=R-q+E+j,V=E+b-N,P=160;switch(c){case"auto":case"bottom":if(w>=k)return{placement:"bottom",maxHeight:l};if(oe>=k&&!v)return m&&Hr(h,W,P),{placement:"bottom",maxHeight:l};if(!v&&oe>=u||v&&w>=u){m&&Hr(h,W,P);var ce=v?w-j:oe-j;return{placement:"bottom",maxHeight:ce}}if(c==="auto"||v){var ye=l,je=v?G:ae;return je>=u&&(ye=Math.min(je-j-y,l)),{placement:"top",maxHeight:ye}}if(c==="bottom")return m&&io(h,W),{placement:"bottom",maxHeight:l};break;case"top":if(G>=k)return{placement:"top",maxHeight:l};if(ae>=k&&!v)return m&&Hr(h,V,P),{placement:"top",maxHeight:l};if(!v&&ae>=u||v&&G>=u){var F=l;return(!v&&ae>=u||v&&G>=u)&&(F=v?G-N:ae-N),m&&Hr(h,V,P),{placement:"top",maxHeight:F}}return{placement:"bottom",maxHeight:l};default:throw new Error('Invalid placement provided "'.concat(c,'".'))}return p}function g2(i){var l={bottom:"top",top:"bottom"};return i?l[i]:"bottom"}var rg=function(l){return l==="auto"?"bottom":l},b2=function(l,d){var u,c=l.placement,m=l.theme,v=m.borderRadius,y=m.spacing,h=m.colors;return we((u={label:"menu"},ml(u,g2(c),"100%"),ml(u,"position","absolute"),ml(u,"width","100%"),ml(u,"zIndex",1),u),d?{}:{backgroundColor:h.neutral0,borderRadius:v,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:y.menuGutter,marginTop:y.menuGutter})},og=g.createContext(null),x2=function(l){var d=l.children,u=l.minMenuHeight,c=l.maxMenuHeight,m=l.menuPlacement,v=l.menuPosition,y=l.menuShouldScrollIntoView,h=l.theme,p=g.useContext(og)||{},S=p.setPortalPlacement,C=g.useRef(null),D=g.useState(c),R=mn(D,2),k=R[0],b=R[1],_=g.useState(null),O=mn(_,2),q=O[0],E=O[1],j=h.spacing.controlHeight;return od(function(){var N=C.current;if(N){var G=v==="fixed",w=y&&!G,ae=v2({maxHeight:c,menuEl:N,minHeight:u,placement:m,shouldScroll:w,isFixedPosition:G,controlHeight:j});b(ae.maxHeight),E(ae.placement),S==null||S(ae.placement)}},[c,m,v,y,u,S,j]),d({ref:C,placerProps:we(we({},l),{},{placement:q||rg(m),maxHeight:k})})},y2=function(l){var d=l.children,u=l.innerRef,c=l.innerProps;return Ae("div",Re({},xt(l,"menu",{menu:!0}),{ref:u},c),d)},j2=y2,S2=function(l,d){var u=l.maxHeight,c=l.theme.spacing.baseUnit;return we({maxHeight:u,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},d?{}:{paddingBottom:c,paddingTop:c})},N2=function(l){var d=l.children,u=l.innerProps,c=l.innerRef,m=l.isMulti;return Ae("div",Re({},xt(l,"menuList",{"menu-list":!0,"menu-list--is-multi":m}),{ref:c},u),d)},cg=function(l,d){var u=l.theme,c=u.spacing.baseUnit,m=u.colors;return we({textAlign:"center"},d?{}:{color:m.neutral40,padding:"".concat(c*2,"px ").concat(c*3,"px")})},C2=cg,_2=cg,T2=function(l){var d=l.children,u=d===void 0?"No options":d,c=l.innerProps,m=vn(l,h2);return Ae("div",Re({},xt(we(we({},m),{},{children:u,innerProps:c}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),c),u)},O2=function(l){var d=l.children,u=d===void 0?"Loading...":d,c=l.innerProps,m=vn(l,p2);return Ae("div",Re({},xt(we(we({},m),{},{children:u,innerProps:c}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),c),u)},E2=function(l){var d=l.rect,u=l.offset,c=l.position;return{left:d.left,position:c,top:u,width:d.width,zIndex:1}},z2=function(l){var d=l.appendTo,u=l.children,c=l.controlElement,m=l.innerProps,v=l.menuPlacement,y=l.menuPosition,h=g.useRef(null),p=g.useRef(null),S=g.useState(rg(v)),C=mn(S,2),D=C[0],R=C[1],k=g.useMemo(function(){return{setPortalPlacement:R}},[]),b=g.useState(null),_=mn(b,2),O=_[0],q=_[1],E=g.useCallback(function(){if(c){var w=r2(c),ae=y==="fixed"?0:window.pageYOffset,oe=w[D]+ae;(oe!==(O==null?void 0:O.offset)||w.left!==(O==null?void 0:O.rect.left)||w.width!==(O==null?void 0:O.rect.width))&&q({offset:oe,rect:w})}},[c,y,D,O==null?void 0:O.offset,O==null?void 0:O.rect.left,O==null?void 0:O.rect.width]);od(function(){E()},[E]);var j=g.useCallback(function(){typeof p.current=="function"&&(p.current(),p.current=null),c&&h.current&&(p.current=e2(c,h.current,E,{elementResize:"ResizeObserver"in window}))},[c,E]);od(function(){j()},[j]);var N=g.useCallback(function(w){h.current=w,j()},[j]);if(!d&&y!=="fixed"||!O)return null;var G=Ae("div",Re({ref:N},xt(we(we({},l),{},{offset:O.offset,position:y,rect:O.rect}),"menuPortal",{"menu-portal":!0}),m),u);return Ae(og.Provider,{value:k},d?Bt.createPortal(G,d):G)},M2=function(l){var d=l.isDisabled,u=l.isRtl;return{label:"container",direction:u?"rtl":void 0,pointerEvents:d?"none":void 0,position:"relative"}},A2=function(l){var d=l.children,u=l.innerProps,c=l.isDisabled,m=l.isRtl;return Ae("div",Re({},xt(l,"container",{"--is-disabled":c,"--is-rtl":m}),u),d)},w2=function(l,d){var u=l.theme.spacing,c=l.isMulti,m=l.hasValue,v=l.selectProps.controlShouldRenderValue;return we({alignItems:"center",display:c&&m&&v?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},d?{}:{padding:"".concat(u.baseUnit/2,"px ").concat(u.baseUnit*2,"px")})},k2=function(l){var d=l.children,u=l.innerProps,c=l.isMulti,m=l.hasValue;return Ae("div",Re({},xt(l,"valueContainer",{"value-container":!0,"value-container--is-multi":c,"value-container--has-value":m}),u),d)},D2=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},R2=function(l){var d=l.children,u=l.innerProps;return Ae("div",Re({},xt(l,"indicatorsContainer",{indicators:!0}),u),d)},Wp,U2=["size"],L2=["innerProps","isRtl","size"],q2={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},ug=function(l){var d=l.size,u=vn(l,U2);return Ae("svg",Re({height:d,width:d,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:q2},u))},Nd=function(l){return Ae(ug,Re({size:20},l),Ae("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},dg=function(l){return Ae(ug,Re({size:20},l),Ae("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},fg=function(l,d){var u=l.isFocused,c=l.theme,m=c.spacing.baseUnit,v=c.colors;return we({label:"indicatorContainer",display:"flex",transition:"color 150ms"},d?{}:{color:u?v.neutral60:v.neutral20,padding:m*2,":hover":{color:u?v.neutral80:v.neutral40}})},H2=fg,V2=function(l){var d=l.children,u=l.innerProps;return Ae("div",Re({},xt(l,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),u),d||Ae(dg,null))},B2=fg,$2=function(l){var d=l.children,u=l.innerProps;return Ae("div",Re({},xt(l,"clearIndicator",{indicator:!0,"clear-indicator":!0}),u),d||Ae(Nd,null))},F2=function(l,d){var u=l.isDisabled,c=l.theme,m=c.spacing.baseUnit,v=c.colors;return we({label:"indicatorSeparator",alignSelf:"stretch",width:1},d?{}:{backgroundColor:u?v.neutral10:v.neutral20,marginBottom:m*2,marginTop:m*2})},P2=function(l){var d=l.innerProps;return Ae("span",Re({},d,xt(l,"indicatorSeparator",{"indicator-separator":!0})))},G2=q1(Wp||(Wp=H1([`
  0%, 80%, 100% { opacity: 0; }
  40% { opacity: 1; }
`]))),Y2=function(l,d){var u=l.isFocused,c=l.size,m=l.theme,v=m.colors,y=m.spacing.baseUnit;return we({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:c,lineHeight:1,marginRight:c,textAlign:"center",verticalAlign:"middle"},d?{}:{color:u?v.neutral60:v.neutral20,padding:y*2})},Ru=function(l){var d=l.delay,u=l.offset;return Ae("span",{css:xd({animation:"".concat(G2," 1s ease-in-out ").concat(d,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:u?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},X2=function(l){var d=l.innerProps,u=l.isRtl,c=l.size,m=c===void 0?4:c,v=vn(l,L2);return Ae("div",Re({},xt(we(we({},v),{},{innerProps:d,isRtl:u,size:m}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),d),Ae(Ru,{delay:0,offset:u}),Ae(Ru,{delay:160,offset:!0}),Ae(Ru,{delay:320,offset:!u}))},I2=function(l,d){var u=l.isDisabled,c=l.isFocused,m=l.theme,v=m.colors,y=m.borderRadius,h=m.spacing;return we({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:h.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},d?{}:{backgroundColor:u?v.neutral5:v.neutral0,borderColor:u?v.neutral10:c?v.primary:v.neutral20,borderRadius:y,borderStyle:"solid",borderWidth:1,boxShadow:c?"0 0 0 1px ".concat(v.primary):void 0,"&:hover":{borderColor:c?v.primary:v.neutral30}})},Q2=function(l){var d=l.children,u=l.isDisabled,c=l.isFocused,m=l.innerRef,v=l.innerProps,y=l.menuIsOpen;return Ae("div",Re({ref:m},xt(l,"control",{control:!0,"control--is-disabled":u,"control--is-focused":c,"control--menu-is-open":y}),v,{"aria-disabled":u||void 0}),d)},Z2=Q2,J2=["data"],K2=function(l,d){var u=l.theme.spacing;return d?{}:{paddingBottom:u.baseUnit*2,paddingTop:u.baseUnit*2}},W2=function(l){var d=l.children,u=l.cx,c=l.getStyles,m=l.getClassNames,v=l.Heading,y=l.headingProps,h=l.innerProps,p=l.label,S=l.theme,C=l.selectProps;return Ae("div",Re({},xt(l,"group",{group:!0}),h),Ae(v,Re({},y,{selectProps:C,theme:S,getStyles:c,getClassNames:m,cx:u}),p),Ae("div",null,d))},eS=function(l,d){var u=l.theme,c=u.colors,m=u.spacing;return we({label:"group",cursor:"default",display:"block"},d?{}:{color:c.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:m.baseUnit*3,paddingRight:m.baseUnit*3,textTransform:"uppercase"})},tS=function(l){var d=sg(l);d.data;var u=vn(d,J2);return Ae("div",Re({},xt(l,"groupHeading",{"group-heading":!0}),u))},aS=W2,nS=["innerRef","isDisabled","isHidden","inputClassName"],sS=function(l,d){var u=l.isDisabled,c=l.value,m=l.theme,v=m.spacing,y=m.colors;return we(we({visibility:u?"hidden":"visible",transform:c?"translateZ(0)":""},iS),d?{}:{margin:v.baseUnit/2,paddingBottom:v.baseUnit/2,paddingTop:v.baseUnit/2,color:y.neutral80})},mg={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},iS={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":we({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},mg)},lS=function(l){return we({label:"input",color:"inherit",background:0,opacity:l?0:1,width:"100%"},mg)},rS=function(l){var d=l.cx,u=l.value,c=sg(l),m=c.innerRef,v=c.isDisabled,y=c.isHidden,h=c.inputClassName,p=vn(c,nS);return Ae("div",Re({},xt(l,"input",{"input-container":!0}),{"data-value":u||""}),Ae("input",Re({className:d({input:!0},h),ref:m,style:lS(y),disabled:v},p)))},oS=rS,cS=function(l,d){var u=l.theme,c=u.spacing,m=u.borderRadius,v=u.colors;return we({label:"multiValue",display:"flex",minWidth:0},d?{}:{backgroundColor:v.neutral10,borderRadius:m/2,margin:c.baseUnit/2})},uS=function(l,d){var u=l.theme,c=u.borderRadius,m=u.colors,v=l.cropWithEllipsis;return we({overflow:"hidden",textOverflow:v||v===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},d?{}:{borderRadius:c/2,color:m.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},dS=function(l,d){var u=l.theme,c=u.spacing,m=u.borderRadius,v=u.colors,y=l.isFocused;return we({alignItems:"center",display:"flex"},d?{}:{borderRadius:m/2,backgroundColor:y?v.dangerLight:void 0,paddingLeft:c.baseUnit,paddingRight:c.baseUnit,":hover":{backgroundColor:v.dangerLight,color:v.danger}})},hg=function(l){var d=l.children,u=l.innerProps;return Ae("div",u,d)},fS=hg,mS=hg;function hS(i){var l=i.children,d=i.innerProps;return Ae("div",Re({role:"button"},d),l||Ae(Nd,{size:14}))}var pS=function(l){var d=l.children,u=l.components,c=l.data,m=l.innerProps,v=l.isDisabled,y=l.removeProps,h=l.selectProps,p=u.Container,S=u.Label,C=u.Remove;return Ae(p,{data:c,innerProps:we(we({},xt(l,"multiValue",{"multi-value":!0,"multi-value--is-disabled":v})),m),selectProps:h},Ae(S,{data:c,innerProps:we({},xt(l,"multiValueLabel",{"multi-value__label":!0})),selectProps:h},d),Ae(C,{data:c,innerProps:we(we({},xt(l,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(d||"option")},y),selectProps:h}))},vS=pS,gS=function(l,d){var u=l.isDisabled,c=l.isFocused,m=l.isSelected,v=l.theme,y=v.spacing,h=v.colors;return we({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},d?{}:{backgroundColor:m?h.primary:c?h.primary25:"transparent",color:u?h.neutral20:m?h.neutral0:"inherit",padding:"".concat(y.baseUnit*2,"px ").concat(y.baseUnit*3,"px"),":active":{backgroundColor:u?void 0:m?h.primary:h.primary50}})},bS=function(l){var d=l.children,u=l.isDisabled,c=l.isFocused,m=l.isSelected,v=l.innerRef,y=l.innerProps;return Ae("div",Re({},xt(l,"option",{option:!0,"option--is-disabled":u,"option--is-focused":c,"option--is-selected":m}),{ref:v,"aria-disabled":u},y),d)},xS=bS,yS=function(l,d){var u=l.theme,c=u.spacing,m=u.colors;return we({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},d?{}:{color:m.neutral50,marginLeft:c.baseUnit/2,marginRight:c.baseUnit/2})},jS=function(l){var d=l.children,u=l.innerProps;return Ae("div",Re({},xt(l,"placeholder",{placeholder:!0}),u),d)},SS=jS,NS=function(l,d){var u=l.isDisabled,c=l.theme,m=c.spacing,v=c.colors;return we({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},d?{}:{color:u?v.neutral40:v.neutral80,marginLeft:m.baseUnit/2,marginRight:m.baseUnit/2})},CS=function(l){var d=l.children,u=l.isDisabled,c=l.innerProps;return Ae("div",Re({},xt(l,"singleValue",{"single-value":!0,"single-value--is-disabled":u}),c),d)},_S=CS,TS={ClearIndicator:$2,Control:Z2,DropdownIndicator:V2,DownChevron:dg,CrossIcon:Nd,Group:aS,GroupHeading:tS,IndicatorsContainer:R2,IndicatorSeparator:P2,Input:oS,LoadingIndicator:X2,Menu:j2,MenuList:N2,MenuPortal:z2,LoadingMessage:O2,NoOptionsMessage:T2,MultiValue:vS,MultiValueContainer:fS,MultiValueLabel:mS,MultiValueRemove:hS,Option:xS,Placeholder:SS,SelectContainer:A2,SingleValue:_S,ValueContainer:k2},OS=function(l){return we(we({},TS),l.components)},ev=Number.isNaN||function(l){return typeof l=="number"&&l!==l};function ES(i,l){return!!(i===l||ev(i)&&ev(l))}function zS(i,l){if(i.length!==l.length)return!1;for(var d=0;d<i.length;d++)if(!ES(i[d],l[d]))return!1;return!0}function MS(i,l){l===void 0&&(l=zS);var d=null;function u(){for(var c=[],m=0;m<arguments.length;m++)c[m]=arguments[m];if(d&&d.lastThis===this&&l(c,d.lastArgs))return d.lastResult;var v=i.apply(this,c);return d={lastResult:v,lastArgs:c,lastThis:this},v}return u.clear=function(){d=null},u}var AS={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},wS=function(l){return Ae("span",Re({css:AS},l))},tv=wS,kS={guidance:function(l){var d=l.isSearchable,u=l.isMulti,c=l.tabSelectsValue,m=l.context,v=l.isInitialFocus;switch(m){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(c?", press Tab to select the option and exit the menu":"",".");case"input":return v?"".concat(l["aria-label"]||"Select"," is focused ").concat(d?",type to refine list":"",", press Down to open the menu, ").concat(u?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(l){var d=l.action,u=l.label,c=u===void 0?"":u,m=l.labels,v=l.isDisabled;switch(d){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(c,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(m.length>1?"s":""," ").concat(m.join(","),", selected.");case"select-option":return v?"option ".concat(c," is disabled. Select another option."):"option ".concat(c,", selected.");default:return""}},onFocus:function(l){var d=l.context,u=l.focused,c=l.options,m=l.label,v=m===void 0?"":m,y=l.selectValue,h=l.isDisabled,p=l.isSelected,S=l.isAppleDevice,C=function(b,_){return b&&b.length?"".concat(b.indexOf(_)+1," of ").concat(b.length):""};if(d==="value"&&y)return"value ".concat(v," focused, ").concat(C(y,u),".");if(d==="menu"&&S){var D=h?" disabled":"",R="".concat(p?" selected":"").concat(D);return"".concat(v).concat(R,", ").concat(C(c,u),".")}return""},onFilter:function(l){var d=l.inputValue,u=l.resultsMessage;return"".concat(u).concat(d?" for search term "+d:"",".")}},DS=function(l){var d=l.ariaSelection,u=l.focusedOption,c=l.focusedValue,m=l.focusableOptions,v=l.isFocused,y=l.selectValue,h=l.selectProps,p=l.id,S=l.isAppleDevice,C=h.ariaLiveMessages,D=h.getOptionLabel,R=h.inputValue,k=h.isMulti,b=h.isOptionDisabled,_=h.isSearchable,O=h.menuIsOpen,q=h.options,E=h.screenReaderStatus,j=h.tabSelectsValue,N=h.isLoading,G=h["aria-label"],w=h["aria-live"],ae=g.useMemo(function(){return we(we({},kS),C||{})},[C]),oe=g.useMemo(function(){var je="";if(d&&ae.onChange){var F=d.option,K=d.options,fe=d.removedValue,Te=d.removedValues,de=d.value,z=function(Ue){return Array.isArray(Ue)?null:Ue},T=fe||F||z(de),ee=T?D(T):"",ne=K||Te||void 0,he=ne?ne.map(D):[],me=we({isDisabled:T&&b(T,y),label:ee,labels:he},d);je=ae.onChange(me)}return je},[d,ae,b,y,D]),W=g.useMemo(function(){var je="",F=u||c,K=!!(u&&y&&y.includes(u));if(F&&ae.onFocus){var fe={focused:F,label:D(F),isDisabled:b(F,y),isSelected:K,options:m,context:F===u?"menu":"value",selectValue:y,isAppleDevice:S};je=ae.onFocus(fe)}return je},[u,c,D,b,ae,m,y,S]),V=g.useMemo(function(){var je="";if(O&&q.length&&!N&&ae.onFilter){var F=E({count:m.length});je=ae.onFilter({inputValue:R,resultsMessage:F})}return je},[m,R,O,ae,q,E,N]),P=(d==null?void 0:d.action)==="initial-input-focus",ce=g.useMemo(function(){var je="";if(ae.guidance){var F=c?"value":O?"menu":"input";je=ae.guidance({"aria-label":G,context:F,isDisabled:u&&b(u,y),isMulti:k,isSearchable:_,tabSelectsValue:j,isInitialFocus:P})}return je},[G,u,c,k,b,_,O,ae,y,j,P]),ye=Ae(g.Fragment,null,Ae("span",{id:"aria-selection"},oe),Ae("span",{id:"aria-focused"},W),Ae("span",{id:"aria-results"},V),Ae("span",{id:"aria-guidance"},ce));return Ae(g.Fragment,null,Ae(tv,{id:p},P&&ye),Ae(tv,{"aria-live":w,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},v&&!P&&ye))},RS=DS,cd=[{base:"A",letters:"AⒶＡÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷＢḂḄḆɃƂƁ"},{base:"C",letters:"CⒸＣĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹＤḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"ǱǄ"},{base:"Dz",letters:"ǲǅ"},{base:"E",letters:"EⒺＥÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻＦḞƑꝻ"},{base:"G",letters:"GⒼＧǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽＨĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾＩÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿＪĴɈ"},{base:"K",letters:"KⓀＫḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁＬĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"Ǉ"},{base:"Lj",letters:"ǈ"},{base:"M",letters:"MⓂＭḾṀṂⱮƜ"},{base:"N",letters:"NⓃＮǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"Ǌ"},{base:"Nj",letters:"ǋ"},{base:"O",letters:"OⓄＯÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅＰṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆＱꝖꝘɊ"},{base:"R",letters:"RⓇＲŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈＳẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉＴṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊＵÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋＶṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌＷẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍＸẊẌ"},{base:"Y",letters:"YⓎＹỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏＺŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐａẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑｂḃḅḇƀƃɓ"},{base:"c",letters:"cⓒｃćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓｄḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"ǳǆ"},{base:"e",letters:"eⓔｅèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕｆḟƒꝼ"},{base:"g",letters:"gⓖｇǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗｈĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘｉìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙｊĵǰɉ"},{base:"k",letters:"kⓚｋḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛｌŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"ǉ"},{base:"m",letters:"mⓜｍḿṁṃɱɯ"},{base:"n",letters:"nⓝｎǹńñṅňṇņṋṉƞɲŉꞑꞥ"},{base:"nj",letters:"ǌ"},{base:"o",letters:"oⓞｏòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟｐṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠｑɋꝗꝙ"},{base:"r",letters:"rⓡｒŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢｓßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣｔṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤｕùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥｖṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦｗẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧｘẋẍ"},{base:"y",letters:"yⓨｙỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩｚźẑżžẓẕƶȥɀⱬꝣ"}],US=new RegExp("["+cd.map(function(i){return i.letters}).join("")+"]","g"),pg={};for(var Uu=0;Uu<cd.length;Uu++)for(var Lu=cd[Uu],qu=0;qu<Lu.letters.length;qu++)pg[Lu.letters[qu]]=Lu.base;var vg=function(l){return l.replace(US,function(d){return pg[d]})},LS=MS(vg),av=function(l){return l.replace(/^\s+|\s+$/g,"")},qS=function(l){return"".concat(l.label," ").concat(l.value)},HS=function(l){return function(d,u){if(d.data.__isNew__)return!0;var c=we({ignoreCase:!0,ignoreAccents:!0,stringify:qS,trim:!0,matchFrom:"any"},l),m=c.ignoreCase,v=c.ignoreAccents,y=c.stringify,h=c.trim,p=c.matchFrom,S=h?av(u):u,C=h?av(y(d)):y(d);return m&&(S=S.toLowerCase(),C=C.toLowerCase()),v&&(S=LS(S),C=vg(C)),p==="start"?C.substr(0,S.length)===S:C.indexOf(S)>-1}},VS=["innerRef"];function BS(i){var l=i.innerRef,d=vn(i,VS),u=m2(d,"onExited","in","enter","exit","appear");return Ae("input",Re({ref:l},u,{css:xd({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var $S=function(l){l.cancelable&&l.preventDefault(),l.stopPropagation()};function FS(i){var l=i.isEnabled,d=i.onBottomArrive,u=i.onBottomLeave,c=i.onTopArrive,m=i.onTopLeave,v=g.useRef(!1),y=g.useRef(!1),h=g.useRef(0),p=g.useRef(null),S=g.useCallback(function(_,O){if(p.current!==null){var q=p.current,E=q.scrollTop,j=q.scrollHeight,N=q.clientHeight,G=p.current,w=O>0,ae=j-N-E,oe=!1;ae>O&&v.current&&(u&&u(_),v.current=!1),w&&y.current&&(m&&m(_),y.current=!1),w&&O>ae?(d&&!v.current&&d(_),G.scrollTop=j,oe=!0,v.current=!0):!w&&-O>E&&(c&&!y.current&&c(_),G.scrollTop=0,oe=!0,y.current=!0),oe&&$S(_)}},[d,u,c,m]),C=g.useCallback(function(_){S(_,_.deltaY)},[S]),D=g.useCallback(function(_){h.current=_.changedTouches[0].clientY},[]),R=g.useCallback(function(_){var O=h.current-_.changedTouches[0].clientY;S(_,O)},[S]),k=g.useCallback(function(_){if(_){var O=u2?{passive:!1}:!1;_.addEventListener("wheel",C,O),_.addEventListener("touchstart",D,O),_.addEventListener("touchmove",R,O)}},[R,D,C]),b=g.useCallback(function(_){_&&(_.removeEventListener("wheel",C,!1),_.removeEventListener("touchstart",D,!1),_.removeEventListener("touchmove",R,!1))},[R,D,C]);return g.useEffect(function(){if(l){var _=p.current;return k(_),function(){b(_)}}},[l,k,b]),function(_){p.current=_}}var nv=["boxSizing","height","overflow","paddingRight","position"],sv={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function iv(i){i.cancelable&&i.preventDefault()}function lv(i){i.stopPropagation()}function rv(){var i=this.scrollTop,l=this.scrollHeight,d=i+this.offsetHeight;i===0?this.scrollTop=1:d===l&&(this.scrollTop=i-1)}function ov(){return"ontouchstart"in window||navigator.maxTouchPoints}var cv=!!(typeof window<"u"&&window.document&&window.document.createElement),ul=0,oi={capture:!1,passive:!1};function PS(i){var l=i.isEnabled,d=i.accountForScrollbars,u=d===void 0?!0:d,c=g.useRef({}),m=g.useRef(null),v=g.useCallback(function(h){if(cv){var p=document.body,S=p&&p.style;if(u&&nv.forEach(function(k){var b=S&&S[k];c.current[k]=b}),u&&ul<1){var C=parseInt(c.current.paddingRight,10)||0,D=document.body?document.body.clientWidth:0,R=window.innerWidth-D+C||0;Object.keys(sv).forEach(function(k){var b=sv[k];S&&(S[k]=b)}),S&&(S.paddingRight="".concat(R,"px"))}p&&ov()&&(p.addEventListener("touchmove",iv,oi),h&&(h.addEventListener("touchstart",rv,oi),h.addEventListener("touchmove",lv,oi))),ul+=1}},[u]),y=g.useCallback(function(h){if(cv){var p=document.body,S=p&&p.style;ul=Math.max(ul-1,0),u&&ul<1&&nv.forEach(function(C){var D=c.current[C];S&&(S[C]=D)}),p&&ov()&&(p.removeEventListener("touchmove",iv,oi),h&&(h.removeEventListener("touchstart",rv,oi),h.removeEventListener("touchmove",lv,oi)))}},[u]);return g.useEffect(function(){if(l){var h=m.current;return v(h),function(){y(h)}}},[l,v,y]),function(h){m.current=h}}var GS=function(l){var d=l.target;return d.ownerDocument.activeElement&&d.ownerDocument.activeElement.blur()},YS={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function XS(i){var l=i.children,d=i.lockEnabled,u=i.captureEnabled,c=u===void 0?!0:u,m=i.onBottomArrive,v=i.onBottomLeave,y=i.onTopArrive,h=i.onTopLeave,p=FS({isEnabled:c,onBottomArrive:m,onBottomLeave:v,onTopArrive:y,onTopLeave:h}),S=PS({isEnabled:d}),C=function(R){p(R),S(R)};return Ae(g.Fragment,null,d&&Ae("div",{onClick:GS,css:YS}),l(C))}var IS={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},QS=function(l){var d=l.name,u=l.onFocus;return Ae("input",{required:!0,name:d,tabIndex:-1,"aria-hidden":"true",onFocus:u,css:IS,value:"",onChange:function(){}})},ZS=QS;function Cd(i){var l;return typeof window<"u"&&window.navigator!=null?i.test(((l=window.navigator.userAgentData)===null||l===void 0?void 0:l.platform)||window.navigator.platform):!1}function JS(){return Cd(/^iPhone/i)}function gg(){return Cd(/^Mac/i)}function KS(){return Cd(/^iPad/i)||gg()&&navigator.maxTouchPoints>1}function WS(){return JS()||KS()}function eN(){return gg()||WS()}var tN=function(l){return l.label},aN=function(l){return l.label},nN=function(l){return l.value},sN=function(l){return!!l.isDisabled},iN={clearIndicator:B2,container:M2,control:I2,dropdownIndicator:H2,group:K2,groupHeading:eS,indicatorsContainer:D2,indicatorSeparator:F2,input:sS,loadingIndicator:Y2,loadingMessage:_2,menu:b2,menuList:S2,menuPortal:E2,multiValue:cS,multiValueLabel:uS,multiValueRemove:dS,noOptionsMessage:C2,option:gS,placeholder:yS,singleValue:NS,valueContainer:w2},lN={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},rN=4,bg=4,oN=38,cN=bg*2,uN={baseUnit:bg,controlHeight:oN,menuGutter:cN},Hu={borderRadius:rN,colors:lN,spacing:uN},dN={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:Kp(),captureMenuScroll:!Kp(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:HS(),formatGroupLabel:tN,getOptionLabel:aN,getOptionValue:nN,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:sN,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!o2(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(l){var d=l.count;return"".concat(d," result").concat(d!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function uv(i,l,d,u){var c=jg(i,l,d),m=Sg(i,l,d),v=yg(i,l),y=lo(i,l);return{type:"option",data:l,isDisabled:c,isSelected:m,label:v,value:y,index:u}}function Jr(i,l){return i.options.map(function(d,u){if("options"in d){var c=d.options.map(function(v,y){return uv(i,v,l,y)}).filter(function(v){return fv(i,v)});return c.length>0?{type:"group",data:d,options:c,index:u}:void 0}var m=uv(i,d,l,u);return fv(i,m)?m:void 0}).filter(d2)}function xg(i){return i.reduce(function(l,d){return d.type==="group"?l.push.apply(l,hd(d.options.map(function(u){return u.data}))):l.push(d.data),l},[])}function dv(i,l){return i.reduce(function(d,u){return u.type==="group"?d.push.apply(d,hd(u.options.map(function(c){return{data:c.data,id:"".concat(l,"-").concat(u.index,"-").concat(c.index)}}))):d.push({data:u.data,id:"".concat(l,"-").concat(u.index)}),d},[])}function fN(i,l){return xg(Jr(i,l))}function fv(i,l){var d=i.inputValue,u=d===void 0?"":d,c=l.data,m=l.isSelected,v=l.label,y=l.value;return(!Cg(i)||!m)&&Ng(i,{label:v,value:y,data:c},u)}function mN(i,l){var d=i.focusedValue,u=i.selectValue,c=u.indexOf(d);if(c>-1){var m=l.indexOf(d);if(m>-1)return d;if(c<l.length)return l[c]}return null}function hN(i,l){var d=i.focusedOption;return d&&l.indexOf(d)>-1?d:l[0]}var Vu=function(l,d){var u,c=(u=l.find(function(m){return m.data===d}))===null||u===void 0?void 0:u.id;return c||null},yg=function(l,d){return l.getOptionLabel(d)},lo=function(l,d){return l.getOptionValue(d)};function jg(i,l,d){return typeof i.isOptionDisabled=="function"?i.isOptionDisabled(l,d):!1}function Sg(i,l,d){if(d.indexOf(l)>-1)return!0;if(typeof i.isOptionSelected=="function")return i.isOptionSelected(l,d);var u=lo(i,l);return d.some(function(c){return lo(i,c)===u})}function Ng(i,l,d){return i.filterOption?i.filterOption(l,d):!0}var Cg=function(l){var d=l.hideSelectedOptions,u=l.isMulti;return d===void 0?u:d},pN=1,_g=(function(i){Rj(d,i);var l=qj(d);function d(u){var c;if(kj(this,d),c=l.call(this,u),c.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:"",isAppleDevice:!1},c.blockOptionHover=!1,c.isComposing=!1,c.commonProps=void 0,c.initialTouchX=0,c.initialTouchY=0,c.openAfterFocus=!1,c.scrollToFocusedOptionOnUpdate=!1,c.userIsDragging=void 0,c.controlRef=null,c.getControlRef=function(h){c.controlRef=h},c.focusedOptionRef=null,c.getFocusedOptionRef=function(h){c.focusedOptionRef=h},c.menuListRef=null,c.getMenuListRef=function(h){c.menuListRef=h},c.inputRef=null,c.getInputRef=function(h){c.inputRef=h},c.focus=c.focusInput,c.blur=c.blurInput,c.onChange=function(h,p){var S=c.props,C=S.onChange,D=S.name;p.name=D,c.ariaOnChange(h,p),C(h,p)},c.setValue=function(h,p,S){var C=c.props,D=C.closeMenuOnSelect,R=C.isMulti,k=C.inputValue;c.onInputChange("",{action:"set-value",prevInputValue:k}),D&&(c.setState({inputIsHiddenAfterUpdate:!R}),c.onMenuClose()),c.setState({clearFocusValueOnUpdate:!0}),c.onChange(h,{action:p,option:S})},c.selectOption=function(h){var p=c.props,S=p.blurInputOnSelect,C=p.isMulti,D=p.name,R=c.state.selectValue,k=C&&c.isOptionSelected(h,R),b=c.isOptionDisabled(h,R);if(k){var _=c.getOptionValue(h);c.setValue(R.filter(function(O){return c.getOptionValue(O)!==_}),"deselect-option",h)}else if(!b)C?c.setValue([].concat(hd(R),[h]),"select-option",h):c.setValue(h,"select-option");else{c.ariaOnChange(h,{action:"select-option",option:h,name:D});return}S&&c.blurInput()},c.removeValue=function(h){var p=c.props.isMulti,S=c.state.selectValue,C=c.getOptionValue(h),D=S.filter(function(k){return c.getOptionValue(k)!==C}),R=Br(p,D,D[0]||null);c.onChange(R,{action:"remove-value",removedValue:h}),c.focusInput()},c.clearValue=function(){var h=c.state.selectValue;c.onChange(Br(c.props.isMulti,[],null),{action:"clear",removedValues:h})},c.popValue=function(){var h=c.props.isMulti,p=c.state.selectValue,S=p[p.length-1],C=p.slice(0,p.length-1),D=Br(h,C,C[0]||null);S&&c.onChange(D,{action:"pop-value",removedValue:S})},c.getFocusedOptionId=function(h){return Vu(c.state.focusableOptionsWithIds,h)},c.getFocusableOptionsWithIds=function(){return dv(Jr(c.props,c.state.selectValue),c.getElementId("option"))},c.getValue=function(){return c.state.selectValue},c.cx=function(){for(var h=arguments.length,p=new Array(h),S=0;S<h;S++)p[S]=arguments[S];return n2.apply(void 0,[c.props.classNamePrefix].concat(p))},c.getOptionLabel=function(h){return yg(c.props,h)},c.getOptionValue=function(h){return lo(c.props,h)},c.getStyles=function(h,p){var S=c.props.unstyled,C=iN[h](p,S);C.boxSizing="border-box";var D=c.props.styles[h];return D?D(C,p):C},c.getClassNames=function(h,p){var S,C;return(S=(C=c.props.classNames)[h])===null||S===void 0?void 0:S.call(C,p)},c.getElementId=function(h){return"".concat(c.state.instancePrefix,"-").concat(h)},c.getComponents=function(){return OS(c.props)},c.buildCategorizedOptions=function(){return Jr(c.props,c.state.selectValue)},c.getCategorizedOptions=function(){return c.props.menuIsOpen?c.buildCategorizedOptions():[]},c.buildFocusableOptions=function(){return xg(c.buildCategorizedOptions())},c.getFocusableOptions=function(){return c.props.menuIsOpen?c.buildFocusableOptions():[]},c.ariaOnChange=function(h,p){c.setState({ariaSelection:we({value:h},p)})},c.onMenuMouseDown=function(h){h.button===0&&(h.stopPropagation(),h.preventDefault(),c.focusInput())},c.onMenuMouseMove=function(h){c.blockOptionHover=!1},c.onControlMouseDown=function(h){if(!h.defaultPrevented){var p=c.props.openMenuOnClick;c.state.isFocused?c.props.menuIsOpen?h.target.tagName!=="INPUT"&&h.target.tagName!=="TEXTAREA"&&c.onMenuClose():p&&c.openMenu("first"):(p&&(c.openAfterFocus=!0),c.focusInput()),h.target.tagName!=="INPUT"&&h.target.tagName!=="TEXTAREA"&&h.preventDefault()}},c.onDropdownIndicatorMouseDown=function(h){if(!(h&&h.type==="mousedown"&&h.button!==0)&&!c.props.isDisabled){var p=c.props,S=p.isMulti,C=p.menuIsOpen;c.focusInput(),C?(c.setState({inputIsHiddenAfterUpdate:!S}),c.onMenuClose()):c.openMenu("first"),h.preventDefault()}},c.onClearIndicatorMouseDown=function(h){h&&h.type==="mousedown"&&h.button!==0||(c.clearValue(),h.preventDefault(),c.openAfterFocus=!1,h.type==="touchend"?c.focusInput():setTimeout(function(){return c.focusInput()}))},c.onScroll=function(h){typeof c.props.closeMenuOnScroll=="boolean"?h.target instanceof HTMLElement&&po(h.target)&&c.props.onMenuClose():typeof c.props.closeMenuOnScroll=="function"&&c.props.closeMenuOnScroll(h)&&c.props.onMenuClose()},c.onCompositionStart=function(){c.isComposing=!0},c.onCompositionEnd=function(){c.isComposing=!1},c.onTouchStart=function(h){var p=h.touches,S=p&&p.item(0);S&&(c.initialTouchX=S.clientX,c.initialTouchY=S.clientY,c.userIsDragging=!1)},c.onTouchMove=function(h){var p=h.touches,S=p&&p.item(0);if(S){var C=Math.abs(S.clientX-c.initialTouchX),D=Math.abs(S.clientY-c.initialTouchY),R=5;c.userIsDragging=C>R||D>R}},c.onTouchEnd=function(h){c.userIsDragging||(c.controlRef&&!c.controlRef.contains(h.target)&&c.menuListRef&&!c.menuListRef.contains(h.target)&&c.blurInput(),c.initialTouchX=0,c.initialTouchY=0)},c.onControlTouchEnd=function(h){c.userIsDragging||c.onControlMouseDown(h)},c.onClearIndicatorTouchEnd=function(h){c.userIsDragging||c.onClearIndicatorMouseDown(h)},c.onDropdownIndicatorTouchEnd=function(h){c.userIsDragging||c.onDropdownIndicatorMouseDown(h)},c.handleInputChange=function(h){var p=c.props.inputValue,S=h.currentTarget.value;c.setState({inputIsHiddenAfterUpdate:!1}),c.onInputChange(S,{action:"input-change",prevInputValue:p}),c.props.menuIsOpen||c.onMenuOpen()},c.onInputFocus=function(h){c.props.onFocus&&c.props.onFocus(h),c.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(c.openAfterFocus||c.props.openMenuOnFocus)&&c.openMenu("first"),c.openAfterFocus=!1},c.onInputBlur=function(h){var p=c.props.inputValue;if(c.menuListRef&&c.menuListRef.contains(document.activeElement)){c.inputRef.focus();return}c.props.onBlur&&c.props.onBlur(h),c.onInputChange("",{action:"input-blur",prevInputValue:p}),c.onMenuClose(),c.setState({focusedValue:null,isFocused:!1})},c.onOptionHover=function(h){if(!(c.blockOptionHover||c.state.focusedOption===h)){var p=c.getFocusableOptions(),S=p.indexOf(h);c.setState({focusedOption:h,focusedOptionId:S>-1?c.getFocusedOptionId(h):null})}},c.shouldHideSelectedOptions=function(){return Cg(c.props)},c.onValueInputFocus=function(h){h.preventDefault(),h.stopPropagation(),c.focus()},c.onKeyDown=function(h){var p=c.props,S=p.isMulti,C=p.backspaceRemovesValue,D=p.escapeClearsValue,R=p.inputValue,k=p.isClearable,b=p.isDisabled,_=p.menuIsOpen,O=p.onKeyDown,q=p.tabSelectsValue,E=p.openMenuOnFocus,j=c.state,N=j.focusedOption,G=j.focusedValue,w=j.selectValue;if(!b&&!(typeof O=="function"&&(O(h),h.defaultPrevented))){switch(c.blockOptionHover=!0,h.key){case"ArrowLeft":if(!S||R)return;c.focusValue("previous");break;case"ArrowRight":if(!S||R)return;c.focusValue("next");break;case"Delete":case"Backspace":if(R)return;if(G)c.removeValue(G);else{if(!C)return;S?c.popValue():k&&c.clearValue()}break;case"Tab":if(c.isComposing||h.shiftKey||!_||!q||!N||E&&c.isOptionSelected(N,w))return;c.selectOption(N);break;case"Enter":if(h.keyCode===229)break;if(_){if(!N||c.isComposing)return;c.selectOption(N);break}return;case"Escape":_?(c.setState({inputIsHiddenAfterUpdate:!1}),c.onInputChange("",{action:"menu-close",prevInputValue:R}),c.onMenuClose()):k&&D&&c.clearValue();break;case" ":if(R)return;if(!_){c.openMenu("first");break}if(!N)return;c.selectOption(N);break;case"ArrowUp":_?c.focusOption("up"):c.openMenu("last");break;case"ArrowDown":_?c.focusOption("down"):c.openMenu("first");break;case"PageUp":if(!_)return;c.focusOption("pageup");break;case"PageDown":if(!_)return;c.focusOption("pagedown");break;case"Home":if(!_)return;c.focusOption("first");break;case"End":if(!_)return;c.focusOption("last");break;default:return}h.preventDefault()}},c.state.instancePrefix="react-select-"+(c.props.instanceId||++pN),c.state.selectValue=Zp(u.value),u.menuIsOpen&&c.state.selectValue.length){var m=c.getFocusableOptionsWithIds(),v=c.buildFocusableOptions(),y=v.indexOf(c.state.selectValue[0]);c.state.focusableOptionsWithIds=m,c.state.focusedOption=v[y],c.state.focusedOptionId=Vu(m,v[y])}return c}return Dj(d,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&Jp(this.menuListRef,this.focusedOptionRef),eN()&&this.setState({isAppleDevice:!0})}},{key:"componentDidUpdate",value:function(c){var m=this.props,v=m.isDisabled,y=m.menuIsOpen,h=this.state.isFocused;(h&&!v&&c.isDisabled||h&&y&&!c.menuIsOpen)&&this.focusInput(),h&&v&&!c.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!h&&!v&&c.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(Jp(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(c,m){this.props.onInputChange(c,m)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(c){var m=this,v=this.state,y=v.selectValue,h=v.isFocused,p=this.buildFocusableOptions(),S=c==="first"?0:p.length-1;if(!this.props.isMulti){var C=p.indexOf(y[0]);C>-1&&(S=C)}this.scrollToFocusedOptionOnUpdate=!(h&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:p[S],focusedOptionId:this.getFocusedOptionId(p[S])},function(){return m.onMenuOpen()})}},{key:"focusValue",value:function(c){var m=this.state,v=m.selectValue,y=m.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var h=v.indexOf(y);y||(h=-1);var p=v.length-1,S=-1;if(v.length){switch(c){case"previous":h===0?S=0:h===-1?S=p:S=h-1;break;case"next":h>-1&&h<p&&(S=h+1);break}this.setState({inputIsHidden:S!==-1,focusedValue:v[S]})}}}},{key:"focusOption",value:function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",m=this.props.pageSize,v=this.state.focusedOption,y=this.getFocusableOptions();if(y.length){var h=0,p=y.indexOf(v);v||(p=-1),c==="up"?h=p>0?p-1:y.length-1:c==="down"?h=(p+1)%y.length:c==="pageup"?(h=p-m,h<0&&(h=0)):c==="pagedown"?(h=p+m,h>y.length-1&&(h=y.length-1)):c==="last"&&(h=y.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:y[h],focusedValue:null,focusedOptionId:this.getFocusedOptionId(y[h])})}}},{key:"getTheme",value:(function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Hu):we(we({},Hu),this.props.theme):Hu})},{key:"getCommonProps",value:function(){var c=this.clearValue,m=this.cx,v=this.getStyles,y=this.getClassNames,h=this.getValue,p=this.selectOption,S=this.setValue,C=this.props,D=C.isMulti,R=C.isRtl,k=C.options,b=this.hasValue();return{clearValue:c,cx:m,getStyles:v,getClassNames:y,getValue:h,hasValue:b,isMulti:D,isRtl:R,options:k,selectOption:p,selectProps:C,setValue:S,theme:this.getTheme()}}},{key:"hasValue",value:function(){var c=this.state.selectValue;return c.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var c=this.props,m=c.isClearable,v=c.isMulti;return m===void 0?v:m}},{key:"isOptionDisabled",value:function(c,m){return jg(this.props,c,m)}},{key:"isOptionSelected",value:function(c,m){return Sg(this.props,c,m)}},{key:"filterOption",value:function(c,m){return Ng(this.props,c,m)}},{key:"formatOptionLabel",value:function(c,m){if(typeof this.props.formatOptionLabel=="function"){var v=this.props.inputValue,y=this.state.selectValue;return this.props.formatOptionLabel(c,{context:m,inputValue:v,selectValue:y})}else return this.getOptionLabel(c)}},{key:"formatGroupLabel",value:function(c){return this.props.formatGroupLabel(c)}},{key:"startListeningComposition",value:(function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))})},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:(function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))})},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:(function(){var c=this.props,m=c.isDisabled,v=c.isSearchable,y=c.inputId,h=c.inputValue,p=c.tabIndex,S=c.form,C=c.menuIsOpen,D=c.required,R=this.getComponents(),k=R.Input,b=this.state,_=b.inputIsHidden,O=b.ariaSelection,q=this.commonProps,E=y||this.getElementId("input"),j=we(we(we({"aria-autocomplete":"list","aria-expanded":C,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":D,role:"combobox","aria-activedescendant":this.state.isAppleDevice?void 0:this.state.focusedOptionId||""},C&&{"aria-controls":this.getElementId("listbox")}),!v&&{"aria-readonly":!0}),this.hasValue()?(O==null?void 0:O.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return v?g.createElement(k,Re({},q,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:E,innerRef:this.getInputRef,isDisabled:m,isHidden:_,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:p,form:S,type:"text",value:h},j)):g.createElement(BS,Re({id:E,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:so,onFocus:this.onInputFocus,disabled:m,tabIndex:p,inputMode:"none",form:S,value:""},j))})},{key:"renderPlaceholderOrValue",value:function(){var c=this,m=this.getComponents(),v=m.MultiValue,y=m.MultiValueContainer,h=m.MultiValueLabel,p=m.MultiValueRemove,S=m.SingleValue,C=m.Placeholder,D=this.commonProps,R=this.props,k=R.controlShouldRenderValue,b=R.isDisabled,_=R.isMulti,O=R.inputValue,q=R.placeholder,E=this.state,j=E.selectValue,N=E.focusedValue,G=E.isFocused;if(!this.hasValue()||!k)return O?null:g.createElement(C,Re({},D,{key:"placeholder",isDisabled:b,isFocused:G,innerProps:{id:this.getElementId("placeholder")}}),q);if(_)return j.map(function(ae,oe){var W=ae===N,V="".concat(c.getOptionLabel(ae),"-").concat(c.getOptionValue(ae));return g.createElement(v,Re({},D,{components:{Container:y,Label:h,Remove:p},isFocused:W,isDisabled:b,key:V,index:oe,removeProps:{onClick:function(){return c.removeValue(ae)},onTouchEnd:function(){return c.removeValue(ae)},onMouseDown:function(ce){ce.preventDefault()}},data:ae}),c.formatOptionLabel(ae,"value"))});if(O)return null;var w=j[0];return g.createElement(S,Re({},D,{data:w,isDisabled:b}),this.formatOptionLabel(w,"value"))}},{key:"renderClearIndicator",value:function(){var c=this.getComponents(),m=c.ClearIndicator,v=this.commonProps,y=this.props,h=y.isDisabled,p=y.isLoading,S=this.state.isFocused;if(!this.isClearable()||!m||h||!this.hasValue()||p)return null;var C={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return g.createElement(m,Re({},v,{innerProps:C,isFocused:S}))}},{key:"renderLoadingIndicator",value:function(){var c=this.getComponents(),m=c.LoadingIndicator,v=this.commonProps,y=this.props,h=y.isDisabled,p=y.isLoading,S=this.state.isFocused;if(!m||!p)return null;var C={"aria-hidden":"true"};return g.createElement(m,Re({},v,{innerProps:C,isDisabled:h,isFocused:S}))}},{key:"renderIndicatorSeparator",value:function(){var c=this.getComponents(),m=c.DropdownIndicator,v=c.IndicatorSeparator;if(!m||!v)return null;var y=this.commonProps,h=this.props.isDisabled,p=this.state.isFocused;return g.createElement(v,Re({},y,{isDisabled:h,isFocused:p}))}},{key:"renderDropdownIndicator",value:function(){var c=this.getComponents(),m=c.DropdownIndicator;if(!m)return null;var v=this.commonProps,y=this.props.isDisabled,h=this.state.isFocused,p={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return g.createElement(m,Re({},v,{innerProps:p,isDisabled:y,isFocused:h}))}},{key:"renderMenu",value:function(){var c=this,m=this.getComponents(),v=m.Group,y=m.GroupHeading,h=m.Menu,p=m.MenuList,S=m.MenuPortal,C=m.LoadingMessage,D=m.NoOptionsMessage,R=m.Option,k=this.commonProps,b=this.state.focusedOption,_=this.props,O=_.captureMenuScroll,q=_.inputValue,E=_.isLoading,j=_.loadingMessage,N=_.minMenuHeight,G=_.maxMenuHeight,w=_.menuIsOpen,ae=_.menuPlacement,oe=_.menuPosition,W=_.menuPortalTarget,V=_.menuShouldBlockScroll,P=_.menuShouldScrollIntoView,ce=_.noOptionsMessage,ye=_.onMenuScrollToTop,je=_.onMenuScrollToBottom;if(!w)return null;var F=function(ee,ne){var he=ee.type,me=ee.data,xe=ee.isDisabled,Ue=ee.isSelected,ke=ee.label,ie=ee.value,B=b===me,pe=xe?void 0:function(){return c.onOptionHover(me)},H=xe?void 0:function(){return c.selectOption(me)},ue="".concat(c.getElementId("option"),"-").concat(ne),I={id:ue,onClick:H,onMouseMove:pe,onMouseOver:pe,tabIndex:-1,role:"option","aria-selected":c.state.isAppleDevice?void 0:Ue};return g.createElement(R,Re({},k,{innerProps:I,data:me,isDisabled:xe,isSelected:Ue,key:ue,label:ke,type:he,value:ie,isFocused:B,innerRef:B?c.getFocusedOptionRef:void 0}),c.formatOptionLabel(ee.data,"menu"))},K;if(this.hasOptions())K=this.getCategorizedOptions().map(function(T){if(T.type==="group"){var ee=T.data,ne=T.options,he=T.index,me="".concat(c.getElementId("group"),"-").concat(he),xe="".concat(me,"-heading");return g.createElement(v,Re({},k,{key:me,data:ee,options:ne,Heading:y,headingProps:{id:xe,data:T.data},label:c.formatGroupLabel(T.data)}),T.options.map(function(Ue){return F(Ue,"".concat(he,"-").concat(Ue.index))}))}else if(T.type==="option")return F(T,"".concat(T.index))});else if(E){var fe=j({inputValue:q});if(fe===null)return null;K=g.createElement(C,k,fe)}else{var Te=ce({inputValue:q});if(Te===null)return null;K=g.createElement(D,k,Te)}var de={minMenuHeight:N,maxMenuHeight:G,menuPlacement:ae,menuPosition:oe,menuShouldScrollIntoView:P},z=g.createElement(x2,Re({},k,de),function(T){var ee=T.ref,ne=T.placerProps,he=ne.placement,me=ne.maxHeight;return g.createElement(h,Re({},k,de,{innerRef:ee,innerProps:{onMouseDown:c.onMenuMouseDown,onMouseMove:c.onMenuMouseMove},isLoading:E,placement:he}),g.createElement(XS,{captureEnabled:O,onTopArrive:ye,onBottomArrive:je,lockEnabled:V},function(xe){return g.createElement(p,Re({},k,{innerRef:function(ke){c.getMenuListRef(ke),xe(ke)},innerProps:{role:"listbox","aria-multiselectable":k.isMulti,id:c.getElementId("listbox")},isLoading:E,maxHeight:me,focusedOption:b}),K)}))});return W||oe==="fixed"?g.createElement(S,Re({},k,{appendTo:W,controlElement:this.controlRef,menuPlacement:ae,menuPosition:oe}),z):z}},{key:"renderFormField",value:function(){var c=this,m=this.props,v=m.delimiter,y=m.isDisabled,h=m.isMulti,p=m.name,S=m.required,C=this.state.selectValue;if(S&&!this.hasValue()&&!y)return g.createElement(ZS,{name:p,onFocus:this.onValueInputFocus});if(!(!p||y))if(h)if(v){var D=C.map(function(b){return c.getOptionValue(b)}).join(v);return g.createElement("input",{name:p,type:"hidden",value:D})}else{var R=C.length>0?C.map(function(b,_){return g.createElement("input",{key:"i-".concat(_),name:p,type:"hidden",value:c.getOptionValue(b)})}):g.createElement("input",{name:p,type:"hidden",value:""});return g.createElement("div",null,R)}else{var k=C[0]?this.getOptionValue(C[0]):"";return g.createElement("input",{name:p,type:"hidden",value:k})}}},{key:"renderLiveRegion",value:function(){var c=this.commonProps,m=this.state,v=m.ariaSelection,y=m.focusedOption,h=m.focusedValue,p=m.isFocused,S=m.selectValue,C=this.getFocusableOptions();return g.createElement(RS,Re({},c,{id:this.getElementId("live-region"),ariaSelection:v,focusedOption:y,focusedValue:h,isFocused:p,selectValue:S,focusableOptions:C,isAppleDevice:this.state.isAppleDevice}))}},{key:"render",value:function(){var c=this.getComponents(),m=c.Control,v=c.IndicatorsContainer,y=c.SelectContainer,h=c.ValueContainer,p=this.props,S=p.className,C=p.id,D=p.isDisabled,R=p.menuIsOpen,k=this.state.isFocused,b=this.commonProps=this.getCommonProps();return g.createElement(y,Re({},b,{className:S,innerProps:{id:C,onKeyDown:this.onKeyDown},isDisabled:D,isFocused:k}),this.renderLiveRegion(),g.createElement(m,Re({},b,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:D,isFocused:k,menuIsOpen:R}),g.createElement(h,Re({},b,{isDisabled:D}),this.renderPlaceholderOrValue(),this.renderInput()),g.createElement(v,Re({},b,{isDisabled:D}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(c,m){var v=m.prevProps,y=m.clearFocusValueOnUpdate,h=m.inputIsHiddenAfterUpdate,p=m.ariaSelection,S=m.isFocused,C=m.prevWasFocused,D=m.instancePrefix,R=c.options,k=c.value,b=c.menuIsOpen,_=c.inputValue,O=c.isMulti,q=Zp(k),E={};if(v&&(k!==v.value||R!==v.options||b!==v.menuIsOpen||_!==v.inputValue)){var j=b?fN(c,q):[],N=b?dv(Jr(c,q),"".concat(D,"-option")):[],G=y?mN(m,q):null,w=hN(m,j),ae=Vu(N,w);E={selectValue:q,focusedOption:w,focusedOptionId:ae,focusableOptionsWithIds:N,focusedValue:G,clearFocusValueOnUpdate:!1}}var oe=h!=null&&c!==v?{inputIsHidden:h,inputIsHiddenAfterUpdate:void 0}:{},W=p,V=S&&C;return S&&!V&&(W={value:Br(O,q,q[0]||null),options:q,action:"initial-input-focus"},V=!C),(p==null?void 0:p.action)==="initial-input-focus"&&(W=null),we(we(we({},E),oe),{},{prevProps:c,ariaSelection:W,prevWasFocused:V})}}]),d})(g.Component);_g.defaultProps=dN;var vN=g.forwardRef(function(i,l){var d=wj(i);return g.createElement(_g,Re({ref:l},d))}),ht=vN;const ms=()=>Be.getApiUrl(),gN=["kg","g","pza","bolsa","paquete","litro","ml"],Bu=gN.map(i=>({value:i,label:i})),hs={control:(i,l)=>({...i,background:"#fff",borderColor:l.isFocused?"#f97316":"#e2e8f0",borderRadius:"0.375rem",minHeight:"0",fontSize:"clamp(0.68rem, 1.5vh, 0.9rem)",boxShadow:"none","&:hover":{borderColor:"#f97316"}}),valueContainer:i=>({...i,padding:"clamp(0.15rem, 0.5vh, 0.35rem) 0.5rem"}),input:i=>({...i,margin:0,padding:0}),dropdownIndicator:i=>({...i,padding:"clamp(0.1rem, 0.3vh, 0.2rem) 0.25rem"}),clearIndicator:i=>({...i,padding:"clamp(0.1rem, 0.3vh, 0.2rem) 0.25rem"}),option:(i,l)=>({...i,backgroundColor:l.isSelected?"#f97316":l.isFocused?"rgba(249, 115, 22, 0.08)":"#fff",color:l.isSelected?"#fff":"#1e293b",cursor:"pointer",padding:"clamp(0.2rem, 0.5vh, 0.4rem) 0.75rem",fontSize:"clamp(0.68rem, 1.5vh, 0.9rem)"}),menu:i=>({...i,borderRadius:"0.375rem",overflow:"hidden",zIndex:1e4}),singleValue:i=>({...i,color:"#1e293b"}),placeholder:i=>({...i,color:"#94a3b8"})};function bN(){const[i,l]=g.useState([]),[d,u]=g.useState([]),[c,m]=g.useState([]),[v,y]=g.useState(""),[h,p]=g.useState(""),[S,C]=g.useState(!1),[D,R]=g.useState(null),[k,b]=g.useState(!0),[_,O]=g.useState({nombre:"",descripcion:"",precio:"",categoria_id:"",unidad:"pza",stock:"",stockMinimo:"",codigo:"",envasado_origen:!1,contabilizar_corte:!0,contar_al_inicio:!1,no_venta:!1,no_descuento_inventario:!1}),[q,E]=g.useState(!1),[j,N]=g.useState(null),[G,w]=g.useState([]),[ae,oe]=g.useState([]),[W,V]=g.useState(!1),P=c.map(H=>({value:H.id,label:H.nombre})),ce=d.map(H=>({value:H.id,label:`${H.nombre} (${H.unidad})`,unidad:H.unidad})),ye=i.filter(H=>H.id!==(j==null?void 0:j.id)).map(H=>({value:H.id,label:`${H.nombre} ($${H.precio})`,unidad:H.unidad,precio:H.precio}));g.useEffect(()=>{je(),F(),K()},[]);const je=async()=>{try{const ue=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductos"})})).json();ue.success?l(ue.data||[]):A.error(ue.message||"Error al cargar productos")}catch{A.error("Error de conexion con el servidor")}finally{b(!1)}},F=async()=>{try{const ue=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCategoriasProductos"})})).json();ue.success&&m(ue.data||[])}catch(H){console.error("Error al cargar categorias:",H)}},K=async()=>{try{const ue=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientes"})})).json();ue.success&&u(ue.data||[])}catch(H){console.error("Error al cargar ingredientes:",H)}},fe=i.filter(H=>{const ue=H.nombre.toLowerCase().includes(v.toLowerCase())||H.codigo&&H.codigo.toLowerCase().includes(v.toLowerCase())||H.descripcion&&H.descripcion.toLowerCase().includes(v.toLowerCase()),I=!h||H.categoria_id===h;return ue&&I}),Te=(H=null)=>{H?(R(H),O({nombre:H.nombre,descripcion:H.descripcion||"",precio:H.precio,categoria_id:H.categoria_id||"",unidad:H.unidad||"pza",stock:H.stock,stockMinimo:H.stockMinimo,codigo:H.codigo||"",envasado_origen:H.envasado_origen===1||H.envasado_origen===!0,contabilizar_corte:H.contabilizar_corte===1||H.contabilizar_corte===!0||H.contabilizar_corte===void 0,contar_al_inicio:H.contar_al_inicio===1||H.contar_al_inicio===!0,no_venta:H.no_venta===1||H.no_venta===!0,no_descuento_inventario:H.no_descuento_inventario===1||H.no_descuento_inventario===!0})):(R(null),O({nombre:"",descripcion:"",precio:"",categoria_id:"",unidad:"pza",stock:"",stockMinimo:"",codigo:"",envasado_origen:!1,contabilizar_corte:!0,contar_al_inicio:!1,no_venta:!1,no_descuento_inventario:!1})),C(!0)},de=()=>{C(!1),R(null)},z=H=>{const{name:ue,value:I}=H.target;O(Se=>({...Se,[ue]:I}))},T=async H=>{H.preventDefault();const ue={tipo:D?"actualizarProducto":"crearProducto",..._,precio:parseFloat(_.precio)||0,stock:parseFloat(_.stock)||0,stockMinimo:parseFloat(_.stockMinimo)||0,categoria_id:_.categoria_id||null,envasado_origen:_.envasado_origen?1:0,contabilizar_corte:_.contabilizar_corte?1:0,contar_al_inicio:_.contar_al_inicio?1:0,no_venta:_.no_venta?1:0,no_descuento_inventario:_.no_descuento_inventario?1:0};D&&(ue.id=D.id);try{const Se=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ue)})).json();Se.success?(A.success(D?"Producto actualizado correctamente":"Producto creado correctamente"),je(),de()):A.error(Se.message||"Error al guardar producto")}catch{A.error("Error de conexion con el servidor")}},ee=H=>{const ue=i.find(I=>I.id===H);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar "',ue==null?void 0:ue.nombre,'"?']}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const Se=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarProducto",id:H})})).json();Se.success?(A.dismiss(),A.success("Producto eliminado"),je()):A.error(Se.message||"Error al eliminar")}catch{A.error("Error de conexion")}},style:{padding:"0.25rem 0.75rem",background:"#ef4444",color:"#fff",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Eliminar"}),a.jsx("button",{onClick:()=>A.dismiss(),style:{padding:"0.25rem 0.75rem",background:"#e2e8f0",color:"#1e293b",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Cancelar"})]})]}),{autoClose:!1,closeOnClick:!1,draggable:!1,closeButton:!1})},ne=async H=>{N(H),V(!0),E(!0);try{const I=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getReceta",producto_id:H.id})})).json();I.success?(w(I.data.ingredientes||[]),oe(I.data.componentes||[])):(w([]),oe([]))}catch{A.error("Error al cargar receta"),w([]),oe([])}finally{V(!1)}},he=()=>{E(!1),N(null),w([]),oe([])},me=()=>{w([...G,{ingrediente_id:"",nombre:"",cantidad:1,unidad:"pza"}])},xe=(H,ue,I)=>{const Se=[...G];Se[H][ue]=I,w(Se)},Ue=H=>{w(G.filter((ue,I)=>I!==H))},ke=()=>{oe([...ae,{componente_id:"",nombre:"",cantidad:1,unidad:"pza"}])},ie=(H,ue,I)=>{const Se=[...ae];Se[H][ue]=I,oe(Se)},B=H=>{oe(ae.filter((ue,I)=>I!==H))},pe=async()=>{const H=G.filter(I=>I.ingrediente_id&&I.cantidad>0),ue=ae.filter(I=>I.componente_id&&I.cantidad>0);try{const Se=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"guardarReceta",producto_id:j.id,ingredientes:H,componentes:ue})})).json();Se.success?(A.success("Receta guardada correctamente"),je(),he()):A.error(Se.message||"Error al guardar receta")}catch{A.error("Error de conexion")}};return k?a.jsx("div",{className:"productos",children:a.jsx("p",{children:"Cargando productos..."})}):a.jsxs("div",{className:"productos",children:[a.jsxs("div",{className:"productos-header",children:[a.jsx("h2",{children:"Productos"}),a.jsxs("button",{className:"btn-primary",onClick:()=>Te(),children:[a.jsx(aa,{size:20}),"Nuevo Producto"]})]}),a.jsxs("div",{className:"productos-filtros",children:[a.jsxs("div",{className:"search-box",children:[a.jsx(ha,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por nombre, codigo o descripcion...",value:v,onChange:H=>y(H.target.value)})]}),a.jsx(ht,{value:h?P.find(H=>H.value===h):null,onChange:H=>p(H?H.value:""),options:P,isClearable:!0,placeholder:"Todas las categorias",styles:hs,className:"filtro-select-container",noOptionsMessage:()=>"Sin resultados"})]}),a.jsxs("div",{className:"productos-tabla",children:[a.jsxs("table",{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Nombre"}),a.jsx("th",{children:"Categoria"}),a.jsx("th",{children:"Precio"}),a.jsx("th",{children:"Unidad"}),a.jsx("th",{children:"Stock"}),a.jsx("th",{children:"Stock Min."}),a.jsx("th",{children:"Codigo"}),a.jsx("th",{children:"Acciones"})]})}),a.jsx("tbody",{children:fe.map(H=>a.jsxs("tr",{className:H.stock<=H.stockMinimo?"stock-bajo":"",children:[a.jsx("td",{children:a.jsxs("div",{className:"producto-nombre",children:[a.jsxs("strong",{children:[H.nombre,H.tiene_receta===1&&a.jsx("span",{className:"receta-badge",title:"Tiene receta",children:a.jsx(mi,{size:12})})]}),H.descripcion&&a.jsx("small",{children:H.descripcion})]})}),a.jsx("td",{children:H.categoria&&a.jsx("span",{className:"categoria-badge",children:H.categoria})}),a.jsxs("td",{children:["$",Number(H.precio).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]}),a.jsx("td",{children:H.unidad}),a.jsx("td",{children:H.stock}),a.jsx("td",{children:H.stockMinimo}),a.jsx("td",{children:H.codigo||"-"}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon btn-receta",onClick:()=>ne(H),title:"Receta",children:a.jsx(mi,{size:14})}),a.jsx("button",{className:"btn-icon",onClick:()=>Te(H),title:"Editar",children:a.jsx(ys,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>ee(H.id),title:"Eliminar",children:a.jsx(Yt,{size:14})})]})]},H.id))})]}),fe.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron productos"})]}),S&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-productos",onClick:de,children:a.jsxs("div",{className:"modal-productos",onClick:H=>H.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:D?"Editar Producto":"Nuevo Producto"}),a.jsx("button",{className:"btn-close",onClick:de,children:a.jsx(tt,{size:18})})]}),a.jsxs("form",{onSubmit:T,children:[a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Nombre *"}),a.jsx("input",{type:"text",name:"nombre",value:_.nombre,onChange:z,required:!0})]}),a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Descripcion"}),a.jsx("input",{type:"text",name:"descripcion",value:_.descripcion,onChange:z})]}),a.jsxs("div",{className:"mp-row",children:[a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Precio *"}),a.jsx("input",{type:"number",name:"precio",value:_.precio,onChange:z,required:!0,min:"0",step:"0.01"})]}),a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Unidad"}),a.jsx(ht,{value:_.unidad?{value:_.unidad,label:_.unidad}:null,onChange:H=>O(ue=>({...ue,unidad:H?H.value:"pza"})),options:Bu,styles:hs,placeholder:"Seleccionar..."})]})]}),a.jsxs("div",{className:"mp-row",children:[a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Stock"}),a.jsx("input",{type:"number",name:"stock",value:_.stock,onChange:z,step:"0.01"})]}),a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Stock Minimo"}),a.jsx("input",{type:"number",name:"stockMinimo",value:_.stockMinimo,onChange:z,step:"0.01"})]})]}),a.jsxs("div",{className:"mp-row",children:[a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Categoria"}),a.jsx(ht,{value:_.categoria_id?P.find(H=>H.value===_.categoria_id):null,onChange:H=>O(ue=>({...ue,categoria_id:H?H.value:""})),options:P,isClearable:!0,styles:hs,placeholder:"Seleccionar...",noOptionsMessage:()=>"Sin categorias"})]}),a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Codigo"}),a.jsx("input",{type:"text",name:"codigo",value:_.codigo,onChange:z,placeholder:"SKU o codigo de barras"})]})]}),a.jsxs("div",{className:"mp-checks",children:[a.jsxs("label",{className:"mp-check-label",children:[a.jsx("input",{type:"checkbox",name:"envasado_origen",checked:_.envasado_origen,onChange:H=>O(ue=>({...ue,envasado_origen:H.target.checked}))}),a.jsx("span",{className:"mp-check-box"}),"Envasado de origen"]}),a.jsxs("label",{className:"mp-check-label",children:[a.jsx("input",{type:"checkbox",name:"contabilizar_corte",checked:_.contabilizar_corte,onChange:H=>O(ue=>({...ue,contabilizar_corte:H.target.checked}))}),a.jsx("span",{className:"mp-check-box"}),"Contabilizar en corte"]}),a.jsxs("label",{className:"mp-check-label",children:[a.jsx("input",{type:"checkbox",name:"contar_al_inicio",checked:_.contar_al_inicio,onChange:H=>O(ue=>({...ue,contar_al_inicio:H.target.checked}))}),a.jsx("span",{className:"mp-check-box"}),"Contar al inicio de turno"]}),a.jsxs("label",{className:"mp-check-label",children:[a.jsx("input",{type:"checkbox",name:"no_venta",checked:_.no_venta,onChange:H=>O(ue=>({...ue,no_venta:H.target.checked}))}),a.jsx("span",{className:"mp-check-box"}),"No se vende"]}),a.jsxs("label",{className:"mp-check-label",children:[a.jsx("input",{type:"checkbox",name:"no_descuento_inventario",checked:_.no_descuento_inventario,onChange:H=>O(ue=>({...ue,no_descuento_inventario:H.target.checked}))}),a.jsx("span",{className:"mp-check-box"}),"No descontar de inventario"]})]}),a.jsxs("div",{className:"mp-actions",children:[a.jsx("button",{type:"button",className:"mp-btn-cancel",onClick:de,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mp-btn-save",children:D?"Guardar Cambios":"Crear Producto"})]})]})]})}),document.body),q&&Bt.createPortal(a.jsx("div",{className:"modal-overlay",onClick:he,children:a.jsxs("div",{className:"modal modal-receta",onClick:H=>H.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsxs("h3",{children:["Receta: ",j==null?void 0:j.nombre]}),a.jsx("button",{className:"btn-icon",onClick:he,children:a.jsx(tt,{size:20})})]}),a.jsx("div",{className:"receta-content",children:W?a.jsx("p",{children:"Cargando receta..."}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"receta-seccion",children:[a.jsxs("div",{className:"receta-seccion-header",children:[a.jsxs("h4",{children:[a.jsx(hl,{size:16})," Ingredientes"]}),a.jsxs("button",{type:"button",className:"btn-sm btn-primary",onClick:me,children:[a.jsx(aa,{size:14})," Agregar"]})]}),G.length===0?a.jsx("p",{className:"receta-vacia",children:"Sin ingredientes en la receta"}):a.jsx("div",{className:"receta-items",children:G.map((H,ue)=>a.jsxs("div",{className:"receta-item",children:[a.jsx(ht,{value:H.ingrediente_id?ce.find(I=>I.value===H.ingrediente_id):null,onChange:I=>{xe(ue,"ingrediente_id",I?I.value:""),xe(ue,"nombre",I?I.label:""),xe(ue,"unidad",I?I.unidad:"pza")},options:ce,styles:hs,placeholder:"Seleccionar ingrediente...",className:"receta-select",noOptionsMessage:()=>"Sin ingredientes"}),a.jsx("input",{type:"number",value:H.cantidad,onChange:I=>xe(ue,"cantidad",parseFloat(I.target.value)||0),min:"0",step:"0.01",className:"receta-cantidad"}),a.jsx(ht,{value:{value:H.unidad,label:H.unidad},onChange:I=>xe(ue,"unidad",I?I.value:"pza"),options:Bu,styles:hs,className:"receta-unidad"}),a.jsx("button",{type:"button",className:"btn-icon btn-danger",onClick:()=>Ue(ue),children:a.jsx(Yt,{size:14})})]},ue))})]}),a.jsxs("div",{className:"receta-seccion",children:[a.jsxs("div",{className:"receta-seccion-header",children:[a.jsxs("h4",{children:[a.jsx($t,{size:16})," Productos"]}),a.jsxs("button",{type:"button",className:"btn-sm btn-primary",onClick:ke,children:[a.jsx(aa,{size:14})," Agregar"]})]}),ae.length===0?a.jsx("p",{className:"receta-vacia",children:"Sin productos en la receta"}):a.jsx("div",{className:"receta-items",children:ae.map((H,ue)=>a.jsxs("div",{className:"receta-item",children:[a.jsx(ht,{value:H.componente_id?ye.find(I=>I.value===H.componente_id):null,onChange:I=>{ie(ue,"componente_id",I?I.value:""),ie(ue,"nombre",I?I.label:""),ie(ue,"unidad",I?I.unidad:"pza")},options:ye,styles:hs,placeholder:"Seleccionar producto...",className:"receta-select",noOptionsMessage:()=>"Sin productos"}),a.jsx("input",{type:"number",value:H.cantidad,onChange:I=>ie(ue,"cantidad",parseFloat(I.target.value)||0),min:"0",step:"0.01",className:"receta-cantidad"}),a.jsx(ht,{value:{value:H.unidad,label:H.unidad},onChange:I=>ie(ue,"unidad",I?I.value:"pza"),options:Bu,styles:hs,className:"receta-unidad"}),a.jsx("button",{type:"button",className:"btn-icon btn-danger",onClick:()=>B(ue),children:a.jsx(Yt,{size:14})})]},ue))})]})]})}),a.jsxs("div",{className:"modal-actions",children:[a.jsx("button",{type:"button",className:"btn-secondary",onClick:he,children:"Cancelar"}),a.jsx("button",{type:"button",className:"btn-primary",onClick:pe,disabled:W,children:"Guardar Receta"})]})]})}),document.body),a.jsx(Ft,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const $u=()=>Be.getApiUrl();function xN(){const[i,l]=g.useState([]),[d,u]=g.useState(""),[c,m]=g.useState(!1),[v,y]=g.useState(null),[h,p]=g.useState(!0),[S,C]=g.useState({nombre:"",descripcion:"",color:"#f97316"});g.useEffect(()=>{D()},[]);const D=async()=>{try{const N=await(await fetch($u(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCategoriasProductos"})})).json();N.success?l(N.data||[]):A.error(N.message||"Error al cargar categorias")}catch{A.error("Error de conexion con el servidor")}finally{p(!1)}},R=i.filter(j=>j.nombre.toLowerCase().includes(d.toLowerCase())||j.descripcion&&j.descripcion.toLowerCase().includes(d.toLowerCase())),k=(j=null)=>{j?(y(j),C({nombre:j.nombre,descripcion:j.descripcion||"",color:j.color||"#f97316"})):(y(null),C({nombre:"",descripcion:"",color:"#f97316"})),m(!0)},b=()=>{m(!1),y(null)},_=j=>{const{name:N,value:G}=j.target;C(w=>({...w,[N]:G}))},O=async j=>{if(j.preventDefault(),!S.nombre.trim()){A.warning("El nombre es requerido");return}const N={tipo:v?"actualizarCategoriaProducto":"crearCategoriaProducto",nombre:S.nombre.trim(),descripcion:S.descripcion.trim(),color:S.color};v&&(N.id=v.id);try{const w=await(await fetch($u(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)})).json();w.success?(A.success(v?"Categoria actualizada":"Categoria creada"),D(),b()):A.error(w.message||"Error al guardar categoria")}catch{A.error("Error de conexion con el servidor")}},q=j=>{const N=i.find(G=>G.id===j);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar "',N==null?void 0:N.nombre,'"?']}),a.jsx("small",{style:{color:"#64748b"},children:"Los productos de esta categoria quedaran sin categoria asignada."}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.75rem"},children:[a.jsx("button",{onClick:async()=>{try{const w=await(await fetch($u(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarCategoriaProducto",id:j})})).json();w.success?(A.dismiss(),A.success("Categoria eliminada"),D()):A.error(w.message||"Error al eliminar")}catch{A.error("Error de conexion")}},style:{padding:"0.25rem 0.75rem",background:"#ef4444",color:"#fff",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Eliminar"}),a.jsx("button",{onClick:()=>A.dismiss(),style:{padding:"0.25rem 0.75rem",background:"#e2e8f0",color:"#1e293b",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Cancelar"})]})]}),{autoClose:!1,closeOnClick:!1,draggable:!1,closeButton:!1})},E=["#f97316","#ef4444","#22c55e","#3b82f6","#8b5cf6","#ec4899","#14b8a6","#f59e0b","#6366f1","#64748b"];return h?a.jsx("div",{className:"categorias",children:a.jsx("p",{children:"Cargando categorias..."})}):a.jsxs("div",{className:"categorias",children:[a.jsxs("div",{className:"categorias-header",children:[a.jsx("h2",{children:"Categorias de Productos"}),a.jsxs("button",{className:"btn-primary",onClick:()=>k(),children:[a.jsx(aa,{size:20}),"Nueva Categoria"]})]}),a.jsxs("div",{className:"categorias-filtros",children:[a.jsxs("div",{className:"search-box",children:[a.jsx(ha,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por nombre o descripcion...",value:d,onChange:j=>u(j.target.value)})]}),a.jsxs("div",{className:"categorias-count",children:[R.length," categoria",R.length!==1?"s":""]})]}),a.jsx("div",{className:"categorias-grid",children:R.length===0?a.jsx("p",{className:"sin-resultados",children:"No se encontraron categorias"}):R.map(j=>a.jsxs("div",{className:"categoria-card",children:[a.jsx("div",{className:"categoria-color",style:{backgroundColor:j.color||"#f97316"},children:a.jsx(Qu,{size:24})}),a.jsxs("div",{className:"categoria-info",children:[a.jsx("h4",{children:j.nombre}),j.descripcion&&a.jsx("p",{children:j.descripcion}),a.jsxs("span",{className:"categoria-productos",children:[j.total_productos||0," producto",(j.total_productos||0)!==1?"s":""]})]}),a.jsxs("div",{className:"categoria-acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>k(j),title:"Editar",children:a.jsx(ys,{size:16})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>q(j.id),title:"Eliminar",children:a.jsx(Yt,{size:16})})]})]},j.id))}),c&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-categorias",onClick:b,children:a.jsxs("div",{className:"modal-categorias",onClick:j=>j.stopPropagation(),children:[a.jsxs("div",{className:"mk-header",children:[a.jsx("h3",{children:v?"Editar Categoria":"Nueva Categoria"}),a.jsx("button",{className:"mk-btn-close",onClick:b,children:a.jsx(tt,{size:20})})]}),a.jsxs("form",{onSubmit:O,children:[a.jsxs("div",{className:"mk-field",children:[a.jsx("label",{children:"Nombre *"}),a.jsx("input",{type:"text",name:"nombre",value:S.nombre,onChange:_,placeholder:"Ej: Tortillas, Bebidas, Postres...",required:!0,autoFocus:!0})]}),a.jsxs("div",{className:"mk-field",children:[a.jsx("label",{children:"Descripcion"}),a.jsx("input",{type:"text",name:"descripcion",value:S.descripcion,onChange:_,placeholder:"Descripcion opcional..."})]}),a.jsxs("div",{className:"mk-field",children:[a.jsx("label",{children:"Color"}),a.jsxs("div",{className:"mk-color-selector",children:[a.jsx("div",{className:"mk-colores-predefinidos",children:E.map(j=>a.jsx("button",{type:"button",className:`mk-color-option ${S.color===j?"activo":""}`,style:{backgroundColor:j},onClick:()=>C(N=>({...N,color:j})),title:j},j))}),a.jsxs("div",{className:"mk-color-custom",children:[a.jsx("input",{type:"color",name:"color",value:S.color,onChange:_,title:"Color personalizado"}),a.jsx("span",{children:S.color})]})]})]}),a.jsxs("div",{className:"mk-preview",children:[a.jsx("label",{children:"Vista previa"}),a.jsxs("div",{className:"mk-preview-card",children:[a.jsx("div",{className:"mk-preview-color",style:{backgroundColor:S.color},children:a.jsx(Qu,{size:24})}),a.jsxs("div",{className:"mk-preview-info",children:[a.jsx("h4",{children:S.nombre||"Nombre de categoria"}),S.descripcion&&a.jsx("p",{children:S.descripcion})]})]})]}),a.jsxs("div",{className:"mk-actions",children:[a.jsx("button",{type:"button",className:"mk-btn-cancel",onClick:b,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mk-btn-save",children:v?"Guardar Cambios":"Crear Categoria"})]})]})]})}),document.body),a.jsx(Ft,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const Gn=()=>Be.getApiUrl(),yN=["Verduras","Carnes","Lácteos","Granos","Especias","Otros"],jN=["kg","g","L","ml","pza","bolsa","caja"],Fu={control:(i,l)=>({...i,background:"#fff",borderColor:l.isFocused?"#f97316":"#e2e8f0",borderRadius:"0.375rem",minHeight:"0",fontSize:"clamp(0.68rem, 1.5vh, 0.9rem)",boxShadow:"none","&:hover":{borderColor:"#f97316"}}),valueContainer:i=>({...i,padding:"clamp(0.15rem, 0.5vh, 0.35rem) 0.5rem"}),input:i=>({...i,margin:0,padding:0}),dropdownIndicator:i=>({...i,padding:"clamp(0.1rem, 0.3vh, 0.2rem) 0.25rem"}),clearIndicator:i=>({...i,padding:"clamp(0.1rem, 0.3vh, 0.2rem) 0.25rem"}),option:(i,l)=>({...i,backgroundColor:l.isSelected?"#f97316":l.isFocused?"rgba(249, 115, 22, 0.08)":"#fff",color:l.isSelected?"#fff":"#1e293b",cursor:"pointer",padding:"clamp(0.2rem, 0.5vh, 0.4rem) 0.75rem",fontSize:"clamp(0.68rem, 1.5vh, 0.9rem)"}),menu:i=>({...i,borderRadius:"0.375rem",overflow:"hidden",zIndex:1e4}),singleValue:i=>({...i,color:"#1e293b"}),placeholder:i=>({...i,color:"#94a3b8"})};function SN(){const[i,l]=g.useState("ingredientes"),[d,u]=g.useState([]),[c,m]=g.useState(yN),[v,y]=g.useState([]),[h,p]=g.useState(jN),[S,C]=g.useState(""),[D,R]=g.useState(""),[k,b]=g.useState(""),[_,O]=g.useState(!1),[q,E]=g.useState(!1),[j,N]=g.useState(null),[G,w]=g.useState(null),[ae,oe]=g.useState(!0),[W,V]=g.useState({nombre:"",cantidad:"",unidad:"",precio:"",proveedor:"",stockMinimo:"",categoria:"Otros"}),[P,ce]=g.useState({nombre:""}),ye=c.map(B=>({value:B,label:B})),je=h.map(B=>({value:B,label:B}));g.useEffect(()=>{F(),K(),fe(),Te()},[]);const F=async()=>{try{const pe=await(await fetch(Gn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientes"})})).json();pe.success?u(pe.data||[]):A.error(pe.message||"Error al cargar ingredientes")}catch(B){A.error("Error de conexión con el servidor"),console.error(B)}finally{oe(!1)}},K=async()=>{try{const pe=await(await fetch(Gn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCategoriasIngredientes"})})).json();pe.success&&pe.data&&m(pe.data)}catch(B){console.error("Error al cargar categorías:",B)}},fe=async()=>{try{const pe=await(await fetch(Gn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCategoriasIngredientesDetalle"})})).json();pe.success&&pe.data&&y(pe.data)}catch(B){console.error("Error al cargar detalle categorías:",B)}},Te=async()=>{try{const pe=await(await fetch(Gn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getUnidades"})})).json();pe.success&&pe.data&&p(pe.data)}catch(B){console.error("Error al cargar unidades:",B)}},de=d.filter(B=>{const pe=B.nombre.toLowerCase().includes(S.toLowerCase())||B.proveedor&&B.proveedor.toLowerCase().includes(S.toLowerCase()),H=!k||B.categoria===k;return pe&&H}),z=v.filter(B=>B.nombre.toLowerCase().includes(D.toLowerCase())),T=(B=null)=>{B?(N(B),V({nombre:B.nombre,cantidad:B.cantidad,unidad:B.unidad,precio:B.precio,proveedor:B.proveedor||"",stockMinimo:B.stockMinimo,categoria:B.categoria})):(N(null),V({nombre:"",cantidad:"",unidad:"",precio:"",proveedor:"",stockMinimo:"",categoria:"Otros"})),O(!0)},ee=()=>{O(!1),N(null)},ne=(B=null)=>{B?(w(B),ce({nombre:B.nombre})):(w(null),ce({nombre:""})),E(!0)},he=()=>{E(!1),w(null)},me=B=>{const{name:pe,value:H}=B.target;V(ue=>({...ue,[pe]:H}))},xe=async B=>{B.preventDefault();const pe={tipo:j?"actualizarIngrediente":"crearIngrediente",...W,cantidad:parseFloat(W.cantidad)||0,precio:parseFloat(W.precio)||0,stockMinimo:parseFloat(W.stockMinimo)||0};j&&(pe.id=j.id);try{const ue=await(await fetch(Gn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(pe)})).json();ue.success?(A.success(j?"Ingrediente actualizado correctamente":"Ingrediente creado correctamente"),F(),ee()):A.error(ue.message||"Error al guardar ingrediente")}catch(H){A.error("Error de conexión con el servidor"),console.error(H)}},Ue=async B=>{B.preventDefault();const pe={tipo:G?"actualizarCategoriaIngrediente":"crearCategoriaIngrediente",nombre:P.nombre.trim()};G&&(pe.id=G.id);try{const ue=await(await fetch(Gn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(pe)})).json();ue.success?(A.success(G?"Categoría actualizada correctamente":"Categoría creada correctamente"),K(),fe(),he()):A.error(ue.message||"Error al guardar categoría")}catch(H){A.error("Error de conexión con el servidor"),console.error(H)}},ke=B=>{const pe=d.find(H=>H.id===B);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar "',pe==null?void 0:pe.nombre,'"?']}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const ue=await(await fetch(Gn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarIngrediente",id:B})})).json();ue.success?(A.dismiss(),A.success("Ingrediente eliminado"),F()):A.error(ue.message||"Error al eliminar")}catch(H){A.error("Error de conexión"),console.error(H)}},style:{padding:"0.25rem 0.75rem",background:"#ef4444",color:"#fff",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Eliminar"}),a.jsx("button",{onClick:()=>A.dismiss(),style:{padding:"0.25rem 0.75rem",background:"#e2e8f0",color:"#1e293b",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Cancelar"})]})]}),{autoClose:!1,closeOnClick:!1,draggable:!1,closeButton:!1})},ie=B=>{const pe=v.find(H=>H.id===B);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar categoría "',pe==null?void 0:pe.nombre,'"?']}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const ue=await(await fetch(Gn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarCategoriaIngrediente",id:B})})).json();ue.success?(A.dismiss(),A.success("Categoría eliminada"),K(),fe()):A.error(ue.message||"Error al eliminar")}catch(H){A.error("Error de conexión"),console.error(H)}},style:{padding:"0.25rem 0.75rem",background:"#ef4444",color:"#fff",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Eliminar"}),a.jsx("button",{onClick:()=>A.dismiss(),style:{padding:"0.25rem 0.75rem",background:"#e2e8f0",color:"#1e293b",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Cancelar"})]})]}),{autoClose:!1,closeOnClick:!1,draggable:!1,closeButton:!1})};return ae?a.jsx("div",{className:"ingredientes",children:a.jsx("p",{children:"Cargando ingredientes..."})}):a.jsxs("div",{className:"ingredientes",children:[a.jsxs("div",{className:"ingredientes-header",children:[a.jsx("h2",{children:i==="ingredientes"?"Ingredientes":"Categorías de Ingredientes"}),a.jsxs("button",{className:"btn-primary",onClick:()=>i==="ingredientes"?T():ne(),children:[a.jsx(aa,{size:20}),i==="ingredientes"?"Nuevo Ingrediente":"Nueva Categoría"]})]}),a.jsxs("div",{className:"ing-tabs",children:[a.jsxs("button",{className:`ing-tab ${i==="ingredientes"?"ing-tab-active":""}`,onClick:()=>l("ingredientes"),children:[a.jsx($t,{size:16}),"Ingredientes"]}),a.jsxs("button",{className:`ing-tab ${i==="categorias"?"ing-tab-active":""}`,onClick:()=>l("categorias"),children:[a.jsx(yy,{size:16}),"Categorías"]})]}),i==="ingredientes"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ingredientes-filtros",children:[a.jsxs("div",{className:"search-box",children:[a.jsx(ha,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por nombre o proveedor...",value:S,onChange:B=>C(B.target.value)})]}),a.jsx(ht,{value:k?{value:k,label:k}:null,onChange:B=>b(B?B.value:""),options:ye,isClearable:!0,placeholder:"Todas las categorías",styles:Fu,className:"filtro-select-container",noOptionsMessage:()=>"Sin resultados"})]}),a.jsxs("div",{className:"ingredientes-tabla",children:[a.jsxs("table",{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Nombre"}),a.jsx("th",{children:"Cantidad"}),a.jsx("th",{children:"Unidad"}),a.jsx("th",{children:"Precio"}),a.jsx("th",{children:"Proveedor"}),a.jsx("th",{children:"Stock Mín."}),a.jsx("th",{children:"Categoría"}),a.jsx("th",{children:"Acciones"})]})}),a.jsx("tbody",{children:de.map(B=>a.jsxs("tr",{className:B.cantidad<=B.stockMinimo?"stock-bajo":"",children:[a.jsx("td",{children:B.nombre}),a.jsx("td",{children:B.cantidad}),a.jsx("td",{children:B.unidad}),a.jsxs("td",{children:["$",Number(B.precio).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]}),a.jsx("td",{children:B.proveedor||"-"}),a.jsx("td",{children:B.stockMinimo}),a.jsx("td",{children:a.jsx("span",{className:"categoria-badge",children:B.categoria})}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>T(B),children:a.jsx(ys,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>ke(B.id),children:a.jsx(Yt,{size:14})})]})]},B.id))})]}),de.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron ingredientes"})]})]}),i==="categorias"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"ingredientes-filtros",children:a.jsxs("div",{className:"search-box",children:[a.jsx(ha,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar categoría...",value:D,onChange:B=>R(B.target.value)})]})}),a.jsxs("div",{className:"ingredientes-tabla",children:[a.jsxs("table",{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Nombre"}),a.jsx("th",{children:"Ingredientes"}),a.jsx("th",{children:"Acciones"})]})}),a.jsx("tbody",{children:z.map(B=>a.jsxs("tr",{children:[a.jsx("td",{children:B.nombre}),a.jsx("td",{children:a.jsx("span",{className:"categoria-badge",children:B.total_ingredientes})}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>ne(B),children:a.jsx(ys,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>ie(B.id),children:a.jsx(Yt,{size:14})})]})]},B.id))})]}),z.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron categorías"})]})]}),_&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-ingredientes",onClick:ee,children:a.jsxs("div",{className:"modal-ingredientes",onClick:B=>B.stopPropagation(),children:[a.jsxs("div",{className:"mi-header",children:[a.jsx("h3",{children:j?"Editar Ingrediente":"Nuevo Ingrediente"}),a.jsx("button",{className:"mi-btn-close",onClick:ee,children:a.jsx(tt,{size:20})})]}),a.jsxs("form",{onSubmit:xe,children:[a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Nombre"}),a.jsx("input",{type:"text",name:"nombre",value:W.nombre,onChange:me,required:!0})]}),a.jsxs("div",{className:"mi-row",children:[a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Cantidad"}),a.jsx("input",{type:"number",name:"cantidad",value:W.cantidad,onChange:me,required:!0,min:"0",step:"0.01"})]}),a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Unidad"}),a.jsx(ht,{value:W.unidad?{value:W.unidad,label:W.unidad}:null,onChange:B=>V(pe=>({...pe,unidad:B?B.value:""})),options:je,styles:Fu,noOptionsMessage:()=>"Sin resultados",placeholder:"Seleccionar..."})]})]}),a.jsxs("div",{className:"mi-row",children:[a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Precio"}),a.jsx("input",{type:"number",name:"precio",value:W.precio,onChange:me,required:!0,min:"0",step:"0.01"})]}),a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Stock Mínimo"}),a.jsx("input",{type:"number",name:"stockMinimo",value:W.stockMinimo,onChange:me,required:!0,min:"0"})]})]}),a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Proveedor"}),a.jsx("input",{type:"text",name:"proveedor",value:W.proveedor,onChange:me})]}),a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Categoría"}),a.jsx(ht,{value:W.categoria?{value:W.categoria,label:W.categoria}:null,onChange:B=>V(pe=>({...pe,categoria:B?B.value:"Otros"})),options:ye,styles:Fu,noOptionsMessage:()=>"Sin resultados",placeholder:"Seleccionar..."})]}),a.jsxs("div",{className:"mi-actions",children:[a.jsx("button",{type:"button",className:"mi-btn-cancel",onClick:ee,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mi-btn-save",children:j?"Guardar Cambios":"Crear Ingrediente"})]})]})]})}),document.body),q&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-ingredientes",onClick:he,children:a.jsxs("div",{className:"modal-ingredientes",onClick:B=>B.stopPropagation(),children:[a.jsxs("div",{className:"mi-header",children:[a.jsx("h3",{children:G?"Editar Categoría":"Nueva Categoría"}),a.jsx("button",{className:"mi-btn-close",onClick:he,children:a.jsx(tt,{size:20})})]}),a.jsxs("form",{onSubmit:Ue,children:[a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Nombre de la categoría"}),a.jsx("input",{type:"text",value:P.nombre,onChange:B=>ce({nombre:B.target.value}),required:!0,autoFocus:!0})]}),a.jsxs("div",{className:"mi-actions",children:[a.jsx("button",{type:"button",className:"mi-btn-cancel",onClick:he,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mi-btn-save",children:G?"Guardar Cambios":"Crear Categoría"})]})]})]})}),document.body),a.jsx(Ft,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const ps=()=>Be.getApiUrl();function NN(){const{user:i}=Fa(),[l,d]=g.useState([]),[u,c]=g.useState(!0),[m,v]=g.useState(null),[y,h]=g.useState([]),[p,S]=g.useState([]),[C,D]=g.useState(""),[R,k]=g.useState(!1),[b,_]=g.useState(null),[O,q]=g.useState(!1),[E,j]=g.useState("ingrediente"),[N,G]=g.useState([]),[w,ae]=g.useState([]),[oe,W]=g.useState([]),[V,P]=g.useState([]),[ce,ye]=g.useState([]),[je,F]=g.useState(null),[K,fe]=g.useState({peso_inicial:"",peso_final:"",items:[]}),[Te,de]=g.useState(!1),[z,T]=g.useState("ingrediente"),[ee,ne]=g.useState(!1);g.useEffect(()=>{he(),me(),xe(),Ue()},[]);const he=async()=>{try{const be=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductosConReceta"})})).json();be.success&&d(be.data||[])}catch{A.error("Error al cargar productos")}finally{c(!1)}},me=async()=>{try{const be=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientes"})})).json();be.success&&G(be.data||[])}catch(J){console.error("Error al cargar ingredientes:",J)}},xe=async()=>{try{const be=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductos"})})).json();be.success&&ae(be.data||[])}catch(J){console.error("Error al cargar productos:",J)}},Ue=async()=>{try{const be=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProduccionesHoy"})})).json();be.success&&ye(be.data||[])}catch(J){console.error("Error al cargar producciones de hoy:",J)}},ke=J=>{F(J),fe({peso_inicial:"",peso_final:"",items:[]})},ie=()=>{F(null),fe({peso_inicial:"",peso_final:"",items:[]}),de(!1)},B=(J,be)=>{if(K.items.some(qe=>qe.tipo===be&&qe.item_id===J.id)){A.warning("Este item ya está en la lista");return}fe({...K,items:[...K.items,{tipo:be,item_id:J.id,nombre:J.nombre,cantidad:0,unidad:J.unidad}]}),de(!1)},pe=J=>{const be=K.items.filter((ve,qe)=>qe!==J);fe({...K,items:be})},H=(J,be)=>{const ve=[...K.items];ve[J].cantidad=Math.max(0,parseFloat(be)||0),fe({...K,items:ve})},ue=async()=>{if(je){if(!K.peso_inicial||parseFloat(K.peso_inicial)<=0){A.warning("Ingresa el peso inicial");return}if(!K.peso_final||parseFloat(K.peso_final)<=0){A.warning("Ingresa el peso final");return}ne(!0);try{const be=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"registrarAjusteProduccion",produccion_id:je.id,peso_inicial:parseFloat(K.peso_inicial),peso_final:parseFloat(K.peso_final),usuario_id:i==null?void 0:i.id,items:K.items.filter(ve=>ve.cantidad>0).map(ve=>({tipo:ve.tipo,item_id:ve.item_id,cantidad:ve.cantidad,unidad:ve.unidad}))})})).json();if(be.success){const ve=parseFloat(K.peso_final)-parseFloat(K.peso_inicial);A.success(`Ajuste registrado: ${ve>=0?"+":""}${ve.toFixed(3)} ${je.unidad}`),ie(),Ue()}else A.error(be.message||"Error al registrar ajuste")}catch{A.error("Error de conexion")}finally{ne(!1)}}},I=async J=>{try{const ve=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getReceta",producto_id:J})})).json();ve.success&&(h(ve.data.ingredientes.map(qe=>({...qe,cantidad_usada:0,cantidad_receta:qe.cantidad}))),S(ve.data.componentes.map(qe=>({...qe,cantidad_usada:0,cantidad_receta:qe.cantidad}))))}catch{A.error("Error al cargar receta")}},Se=J=>{v(J),D(""),I(J.id)},Mt=()=>{v(null),h([]),S([]),D(""),W([]),P([]),_(null),q(!1)},Ot=J=>{const be=y.some(qe=>qe.ingrediente_id===J.id),ve=oe.some(qe=>qe.ingrediente_id===J.id);if(be||ve){A.warning("Este ingrediente ya está en la lista");return}W([...oe,{ingrediente_id:J.id,nombre:J.nombre,unidad:J.unidad,cantidad_usada:0,cantidad_receta:0,es_extra:!0}]),q(!1)},Dt=J=>{const be=p.some(qe=>qe.componente_id===J.id),ve=V.some(qe=>qe.componente_id===J.id);if(be||ve){A.warning("Este producto ya está en la lista");return}P([...V,{componente_id:J.id,nombre:J.nombre,unidad:J.unidad,cantidad_usada:0,cantidad_receta:0,es_extra:!0}]),q(!1)},pa=J=>{const be=oe.filter((ve,qe)=>qe!==J);W(be),(b==null?void 0:b.tipo)==="extra_ing"&&(b==null?void 0:b.index)===J&&_(null)},sa=J=>{const be=V.filter((ve,qe)=>qe!==J);P(be),(b==null?void 0:b.tipo)==="extra_prod"&&(b==null?void 0:b.index)===J&&_(null)},Xn=(J,be)=>{const ve=[...oe];ve[J].cantidad_usada=ft(Math.max(0,parseFloat(be)||0)),W(ve)},Ma=(J,be)=>{const ve=[...V];ve[J].cantidad_usada=ft(Math.max(0,parseFloat(be)||0)),P(ve)},ft=J=>Math.round(J*1e3)/1e3,Pa=(J,be)=>{const ve=[...y];ve[J].cantidad_usada=ft(Math.max(0,parseFloat(be)||0)),h(ve)},Aa=(J,be)=>{const ve=[...p];ve[J].cantidad_usada=ft(Math.max(0,parseFloat(be)||0)),S(ve)},wa=()=>{var J,be,ve,qe,Xe,ia,Ga,At;return b?b.tipo==="ingrediente"?((be=(J=y[b.index])==null?void 0:J.cantidad_usada)==null?void 0:be.toString())||"0":b.tipo==="componente"?((qe=(ve=p[b.index])==null?void 0:ve.cantidad_usada)==null?void 0:qe.toString())||"0":b.tipo==="extra_ing"?((ia=(Xe=oe[b.index])==null?void 0:Xe.cantidad_usada)==null?void 0:ia.toString())||"0":b.tipo==="extra_prod"?((At=(Ga=V[b.index])==null?void 0:Ga.cantidad_usada)==null?void 0:At.toString())||"0":b.tipo==="salida"?C:"":""},Et=J=>{b&&(b.tipo==="ingrediente"?Pa(b.index,J):b.tipo==="componente"?Aa(b.index,J):b.tipo==="extra_ing"?Xn(b.index,J):b.tipo==="extra_prod"?Ma(b.index,J):b.tipo==="salida"&&D(J))},In=()=>{var J,be,ve,qe;return b?b.tipo==="ingrediente"?(J=y[b.index])==null?void 0:J.nombre:b.tipo==="componente"?(be=p[b.index])==null?void 0:be.nombre:b.tipo==="extra_ing"?((ve=oe[b.index])==null?void 0:ve.nombre)+" (extra)":b.tipo==="extra_prod"?((qe=V[b.index])==null?void 0:qe.nombre)+" (extra)":b.tipo==="salida"?"Cantidad producida":"Selecciona un campo":"Selecciona un campo"},pt=J=>{if(!b)return;let be=wa();if(J==="C")Et("0");else if(J==="CE")Et(be.slice(0,-1)||"0");else if(J===".")be.includes(".")||Et(be+".");else if(be==="0"&&J!==".")Et(J);else{const ve=be.split(".");if(ve.length===2&&ve[1].length>=3)return;Et(be+J)}},gn=async()=>{if(!m){A.warning("Selecciona un producto");return}if(!C||parseFloat(C)<=0){A.warning("Ingresa la cantidad producida");return}k(!0);try{const be=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"registrarProduccion",producto_id:m.id,cantidad_producida:parseFloat(C),unidad:m.unidad,fecha:new Date().toISOString().split("T")[0],hora:new Date().toTimeString().split(" ")[0],usuario_id:i==null?void 0:i.id,ingredientes:[...y.filter(ve=>ve.cantidad_usada>0).map(ve=>({ingrediente_id:ve.ingrediente_id,cantidad_usada:ve.cantidad_usada,cantidad_receta:ve.cantidad_receta||0,unidad:ve.unidad})),...oe.filter(ve=>ve.cantidad_usada>0).map(ve=>({ingrediente_id:ve.ingrediente_id,cantidad_usada:ve.cantidad_usada,cantidad_receta:0,unidad:ve.unidad}))],componentes:[...p.filter(ve=>ve.cantidad_usada>0).map(ve=>({componente_id:ve.componente_id,cantidad_usada:ve.cantidad_usada,cantidad_receta:ve.cantidad_receta||0,unidad:ve.unidad})),...V.filter(ve=>ve.cantidad_usada>0).map(ve=>({componente_id:ve.componente_id,cantidad_usada:ve.cantidad_usada,cantidad_receta:0,unidad:ve.unidad}))],descontar_inventario:!0})})).json();be.success?(A.success(`Produccion registrada: ${C} ${m.unidad} de ${m.nombre}`),Mt(),he(),Ue()):A.error(be.message||"Error al registrar")}catch{A.error("Error de conexion")}finally{k(!1)}};return u?a.jsx("div",{className:"producciones-pos",children:a.jsx("p",{children:"Cargando..."})}):a.jsxs("div",{className:"producciones-pos",children:[a.jsxs("div",{className:"prod-hoy",children:[a.jsx("div",{className:"prod-hoy-header",children:a.jsxs("h3",{children:[a.jsx(fn,{size:18})," Hoy"]})}),je?a.jsxs("div",{className:"ajuste-panel",children:[a.jsxs("div",{className:"ajuste-header",children:[a.jsxs("div",{className:"ajuste-titulo",children:[a.jsx("span",{children:je.producto_nombre}),a.jsxs("small",{children:[je.cantidad_producida," ",je.unidad]})]}),a.jsx("button",{className:"btn-cerrar-ajuste",onClick:ie,children:a.jsx(tt,{size:18})})]}),a.jsxs("div",{className:"ajuste-content",children:[a.jsxs("div",{className:"ajuste-pesos",children:[a.jsxs("div",{className:"ajuste-peso",children:[a.jsxs("label",{children:[a.jsx(wp,{size:14})," Peso inicial"]}),a.jsx("input",{type:"number",value:K.peso_inicial,onChange:J=>fe({...K,peso_inicial:J.target.value}),placeholder:"0",step:"0.001"})]}),a.jsxs("div",{className:"ajuste-peso",children:[a.jsxs("label",{children:[a.jsx(wp,{size:14})," Peso final"]}),a.jsx("input",{type:"number",value:K.peso_final,onChange:J=>fe({...K,peso_final:J.target.value}),placeholder:"0",step:"0.001"})]})]}),K.peso_inicial&&K.peso_final&&a.jsxs("div",{className:`ajuste-diferencia ${parseFloat(K.peso_final)-parseFloat(K.peso_inicial)>=0?"positivo":"negativo"}`,children:["Diferencia: ",(parseFloat(K.peso_final)-parseFloat(K.peso_inicial)).toFixed(3)," ",je.unidad]}),a.jsxs("div",{className:"ajuste-items",children:[a.jsx("h5",{children:"Agregados:"}),K.items.length===0?a.jsx("p",{className:"sin-items",children:"Sin items agregados"}):K.items.map((J,be)=>a.jsxs("div",{className:"ajuste-item",children:[a.jsx("span",{className:"ajuste-item-nombre",children:J.nombre}),a.jsx("input",{type:"number",value:J.cantidad,onChange:ve=>H(be,ve.target.value),min:"0",step:"0.001"}),a.jsx("small",{children:J.unidad}),a.jsx("button",{className:"btn-quitar-item",onClick:()=>pe(be),children:a.jsx(tt,{size:14})})]},be)),a.jsxs("button",{className:"btn-agregar-item-ajuste",onClick:()=>de(!0),children:[a.jsx(Ur,{size:14})," Agregar"]})]})]}),a.jsx("div",{className:"ajuste-footer",children:a.jsxs("button",{className:"btn-guardar-ajuste",onClick:ue,disabled:ee,children:[a.jsx(gs,{size:18}),ee?"Guardando...":"Guardar Ajuste"]})})]}):a.jsx("div",{className:"prod-hoy-lista",children:ce.length===0?a.jsx("p",{className:"sin-producciones",children:"Sin producciones hoy"}):ce.map(J=>a.jsxs("div",{className:"prod-hoy-item",onClick:()=>ke(J),children:[a.jsxs("div",{className:"prod-hoy-info",children:[a.jsx("span",{className:"prod-hoy-nombre",children:J.producto_nombre}),a.jsx("span",{className:"prod-hoy-hora",children:J.hora.slice(0,5)})]}),a.jsxs("div",{className:"prod-hoy-cant",children:[J.cantidad_producida," ",J.unidad,J.num_ajustes>0&&a.jsxs("span",{className:"badge-ajustes",children:["+",J.num_ajustes]})]}),a.jsx(_v,{size:16,className:"prod-hoy-arrow"})]},J.id))})]}),a.jsxs("div",{className:"prod-productos",children:[a.jsx("div",{className:"prod-productos-header",children:a.jsxs("h3",{children:[a.jsx(hi,{size:20})," Producir"]})}),a.jsxs("div",{className:"prod-grid",children:[l.map(J=>a.jsxs("button",{className:`prod-producto-btn ${(m==null?void 0:m.id)===J.id?"seleccionado":""}`,onClick:()=>Se(J),children:[a.jsx("span",{className:"prod-nombre",children:J.nombre}),a.jsx("span",{className:"prod-unidad",children:J.unidad})]},J.id)),l.length===0&&a.jsx("p",{className:"sin-productos",children:"No hay productos con receta"})]})]}),a.jsx("div",{className:"prod-receta",children:m?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"prod-receta-header",children:[a.jsx("h3",{children:m.nombre}),a.jsx("button",{className:"btn-limpiar",onClick:Mt,children:a.jsx(ny,{size:18})})]}),a.jsxs("div",{className:"prod-receta-content",children:[y.length>0&&a.jsxs("div",{className:"prod-seccion",children:[a.jsxs("h4",{children:[a.jsx(hl,{size:16})," Ingredientes"]}),a.jsx("div",{className:"prod-items",children:y.map((J,be)=>a.jsxs("div",{className:`prod-item-compacto ${(b==null?void 0:b.tipo)==="ingrediente"&&(b==null?void 0:b.index)===be?"activo":""}`,onClick:()=>_({tipo:"ingrediente",index:be}),children:[a.jsx("span",{className:"item-nombre",children:J.nombre}),a.jsxs("span",{className:"item-valor",children:[J.cantidad_usada," ",a.jsx("small",{children:J.unidad})]})]},be))})]}),p.length>0&&a.jsxs("div",{className:"prod-seccion",children:[a.jsxs("h4",{children:[a.jsx($t,{size:16})," Productos"]}),a.jsx("div",{className:"prod-items",children:p.map((J,be)=>a.jsxs("div",{className:`prod-item-compacto ${(b==null?void 0:b.tipo)==="componente"&&(b==null?void 0:b.index)===be?"activo":""}`,onClick:()=>_({tipo:"componente",index:be}),children:[a.jsx("span",{className:"item-nombre",children:J.nombre}),a.jsxs("span",{className:"item-valor",children:[J.cantidad_usada," ",a.jsx("small",{children:J.unidad})]})]},be))})]}),y.length===0&&p.length===0&&a.jsx("div",{className:"prod-sin-receta",children:a.jsx("p",{children:"Sin ingredientes"})}),oe.length>0&&a.jsxs("div",{className:"prod-seccion",children:[a.jsxs("h4",{children:[a.jsx(Ur,{size:16})," Ingredientes Extra"]}),a.jsx("div",{className:"prod-items",children:oe.map((J,be)=>a.jsxs("div",{className:`prod-item-compacto extra ${(b==null?void 0:b.tipo)==="extra_ing"&&(b==null?void 0:b.index)===be?"activo":""}`,onClick:()=>_({tipo:"extra_ing",index:be}),children:[a.jsx("span",{className:"item-nombre",children:J.nombre}),a.jsxs("span",{className:"item-valor",children:[J.cantidad_usada," ",a.jsx("small",{children:J.unidad})]}),a.jsx("button",{className:"btn-eliminar-extra",onClick:ve=>{ve.stopPropagation(),pa(be)},children:a.jsx(tt,{size:14})})]},be))})]}),V.length>0&&a.jsxs("div",{className:"prod-seccion",children:[a.jsxs("h4",{children:[a.jsx(Ur,{size:16})," Productos Extra"]}),a.jsx("div",{className:"prod-items",children:V.map((J,be)=>a.jsxs("div",{className:`prod-item-compacto extra ${(b==null?void 0:b.tipo)==="extra_prod"&&(b==null?void 0:b.index)===be?"activo":""}`,onClick:()=>_({tipo:"extra_prod",index:be}),children:[a.jsx("span",{className:"item-nombre",children:J.nombre}),a.jsxs("span",{className:"item-valor",children:[J.cantidad_usada," ",a.jsx("small",{children:J.unidad})]}),a.jsx("button",{className:"btn-eliminar-extra",onClick:ve=>{ve.stopPropagation(),sa(be)},children:a.jsx(tt,{size:14})})]},be))})]}),a.jsxs("button",{className:"btn-agregar-extra",onClick:()=>q(!0),children:[a.jsx(Ur,{size:16})," Agregar extra"]}),a.jsxs("div",{className:"prod-seccion",children:[a.jsxs("h4",{children:[a.jsx(gs,{size:16})," Producido"]}),a.jsxs("div",{className:`prod-item-compacto salida ${(b==null?void 0:b.tipo)==="salida"?"activo":""}`,onClick:()=>_({tipo:"salida",index:0}),children:[a.jsx("span",{className:"item-nombre",children:"Cantidad"}),a.jsxs("span",{className:"item-valor grande",children:[C||"0"," ",a.jsx("small",{children:m.unidad})]})]})]})]}),a.jsx("div",{className:"prod-footer-mini",children:a.jsxs("button",{className:"btn-registrar",onClick:gn,disabled:!C||parseFloat(C)<=0||R,children:[a.jsx(gs,{size:20}),R?"Guardando...":"Registrar"]})})]}):a.jsxs("div",{className:"prod-vacio",children:[a.jsx(hi,{size:48}),a.jsx("p",{children:"Selecciona un producto para producir"})]})}),m&&a.jsxs("div",{className:"prod-teclado",children:[a.jsxs("div",{className:"teclado-display",children:[a.jsx("span",{className:"teclado-label",children:In()}),a.jsx("span",{className:"teclado-valor",children:wa()||"0"})]}),a.jsxs("div",{className:"teclado-rapidos",children:[a.jsx("button",{onClick:()=>b&&Et("1"),children:"1"}),a.jsx("button",{onClick:()=>b&&Et("2"),children:"2"}),a.jsx("button",{onClick:()=>b&&Et("5"),children:"5"}),a.jsx("button",{onClick:()=>b&&Et("10"),children:"10"})]}),a.jsxs("div",{className:"teclado-grid",children:[a.jsx("button",{className:"tecla",onClick:()=>pt("7"),children:"7"}),a.jsx("button",{className:"tecla",onClick:()=>pt("8"),children:"8"}),a.jsx("button",{className:"tecla",onClick:()=>pt("9"),children:"9"}),a.jsx("button",{className:"tecla",onClick:()=>pt("4"),children:"4"}),a.jsx("button",{className:"tecla",onClick:()=>pt("5"),children:"5"}),a.jsx("button",{className:"tecla",onClick:()=>pt("6"),children:"6"}),a.jsx("button",{className:"tecla",onClick:()=>pt("1"),children:"1"}),a.jsx("button",{className:"tecla",onClick:()=>pt("2"),children:"2"}),a.jsx("button",{className:"tecla",onClick:()=>pt("3"),children:"3"}),a.jsx("button",{className:"tecla",onClick:()=>pt("0"),children:"0"}),a.jsx("button",{className:"tecla",onClick:()=>pt("."),children:"."}),a.jsx("button",{className:"tecla borrar",onClick:()=>pt("CE"),children:a.jsx(Tx,{size:20})})]}),a.jsx("button",{className:"tecla-limpiar",onClick:()=>pt("C"),children:"C"})]}),Te&&a.jsx("div",{className:"modal-overlay",onClick:()=>de(!1),children:a.jsxs("div",{className:"modal-extras",onClick:J=>J.stopPropagation(),children:[a.jsxs("div",{className:"modal-extras-header",children:[a.jsx("h4",{children:"Agregar a Ajuste"}),a.jsx("button",{className:"btn-cerrar-modal",onClick:()=>de(!1),children:a.jsx(tt,{size:20})})]}),a.jsxs("div",{className:"modal-extras-tabs",children:[a.jsxs("button",{className:`tab-extra ${z==="ingrediente"?"activo":""}`,onClick:()=>T("ingrediente"),children:[a.jsx(hl,{size:16})," Ingredientes"]}),a.jsxs("button",{className:`tab-extra ${z==="producto"?"activo":""}`,onClick:()=>T("producto"),children:[a.jsx($t,{size:16})," Productos"]})]}),a.jsx("div",{className:"modal-extras-lista",children:z==="ingrediente"?N.map(J=>a.jsxs("button",{className:"item-seleccionable",onClick:()=>B(J,"ingrediente"),children:[a.jsx("span",{children:J.nombre}),a.jsx("small",{children:J.unidad})]},J.id)):w.filter(J=>!J.envasado_origen).map(J=>a.jsxs("button",{className:"item-seleccionable",onClick:()=>B(J,"producto"),children:[a.jsx("span",{children:J.nombre}),a.jsx("small",{children:J.unidad})]},J.id))})]})}),O&&a.jsx("div",{className:"modal-overlay",onClick:()=>q(!1),children:a.jsxs("div",{className:"modal-extras",onClick:J=>J.stopPropagation(),children:[a.jsxs("div",{className:"modal-extras-header",children:[a.jsx("h4",{children:"Agregar Extra"}),a.jsx("button",{className:"btn-cerrar-modal",onClick:()=>q(!1),children:a.jsx(tt,{size:20})})]}),a.jsxs("div",{className:"modal-extras-tabs",children:[a.jsxs("button",{className:`tab-extra ${E==="ingrediente"?"activo":""}`,onClick:()=>j("ingrediente"),children:[a.jsx(hl,{size:16})," Ingredientes"]}),a.jsxs("button",{className:`tab-extra ${E==="producto"?"activo":""}`,onClick:()=>j("producto"),children:[a.jsx($t,{size:16})," Productos"]})]}),a.jsx("div",{className:"modal-extras-lista",children:E==="ingrediente"?N.map(J=>a.jsxs("button",{className:"item-seleccionable",onClick:()=>Ot(J),children:[a.jsx("span",{children:J.nombre}),a.jsx("small",{children:J.unidad})]},J.id)):w.filter(J=>!J.envasado_origen).map(J=>a.jsxs("button",{className:"item-seleccionable",onClick:()=>Dt(J),children:[a.jsx("span",{children:J.nombre}),a.jsx("small",{children:J.unidad})]},J.id))})]})}),a.jsx(Ft,{position:"top-center",autoClose:2e3,hideProgressBar:!0,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!1,draggable:!1,pauseOnHover:!1,theme:"light"})]})}const mv=()=>Be.getApiUrl();function CN(){const[i,l]=g.useState(!1),[d,u]=g.useState(null),[c,m]=g.useState([]),[v,y]=g.useState(()=>{const j=new Date;return j.setDate(1),j.toISOString().split("T")[0]}),[h,p]=g.useState(()=>new Date().toISOString().split("T")[0]),[S,C]=g.useState(0),[D,R]=g.useState({});g.useEffect(()=>{k()},[]),g.useEffect(()=>{b()},[v,h,S]);const k=async()=>{try{const N=await(await fetch(mv(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductosConReceta"})})).json();N.success&&m(N.data||[])}catch(j){console.error("Error al cargar productos:",j)}},b=async()=>{l(!0);try{const N=await(await fetch(mv(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getReporteProducciones",fecha_inicio:v,fecha_fin:h,producto_id:S})})).json();N.success?u(N.data):A.error(N.message||"Error al cargar reporte")}catch{A.error("Error de conexión")}finally{l(!1)}},_=j=>{R(N=>({...N,[j]:!N[j]}))},O=j=>new Date(j+"T00:00:00").toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}),q=(j,N)=>j===0?"neutral":N>10?"alto":N>5?"medio":j>0?"bajo":"negativo",E=j=>j>=100?"excelente":j>=95?"bueno":j>=90?"regular":"bajo";return a.jsxs("div",{className:"reporte-producciones",children:[a.jsxs("div",{className:"reporte-header",children:[a.jsxs("div",{className:"reporte-titulo",children:[a.jsx(Iu,{size:24}),a.jsx("h2",{children:"Reporte de Producciones"})]}),a.jsxs("div",{className:"reporte-filtros",children:[a.jsxs("div",{className:"filtro-grupo",children:[a.jsxs("label",{children:[a.jsx(Yn,{size:14})," Desde"]}),a.jsx("input",{type:"date",value:v,onChange:j=>y(j.target.value)})]}),a.jsxs("div",{className:"filtro-grupo",children:[a.jsxs("label",{children:[a.jsx(Yn,{size:14})," Hasta"]}),a.jsx("input",{type:"date",value:h,onChange:j=>p(j.target.value)})]}),a.jsxs("div",{className:"filtro-grupo",children:[a.jsxs("label",{children:[a.jsx(Dx,{size:14})," Producto"]}),a.jsxs("select",{value:S,onChange:j=>C(parseInt(j.target.value)),children:[a.jsx("option",{value:0,children:"Todos"}),c.map(j=>a.jsx("option",{value:j.id,children:j.nombre},j.id))]})]})]})]}),i?a.jsx("div",{className:"reporte-loading",children:"Cargando reporte..."}):d?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"reporte-seccion",children:[a.jsxs("h3",{children:[a.jsx(zv,{size:18})," Rendimiento por Producto"]}),a.jsx("div",{className:"rendimiento-grid",children:d.rendimiento_por_producto.length===0?a.jsx("p",{className:"sin-datos",children:"No hay datos en el período seleccionado"}):d.rendimiento_por_producto.map(j=>{var N,G;return a.jsxs("div",{className:"rendimiento-card",children:[a.jsxs("div",{className:"rendimiento-header",children:[a.jsx("span",{className:"rendimiento-nombre",children:j.producto_nombre}),a.jsxs("span",{className:`rendimiento-eficiencia ${E(j.eficiencia)}`,children:[j.eficiencia,"%"]})]}),a.jsxs("div",{className:"rendimiento-stats",children:[a.jsxs("div",{className:"stat",children:[a.jsx("span",{className:"stat-label",children:"Producciones"}),a.jsx("span",{className:"stat-valor",children:j.num_producciones})]}),a.jsxs("div",{className:"stat",children:[a.jsx("span",{className:"stat-label",children:"Total producido"}),a.jsxs("span",{className:"stat-valor",children:[j.total_producido.toFixed(2)," ",j.unidad]})]}),a.jsxs("div",{className:"stat",children:[a.jsx("span",{className:"stat-label",children:"Desv. Absoluta"}),a.jsx("span",{className:`stat-valor ${j.desviacion_absoluta>0?"negativo":""}`,children:((N=j.desviacion_absoluta)==null?void 0:N.toFixed(3))||"0.000"})]}),a.jsxs("div",{className:"stat",children:[a.jsx("span",{className:"stat-label",children:"Desv. Neta"}),a.jsxs("span",{className:`stat-valor ${j.desviacion_neta>0?"positivo":j.desviacion_neta<0?"negativo":""}`,children:[j.desviacion_neta>0?"+":"",((G=j.desviacion_neta)==null?void 0:G.toFixed(3))||"0.000"]})]})]}),a.jsxs("div",{className:"rendimiento-detalle-prods",children:[a.jsxs("span",{className:"prod-sobre",children:["▲ ",j.producciones_sobre||0]}),a.jsxs("span",{className:"prod-bajo",children:["▼ ",j.producciones_bajo||0]})]}),a.jsx("div",{className:"rendimiento-barra",children:a.jsx("div",{className:`barra-fill ${E(j.eficiencia)}`,style:{width:`${Math.min(j.eficiencia,100)}%`}})})]},j.producto_id)})})]}),a.jsxs("div",{className:"reporte-seccion",children:[a.jsxs("h3",{children:[a.jsx($t,{size:18})," Detalle de Producciones (",d.totales.total_producciones,")"]}),a.jsx("div",{className:"producciones-lista",children:d.producciones.length===0?a.jsx("p",{className:"sin-datos",children:"No hay producciones en el período seleccionado"}):d.producciones.map(j=>a.jsxs("div",{className:"produccion-item",children:[a.jsxs("div",{className:"produccion-header",onClick:()=>_(j.id),children:[a.jsxs("div",{className:"produccion-info",children:[a.jsx("span",{className:"produccion-nombre",children:j.producto_nombre}),a.jsxs("span",{className:"produccion-fecha",children:[O(j.fecha)," ",j.hora.slice(0,5)]})]}),a.jsxs("div",{className:"produccion-cantidad",children:[j.cantidad_producida," ",j.unidad]}),a.jsxs("div",{className:"produccion-resumen",children:[j.rendimiento&&j.rendimiento.desviacion!==0&&a.jsxs("span",{className:`badge-rendimiento ${j.rendimiento.desviacion>0?"positivo":"negativo"}`,children:[a.jsx(Dp,{size:12}),j.rendimiento.desviacion>0?"+":"",j.rendimiento.desviacion.toFixed(3)]}),j.resumen.costo_desviacion!==0&&a.jsxs("span",{className:`badge-desviacion ${j.resumen.costo_desviacion>0?"negativo":"positivo"}`,children:[j.resumen.costo_desviacion>0?"+":"","$",j.resumen.costo_desviacion.toFixed(2)]}),j.resumen.num_ajustes>0&&a.jsxs("span",{className:"badge-ajustes",children:[j.resumen.num_ajustes," ajustes"]})]}),a.jsx("button",{className:"btn-expandir",children:D[j.id]?a.jsx(px,{size:18}):a.jsx(Cv,{size:18})})]}),D[j.id]&&a.jsxs("div",{className:"produccion-detalles",children:[j.rendimiento&&a.jsxs("div",{className:"detalle-rendimiento",children:[a.jsxs("h5",{children:[a.jsx(Dp,{size:14})," Rendimiento"]}),a.jsxs("div",{className:"rendimiento-detalle-grid",children:[a.jsxs("div",{className:"rendimiento-stat",children:[a.jsx("span",{className:"label",children:"Receta base"}),a.jsxs("span",{className:"valor",children:[j.rendimiento.receta_base," ",j.unidad]})]}),a.jsxs("div",{className:"rendimiento-stat",children:[a.jsx("span",{className:"label",children:"Esperado"}),a.jsxs("span",{className:"valor",children:[j.rendimiento.esperado," ",j.unidad]})]}),a.jsxs("div",{className:"rendimiento-stat",children:[a.jsx("span",{className:"label",children:"Producido"}),a.jsxs("span",{className:"valor",children:[j.rendimiento.real," ",j.unidad]})]}),a.jsxs("div",{className:"rendimiento-stat",children:[a.jsx("span",{className:"label",children:"Desviación"}),a.jsxs("span",{className:`valor ${j.rendimiento.desviacion>0?"positivo":j.rendimiento.desviacion<0?"negativo":""}`,children:[j.rendimiento.desviacion>0?"+":"",j.rendimiento.desviacion," ",j.unidad]})]}),a.jsxs("div",{className:"rendimiento-stat",children:[a.jsx("span",{className:"label",children:"% Rendimiento"}),a.jsxs("span",{className:`valor ${j.rendimiento.porcentaje>=100?"positivo":"negativo"}`,children:[j.rendimiento.porcentaje,"%"]})]})]})]}),j.ingredientes.length>0&&a.jsxs("div",{className:"detalle-seccion",children:[a.jsxs("h5",{children:[a.jsx(hl,{size:14})," Ingredientes"]}),a.jsxs("table",{className:"tabla-detalle",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Ingrediente"}),a.jsx("th",{children:"Receta"}),a.jsx("th",{children:"Usado"}),a.jsx("th",{children:"Desviación"}),a.jsx("th",{children:"%"}),a.jsx("th",{children:"Costo Extra"})]})}),a.jsx("tbody",{children:j.ingredientes.map(N=>a.jsxs("tr",{className:q(N.desviacion,Math.abs(N.porcentaje_desviacion)),children:[a.jsx("td",{children:N.nombre}),a.jsxs("td",{children:[N.cantidad_receta," ",N.unidad]}),a.jsxs("td",{children:[N.cantidad_usada," ",N.unidad]}),a.jsxs("td",{className:N.desviacion>0?"valor-negativo":N.desviacion<0?"valor-positivo":"",children:[N.desviacion>0?"+":"",N.desviacion.toFixed(3)]}),a.jsxs("td",{className:Math.abs(N.porcentaje_desviacion)>10?"valor-alerta":"",children:[N.porcentaje_desviacion>0?"+":"",N.porcentaje_desviacion,"%"]}),a.jsxs("td",{className:N.costo_desviacion>0?"valor-negativo":"",children:["$",N.costo_desviacion.toFixed(2)]})]},N.id))})]})]}),j.componentes.length>0&&a.jsxs("div",{className:"detalle-seccion",children:[a.jsxs("h5",{children:[a.jsx($t,{size:14})," Productos/Componentes"]}),a.jsxs("table",{className:"tabla-detalle",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Producto"}),a.jsx("th",{children:"Receta"}),a.jsx("th",{children:"Usado"}),a.jsx("th",{children:"Desviación"}),a.jsx("th",{children:"%"}),a.jsx("th",{children:"Costo Extra"})]})}),a.jsx("tbody",{children:j.componentes.map(N=>a.jsxs("tr",{className:q(N.desviacion,Math.abs(N.porcentaje_desviacion)),children:[a.jsx("td",{children:N.nombre}),a.jsxs("td",{children:[N.cantidad_receta," ",N.unidad]}),a.jsxs("td",{children:[N.cantidad_usada," ",N.unidad]}),a.jsxs("td",{className:N.desviacion>0?"valor-negativo":N.desviacion<0?"valor-positivo":"",children:[N.desviacion>0?"+":"",N.desviacion.toFixed(3)]}),a.jsxs("td",{className:Math.abs(N.porcentaje_desviacion)>10?"valor-alerta":"",children:[N.porcentaje_desviacion>0?"+":"",N.porcentaje_desviacion,"%"]}),a.jsxs("td",{className:N.costo_desviacion>0?"valor-negativo":"",children:["$",N.costo_desviacion.toFixed(2)]})]},N.id))})]})]}),j.resumen.num_ajustes>0&&a.jsxs("div",{className:"detalle-ajustes",children:[a.jsx(Mv,{size:14}),a.jsxs("span",{children:["Esta producción tuvo ",j.resumen.num_ajustes," ajuste(s) con diferencia total de ",j.resumen.ajuste_diferencia.toFixed(3)," ",j.unidad]})]})]})]},j.id))})]}),d.totales.total_producciones>0&&a.jsxs("div",{className:"reporte-totales",children:[a.jsxs("div",{className:"total-item",children:[a.jsx("span",{className:"total-label",children:"Total Producciones"}),a.jsx("span",{className:"total-valor",children:d.totales.total_producciones})]}),a.jsxs("div",{className:"total-item",children:[a.jsx("span",{className:"total-label",children:"Costo Extra por Desviaciones"}),a.jsxs("span",{className:`total-valor ${d.totales.costo_extra_total>0?"negativo":""}`,children:["$",d.totales.costo_extra_total.toFixed(2)]})]})]})]}):a.jsxs("div",{className:"reporte-vacio",children:[a.jsx(Iu,{size:48}),a.jsx("p",{children:"Selecciona un rango de fechas para ver el reporte"})]}),a.jsx(Ft,{position:"top-center",autoClose:2e3,hideProgressBar:!0,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!1,draggable:!1,pauseOnHover:!1,theme:"light"})]})}const Pu=()=>Be.getApiUrl();function _N(){const[i,l]=g.useState([]),[d,u]=g.useState(""),[c,m]=g.useState(!1),[v,y]=g.useState(null),[h,p]=g.useState(!0),[S,C]=g.useState({nombre:"",telefono:"",email:"",direccion:""});g.useEffect(()=>{D()},[]);const D=async()=>{try{const j=await(await fetch(Pu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getClientes"})})).json();j.success?l(j.data||[]):A.error(j.message||"Error al cargar clientes")}catch{A.error("Error de conexion con el servidor")}finally{p(!1)}},R=i.filter(E=>{const j=d.toLowerCase();return E.nombre.toLowerCase().includes(j)||E.telefono&&E.telefono.toLowerCase().includes(j)||E.email&&E.email.toLowerCase().includes(j)||E.direccion&&E.direccion.toLowerCase().includes(j)}),k=(E=null)=>{E?(y(E),C({nombre:E.nombre,telefono:E.telefono||"",email:E.email||"",direccion:E.direccion||""})):(y(null),C({nombre:"",telefono:"",email:"",direccion:""})),m(!0)},b=()=>{m(!1),y(null)},_=E=>{const{name:j,value:N}=E.target;C(G=>({...G,[j]:N}))},O=async E=>{E.preventDefault();const j={tipo:v?"actualizarCliente":"crearCliente",...S};v&&(j.id=v.id);try{const G=await(await fetch(Pu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)})).json();G.success?(A.success(v?"Cliente actualizado correctamente":"Cliente creado correctamente"),D(),b()):A.error(G.message||"Error al guardar cliente")}catch{A.error("Error de conexion con el servidor")}},q=E=>{const j=i.find(N=>N.id===E);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar "',j==null?void 0:j.nombre,'"?']}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const G=await(await fetch(Pu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarCliente",id:E})})).json();G.success?(A.dismiss(),A.success("Cliente eliminado"),D()):A.error(G.message||"Error al eliminar")}catch{A.error("Error de conexion")}},style:{padding:"0.25rem 0.75rem",background:"#ef4444",color:"#fff",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Eliminar"}),a.jsx("button",{onClick:()=>A.dismiss(),style:{padding:"0.25rem 0.75rem",background:"#e2e8f0",color:"#1e293b",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Cancelar"})]})]}),{autoClose:!1,closeOnClick:!1,draggable:!1,closeButton:!1})};return h?a.jsx("div",{className:"clientes",children:a.jsx("p",{children:"Cargando clientes..."})}):a.jsxs("div",{className:"clientes",children:[a.jsxs("div",{className:"clientes-header",children:[a.jsx("h2",{children:"Clientes"}),a.jsxs("button",{className:"btn-primary",onClick:()=>k(),children:[a.jsx(aa,{size:20}),"Nuevo Cliente"]})]}),a.jsx("div",{className:"clientes-filtros",children:a.jsxs("div",{className:"search-box",children:[a.jsx(ha,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por nombre, telefono, email o direccion...",value:d,onChange:E=>u(E.target.value)})]})}),a.jsxs("div",{className:"clientes-tabla",children:[a.jsxs("table",{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Nombre"}),a.jsx("th",{children:"Telefono"}),a.jsx("th",{children:"Email"}),a.jsx("th",{children:"Direccion"}),a.jsx("th",{children:"Acciones"})]})}),a.jsx("tbody",{children:R.map(E=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("div",{className:"cliente-nombre",children:a.jsx("strong",{children:E.nombre})})}),a.jsx("td",{children:E.telefono||"-"}),a.jsx("td",{children:E.email||"-"}),a.jsx("td",{children:E.direccion||"-"}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>k(E),title:"Editar",children:a.jsx(ys,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>q(E.id),title:"Eliminar",children:a.jsx(Yt,{size:14})})]})]},E.id))})]}),R.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron clientes"})]}),c&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-clientes",onClick:b,children:a.jsxs("div",{className:"modal-clientes",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:v?"Editar Cliente":"Nuevo Cliente"}),a.jsx("button",{className:"btn-close",onClick:b,children:a.jsx(tt,{size:18})})]}),a.jsxs("form",{onSubmit:O,children:[a.jsxs("div",{className:"mcli-field",children:[a.jsx("label",{children:"Nombre *"}),a.jsx("input",{type:"text",name:"nombre",value:S.nombre,onChange:_,required:!0})]}),a.jsxs("div",{className:"mcli-row",children:[a.jsxs("div",{className:"mcli-field",children:[a.jsx("label",{children:"Telefono"}),a.jsx("input",{type:"tel",name:"telefono",value:S.telefono,onChange:_,placeholder:"Ej: 555-123-4567"})]}),a.jsxs("div",{className:"mcli-field",children:[a.jsx("label",{children:"Email"}),a.jsx("input",{type:"email",name:"email",value:S.email,onChange:_,placeholder:"correo@ejemplo.com"})]})]}),a.jsxs("div",{className:"mcli-field",children:[a.jsx("label",{children:"Direccion"}),a.jsx("textarea",{name:"direccion",value:S.direccion,onChange:_,placeholder:"Calle, numero, colonia, ciudad...",rows:2})]}),a.jsxs("div",{className:"mcli-actions",children:[a.jsx("button",{type:"button",className:"mcli-btn-cancel",onClick:b,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mcli-btn-save",children:v?"Guardar Cambios":"Crear Cliente"})]})]})]})}),document.body),a.jsx(Ft,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const ci=()=>Be.getApiUrl(),hv=[{value:"caducidad",label:"Caducidad"},{value:"dano",label:"Daño"},{value:"derrame",label:"Derrame"},{value:"error_produccion",label:"Error de producción"},{value:"contaminacion",label:"Contaminación"},{value:"devolucion",label:"Devolución"},{value:"otro",label:"Otro"}],TN=[{value:"producto",label:"Producto",icon:$t},{value:"produccion",label:"Producción",icon:hi},{value:"ingrediente",label:"Ingrediente",icon:xl}],$r={control:(i,l)=>({...i,background:"#fff",borderColor:l.isFocused?"#f97316":"#e2e8f0",borderRadius:"0.375rem",minHeight:"0",fontSize:"clamp(0.68rem, 1.5vh, 0.9rem)",boxShadow:"none","&:hover":{borderColor:"#f97316"}}),valueContainer:i=>({...i,padding:"clamp(0.15rem, 0.5vh, 0.35rem) 0.5rem"}),input:i=>({...i,margin:0,padding:0}),dropdownIndicator:i=>({...i,padding:"clamp(0.1rem, 0.3vh, 0.2rem) 0.25rem"}),clearIndicator:i=>({...i,padding:"clamp(0.1rem, 0.3vh, 0.2rem) 0.25rem"}),option:(i,l)=>({...i,backgroundColor:l.isSelected?"#f97316":l.isFocused?"rgba(249, 115, 22, 0.08)":"#fff",color:l.isSelected?"#fff":"#1e293b",cursor:"pointer",padding:"clamp(0.2rem, 0.5vh, 0.4rem) 0.75rem",fontSize:"clamp(0.68rem, 1.5vh, 0.9rem)"}),menu:i=>({...i,borderRadius:"0.375rem",overflow:"hidden",zIndex:1e4}),singleValue:i=>({...i,color:"#1e293b"}),placeholder:i=>({...i,color:"#94a3b8"})};function ON(){const{user:i}=Fa(),[l,d]=g.useState([]),[u,c]=g.useState([]),[m,v]=g.useState([]),[y,h]=g.useState([]),[p,S]=g.useState(""),[C,D]=g.useState(""),[R,k]=g.useState(""),[b,_]=g.useState(""),[O,q]=g.useState(!1),[E,j]=g.useState(!0),[N,G]=g.useState(!1),[w,ae]=g.useState({tipo_item:"",item_id:"",cantidad:"",unidad:"",motivo:"",observaciones:""}),oe=TN.map(T=>({value:T.value,label:T.label}));g.useEffect(()=>{W(),V(),P(),ce()},[]);const W=async()=>{try{const ee=await(await fetch(ci(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getMermas"})})).json();ee.success?d(ee.data||[]):A.error(ee.message||"Error al cargar mermas")}catch{A.error("Error de conexion con el servidor")}finally{j(!1)}},V=async()=>{try{const ee=await(await fetch(ci(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductos"})})).json();ee.success&&c(ee.data||[])}catch(T){console.error("Error al cargar productos:",T)}},P=async()=>{try{const ee=await(await fetch(ci(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientes"})})).json();ee.success&&v(ee.data||[])}catch(T){console.error("Error al cargar ingredientes:",T)}},ce=async()=>{try{const ee=await(await fetch(ci(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProducciones"})})).json();ee.success&&h(ee.data||[])}catch(T){console.error("Error al cargar producciones:",T)}},ye=()=>{switch(w.tipo_item){case"producto":return u.map(T=>({value:T.id,label:`${T.nombre} (Stock: ${T.stock} ${T.unidad})`,unidad:T.unidad}));case"ingrediente":return m.map(T=>({value:T.id,label:`${T.nombre} (Stock: ${T.cantidad} ${T.unidad})`,unidad:T.unidad}));case"produccion":return y.map(T=>({value:T.id,label:`${T.producto_nombre} - ${T.fecha} (${T.cantidad_producida} ${T.unidad})`,unidad:T.unidad}));default:return[]}},je=l.filter(T=>{const ee=!p||T.item_nombre.toLowerCase().includes(p.toLowerCase())||T.motivo_label.toLowerCase().includes(p.toLowerCase()),ne=!C||T.tipo_item===C,he=!R||T.fecha>=R,me=!b||T.fecha<=b;return ee&&ne&&he&&me}),F=()=>{ae({tipo_item:"",item_id:"",cantidad:"",unidad:"",motivo:"",observaciones:""}),q(!0)},K=()=>{q(!1)},fe=async T=>{if(T.preventDefault(),!w.tipo_item||!w.item_id||!w.cantidad||!w.motivo){A.error("Completa todos los campos requeridos");return}if(parseFloat(w.cantidad)<=0){A.error("La cantidad debe ser mayor a 0");return}G(!0);try{const ne=await(await fetch(ci(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"registrarMerma",tipo_item:w.tipo_item,item_id:parseInt(w.item_id),cantidad:parseFloat(w.cantidad),unidad:w.unidad,motivo:w.motivo,observaciones:w.observaciones,usuario_id:i==null?void 0:i.id})})).json();ne.success?(A.success("Merma registrada correctamente"),W(),V(),P(),ce(),K()):A.error(ne.message||"Error al registrar merma")}catch{A.error("Error de conexion con el servidor")}finally{G(!1)}},Te=T=>{const ee=l.find(ne=>ne.id===T);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar merma de "',ee==null?void 0:ee.item_nombre,'"?']}),a.jsx("p",{style:{fontSize:"0.75rem",color:"#64748b"},children:"Se restaurara el stock descontado"}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const he=await(await fetch(ci(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarMerma",id:T})})).json();he.success?(A.dismiss(),A.success("Merma eliminada y stock restaurado"),W(),V(),P(),ce()):A.error(he.message||"Error al eliminar")}catch{A.error("Error de conexion")}},style:{padding:"0.25rem 0.75rem",background:"#ef4444",color:"#fff",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Eliminar"}),a.jsx("button",{onClick:()=>A.dismiss(),style:{padding:"0.25rem 0.75rem",background:"#e2e8f0",color:"#1e293b",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Cancelar"})]})]}),{autoClose:!1,closeOnClick:!1,draggable:!1,closeButton:!1})},de=T=>{switch(T){case"producto":return a.jsx($t,{size:14});case"ingrediente":return a.jsx(xl,{size:14});case"produccion":return a.jsx(hi,{size:14});default:return null}},z=T=>{switch(T){case"producto":return"merma-badge-producto";case"ingrediente":return"merma-badge-ingrediente";case"produccion":return"merma-badge-produccion";default:return""}};return E?a.jsx("div",{className:"merma",children:a.jsx("p",{children:"Cargando mermas..."})}):a.jsxs("div",{className:"merma",children:[a.jsxs("div",{className:"merma-header",children:[a.jsx("h2",{children:"Merma"}),a.jsxs("button",{className:"btn-primary",onClick:F,children:[a.jsx(aa,{size:20}),"Registrar Merma"]})]}),a.jsxs("div",{className:"merma-filtros",children:[a.jsxs("div",{className:"search-box",children:[a.jsx(ha,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por nombre o motivo...",value:p,onChange:T=>S(T.target.value)})]}),a.jsx(ht,{value:C?oe.find(T=>T.value===C):null,onChange:T=>D(T?T.value:""),options:oe,isClearable:!0,placeholder:"Todos los tipos",styles:$r,className:"filtro-select-container",noOptionsMessage:()=>"Sin resultados"}),a.jsxs("div",{className:"merma-filtro-fechas",children:[a.jsxs("div",{className:"merma-fecha-input",children:[a.jsx(Yn,{size:14}),a.jsx("input",{type:"date",value:R,onChange:T=>k(T.target.value),placeholder:"Desde"})]}),a.jsxs("div",{className:"merma-fecha-input",children:[a.jsx(Yn,{size:14}),a.jsx("input",{type:"date",value:b,onChange:T=>_(T.target.value),placeholder:"Hasta"})]})]})]}),a.jsxs("div",{className:"merma-tabla",children:[a.jsxs("table",{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Fecha"}),a.jsx("th",{children:"Tipo"}),a.jsx("th",{children:"Item"}),a.jsx("th",{children:"Cantidad"}),a.jsx("th",{children:"Motivo"}),a.jsx("th",{children:"Observaciones"}),a.jsx("th",{children:"Registrado por"}),a.jsx("th",{children:"Acciones"})]})}),a.jsx("tbody",{children:je.map(T=>a.jsxs("tr",{children:[a.jsx("td",{children:new Date(T.fecha+"T00:00:00").toLocaleDateString("es-MX")}),a.jsx("td",{children:a.jsxs("span",{className:`merma-tipo-badge ${z(T.tipo_item)}`,children:[de(T.tipo_item),T.tipo_item==="produccion"?"Producción":T.tipo_item.charAt(0).toUpperCase()+T.tipo_item.slice(1)]})}),a.jsx("td",{children:a.jsx("strong",{children:T.item_nombre})}),a.jsxs("td",{className:"merma-cantidad-cell",children:[T.cantidad," ",T.unidad]}),a.jsx("td",{children:T.motivo_label}),a.jsx("td",{children:T.observaciones||"-"}),a.jsx("td",{children:T.usuario_nombre}),a.jsx("td",{className:"acciones",children:a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>Te(T.id),title:"Eliminar",children:a.jsx(Yt,{size:14})})})]},T.id))})]}),je.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron registros de merma"})]}),O&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-merma",onClick:K,children:a.jsxs("div",{className:"modal-merma",onClick:T=>T.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:"Registrar Merma"}),a.jsx("button",{className:"btn-close",onClick:K,children:a.jsx(tt,{size:18})})]}),a.jsxs("form",{onSubmit:fe,children:[a.jsxs("div",{className:"mmer-row",children:[a.jsxs("div",{className:"mmer-field",children:[a.jsx("label",{children:"Tipo *"}),a.jsx(ht,{value:w.tipo_item?oe.find(T=>T.value===w.tipo_item):null,onChange:T=>{ae(ee=>({...ee,tipo_item:T?T.value:"",item_id:"",unidad:""}))},options:oe,styles:$r,placeholder:"Seleccionar tipo..."})]}),a.jsxs("div",{className:"mmer-field",children:[a.jsx("label",{children:"Motivo *"}),a.jsx(ht,{value:w.motivo?hv.find(T=>T.value===w.motivo):null,onChange:T=>ae(ee=>({...ee,motivo:T?T.value:""})),options:hv,styles:$r,placeholder:"Seleccionar motivo..."})]})]}),a.jsxs("div",{className:"mmer-field",children:[a.jsxs("label",{children:[w.tipo_item==="producto"?"Producto":w.tipo_item==="ingrediente"?"Ingrediente":w.tipo_item==="produccion"?"Producción":"Item"," *"]}),a.jsx(ht,{value:w.item_id?ye().find(T=>T.value===parseInt(w.item_id)):null,onChange:T=>{ae(ee=>({...ee,item_id:T?T.value:"",unidad:T?T.unidad:""}))},options:ye(),styles:$r,placeholder:w.tipo_item?"Seleccionar...":"Primero selecciona un tipo",isDisabled:!w.tipo_item,noOptionsMessage:()=>"Sin resultados"})]}),a.jsxs("div",{className:"mmer-row",children:[a.jsxs("div",{className:"mmer-field",children:[a.jsx("label",{children:"Cantidad *"}),a.jsx("input",{type:"number",value:w.cantidad,onChange:T=>ae(ee=>({...ee,cantidad:T.target.value})),min:"0",step:"0.01",required:!0})]}),a.jsxs("div",{className:"mmer-field",children:[a.jsx("label",{children:"Unidad"}),a.jsx("input",{type:"text",value:w.unidad,readOnly:!0,disabled:!0})]})]}),a.jsxs("div",{className:"mmer-field",children:[a.jsx("label",{children:"Observaciones"}),a.jsx("textarea",{value:w.observaciones,onChange:T=>ae(ee=>({...ee,observaciones:T.target.value})),placeholder:"Detalles adicionales...",rows:2})]}),a.jsxs("div",{className:"mmer-actions",children:[a.jsx("button",{type:"button",className:"mmer-btn-cancel",onClick:K,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mmer-btn-save",disabled:N,children:N?"Guardando...":"Registrar Merma"})]})]})]})}),document.body),a.jsx(Ft,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const ui=()=>Be.getApiUrl(),Fr=[{value:"efectivo",label:"Efectivo"},{value:"transferencia",label:"Transferencia"},{value:"credito",label:"Crédito"},{value:"tarjeta",label:"Tarjeta"}],pv={control:(i,l)=>({...i,background:"#fff",borderColor:l.isFocused?"#f97316":"#e2e8f0",borderRadius:"0.375rem",minHeight:"0",fontSize:"clamp(0.68rem, 1.5vh, 0.9rem)",boxShadow:"none","&:hover":{borderColor:"#f97316"}}),valueContainer:i=>({...i,padding:"clamp(0.15rem, 0.5vh, 0.35rem) 0.5rem"}),input:i=>({...i,margin:0,padding:0}),dropdownIndicator:i=>({...i,padding:"clamp(0.1rem, 0.3vh, 0.2rem) 0.25rem"}),clearIndicator:i=>({...i,padding:"clamp(0.1rem, 0.3vh, 0.2rem) 0.25rem"}),option:(i,l)=>({...i,backgroundColor:l.isSelected?"#f97316":l.isFocused?"rgba(249, 115, 22, 0.08)":"#fff",color:l.isSelected?"#fff":"#1e293b",cursor:"pointer",padding:"clamp(0.2rem, 0.5vh, 0.4rem) 0.75rem",fontSize:"clamp(0.68rem, 1.5vh, 0.9rem)"}),menu:i=>({...i,borderRadius:"0.375rem",overflow:"hidden",zIndex:1e4}),singleValue:i=>({...i,color:"#1e293b"}),placeholder:i=>({...i,color:"#94a3b8"})};function EN(){var Ue,ke;const{user:i}=Fa(),[l,d]=g.useState([]),[u,c]=g.useState([]),[m,v]=g.useState([]),[y,h]=g.useState(""),[p,S]=g.useState(""),[C,D]=g.useState(""),[R,k]=g.useState(!1),[b,_]=g.useState(!1),[O,q]=g.useState(null),[E,j]=g.useState(!0),[N,G]=g.useState(!1),[w,ae]=g.useState({proveedor:"",metodo_pago:"efectivo",observaciones:""}),[oe,W]=g.useState([]),V=u.filter(ie=>ie.envasado_origen===1||ie.envasado_origen===!0).map(ie=>({value:`prod_${ie.id}`,id:ie.id,tipo:"producto",label:`${ie.nombre} (${ie.unidad})`,unidad:ie.unidad})),ce=[{label:"Ingredientes",options:m.map(ie=>({value:`ing_${ie.id}`,id:ie.id,tipo:"ingrediente",label:`${ie.nombre} (${ie.unidad})`,unidad:ie.unidad}))},{label:"Productos envasados",options:V}];g.useEffect(()=>{ye(),je(),F()},[]);const ye=async()=>{try{const B=await(await fetch(ui(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCompras"})})).json();B.success?d(B.data||[]):A.error(B.message||"Error al cargar compras")}catch{A.error("Error de conexion con el servidor")}finally{j(!1)}},je=async()=>{try{const B=await(await fetch(ui(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductos"})})).json();B.success&&c(B.data||[])}catch(ie){console.error("Error al cargar productos:",ie)}},F=async()=>{try{const B=await(await fetch(ui(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientes"})})).json();B.success&&v(B.data||[])}catch(ie){console.error("Error al cargar ingredientes:",ie)}},K=l.filter(ie=>{const B=!y||ie.proveedor&&ie.proveedor.toLowerCase().includes(y.toLowerCase())||ie.id.toString().includes(y),pe=!p||ie.fecha>=p,H=!C||ie.fecha<=C;return B&&pe&&H}),fe=()=>{ae({proveedor:"",metodo_pago:"efectivo",observaciones:""}),W([]),k(!0)},Te=()=>{k(!1)},de=()=>{W([...oe,{tipo:"",item_id:"",nombre:"",cantidad:"",precio_unitario:"",unidad:"",_selectValue:null}])},z=(ie,B,pe)=>{const H=[...oe];H[ie][B]=pe,W(H)},T=ie=>{W(oe.filter((B,pe)=>pe!==ie))},ee=ie=>{const B=parseFloat(ie.cantidad)||0,pe=parseFloat(ie.precio_unitario)||0;return B*pe},ne=()=>oe.reduce((ie,B)=>ie+ee(B),0),he=async ie=>{ie.preventDefault();const B=oe.filter(pe=>pe.item_id&&pe.cantidad>0&&pe.precio_unitario>0);if(B.length===0){A.error("Agrega al menos un item con cantidad y precio");return}G(!0);try{const H=await(await fetch(ui(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"registrarCompra",proveedor:w.proveedor,metodo_pago:w.metodo_pago,observaciones:w.observaciones,total:ne(),usuario_id:i==null?void 0:i.id,items:B.map(ue=>({tipo_item:ue.tipo,item_id:ue.item_id,cantidad:parseFloat(ue.cantidad),precio_unitario:parseFloat(ue.precio_unitario),unidad:ue.unidad}))})})).json();H.success?(A.success("Compra registrada correctamente"),ye(),je(),F(),Te()):A.error(H.message||"Error al registrar compra")}catch{A.error("Error de conexion con el servidor")}finally{G(!1)}},me=async ie=>{try{const pe=await(await fetch(ui(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCompraDetalle",id:ie.id})})).json();pe.success?(q(pe.data),_(!0)):A.error(pe.message||"Error al cargar detalle")}catch{A.error("Error de conexion")}},xe=ie=>{l.find(B=>B.id===ie),A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:["¿Eliminar compra #",ie,"?"]}),a.jsx("p",{style:{fontSize:"0.75rem",color:"#64748b"},children:"Se revertira el stock agregado"}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const pe=await(await fetch(ui(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarCompra",id:ie})})).json();pe.success?(A.dismiss(),A.success("Compra eliminada y stock revertido"),ye(),je(),F()):A.error(pe.message||"Error al eliminar")}catch{A.error("Error de conexion")}},style:{padding:"0.25rem 0.75rem",background:"#ef4444",color:"#fff",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Eliminar"}),a.jsx("button",{onClick:()=>A.dismiss(),style:{padding:"0.25rem 0.75rem",background:"#e2e8f0",color:"#1e293b",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Cancelar"})]})]}),{autoClose:!1,closeOnClick:!1,draggable:!1,closeButton:!1})};return E?a.jsx("div",{className:"compras",children:a.jsx("p",{children:"Cargando compras..."})}):a.jsxs("div",{className:"compras",children:[a.jsxs("div",{className:"compras-header",children:[a.jsx("h2",{children:"Compras"}),a.jsxs("button",{className:"btn-primary",onClick:fe,children:[a.jsx(aa,{size:20}),"Nueva Compra"]})]}),a.jsxs("div",{className:"compras-filtros",children:[a.jsxs("div",{className:"search-box",children:[a.jsx(ha,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por proveedor o # compra...",value:y,onChange:ie=>h(ie.target.value)})]}),a.jsxs("div",{className:"compras-filtro-fechas",children:[a.jsxs("div",{className:"compras-fecha-input",children:[a.jsx(Yn,{size:14}),a.jsx("input",{type:"date",value:p,onChange:ie=>S(ie.target.value)})]}),a.jsxs("div",{className:"compras-fecha-input",children:[a.jsx(Yn,{size:14}),a.jsx("input",{type:"date",value:C,onChange:ie=>D(ie.target.value)})]})]})]}),a.jsxs("div",{className:"compras-tabla",children:[a.jsxs("table",{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"#"}),a.jsx("th",{children:"Fecha"}),a.jsx("th",{children:"Proveedor"}),a.jsx("th",{children:"Items"}),a.jsx("th",{children:"Metodo Pago"}),a.jsx("th",{children:"Total"}),a.jsx("th",{children:"Registrado por"}),a.jsx("th",{children:"Acciones"})]})}),a.jsx("tbody",{children:K.map(ie=>{var B;return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsxs("strong",{children:["#",ie.id]})}),a.jsx("td",{children:new Date(ie.fecha+"T00:00:00").toLocaleDateString("es-MX")}),a.jsx("td",{children:ie.proveedor||a.jsx("span",{style:{color:"#94a3b8"},children:"Sin proveedor"})}),a.jsx("td",{children:a.jsxs("span",{className:"compras-items-badge",children:[a.jsx(Tv,{size:12}),ie.total_items]})}),a.jsx("td",{children:a.jsx("span",{className:`compras-pago-badge compras-pago-${ie.metodo_pago}`,children:((B=Fr.find(pe=>pe.value===ie.metodo_pago))==null?void 0:B.label)||ie.metodo_pago})}),a.jsxs("td",{className:"compras-total-cell",children:["$",Number(ie.total).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]}),a.jsx("td",{children:ie.usuario_nombre}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>me(ie),title:"Ver detalle",children:a.jsx(xs,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>xe(ie.id),title:"Eliminar",children:a.jsx(Yt,{size:14})})]})]},ie.id)})})]}),K.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron compras"})]}),R&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-compras",onClick:Te,children:a.jsxs("div",{className:"modal-compras",onClick:ie=>ie.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:"Nueva Compra"}),a.jsx("button",{className:"btn-close",onClick:Te,children:a.jsx(tt,{size:18})})]}),a.jsxs("form",{onSubmit:he,children:[a.jsxs("div",{className:"mcom-row mcom-row-3",children:[a.jsxs("div",{className:"mcom-field",children:[a.jsx("label",{children:"Proveedor"}),a.jsx("input",{type:"text",value:w.proveedor,onChange:ie=>ae(B=>({...B,proveedor:ie.target.value})),placeholder:"Opcional"})]}),a.jsxs("div",{className:"mcom-field",children:[a.jsx("label",{children:"Metodo de Pago *"}),a.jsx(ht,{value:Fr.find(ie=>ie.value===w.metodo_pago),onChange:ie=>ae(B=>({...B,metodo_pago:ie?ie.value:"efectivo"})),options:Fr,styles:pv})]}),a.jsxs("div",{className:"mcom-field",children:[a.jsx("label",{children:"Observaciones"}),a.jsx("input",{type:"text",value:w.observaciones,onChange:ie=>ae(B=>({...B,observaciones:ie.target.value})),placeholder:"Opcional"})]})]}),a.jsxs("div",{className:"mcom-items-section",children:[a.jsxs("div",{className:"mcom-items-header",children:[a.jsx("h4",{children:"Items de la compra"}),a.jsxs("button",{type:"button",className:"mcom-btn-add",onClick:de,children:[a.jsx(aa,{size:14})," Agregar item"]})]}),oe.length===0?a.jsx("p",{className:"mcom-items-empty",children:"Agrega items a la compra"}):a.jsxs("div",{className:"mcom-items-list",children:[a.jsxs("div",{className:"mcom-items-list-header",children:[a.jsx("span",{className:"mcom-col-item",children:"Item"}),a.jsx("span",{className:"mcom-col-cant",children:"Cantidad"}),a.jsx("span",{className:"mcom-col-unit",children:"Unidad"}),a.jsx("span",{className:"mcom-col-precio",children:"P. Unitario"}),a.jsx("span",{className:"mcom-col-subtotal",children:"Subtotal"}),a.jsx("span",{className:"mcom-col-del"})]}),oe.map((ie,B)=>a.jsxs("div",{className:"mcom-item-row",children:[a.jsx("div",{className:"mcom-col-item",children:a.jsx(ht,{value:ie._selectValue,onChange:pe=>{const H=[...oe];H[B]={...H[B],tipo:pe?pe.tipo:"",item_id:pe?pe.id:"",nombre:pe?pe.label:"",unidad:pe?pe.unidad:"",_selectValue:pe},W(H)},options:ce,styles:pv,placeholder:"Seleccionar...",noOptionsMessage:()=>"Sin resultados"})}),a.jsx("div",{className:"mcom-col-cant",children:a.jsx("input",{type:"number",value:ie.cantidad,onChange:pe=>z(B,"cantidad",pe.target.value),min:"0",step:"0.01",placeholder:"0"})}),a.jsx("div",{className:"mcom-col-unit",children:a.jsx("input",{type:"text",value:ie.unidad,readOnly:!0,disabled:!0})}),a.jsx("div",{className:"mcom-col-precio",children:a.jsx("input",{type:"number",value:ie.precio_unitario,onChange:pe=>z(B,"precio_unitario",pe.target.value),min:"0",step:"0.01",placeholder:"$0.00"})}),a.jsxs("div",{className:"mcom-col-subtotal",children:["$",ee(ie).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]}),a.jsx("div",{className:"mcom-col-del",children:a.jsx("button",{type:"button",className:"btn-icon btn-danger",onClick:()=>T(B),children:a.jsx(Yt,{size:13})})})]},B))]}),oe.length>0&&a.jsxs("div",{className:"mcom-total-row",children:[a.jsx("strong",{children:"Total:"}),a.jsxs("span",{children:["$",ne().toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]})]})]}),a.jsxs("div",{className:"mcom-actions",children:[a.jsx("button",{type:"button",className:"mcom-btn-cancel",onClick:Te,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mcom-btn-save",disabled:N,children:N?"Guardando...":"Registrar Compra"})]})]})]})}),document.body),b&&O&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-compras",onClick:()=>_(!1),children:a.jsxs("div",{className:"modal-compras modal-compras-detalle",onClick:ie=>ie.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsxs("h3",{children:["Compra #",O.id]}),a.jsx("button",{className:"btn-close",onClick:()=>_(!1),children:a.jsx(tt,{size:18})})]}),a.jsxs("div",{className:"mcom-detalle-content",children:[a.jsxs("div",{className:"mcom-detalle-info",children:[a.jsxs("div",{className:"mcom-detalle-info-item",children:[a.jsx("span",{children:"Fecha:"}),a.jsx("strong",{children:new Date(O.fecha+"T00:00:00").toLocaleDateString("es-MX")})]}),a.jsxs("div",{className:"mcom-detalle-info-item",children:[a.jsx("span",{children:"Proveedor:"}),a.jsx("strong",{children:O.proveedor||"Sin proveedor"})]}),a.jsxs("div",{className:"mcom-detalle-info-item",children:[a.jsx("span",{children:"Metodo de pago:"}),a.jsx("strong",{children:((Ue=Fr.find(ie=>ie.value===O.metodo_pago))==null?void 0:Ue.label)||O.metodo_pago})]}),a.jsxs("div",{className:"mcom-detalle-info-item",children:[a.jsx("span",{children:"Registrado por:"}),a.jsx("strong",{children:O.usuario_nombre})]}),O.observaciones&&a.jsxs("div",{className:"mcom-detalle-info-item",children:[a.jsx("span",{children:"Observaciones:"}),a.jsx("strong",{children:O.observaciones})]})]}),a.jsxs("table",{className:"mcom-detalle-tabla",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Tipo"}),a.jsx("th",{children:"Item"}),a.jsx("th",{children:"Cantidad"}),a.jsx("th",{children:"P. Unitario"}),a.jsx("th",{children:"Subtotal"})]})}),a.jsx("tbody",{children:(ke=O.items)==null?void 0:ke.map((ie,B)=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("span",{className:`merma-tipo-badge ${ie.tipo_item==="producto"?"merma-badge-producto":"merma-badge-ingrediente"}`,children:ie.tipo_item==="producto"?"Producto":"Ingrediente"})}),a.jsx("td",{children:a.jsx("strong",{children:ie.item_nombre})}),a.jsxs("td",{children:[ie.cantidad," ",ie.unidad]}),a.jsxs("td",{children:["$",Number(ie.precio_unitario).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]}),a.jsx("td",{children:a.jsxs("strong",{children:["$",Number(ie.subtotal).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]})})]},B))})]}),a.jsxs("div",{className:"mcom-detalle-total",children:[a.jsx("span",{children:"Total:"}),a.jsxs("strong",{children:["$",Number(O.total).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]})]})]})]})}),document.body),a.jsx(Ft,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const di=()=>Be.getApiUrl(),Gu=[{valor:1e3,tipo:"billete",label:"$1,000"},{valor:500,tipo:"billete",label:"$500"},{valor:200,tipo:"billete",label:"$200"},{valor:100,tipo:"billete",label:"$100"},{valor:50,tipo:"billete",label:"$50"},{valor:20,tipo:"billete",label:"$20"},{valor:10,tipo:"moneda",label:"$10"},{valor:5,tipo:"moneda",label:"$5"},{valor:2,tipo:"moneda",label:"$2"},{valor:1,tipo:"moneda",label:"$1"},{valor:.5,tipo:"moneda",label:"$0.50"}];function zN(){const{user:i}=Fa(),[l,d]=g.useState(!0),[u,c]=g.useState(null),[m,v]=g.useState([]),[y,h]=g.useState({}),[p,S]=g.useState(""),[C,D]=g.useState(""),[R,k]=g.useState(!1),[b,_]=g.useState(null),[O,q]=g.useState([]),[E,j]=g.useState(null),[N,G]=g.useState([]),[w,ae]=g.useState({}),[oe,W]=g.useState(null),[V,P]=g.useState(1),ce=Be.getSucursal(),ye=Be.getCaja();g.useEffect(()=>{je()},[]);const je=async()=>{d(!0),await Promise.all([K(),fe(),Te(),de(),F()]),d(!1)},F=async()=>{try{const Se=await(await fetch(di(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getTurnoActivo",caja:ye,sucursal:ce})})).json();Se.success&&Se.data&&(W(Se.data),S(String(Se.data.fondo_caja)))}catch(I){console.error("Error al cargar turno:",I)}},K=async()=>{try{const Se=await(await fetch(di(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getResumenCaja",caja:ye,sucursal:ce})})).json();Se.success&&c(Se.data)}catch(I){console.error("Error al cargar resumen:",I)}},fe=async()=>{try{const Se=await(await fetch(di(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getPedidosPausadosActivos",caja:ye,sucursal:ce})})).json();Se.success&&v(Se.data||[])}catch(I){console.error("Error al cargar pedidos:",I)}},Te=async()=>{try{const Se=await(await fetch(di(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCortes",caja:ye,sucursal:ce,limite:5})})).json();Se.success&&q(Se.data||[])}catch(I){console.error("Error al cargar historial:",I)}},de=async()=>{try{const Se=await(await fetch(di(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductosContabilizar"})})).json();Se.success&&G(Se.data||[])}catch(I){console.error("Error al cargar productos:",I)}},z=(I,Se)=>{ae(Mt=>({...Mt,[I]:Se===""?"":parseFloat(Se)||0}))},T=()=>N.length===0?!0:N.every(I=>w[I.id]!==void 0&&w[I.id]!==""),ee=(I,Se)=>{const Mt=Se===""?0:parseInt(Se)||0;h(Ot=>({...Ot,[I]:Mt}))},ne=()=>Gu.reduce((I,Se)=>I+Se.valor*(y[Se.valor]||0),0),he=()=>{if(!u)return 0;const I=parseFloat(p)||0;return u.efectivo+I},me=()=>ne()-he(),xe=N.length>0?3:2,Ue=()=>V===1?!(!oe&&!p&&p!==0):V===2&&N.length>0?T():!0,ke=()=>!(m.length>0||!ce||!ye||!u||u.num_ventas===0||!T()),ie=async()=>{if(!ke())return;k(!0);const I=N.map(Se=>({producto_id:Se.id,nombre:Se.nombre,unidad:Se.unidad,stock_esperado:Se.stock,stock_fisico:w[Se.id]||0}));try{const Mt=await(await fetch(di(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"realizarCorte",usuario_id:(i==null?void 0:i.id)||null,caja:ye,sucursal:ce,efectivo_fisico:ne(),fondo_caja:parseFloat(p)||0,detalle_arqueo:y,notas:C,inventario:I})})).json();Mt.success?(A.success("Corte de caja realizado correctamente"),_(Mt.data),h({}),S(""),D(""),ae({}),P(1),je()):A.error(Mt.message||"Error al realizar corte")}catch{A.error("Error de conexion")}k(!1)},B=I=>new Intl.NumberFormat("es-MX",{style:"currency",currency:"MXN"}).format(I),pe=I=>new Date(I).toLocaleString("es-MX",{dateStyle:"short",timeStyle:"short"});if(l)return a.jsx("div",{className:"cj",children:a.jsxs("div",{className:"cj-loading",children:[a.jsx(za,{className:"cj-spin",size:28}),a.jsx("span",{children:"Cargando..."})]})});const H=m.length>0||!ce||!ye,ue=u&&u.num_ventas===0;return a.jsxs("div",{className:"cj",children:[a.jsx(Ft,{position:"top-right",autoClose:3e3}),a.jsxs("div",{className:"cj-sidebar",children:[a.jsxs("div",{className:"cj-sidebar-header",children:[a.jsxs("h2",{children:[a.jsx(ix,{size:20})," Corte de Caja"]}),a.jsxs("span",{className:"cj-meta",children:[ce," - ",ye]})]}),u&&a.jsxs("div",{className:"cj-resumen",children:[a.jsxs("div",{className:"cj-stat cj-stat-main",children:[a.jsx("span",{className:"cj-stat-label",children:"Total Vendido"}),a.jsx("span",{className:"cj-stat-value",children:B(u.total_ventas)}),a.jsxs("span",{className:"cj-stat-sub",children:[u.num_ventas," venta",u.num_ventas!==1?"s":""]})]}),a.jsxs("div",{className:"cj-stats-row",children:[a.jsxs("div",{className:"cj-stat",children:[a.jsx("span",{className:"cj-stat-label",children:"Efectivo"}),a.jsx("span",{className:"cj-stat-value sm",children:B(u.efectivo)})]}),a.jsxs("div",{className:"cj-stat",children:[a.jsx("span",{className:"cj-stat-label",children:"Tarjeta"}),a.jsx("span",{className:"cj-stat-value sm",children:B(u.tarjeta)})]})]}),oe&&a.jsxs("div",{className:"cj-stat cj-stat-fondo",children:[a.jsx("span",{className:"cj-stat-label",children:"Fondo de Caja"}),a.jsx("span",{className:"cj-stat-value sm",children:B(oe.fondo_caja)})]})]}),H&&a.jsxs("div",{className:"cj-alerta cj-alerta-error",children:[a.jsx(vs,{size:16}),m.length>0?a.jsxs("span",{children:["Hay ",m.length," pedido(s) pausado(s). Cobralos antes del corte."]}):a.jsx("span",{children:"Configura sucursal y caja primero."})]}),ue&&!H&&a.jsxs("div",{className:"cj-alerta cj-alerta-warn",children:[a.jsx(fn,{size:16}),a.jsxs("span",{children:["No hay ventas registradas",u.es_primer_corte?"":" desde el ultimo corte","."]})]}),!H&&!ue&&a.jsxs("div",{className:"cj-alerta cj-alerta-ok",children:[a.jsx(Ba,{size:16}),a.jsx("span",{children:"Listo para corte"})]}),a.jsxs("div",{className:"cj-historial",children:[a.jsxs("h4",{children:[a.jsx(fn,{size:14})," Ultimos Cortes"]}),O.length===0?a.jsx("p",{className:"cj-sin-data",children:"Sin cortes anteriores"}):a.jsx("div",{className:"cj-historial-list",children:O.map(I=>a.jsxs("button",{className:`cj-hist-item ${(E==null?void 0:E.id)===I.id?"activo":""}`,onClick:()=>j((E==null?void 0:E.id)===I.id?null:I),children:[a.jsx("span",{className:"cj-hist-fecha",children:pe(I.fecha_fin)}),a.jsx("span",{className:"cj-hist-total",children:B(I.ventas_total)}),a.jsx("span",{className:`cj-hist-dif ${I.diferencia>=0?"pos":"neg"}`,children:B(I.diferencia)})]},I.id))})]})]}),a.jsxs("div",{className:"cj-main",children:[a.jsxs("div",{className:"cj-stepper",children:[a.jsxs("button",{className:`cj-step ${V===1?"activo":V>1?"completo":""}`,onClick:()=>P(1),children:[a.jsx("span",{className:"cj-step-num",children:"1"}),a.jsx("span",{className:"cj-step-label",children:"Arqueo"})]}),a.jsx("div",{className:"cj-step-line"}),N.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:`cj-step ${V===2?"activo":V>2?"completo":""}`,onClick:()=>V>=2&&P(2),children:[a.jsx("span",{className:"cj-step-num",children:"2"}),a.jsx("span",{className:"cj-step-label",children:"Inventario"})]}),a.jsx("div",{className:"cj-step-line"})]}),a.jsxs("button",{className:`cj-step ${V===xe?"activo":""}`,onClick:()=>V>=xe&&P(xe),children:[a.jsx("span",{className:"cj-step-num",children:xe}),a.jsx("span",{className:"cj-step-label",children:"Confirmar"})]})]}),V===1&&a.jsx("div",{className:"cj-paso",children:a.jsxs("div",{className:"cj-paso-content",children:[!oe&&a.jsxs("div",{className:"cj-fondo",children:[a.jsx("label",{children:"Fondo de caja inicial"}),a.jsx("input",{type:"number",value:p,onChange:I=>S(I.target.value),placeholder:"0.00",min:"0",step:"0.01"})]}),a.jsxs("div",{className:"cj-denom-group",children:[a.jsx("span",{className:"cj-denom-title",children:"Billetes"}),a.jsx("div",{className:"cj-denom-grid",children:Gu.filter(I=>I.tipo==="billete").map(I=>a.jsxs("div",{className:`cj-denom ${(y[I.valor]||0)>0?"tiene":""}`,children:[a.jsx("span",{className:"cj-denom-label",children:I.label}),a.jsx("input",{type:"number",min:"0",value:y[I.valor]||"",onChange:Se=>ee(I.valor,Se.target.value),placeholder:"0"}),a.jsx("span",{className:"cj-denom-sub",children:B((y[I.valor]||0)*I.valor)})]},I.valor))})]}),a.jsxs("div",{className:"cj-denom-group",children:[a.jsx("span",{className:"cj-denom-title",children:"Monedas"}),a.jsx("div",{className:"cj-denom-grid",children:Gu.filter(I=>I.tipo==="moneda").map(I=>a.jsxs("div",{className:`cj-denom moneda ${(y[I.valor]||0)>0?"tiene":""}`,children:[a.jsx("span",{className:"cj-denom-label",children:I.label}),a.jsx("input",{type:"number",min:"0",value:y[I.valor]||"",onChange:Se=>ee(I.valor,Se.target.value),placeholder:"0"}),a.jsx("span",{className:"cj-denom-sub",children:B((y[I.valor]||0)*I.valor)})]},I.valor))})]}),a.jsxs("div",{className:"cj-arqueo-total",children:[a.jsx("span",{children:"Total Contado"}),a.jsx("span",{className:"cj-arqueo-total-val",children:B(ne())})]})]})}),V===2&&N.length>0&&a.jsx("div",{className:"cj-paso",children:a.jsxs("div",{className:"cj-paso-content",children:[a.jsxs("p",{className:"cj-inv-desc",children:["Registra el inventario fisico de cada producto.",!T()&&a.jsxs("span",{className:"cj-inv-pend",children:[" ",N.filter(I=>w[I.id]===void 0||w[I.id]==="").length," pendiente(s)"]})]}),a.jsx("div",{className:"cj-inv-list",children:N.map(I=>{const Se=w[I.id],Mt=Se!==void 0&&Se!=="",Ot=Mt?(parseFloat(Se)||0)-I.stock:null;return a.jsxs("div",{className:`cj-inv-item ${Mt?"ok":""}`,children:[a.jsx("span",{className:"cj-inv-nombre",children:I.nombre}),a.jsxs("span",{className:"cj-inv-sistema",children:[I.stock," ",I.unidad]}),a.jsxs("div",{className:"cj-inv-input",children:[a.jsx("input",{type:"number",min:"0",step:"0.01",value:Se??"",onChange:Dt=>z(I.id,Dt.target.value),placeholder:"Fisico"}),a.jsx("span",{className:"cj-inv-unidad",children:I.unidad})]}),a.jsx("span",{className:`cj-inv-dif ${Ot!==null?Ot<0?"neg":Ot>0?"pos":"":""}`,children:Ot!==null?(Ot>=0?"+":"")+Ot.toFixed(1):"-"})]},I.id)})})]})}),V===xe&&a.jsx("div",{className:"cj-paso",children:a.jsxs("div",{className:"cj-paso-content",children:[a.jsxs("div",{className:"cj-confirm-grid",children:[a.jsxs("div",{className:"cj-confirm-card",children:[a.jsx("span",{className:"cj-confirm-label",children:"Efectivo en Sistema"}),a.jsx("span",{className:"cj-confirm-val",children:B(he())}),a.jsxs("span",{className:"cj-confirm-detail",children:["Ventas ",B((u==null?void 0:u.efectivo)||0)," + Fondo ",B(parseFloat(p)||0)]})]}),a.jsxs("div",{className:"cj-confirm-card",children:[a.jsx("span",{className:"cj-confirm-label",children:"Efectivo Contado"}),a.jsx("span",{className:"cj-confirm-val",children:B(ne())}),a.jsx("span",{className:"cj-confirm-detail",children:"Arqueo fisico"})]}),a.jsxs("div",{className:`cj-confirm-card cj-confirm-dif ${me()>=0?"pos":"neg"}`,children:[a.jsx("span",{className:"cj-confirm-label",children:"Diferencia"}),a.jsx("span",{className:"cj-confirm-val",children:B(me())}),a.jsx("span",{className:"cj-confirm-detail",children:me()>0?"Sobrante":me()<0?"Faltante":"Cuadrado"})]})]}),a.jsxs("div",{className:"cj-notas",children:[a.jsxs("label",{children:[a.jsx(Iu,{size:14})," Notas (opcional)"]}),a.jsx("textarea",{value:C,onChange:I=>D(I.target.value),placeholder:"Observaciones del corte...",rows:2})]}),a.jsx("button",{className:"cj-btn-corte",onClick:ie,disabled:R||!ke(),children:R?a.jsxs(a.Fragment,{children:[a.jsx(za,{size:18,className:"cj-spin"})," Procesando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ba,{size:18})," Realizar Corte de Caja"]})})]})}),a.jsxs("div",{className:"cj-nav",children:[V>1&&a.jsxs("button",{className:"cj-nav-btn",onClick:()=>P(V-1),children:[a.jsx(fx,{size:16})," Anterior"]}),a.jsx("div",{style:{flex:1}}),V<xe&&a.jsxs("button",{className:"cj-nav-btn cj-nav-next",onClick:()=>Ue()&&P(V+1),disabled:!Ue(),children:["Siguiente ",a.jsx(_v,{size:16})]})]})]}),b&&a.jsx("div",{className:"cj-modal-overlay",onClick:()=>_(null),children:a.jsxs("div",{className:"cj-modal",onClick:I=>I.stopPropagation(),children:[a.jsxs("div",{className:"cj-modal-header",children:[a.jsx(Ba,{size:24}),a.jsx("h3",{children:"Corte Realizado"}),a.jsx("button",{className:"cj-modal-close",onClick:()=>_(null),children:a.jsx(tt,{size:18})})]}),a.jsxs("div",{className:"cj-modal-body",children:[a.jsxs("div",{className:"cj-result-grid",children:[a.jsxs("div",{className:"cj-result-item",children:[a.jsx("span",{children:"Ventas"}),a.jsx("strong",{children:b.num_ventas})]}),a.jsxs("div",{className:"cj-result-item",children:[a.jsx("span",{children:"Total Vendido"}),a.jsx("strong",{children:B(b.ventas_total)})]}),a.jsxs("div",{className:"cj-result-item",children:[a.jsx("span",{children:"Efectivo"}),a.jsx("strong",{children:B(b.ventas_efectivo)})]}),a.jsxs("div",{className:"cj-result-item",children:[a.jsx("span",{children:"Tarjeta"}),a.jsx("strong",{children:B(b.ventas_tarjeta)})]})]}),a.jsxs("div",{className:`cj-result-dif ${b.diferencia>=0?"pos":"neg"}`,children:[a.jsx("span",{children:"Diferencia:"}),a.jsx("strong",{children:B(b.diferencia)}),a.jsx("span",{className:"cj-result-dif-label",children:b.diferencia>0?"Sobrante":b.diferencia<0?"Faltante":"Cuadrado"})]}),b.inventario&&b.inventario.length>0&&a.jsxs("div",{className:"cj-result-inv",children:[a.jsx("h4",{children:"Inventario"}),b.inventario.map((I,Se)=>a.jsxs("div",{className:"cj-result-inv-row",children:[a.jsx("span",{children:I.nombre}),a.jsx("span",{children:I.stock_fisico}),a.jsxs("span",{className:I.diferencia<0?"neg":I.diferencia>0?"pos":"",children:[I.diferencia>=0?"+":"",I.diferencia.toFixed(1)]})]},Se))]})]}),a.jsxs("button",{className:"cj-modal-ok",onClick:()=>_(null),children:[a.jsx(Ba,{size:16})," Entendido"]})]})}),E&&a.jsx("div",{className:"cj-modal-overlay",onClick:()=>j(null),children:a.jsxs("div",{className:"cj-modal",onClick:I=>I.stopPropagation(),children:[a.jsxs("div",{className:"cj-modal-header cj-modal-header-hist",children:[a.jsx(fn,{size:20}),a.jsx("h3",{children:"Detalle del Corte"}),a.jsx("button",{className:"cj-modal-close",onClick:()=>j(null),children:a.jsx(tt,{size:18})})]}),a.jsxs("div",{className:"cj-modal-body",children:[a.jsxs("div",{className:"cj-detail-meta",children:[a.jsx("span",{children:pe(E.fecha_fin)}),a.jsx("span",{children:E.usuario_nombre||"N/A"}),a.jsxs("span",{children:[E.sucursal," - ",E.caja]})]}),a.jsxs("div",{className:"cj-result-grid",children:[a.jsxs("div",{className:"cj-result-item",children:[a.jsx("span",{children:"Ventas"}),a.jsx("strong",{children:E.num_ventas})]}),a.jsxs("div",{className:"cj-result-item",children:[a.jsx("span",{children:"Total"}),a.jsx("strong",{children:B(E.ventas_total)})]}),a.jsxs("div",{className:"cj-result-item",children:[a.jsx("span",{children:"Efectivo"}),a.jsx("strong",{children:B(E.ventas_efectivo)})]}),a.jsxs("div",{className:"cj-result-item",children:[a.jsx("span",{children:"Tarjeta"}),a.jsx("strong",{children:B(E.ventas_tarjeta)})]}),a.jsxs("div",{className:"cj-result-item",children:[a.jsx("span",{children:"Fondo"}),a.jsx("strong",{children:B(E.fondo_caja)})]}),a.jsxs("div",{className:"cj-result-item",children:[a.jsx("span",{children:"Contado"}),a.jsx("strong",{children:B(E.efectivo_fisico)})]})]}),a.jsxs("div",{className:`cj-result-dif ${E.diferencia>=0?"pos":"neg"}`,children:[a.jsx("span",{children:"Diferencia:"}),a.jsx("strong",{children:B(E.diferencia)}),a.jsx("span",{className:"cj-result-dif-label",children:E.diferencia>0?"Sobrante":E.diferencia<0?"Faltante":"Cuadrado"})]})]}),a.jsxs("button",{className:"cj-modal-ok",onClick:()=>j(null),children:[a.jsx(Ba,{size:16})," Cerrar"]})]})})]})}function MN(){return a.jsx("div",{className:"reportes",children:a.jsx("h2",{children:"Módulo de Reportes"})})}function AN(){return a.jsx("div",{className:"estadisticas",children:a.jsx("h2",{children:"Módulo de Estadísticas"})})}const Yu=()=>Be.getApiUrl(),wN=[{value:0,label:"Desactivado"},{value:1,label:"1 minuto"},{value:2,label:"2 minutos"},{value:3,label:"3 minutos"},{value:5,label:"5 minutos"},{value:10,label:"10 minutos"},{value:15,label:"15 minutos"},{value:30,label:"30 minutos"}];function kN(){const{syncStatus:i,sincronizando:l,ultimaSync:d,syncError:u,intervalo:c,logs:m,ejecutarSync:v,setIntervalo:y,limpiarLogs:h,cargarEstadoSync:p}=dd(),[S,C]=g.useState("general"),[D,R]=g.useState({sucursal:"",caja:"",apiUrl:""}),[k,b]=g.useState({host:"",usuario:"",password:"",nombre:"",puerto:3306,activa:!1}),[_,O]=g.useState(!1),[q,E]=g.useState(!1),[j,N]=g.useState(null),[G,w]=g.useState(!1),[ae,oe]=g.useState(null),[W,V]=g.useState(!1),[P,ce]=g.useState(null),[ye,je]=g.useState(!0);g.useEffect(()=>{F()},[]);const F=async()=>{const ne=Be.getAll();R({sucursal:ne.sucursal||"",caja:ne.caja||"",apiUrl:ne.apiUrl||""});try{const me=await(await fetch(Yu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getConfiguracion"})})).json();me.success&&me.data&&(R(xe=>({...xe,sucursal:me.data.sucursal||xe.sucursal,caja:me.data.caja||xe.caja})),b({host:me.data.db_remota_host||"",usuario:me.data.db_remota_usuario||"",password:me.data.db_remota_password||"",nombre:me.data.db_remota_nombre||"",puerto:me.data.db_remota_puerto||3306,activa:me.data.db_remota_activa||!1}))}catch(he){console.error("Error al cargar configuracion:",he)}je(!1)},K=ne=>{const{name:he,value:me}=ne.target;R(xe=>({...xe,[he]:me})),N(null),he==="apiUrl"&&oe(null)},fe=ne=>{const{name:he,value:me,type:xe,checked:Ue}=ne.target;b(ke=>({...ke,[he]:xe==="checkbox"?Ue:me})),N(null),ce(null)},Te=async()=>{if(!D.apiUrl.trim()){oe({success:!1,message:"Ingrese una URL"});return}w(!0),oe(null);const ne=await Be.testConnection(D.apiUrl);oe(ne),w(!1)},de=async()=>{if(!k.host.trim()||!k.usuario.trim()||!k.nombre.trim()){ce({success:!1,message:"Complete los campos requeridos"});return}V(!0),ce(null);try{const he=await(await fetch(Yu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"probarConexionRemota",host:k.host,usuario:k.usuario,password:k.password,nombre:k.nombre,puerto:k.puerto})})).json();ce({success:he.success,message:he.message})}catch{ce({success:!1,message:"Error al probar conexion"})}V(!1)},z=async()=>{if(!D.sucursal.trim()){N({tipo:"error",texto:"El nombre de la sucursal es requerido"});return}if(!D.caja.trim()){N({tipo:"error",texto:"El nombre de la caja es requerido"});return}if(!D.apiUrl.trim()){N({tipo:"error",texto:"La URL de la API es requerida"});return}E(!0),Be.save({apiUrl:D.apiUrl,sucursal:D.sucursal,caja:D.caja});try{const he=await(await fetch(Yu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"actualizarConfiguracion",sucursal:D.sucursal,caja:D.caja,db_remota_host:k.host,db_remota_usuario:k.usuario,db_remota_password:k.password,db_remota_nombre:k.nombre,db_remota_puerto:k.puerto,db_remota_activa:k.activa})})).json();E(!1),he.success?(N({tipo:"exito",texto:"Configuracion guardada correctamente"}),p()):N({tipo:"error",texto:he.message||"Error al guardar"})}catch{E(!1),N({tipo:"error",texto:"Error de conexion al guardar"})}},T=async()=>{await v(!0)},ee=ne=>ne?ne.toLocaleString("es-MX",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-";return ye?a.jsxs("div",{className:"configuracion",children:[a.jsx("div",{className:"configuracion-header",children:a.jsxs("h2",{children:[a.jsx(Kr,{size:20})," Configuracion"]})}),a.jsx("div",{className:"configuracion-loading",children:"Cargando configuracion..."})]}):a.jsxs("div",{className:"configuracion",children:[a.jsx("div",{className:"configuracion-header",children:a.jsxs("h2",{children:[a.jsx(Kr,{size:20})," Configuracion"]})}),a.jsxs("div",{className:"cfg-tabs",children:[a.jsxs("button",{className:`cfg-tab ${S==="general"?"cfg-tab-active":""}`,onClick:()=>C("general"),children:[a.jsx(kp,{size:15})," General"]}),a.jsxs("button",{className:`cfg-tab ${S==="sync"?"cfg-tab-active":""}`,onClick:()=>C("sync"),children:[a.jsx(za,{size:15})," Sincronizacion",i.activa&&a.jsx("span",{className:`cfg-tab-dot ${i.conectada&&!u?"cfg-dot-ok":"cfg-dot-off"}`})]})]}),S==="general"&&a.jsxs("div",{className:"configuracion-content",children:[a.jsxs("div",{className:"config-section",children:[a.jsxs("h3",{children:[a.jsx(kp,{size:16})," Informacion del Negocio"]}),a.jsxs("div",{className:"config-row",children:[a.jsxs("div",{className:"config-field",children:[a.jsx("label",{htmlFor:"sucursal",children:"Sucursal"}),a.jsx("input",{type:"text",id:"sucursal",name:"sucursal",value:D.sucursal,onChange:K,placeholder:"Ej: Sucursal Centro"})]}),a.jsxs("div",{className:"config-field",children:[a.jsx("label",{htmlFor:"caja",children:"Caja"}),a.jsx("input",{type:"text",id:"caja",name:"caja",value:D.caja,onChange:K,placeholder:"Ej: Caja 1"})]})]})]}),a.jsxs("div",{className:"config-section",children:[a.jsxs("h3",{children:[a.jsx(dy,{size:16})," Conexion a la API"]}),a.jsxs("div",{className:"config-field",children:[a.jsx("label",{htmlFor:"apiUrl",children:"URL de la API"}),a.jsxs("div",{className:"api-input-group",children:[a.jsx("input",{type:"text",id:"apiUrl",name:"apiUrl",value:D.apiUrl,onChange:K,placeholder:"http://localhost/api_torti/api.php"}),a.jsx("button",{type:"button",className:"btn-probar",onClick:Te,disabled:G,children:G?a.jsxs(a.Fragment,{children:[a.jsx(za,{size:14,className:"spinning"})," Probando..."]}):a.jsx(a.Fragment,{children:"Probar"})})]}),ae&&a.jsx("div",{className:`estado-conexion ${ae.success?"exito":"error"}`,children:ae.success?a.jsxs(a.Fragment,{children:[a.jsx(Ba,{size:14})," ",ae.message]}):a.jsxs(a.Fragment,{children:[a.jsx(vs,{size:14})," ",ae.message]})})]})]}),a.jsxs("div",{className:"config-section",children:[a.jsxs("h3",{children:[a.jsx(Cx,{size:16})," Base de Datos Remota"]}),a.jsx("div",{className:"config-field checkbox-field",children:a.jsxs("label",{className:"checkbox-label",children:[a.jsx("input",{type:"checkbox",name:"activa",checked:k.activa,onChange:fe}),a.jsx("span",{children:"Habilitar conexion remota"})]})}),a.jsxs("div",{className:"config-row",children:[a.jsxs("div",{className:"config-field",children:[a.jsx("label",{htmlFor:"db_host",children:"Host / IP"}),a.jsx("input",{type:"text",id:"db_host",name:"host",value:k.host,onChange:fe,placeholder:"Ej: 192.168.1.100"})]}),a.jsxs("div",{className:"config-field config-field-small",children:[a.jsx("label",{htmlFor:"db_puerto",children:"Puerto"}),a.jsx("input",{type:"number",id:"db_puerto",name:"puerto",value:k.puerto,onChange:fe,placeholder:"3306"})]})]}),a.jsxs("div",{className:"config-row",children:[a.jsxs("div",{className:"config-field",children:[a.jsx("label",{htmlFor:"db_usuario",children:"Usuario"}),a.jsx("input",{type:"text",id:"db_usuario",name:"usuario",value:k.usuario,onChange:fe,placeholder:"Usuario de la BD"})]}),a.jsxs("div",{className:"config-field",children:[a.jsx("label",{htmlFor:"db_password",children:"Contrasena"}),a.jsxs("div",{className:"password-input-group",children:[a.jsx("input",{type:_?"text":"password",id:"db_password",name:"password",value:k.password,onChange:fe,placeholder:"Contrasena"}),a.jsx("button",{type:"button",className:"btn-toggle-password",onClick:()=>O(!_),children:_?a.jsx(fd,{size:16}):a.jsx(xs,{size:16})})]})]})]}),a.jsxs("div",{className:"config-field",children:[a.jsx("label",{htmlFor:"db_nombre",children:"Nombre de la Base de Datos"}),a.jsxs("div",{className:"api-input-group",children:[a.jsx("input",{type:"text",id:"db_nombre",name:"nombre",value:k.nombre,onChange:fe,placeholder:"Nombre de la BD"}),a.jsx("button",{type:"button",className:"btn-probar",onClick:de,disabled:W,children:W?a.jsxs(a.Fragment,{children:[a.jsx(za,{size:14,className:"spinning"})," Probando..."]}):a.jsx(a.Fragment,{children:"Probar"})})]}),P&&a.jsx("div",{className:`estado-conexion ${P.success?"exito":"error"}`,children:P.success?a.jsxs(a.Fragment,{children:[a.jsx(Ba,{size:14})," ",P.message]}):a.jsxs(a.Fragment,{children:[a.jsx(vs,{size:14})," ",P.message]})})]})]}),j&&a.jsxs("div",{className:`config-mensaje ${j.tipo}`,children:[j.tipo==="exito"?a.jsx(Ba,{size:16}):a.jsx(vs,{size:16}),j.texto]}),a.jsx("div",{className:"config-actions",children:a.jsx("button",{className:"btn-guardar",onClick:z,disabled:q,children:q?"Guardando...":"Guardar Configuracion"})}),a.jsxs("div",{className:"config-info",children:[a.jsx(Xx,{size:14}),a.jsx("span",{children:"La URL de la API se guarda localmente. Los demas datos se guardan en la base de datos."})]})]}),S==="sync"&&a.jsxs("div",{className:"configuracion-content",children:[a.jsxs("div",{className:"config-section",children:[a.jsxs("h3",{children:[a.jsx(Ap,{size:16})," Estado de Sincronizacion"]}),a.jsxs("div",{className:"cfg-sync-status-panel",children:[a.jsxs("div",{className:"cfg-sync-status-row",children:[a.jsx("span",{className:"cfg-sync-label",children:"BD Remota:"}),a.jsx("span",{className:`cfg-sync-badge ${i.activa?"cfg-badge-active":"cfg-badge-inactive"}`,children:i.activa?"Habilitada":"Deshabilitada"})]}),a.jsxs("div",{className:"cfg-sync-status-row",children:[a.jsx("span",{className:"cfg-sync-label",children:"Conexion:"}),a.jsxs("span",{className:`cfg-sync-badge ${i.conectada&&!u?"cfg-badge-ok":"cfg-badge-error"}`,children:[a.jsx("span",{className:`cfg-sync-status-dot ${i.conectada&&!u?"cfg-dot-ok":"cfg-dot-off"}`}),i.conectada&&!u?"Conectado":"Sin conexion"]})]}),i.host&&a.jsxs("div",{className:"cfg-sync-status-row",children:[a.jsx("span",{className:"cfg-sync-label",children:"Host:"}),a.jsx("span",{className:"cfg-sync-value",children:i.host})]}),a.jsxs("div",{className:"cfg-sync-status-row",children:[a.jsx("span",{className:"cfg-sync-label",children:"Ultima sync:"}),a.jsx("span",{className:"cfg-sync-value",children:d?ee(d):"Nunca"})]})]}),a.jsx("div",{className:"cfg-sync-action",children:a.jsxs("button",{className:"btn-guardar",onClick:T,disabled:l||!i.activa,children:[a.jsx(za,{size:14,className:l?"spinning":""}),l?"Sincronizando...":"Sincronizar ahora"]})})]}),a.jsxs("div",{className:"config-section",children:[a.jsxs("h3",{children:[a.jsx(fn,{size:16})," Sincronizacion Automatica"]}),a.jsx("div",{className:"cfg-intervalo-grid",children:wN.map(ne=>a.jsx("button",{className:`cfg-intervalo-btn ${c===ne.value?"cfg-intervalo-active":""}`,onClick:()=>y(ne.value),children:ne.label},ne.value))}),a.jsxs("div",{className:"config-info",style:{marginTop:"clamp(0.3rem, 0.6vh, 0.5rem)"},children:[a.jsx(fn,{size:13}),a.jsx("span",{children:c===0?"La sincronizacion automatica esta desactivada. Solo se ejecutara manualmente.":`Se sincronizara automaticamente cada ${c} minuto${c>1?"s":""}.`})]})]}),a.jsxs("div",{className:"config-section cfg-logs-section",children:[a.jsxs("div",{className:"cfg-logs-header",children:[a.jsxs("h3",{children:[a.jsx(Ap,{size:16})," Historial de Sincronizacion"]}),m.length>0&&a.jsxs("button",{className:"cfg-logs-clear",onClick:h,title:"Limpiar historial",children:[a.jsx(Yt,{size:13})," Limpiar"]})]}),a.jsx("div",{className:"cfg-logs-container",children:m.length===0?a.jsx("div",{className:"cfg-logs-empty",children:"No hay registros de sincronizacion"}):a.jsxs("table",{className:"cfg-logs-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Hora"}),a.jsx("th",{children:"Tipo"}),a.jsx("th",{children:"Estado"}),a.jsx("th",{children:"Detalle"}),a.jsx("th",{children:"Duracion"})]})}),a.jsx("tbody",{children:m.map((ne,he)=>a.jsxs("tr",{className:ne.exito?"":"cfg-log-error",children:[a.jsx("td",{children:ne.fecha.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),a.jsx("td",{children:a.jsx("span",{className:`cfg-log-tipo ${ne.tipo==="manual"?"cfg-log-manual":"cfg-log-auto"}`,children:ne.tipo==="manual"?"Manual":"Auto"})}),a.jsx("td",{children:a.jsxs("span",{className:`cfg-log-estado ${ne.exito?"cfg-log-ok":"cfg-log-fail"}`,children:[ne.exito?a.jsx(Ba,{size:12}):a.jsx(vs,{size:12}),ne.exito?"OK":"Error"]})}),a.jsx("td",{className:"cfg-log-msg",children:ne.mensaje}),a.jsxs("td",{children:[ne.duracion,"s"]})]},he))})]})})]})]})]})}const Pr=()=>Be.getApiUrl(),vv={control:(i,l)=>({...i,background:"#fff",borderColor:l.isFocused?"var(--color-primary)":"var(--color-border)",borderRadius:"0.5rem",padding:"0.25rem",boxShadow:"none","&:hover":{borderColor:"var(--color-primary)"}}),option:(i,l)=>({...i,backgroundColor:l.isSelected?"var(--color-primary)":l.isFocused?"rgba(249, 115, 22, 0.1)":"#fff",color:l.isSelected?"#fff":"var(--color-text)",cursor:"pointer"}),menu:i=>({...i,borderRadius:"0.5rem",overflow:"hidden",zIndex:1001}),singleValue:i=>({...i,color:"var(--color-text)"}),placeholder:i=>({...i,color:"var(--color-text-light)"})};function DN(){const[i,l]=g.useState([]),[d,u]=g.useState([]),[c,m]=g.useState(""),[v,y]=g.useState(""),[h,p]=g.useState(!1),[S,C]=g.useState(null),[D,R]=g.useState(!0),[k,b]=g.useState(!1),[_,O]=g.useState({username:"",password:"",nombre:"",email:"",telefono:"",perfil_id:""}),q=d.map(V=>({value:V.id,label:V.nombre}));g.useEffect(()=>{E(),j()},[]);const E=async()=>{try{const P=await(await fetch(Pr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getUsuarios"})})).json();P.success?l(P.data||[]):A.error(P.message||"Error al cargar usuarios")}catch{A.error("Error de conexion con el servidor")}finally{R(!1)}},j=async()=>{try{const P=await(await fetch(Pr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getPerfiles"})})).json();P.success&&u(P.data||[])}catch(V){console.error("Error al cargar perfiles:",V)}},N=i.filter(V=>{const P=V.nombre.toLowerCase().includes(c.toLowerCase())||V.username.toLowerCase().includes(c.toLowerCase())||V.email&&V.email.toLowerCase().includes(c.toLowerCase()),ce=!v||V.perfil_id===v;return P&&ce}),G=(V=null)=>{V?(C(V),O({username:V.username,password:"",nombre:V.nombre,email:V.email||"",telefono:V.telefono||"",perfil_id:V.perfil_id})):(C(null),O({username:"",password:"",nombre:"",email:"",telefono:"",perfil_id:""})),b(!1),p(!0)},w=()=>{p(!1),C(null)},ae=V=>{const{name:P,value:ce}=V.target;O(ye=>({...ye,[P]:ce}))},oe=async V=>{if(V.preventDefault(),!S&&!_.password){A.error("La contraseña es requerida para nuevos usuarios");return}const P={tipo:S?"actualizarUsuario":"crearUsuario",..._,perfil_id:parseInt(_.perfil_id)};S&&(P.id=S.id,_.password||delete P.password);try{const ye=await(await fetch(Pr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})).json();ye.success?(A.success(S?"Usuario actualizado correctamente":"Usuario creado correctamente"),E(),w()):A.error(ye.message||"Error al guardar usuario")}catch{A.error("Error de conexion con el servidor")}},W=V=>{const P=i.find(ce=>ce.id===V);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar usuario "',P==null?void 0:P.nombre,'"?']}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const ye=await(await fetch(Pr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarUsuario",id:V})})).json();ye.success?(A.dismiss(),A.success("Usuario eliminado"),E()):A.error(ye.message||"Error al eliminar")}catch{A.error("Error de conexion")}},style:{padding:"0.25rem 0.75rem",background:"#ef4444",color:"#fff",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Eliminar"}),a.jsx("button",{onClick:()=>A.dismiss(),style:{padding:"0.25rem 0.75rem",background:"#e2e8f0",color:"#1e293b",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Cancelar"})]})]}),{autoClose:!1,closeOnClick:!1,draggable:!1,closeButton:!1})};return D?a.jsx("div",{className:"usuarios",children:a.jsx("p",{children:"Cargando usuarios..."})}):a.jsxs("div",{className:"usuarios",children:[a.jsxs("div",{className:"usuarios-header",children:[a.jsx("h2",{children:"Usuarios"}),a.jsxs("button",{className:"btn-primary",onClick:()=>G(),children:[a.jsx(aa,{size:20}),"Nuevo Usuario"]})]}),a.jsxs("div",{className:"usuarios-filtros",children:[a.jsxs("div",{className:"search-box",children:[a.jsx(ha,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por nombre, usuario o email...",value:c,onChange:V=>m(V.target.value)})]}),a.jsx(ht,{value:v?q.find(V=>V.value===v):null,onChange:V=>y(V?V.value:""),options:q,isClearable:!0,placeholder:"Todos los perfiles",styles:vv,className:"filtro-select-container",noOptionsMessage:()=>"Sin resultados"})]}),a.jsxs("div",{className:"usuarios-tabla",children:[a.jsxs("table",{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Usuario"}),a.jsx("th",{children:"Nombre"}),a.jsx("th",{children:"Email"}),a.jsx("th",{children:"Telefono"}),a.jsx("th",{children:"Perfil"}),a.jsx("th",{children:"Ultimo Acceso"}),a.jsx("th",{children:"Acciones"})]})}),a.jsx("tbody",{children:N.map(V=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("strong",{children:V.username})}),a.jsx("td",{children:V.nombre}),a.jsx("td",{children:V.email||"-"}),a.jsx("td",{children:V.telefono||"-"}),a.jsx("td",{children:a.jsx("span",{className:"perfil-badge",children:V.perfil})}),a.jsx("td",{children:V.ultimo_acceso?new Date(V.ultimo_acceso).toLocaleString():"Nunca"}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>G(V),children:a.jsx(ys,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>W(V.id),children:a.jsx(Yt,{size:14})})]})]},V.id))})]}),N.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron usuarios"})]}),h&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-usuarios",onClick:w,children:a.jsxs("div",{className:"modal-usuarios",onClick:V=>V.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:S?"Editar Usuario":"Nuevo Usuario"}),a.jsx("button",{className:"btn-close",onClick:w,children:a.jsx(tt,{size:18})})]}),a.jsxs("form",{onSubmit:oe,children:[a.jsxs("div",{className:"musr-row",children:[a.jsxs("div",{className:"musr-field",children:[a.jsx("label",{children:"Usuario *"}),a.jsx("input",{type:"text",name:"username",value:_.username,onChange:ae,required:!0})]}),a.jsxs("div",{className:"musr-field",children:[a.jsx("label",{children:S?"Nueva Contraseña":"Contraseña *"}),a.jsxs("div",{className:"musr-input-password",children:[a.jsx("input",{type:k?"text":"password",name:"password",value:_.password,onChange:ae,required:!S,placeholder:S?"Dejar vacio para mantener":""}),a.jsx("button",{type:"button",className:"musr-toggle-password",onClick:()=>b(!k),children:k?a.jsx(fd,{size:18}):a.jsx(xs,{size:18})})]})]})]}),a.jsxs("div",{className:"musr-field",children:[a.jsx("label",{children:"Nombre Completo *"}),a.jsx("input",{type:"text",name:"nombre",value:_.nombre,onChange:ae,required:!0})]}),a.jsxs("div",{className:"musr-row",children:[a.jsxs("div",{className:"musr-field",children:[a.jsx("label",{children:"Email"}),a.jsx("input",{type:"email",name:"email",value:_.email,onChange:ae})]}),a.jsxs("div",{className:"musr-field",children:[a.jsx("label",{children:"Telefono"}),a.jsx("input",{type:"text",name:"telefono",value:_.telefono,onChange:ae})]})]}),a.jsxs("div",{className:"musr-field",children:[a.jsx("label",{children:"Perfil *"}),a.jsx(ht,{value:_.perfil_id?q.find(V=>V.value===_.perfil_id):null,onChange:V=>O(P=>({...P,perfil_id:V?V.value:""})),options:q,styles:vv,placeholder:"Seleccionar perfil...",noOptionsMessage:()=>"Sin perfiles"})]}),a.jsxs("div",{className:"musr-actions",children:[a.jsx("button",{type:"button",className:"musr-btn-cancel",onClick:w,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"musr-btn-save",children:S?"Guardar Cambios":"Crear Usuario"})]})]})]})}),document.body),a.jsx(Ft,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const Gr=()=>Be.getApiUrl();function RN(){const[i,l]=g.useState([]),[d,u]=g.useState([]),[c,m]=g.useState(""),[v,y]=g.useState(!1),[h,p]=g.useState(null),[S,C]=g.useState(!0),[D,R]=g.useState({nombre:"",descripcion:"",permisos:[]});g.useEffect(()=>{k(),b()},[]);const k=async()=>{try{const V=await(await fetch(Gr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getPerfiles"})})).json();V.success?l(V.data||[]):A.error(V.message||"Error al cargar perfiles")}catch{A.error("Error de conexion con el servidor")}finally{C(!1)}},b=async()=>{try{const V=await(await fetch(Gr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getPermisos"})})).json();V.success&&u(V.data||[])}catch(W){console.error("Error al cargar permisos:",W)}},_=i.filter(W=>W.nombre.toLowerCase().includes(c.toLowerCase())||W.descripcion&&W.descripcion.toLowerCase().includes(c.toLowerCase())),O=(W=null)=>{W?(p(W),R({nombre:W.nombre,descripcion:W.descripcion||"",permisos:W.permisos||[]})):(p(null),R({nombre:"",descripcion:"",permisos:[]})),y(!0)},q=()=>{y(!1),p(null)},E=W=>{const{name:V,value:P}=W.target;R(ce=>({...ce,[V]:P}))},j=W=>{R(V=>({...V,permisos:V.permisos.includes(W)?V.permisos.filter(P=>P!==W):[...V.permisos,W]}))},N=()=>{R(W=>({...W,permisos:d.map(V=>V.codigo)}))},G=()=>{R(W=>({...W,permisos:[]}))},w=async W=>{if(W.preventDefault(),!D.nombre){A.error("El nombre es requerido");return}const V={tipo:h?"actualizarPerfil":"crearPerfil",...D};h&&(V.id=h.id);try{const ce=await(await fetch(Gr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)})).json();ce.success?(A.success(h?"Perfil actualizado correctamente":"Perfil creado correctamente"),k(),q()):A.error(ce.message||"Error al guardar perfil")}catch{A.error("Error de conexion con el servidor")}},ae=W=>{const V=i.find(P=>P.id===W);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar perfil "',V==null?void 0:V.nombre,'"?']}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const ce=await(await fetch(Gr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarPerfil",id:W})})).json();ce.success?(A.dismiss(),A.success("Perfil eliminado"),k()):A.error(ce.message||"Error al eliminar")}catch{A.error("Error de conexion")}},style:{padding:"0.25rem 0.75rem",background:"#ef4444",color:"#fff",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Eliminar"}),a.jsx("button",{onClick:()=>A.dismiss(),style:{padding:"0.25rem 0.75rem",background:"#e2e8f0",color:"#1e293b",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Cancelar"})]})]}),{autoClose:!1,closeOnClick:!1,draggable:!1,closeButton:!1})},oe=d.reduce((W,V)=>{const P=V.modulo;return W[P]||(W[P]=[]),W[P].push(V),W},{});return S?a.jsx("div",{className:"perfiles",children:a.jsx("p",{children:"Cargando perfiles..."})}):a.jsxs("div",{className:"perfiles",children:[a.jsxs("div",{className:"perfiles-header",children:[a.jsx("h2",{children:"Perfiles y Permisos"}),a.jsxs("button",{className:"btn-primary",onClick:()=>O(),children:[a.jsx(aa,{size:20}),"Nuevo Perfil"]})]}),a.jsx("div",{className:"perfiles-filtros",children:a.jsxs("div",{className:"search-box",children:[a.jsx(ha,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar perfil...",value:c,onChange:W=>m(W.target.value)})]})}),a.jsx("div",{className:"perfiles-grid",children:_.map(W=>{var V,P,ce,ye;return a.jsxs("div",{className:"perfil-card",children:[a.jsxs("div",{className:"perfil-card-header",children:[a.jsx("div",{className:"perfil-icon",children:a.jsx(Zu,{size:24})}),a.jsxs("div",{className:"perfil-info",children:[a.jsx("h3",{children:W.nombre}),a.jsx("p",{children:W.descripcion||"Sin descripcion"})]}),a.jsxs("div",{className:"perfil-actions",children:[a.jsx("button",{className:"btn-icon",onClick:()=>O(W),children:a.jsx(ys,{size:16})}),W.nombre!=="Administrador"&&a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>ae(W.id),children:a.jsx(Yt,{size:16})})]})]}),a.jsxs("div",{className:"perfil-card-body",children:[a.jsxs("div",{className:"perfil-stats",children:[a.jsxs("div",{className:"stat",children:[a.jsx(md,{size:16}),a.jsxs("span",{children:[W.total_usuarios," usuario",W.total_usuarios!==1?"s":""]})]}),a.jsxs("div",{className:"stat",children:[a.jsx(Zu,{size:16}),a.jsxs("span",{children:[((V=W.permisos)==null?void 0:V.length)||0," permiso",(((P=W.permisos)==null?void 0:P.length)||0)!==1?"s":""]})]})]}),a.jsxs("div",{className:"perfil-permisos",children:[(ce=W.permisos)==null?void 0:ce.slice(0,5).map(je=>a.jsx("span",{className:"permiso-tag",children:je.replace("ver_","")},je)),((ye=W.permisos)==null?void 0:ye.length)>5&&a.jsxs("span",{className:"permiso-tag more",children:["+",W.permisos.length-5]})]})]})]},W.id)})}),_.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron perfiles"}),v&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-perfiles",onClick:q,children:a.jsxs("div",{className:"modal-perfiles",onClick:W=>W.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:h?"Editar Perfil":"Nuevo Perfil"}),a.jsx("button",{className:"btn-close",onClick:q,children:a.jsx(tt,{size:18})})]}),a.jsxs("form",{onSubmit:w,children:[a.jsxs("div",{className:"mperf-row",children:[a.jsxs("div",{className:"mperf-field",children:[a.jsx("label",{children:"Nombre del Perfil *"}),a.jsx("input",{type:"text",name:"nombre",value:D.nombre,onChange:E,required:!0,disabled:(h==null?void 0:h.nombre)==="Administrador"})]}),a.jsxs("div",{className:"mperf-field",children:[a.jsx("label",{children:"Descripcion"}),a.jsx("input",{type:"text",name:"descripcion",value:D.descripcion,onChange:E})]})]}),a.jsxs("div",{className:"mperf-permisos-section",children:[a.jsxs("div",{className:"mperf-permisos-header",children:[a.jsx("h4",{children:"Permisos del Perfil"}),a.jsxs("div",{className:"mperf-permisos-actions",children:[a.jsx("button",{type:"button",className:"mperf-btn-link",onClick:N,children:"Seleccionar todos"}),a.jsx("button",{type:"button",className:"mperf-btn-link",onClick:G,children:"Deseleccionar todos"})]})]}),a.jsx("div",{className:"mperf-permisos-grid",children:Object.entries(oe).map(([W,V])=>a.jsxs("div",{className:"mperf-permiso-group",children:[a.jsx("h5",{children:W.charAt(0).toUpperCase()+W.slice(1)}),V.map(P=>a.jsxs("label",{className:"mperf-check-label",children:[a.jsx("input",{type:"checkbox",checked:D.permisos.includes(P.codigo),onChange:()=>j(P.codigo)}),a.jsx("span",{className:"mperf-check-box"}),a.jsxs("span",{className:"mperf-permiso-label",children:[a.jsx("strong",{children:P.nombre}),a.jsx("small",{children:P.descripcion})]})]},P.codigo))]},W))})]}),a.jsxs("div",{className:"mperf-actions",children:[a.jsx("button",{type:"button",className:"mperf-btn-cancel",onClick:q,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mperf-btn-save",children:h?"Guardar Cambios":"Crear Perfil"})]})]})]})}),document.body),a.jsx(Ft,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const qa=()=>Be.getApiUrl(),dl={control:(i,l)=>({...i,background:"#fff",borderColor:l.isFocused?"#f97316":"#e2e8f0",borderRadius:"0.375rem",minHeight:"0",fontSize:"clamp(0.68rem, 1.5vh, 0.9rem)",boxShadow:"none","&:hover":{borderColor:"#f97316"}}),valueContainer:i=>({...i,padding:"clamp(0.15rem, 0.5vh, 0.35rem) 0.5rem"}),input:i=>({...i,margin:0,padding:0}),dropdownIndicator:i=>({...i,padding:"clamp(0.1rem, 0.3vh, 0.2rem) 0.25rem"}),clearIndicator:i=>({...i,padding:"clamp(0.1rem, 0.3vh, 0.2rem) 0.25rem"}),option:(i,l)=>({...i,backgroundColor:l.isSelected?"#f97316":l.isFocused?"rgba(249, 115, 22, 0.08)":"#fff",color:l.isSelected?"#fff":"#1e293b",cursor:"pointer",padding:"clamp(0.2rem, 0.5vh, 0.4rem) 0.75rem",fontSize:"clamp(0.68rem, 1.5vh, 0.9rem)"}),menu:i=>({...i,borderRadius:"0.375rem",overflow:"hidden",zIndex:1e4}),menuPortal:i=>({...i,zIndex:10001}),singleValue:i=>({...i,color:"#1e293b"}),placeholder:i=>({...i,color:"#94a3b8"})},Yr={pendiente:"Pendiente",aprobada:"Aprobada",rechazada:"Rechazada",enviada:"Enviada",recibida:"Recibida",cancelada:"Cancelada"},Xu={requisicion:"Requisición",envio_directo:"Envío Directo"};function UN(){const{user:i}=Fa(),{ejecutarSync:l,sincronizando:d}=dd(),u=Be.getSucursal(),[c,m]=g.useState("transferencias"),[v,y]=g.useState([]),[h,p]=g.useState([]),[S,C]=g.useState([]),[D,R]=g.useState([]),[k,b]=g.useState(!0),[_,O]=g.useState(!1),[q,E]=g.useState(""),[j,N]=g.useState(""),[G,w]=g.useState(""),[ae,oe]=g.useState(""),[W,V]=g.useState(""),[P,ce]=g.useState(!1),[ye,je]=g.useState(!1),[F,K]=g.useState(!1),[fe,Te]=g.useState(!1),[de,z]=g.useState(null),[T,ee]=g.useState({sucursal_destino_id:"",observaciones:""}),[ne,he]=g.useState({sucursal_destino_id:"",observaciones:""}),[me,xe]=g.useState([]),[Ue,ke]=g.useState({}),[ie,B]=g.useState(null),[pe,H]=g.useState({nombre:"",direccion:"",telefono:""}),[ue,I]=g.useState(""),Se=S.map(U=>({value:`prod_${U.id}`,id:U.id,tipo:"producto",label:`${U.nombre} (${U.unidad||"pza"})`,unidad:U.unidad||"pza",stock:U.stock})),Ot=[{label:"Ingredientes",options:D.map(U=>({value:`ing_${U.id}`,id:U.id,tipo:"ingrediente",label:`${U.nombre} (${U.unidad})`,unidad:U.unidad,stock:U.cantidad}))},{label:"Productos",options:Se}],Dt=h.find(U=>U.nombre===u),sa=h.filter(U=>U.nombre!==u).map(U=>({value:U.id,label:U.nombre}));g.useEffect(()=>{Xn()},[]);const Xn=async()=>{await Promise.all([Ma(),ft(),Pa(),Aa()]),b(!1)},Ma=async()=>{try{const ge=await(await fetch(qa(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getTransferencias"})})).json();ge.success&&y(ge.data||[])}catch(U){console.error(U)}},ft=async()=>{try{const ge=await(await fetch(qa(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getSucursales"})})).json();ge.success&&p(ge.data||[])}catch(U){console.error(U)}},Pa=async()=>{try{const ge=await(await fetch(qa(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductos"})})).json();ge.success&&C(ge.data||[])}catch(U){console.error(U)}},Aa=async()=>{try{const ge=await(await fetch(qa(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientes"})})).json();ge.success&&R(ge.data||[])}catch(U){console.error(U)}},wa=v.filter(U=>{const ge=q.toLowerCase(),_e=!q||U.sucursal_origen_nombre.toLowerCase().includes(ge)||U.sucursal_destino_nombre.toLowerCase().includes(ge)||U.id.toString().includes(ge),ze=!j||U.tipo===j,Ie=!G||U.estado===G,st=!ae||U.fecha>=ae,vt=!W||U.fecha<=W;return _e&&ze&&Ie&&st&&vt}),Et=h.filter(U=>U.nombre.toLowerCase().includes(ue.toLowerCase())),In=()=>{xe([...me,{tipo:"",item_id:"",item_nombre:"",cantidad:"",unidad:"",_selectValue:null,stock:0}])},pt=U=>{xe(me.filter((ge,_e)=>_e!==U))},gn=()=>{ee({sucursal_destino_id:"",observaciones:""}),xe([]),ce(!0)},J=async U=>{U.preventDefault();const ge=me.filter(ze=>ze.item_id&&parseFloat(ze.cantidad)>0);if(ge.length===0){A.error("Agrega al menos un item con cantidad");return}if(!T.sucursal_destino_id){A.error("Selecciona una sucursal a quien solicitar");return}const _e=h.find(ze=>ze.id===T.sucursal_destino_id);O(!0);try{const Ie=await(await fetch(qa(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"crearRequisicion",sucursal_origen_id:(Dt==null?void 0:Dt.id)||0,sucursal_origen_nombre:u,sucursal_destino_id:T.sucursal_destino_id,sucursal_destino_nombre:(_e==null?void 0:_e.nombre)||"",observaciones:T.observaciones,usuario_id:i==null?void 0:i.id,items:ge.map(st=>({tipo_item:st.tipo,item_id:st.item_id,item_nombre:st.item_nombre,cantidad:parseFloat(st.cantidad),unidad:st.unidad}))})})).json();Ie.success?(A.success("Requisición creada"),Ma(),l(),ce(!1)):A.error(Ie.message)}catch{A.error("Error de conexión")}finally{O(!1)}},be=()=>{he({sucursal_destino_id:"",observaciones:""}),xe([]),je(!0)},ve=async U=>{U.preventDefault();const ge=me.filter(ze=>ze.item_id&&parseFloat(ze.cantidad)>0);if(ge.length===0){A.error("Agrega al menos un item con cantidad");return}if(!ne.sucursal_destino_id){A.error("Selecciona una sucursal destino");return}const _e=h.find(ze=>ze.id===ne.sucursal_destino_id);O(!0);try{const Ie=await(await fetch(qa(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"crearEnvioDirecto",sucursal_origen_id:(Dt==null?void 0:Dt.id)||0,sucursal_origen_nombre:u,sucursal_destino_id:ne.sucursal_destino_id,sucursal_destino_nombre:(_e==null?void 0:_e.nombre)||"",observaciones:ne.observaciones,usuario_id:i==null?void 0:i.id,items:ge.map(st=>({tipo_item:st.tipo,item_id:st.item_id,item_nombre:st.item_nombre,cantidad:parseFloat(st.cantidad),unidad:st.unidad}))})})).json();Ie.success?(A.success("Envío registrado. Stock descontado."),Ma(),Pa(),Aa(),l(),je(!1)):A.error(Ie.message)}catch{A.error("Error de conexión")}finally{O(!1)}},qe=async U=>{var ge;try{const ze=await(await fetch(qa(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getTransferenciaDetalle",id:U.id})})).json();if(ze.success){z(ze.data);const Ie={};(ge=ze.data.items)==null||ge.forEach(st=>{Ie[st.id]={enviada:st.cantidad_enviada>0?st.cantidad_enviada:st.cantidad_solicitada,recibida:st.cantidad_recibida>0?st.cantidad_recibida:st.cantidad_enviada}}),ke(Ie),K(!0)}else A.error(ze.message)}catch{A.error("Error de conexión")}},Xe=async(U,ge,_e={})=>{try{const Ie=await(await fetch(qa(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:U,id:ge,usuario_id:i==null?void 0:i.id,..._e})})).json();Ie.success?(A.success(Ie.message),Ma(),Pa(),Aa(),l(),K(!1)):A.error(Ie.message)}catch{A.error("Error de conexión")}},ia=()=>{if(!de)return;const U=de.items.map(ge=>{var _e;return{id:ge.id,cantidad_enviada:parseFloat((_e=Ue[ge.id])==null?void 0:_e.enviada)||0}});Xe("enviarRequisicion",de.id,{items:U})},Ga=()=>{if(!de)return;const U=de.items.map(ge=>{var _e;return{id:ge.id,cantidad_recibida:parseFloat((_e=Ue[ge.id])==null?void 0:_e.recibida)||0}});Xe("recibirTransferencia",de.id,{items:U})},At=(U=null)=>{U?(B(U),H({nombre:U.nombre,direccion:U.direccion||"",telefono:U.telefono||""})):(B(null),H({nombre:"",direccion:"",telefono:""})),Te(!0)},bn=async U=>{U.preventDefault();const ge={tipo:ie?"actualizarSucursal":"crearSucursal",...pe};ie&&(ge.id=ie.id);try{const ze=await(await fetch(qa(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ge)})).json();ze.success?(A.success(ie?"Sucursal actualizada":"Sucursal creada"),ft(),Te(!1)):A.error(ze.message)}catch{A.error("Error de conexión")}},xn=U=>{const ge=h.find(_e=>_e.id===U);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar sucursal "',ge==null?void 0:ge.nombre,'"?']}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const ze=await(await fetch(qa(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarSucursal",id:U})})).json();ze.success?(A.dismiss(),A.success("Sucursal eliminada"),ft()):A.error(ze.message)}catch{A.error("Error de conexión")}},style:{padding:"0.25rem 0.75rem",background:"#ef4444",color:"#fff",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Eliminar"}),a.jsx("button",{onClick:()=>A.dismiss(),style:{padding:"0.25rem 0.75rem",background:"#e2e8f0",color:"#1e293b",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Cancelar"})]})]}),{autoClose:!1,closeOnClick:!1,draggable:!1,closeButton:!1})},Ya=U=>{A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:["¿Cancelar transferencia #",U,"?"]}),a.jsx("p",{style:{fontSize:"0.75rem",color:"#64748b"},children:"Si ya fue enviada, se revertirá el stock"}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{A.dismiss(),await Xe("cancelarTransferencia",U)},style:{padding:"0.25rem 0.75rem",background:"#ef4444",color:"#fff",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"Cancelar Transferencia"}),a.jsx("button",{onClick:()=>A.dismiss(),style:{padding:"0.25rem 0.75rem",background:"#e2e8f0",color:"#1e293b",border:"none",borderRadius:"0.25rem",cursor:"pointer"},children:"No"})]})]}),{autoClose:!1,closeOnClick:!1,draggable:!1,closeButton:!1})},Q=U=>a.jsxs("div",{className:"mreq-items-section",children:[a.jsxs("div",{className:"mreq-items-header",children:[a.jsx("h4",{children:"Items"}),a.jsxs("button",{type:"button",className:"mreq-btn-add",onClick:In,children:[a.jsx(aa,{size:14})," Agregar item"]})]}),me.length===0?a.jsx("p",{className:"mreq-items-empty",children:"Agrega items a la transferencia"}):a.jsxs("div",{className:"mreq-items-list",children:[a.jsxs("div",{className:"mreq-items-list-header",children:[a.jsx("span",{className:"mreq-col-item",children:"Item"}),a.jsx("span",{className:"mreq-col-cant",children:"Cantidad"}),a.jsx("span",{className:"mreq-col-unit",children:"Unidad"}),U&&a.jsx("span",{className:"mreq-col-stock",children:"Stock"}),a.jsx("span",{className:"mreq-col-del"})]}),me.map((ge,_e)=>a.jsxs("div",{className:"mreq-item-row",children:[a.jsx("div",{className:"mreq-col-item",children:a.jsx(ht,{value:ge._selectValue,onChange:ze=>{const Ie=[...me];Ie[_e]={...Ie[_e],tipo:ze?ze.tipo:"",item_id:ze?ze.id:"",item_nombre:ze?ze.label.split(" (")[0]:"",unidad:ze?ze.unidad:"",stock:ze?ze.stock:0,_selectValue:ze},xe(Ie)},options:Ot,styles:dl,placeholder:"Seleccionar...",noOptionsMessage:()=>"Sin resultados",menuPortalTarget:document.body,menuPosition:"fixed"})}),a.jsx("div",{className:"mreq-col-cant",children:a.jsx("input",{type:"number",value:ge.cantidad,onChange:ze=>{const Ie=[...me];Ie[_e].cantidad=ze.target.value,xe(Ie)},min:"0",step:"0.01",placeholder:"0"})}),a.jsx("div",{className:"mreq-col-unit",children:a.jsx("input",{type:"text",value:ge.unidad,readOnly:!0,disabled:!0})}),U&&a.jsx("div",{className:"mreq-col-stock",children:a.jsx("span",{className:ge.stock>0?"req-stock-ok":"req-stock-low",children:ge.stock})}),a.jsx("div",{className:"mreq-col-del",children:a.jsx("button",{type:"button",className:"btn-icon btn-danger",onClick:()=>pt(_e),children:a.jsx(Yt,{size:13})})})]},_e))]})]});if(k)return a.jsx("div",{className:"requisiciones",children:a.jsx("p",{children:"Cargando..."})});const Ne={transferencias:"Transferencias",sucursales:"Sucursales"};return a.jsxs("div",{className:"requisiciones",children:[a.jsxs("div",{className:"req-header",children:[a.jsx("div",{className:"req-header-left",children:a.jsx("h2",{children:Ne[c]||"Transferencias"})}),a.jsxs("div",{className:"req-header-actions",children:[c==="transferencias"&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"req-btn-secondary",onClick:gn,children:[a.jsx(mi,{size:16})," Nueva Requisición"]}),a.jsxs("button",{className:"btn-primary",onClick:be,children:[a.jsx(cy,{size:16})," Nuevo Envío"]})]}),c==="sucursales"&&a.jsxs("button",{className:"btn-primary",onClick:()=>At(),children:[a.jsx(aa,{size:20})," Nueva Sucursal"]})]})]}),a.jsxs("div",{className:"req-tabs",children:[a.jsxs("button",{className:`req-tab ${c==="transferencias"?"req-tab-active":""}`,onClick:()=>m("transferencias"),children:[a.jsx(Nv,{size:16})," Transferencias"]}),a.jsxs("button",{className:`req-tab ${c==="sucursales"?"req-tab-active":""}`,onClick:()=>m("sucursales"),children:[a.jsx(Bx,{size:16})," Sucursales"]})]}),c==="transferencias"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"req-filtros",children:[a.jsxs("div",{className:"search-box",children:[a.jsx(ha,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por # o sucursal...",value:q,onChange:U=>E(U.target.value)})]}),a.jsx(ht,{value:j?{value:j,label:Xu[j]}:null,onChange:U=>N(U?U.value:""),options:[{value:"requisicion",label:"Requisición"},{value:"envio_directo",label:"Envío Directo"}],isClearable:!0,placeholder:"Tipo",styles:dl,className:"req-filtro-select"}),a.jsx(ht,{value:G?{value:G,label:Yr[G]}:null,onChange:U=>w(U?U.value:""),options:Object.entries(Yr).map(([U,ge])=>({value:U,label:ge})),isClearable:!0,placeholder:"Estado",styles:dl,className:"req-filtro-select"}),a.jsxs("div",{className:"req-filtro-fechas",children:[a.jsxs("div",{className:"req-fecha-input",children:[a.jsx(Yn,{size:14}),a.jsx("input",{type:"date",value:ae,onChange:U=>oe(U.target.value)})]}),a.jsxs("div",{className:"req-fecha-input",children:[a.jsx(Yn,{size:14}),a.jsx("input",{type:"date",value:W,onChange:U=>V(U.target.value)})]})]})]}),a.jsxs("div",{className:"req-tabla",children:[a.jsxs("table",{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"#"}),a.jsx("th",{children:"Fecha"}),a.jsx("th",{children:"Tipo"}),a.jsx("th",{children:"Origen"}),a.jsx("th",{children:"Destino"}),a.jsx("th",{children:"Items"}),a.jsx("th",{children:"Estado"}),a.jsx("th",{children:"Acciones"})]})}),a.jsx("tbody",{children:wa.map(U=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsxs("strong",{children:["#",U.id]})}),a.jsx("td",{children:new Date(U.fecha+"T00:00:00").toLocaleDateString("es-MX")}),a.jsx("td",{children:a.jsx("span",{className:`req-tipo-badge req-tipo-${U.tipo}`,children:Xu[U.tipo]})}),a.jsx("td",{children:U.sucursal_origen_nombre}),a.jsx("td",{children:U.sucursal_destino_nombre}),a.jsx("td",{children:a.jsxs("span",{className:"req-items-badge",children:[a.jsx($t,{size:12})," ",U.total_items]})}),a.jsx("td",{children:a.jsx("span",{className:`req-estado-badge req-estado-${U.estado}`,children:Yr[U.estado]})}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>qe(U),title:"Ver detalle",children:a.jsx(xs,{size:14})}),U.estado!=="recibida"&&U.estado!=="cancelada"&&U.estado!=="rechazada"&&a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>Ya(U.id),title:"Cancelar",children:a.jsx(vs,{size:14})})]})]},U.id))})]}),wa.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron transferencias"})]})]}),c==="sucursales"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"req-filtros",children:a.jsxs("div",{className:"search-box",children:[a.jsx(ha,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar sucursal...",value:ue,onChange:U=>I(U.target.value)})]})}),a.jsxs("div",{className:"req-tabla",children:[a.jsxs("table",{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Nombre"}),a.jsx("th",{children:"Dirección"}),a.jsx("th",{children:"Teléfono"}),a.jsx("th",{children:"Acciones"})]})}),a.jsx("tbody",{children:Et.map(U=>a.jsxs("tr",{children:[a.jsxs("td",{children:[a.jsx("strong",{children:U.nombre}),U.nombre===u&&a.jsx("span",{className:"req-badge-actual",children:"Actual"})]}),a.jsx("td",{children:U.direccion||a.jsx("span",{style:{color:"#94a3b8"},children:"-"})}),a.jsx("td",{children:U.telefono||a.jsx("span",{style:{color:"#94a3b8"},children:"-"})}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>At(U),title:"Editar",children:a.jsx(xs,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>xn(U.id),title:"Eliminar",children:a.jsx(Yt,{size:14})})]})]},U.id))})]}),Et.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron sucursales"})]})]}),P&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-req",onClick:()=>ce(!1),children:a.jsxs("div",{className:"modal-req",onClick:U=>U.stopPropagation(),children:[a.jsxs("div",{className:"mreq-header",children:[a.jsx("h3",{children:"Nueva Requisición"}),a.jsx("button",{className:"mreq-btn-close",onClick:()=>ce(!1),children:a.jsx(tt,{size:18})})]}),a.jsxs("form",{onSubmit:J,children:[a.jsx("div",{className:"mreq-info-bar",children:a.jsxs("span",{children:["Solicita: ",a.jsx("strong",{children:u||"Sin configurar"})]})}),a.jsxs("div",{className:"mreq-row",children:[a.jsxs("div",{className:"mreq-field",children:[a.jsx("label",{children:"Solicitar a (sucursal) *"}),a.jsx(ht,{value:sa.find(U=>U.value===T.sucursal_destino_id)||null,onChange:U=>ee(ge=>({...ge,sucursal_destino_id:U?U.value:""})),options:sa,styles:dl,placeholder:"Seleccionar sucursal...",noOptionsMessage:()=>"Sin sucursales",menuPortalTarget:document.body,menuPosition:"fixed"})]}),a.jsxs("div",{className:"mreq-field",children:[a.jsx("label",{children:"Observaciones"}),a.jsx("input",{type:"text",value:T.observaciones,onChange:U=>ee(ge=>({...ge,observaciones:U.target.value})),placeholder:"Opcional"})]})]}),Q(!1),a.jsxs("div",{className:"mreq-actions",children:[a.jsx("button",{type:"button",className:"mreq-btn-cancel",onClick:()=>ce(!1),children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mreq-btn-save",disabled:_,children:_?"Guardando...":"Crear Requisición"})]})]})]})}),document.body),ye&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-req",onClick:()=>je(!1),children:a.jsxs("div",{className:"modal-req",onClick:U=>U.stopPropagation(),children:[a.jsxs("div",{className:"mreq-header",children:[a.jsx("h3",{children:"Nuevo Envío Directo"}),a.jsx("button",{className:"mreq-btn-close",onClick:()=>je(!1),children:a.jsx(tt,{size:18})})]}),a.jsxs("form",{onSubmit:ve,children:[a.jsxs("div",{className:"mreq-info-bar",children:[a.jsxs("span",{children:["Envía: ",a.jsx("strong",{children:u||"Sin configurar"})]}),a.jsx("span",{style:{color:"#ef4444",fontSize:"clamp(0.6rem, 1.2vh, 0.75rem)"},children:"Se descontará stock al registrar"})]}),a.jsxs("div",{className:"mreq-row",children:[a.jsxs("div",{className:"mreq-field",children:[a.jsx("label",{children:"Enviar a (sucursal) *"}),a.jsx(ht,{value:sa.find(U=>U.value===ne.sucursal_destino_id)||null,onChange:U=>he(ge=>({...ge,sucursal_destino_id:U?U.value:""})),options:sa,styles:dl,placeholder:"Seleccionar sucursal...",noOptionsMessage:()=>"Sin sucursales",menuPortalTarget:document.body,menuPosition:"fixed"})]}),a.jsxs("div",{className:"mreq-field",children:[a.jsx("label",{children:"Observaciones"}),a.jsx("input",{type:"text",value:ne.observaciones,onChange:U=>he(ge=>({...ge,observaciones:U.target.value})),placeholder:"Opcional"})]})]}),Q(!0),a.jsxs("div",{className:"mreq-actions",children:[a.jsx("button",{type:"button",className:"mreq-btn-cancel",onClick:()=>je(!1),children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mreq-btn-save",disabled:_,children:_?"Guardando...":"Registrar Envío"})]})]})]})}),document.body),F&&de&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-req",onClick:()=>K(!1),children:a.jsxs("div",{className:"modal-req modal-req-detalle",onClick:U=>U.stopPropagation(),children:[a.jsxs("div",{className:"mreq-header",children:[a.jsxs("h3",{children:["Transferencia #",de.id]}),a.jsx("button",{className:"mreq-btn-close",onClick:()=>K(!1),children:a.jsx(tt,{size:18})})]}),a.jsxs("div",{className:"mreq-detalle-content",children:[a.jsxs("div",{className:"mreq-detalle-info",children:[a.jsxs("div",{className:"mreq-detalle-info-item",children:[a.jsx("span",{children:"Tipo:"}),a.jsx("strong",{children:a.jsx("span",{className:`req-tipo-badge req-tipo-${de.tipo}`,children:Xu[de.tipo]})})]}),a.jsxs("div",{className:"mreq-detalle-info-item",children:[a.jsx("span",{children:"Estado:"}),a.jsx("strong",{children:a.jsx("span",{className:`req-estado-badge req-estado-${de.estado}`,children:Yr[de.estado]})})]}),a.jsxs("div",{className:"mreq-detalle-info-item",children:[a.jsx("span",{children:"Origen:"}),a.jsx("strong",{children:de.sucursal_origen_nombre})]}),a.jsxs("div",{className:"mreq-detalle-info-item",children:[a.jsx("span",{children:"Destino:"}),a.jsx("strong",{children:de.sucursal_destino_nombre})]}),a.jsxs("div",{className:"mreq-detalle-info-item",children:[a.jsx("span",{children:"Fecha:"}),a.jsx("strong",{children:new Date(de.fecha+"T00:00:00").toLocaleDateString("es-MX")})]}),de.observaciones&&a.jsxs("div",{className:"mreq-detalle-info-item",children:[a.jsx("span",{children:"Observaciones:"}),a.jsx("strong",{children:de.observaciones})]})]}),(()=>{var st;const U=de.sucursal_origen_nombre===u,ge=de.sucursal_destino_nombre===u,_e=de.tipo==="requisicion",ze=de.estado==="aprobada"&&ge&&_e,Ie=de.estado==="enviada"&&(_e&&U||!_e&&ge);return a.jsxs("table",{className:"mreq-detalle-tabla",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Tipo"}),a.jsx("th",{children:"Item"}),a.jsx("th",{children:"Solicitado"}),a.jsx("th",{children:"Enviado"}),a.jsx("th",{children:"Recibido"})]})}),a.jsx("tbody",{children:(st=de.items)==null?void 0:st.map((vt,Nl)=>{var gi,Ns;return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("span",{className:`req-item-tipo-badge ${vt.tipo_item==="producto"?"req-badge-producto":"req-badge-ingrediente"}`,children:vt.tipo_item==="producto"?"Producto":"Ingrediente"})}),a.jsx("td",{children:a.jsx("strong",{children:vt.item_nombre})}),a.jsxs("td",{children:[vt.cantidad_solicitada," ",vt.unidad]}),a.jsx("td",{children:ze?a.jsx("input",{type:"number",className:"mreq-cant-input",value:((gi=Ue[vt.id])==null?void 0:gi.enviada)??"",onChange:Qn=>ke(yn=>({...yn,[vt.id]:{...yn[vt.id],enviada:Qn.target.value}})),min:"0",step:"0.01"}):vt.cantidad_enviada>0?`${vt.cantidad_enviada} ${vt.unidad}`:"-"}),a.jsx("td",{children:Ie?a.jsx("input",{type:"number",className:"mreq-cant-input",value:((Ns=Ue[vt.id])==null?void 0:Ns.recibida)??"",onChange:Qn=>ke(yn=>({...yn,[vt.id]:{...yn[vt.id],recibida:Qn.target.value}})),min:"0",step:"0.01"}):vt.cantidad_recibida>0?`${vt.cantidad_recibida} ${vt.unidad}`:"-"})]},Nl)})})]})})(),a.jsxs("div",{className:"mreq-timeline",children:[a.jsxs("div",{className:"mreq-timeline-item mreq-timeline-done",children:[a.jsx("div",{className:"mreq-timeline-dot"}),a.jsxs("span",{children:["Creada - ",new Date(de.created_at).toLocaleString("es-MX")]})]}),de.fecha_aprobacion&&a.jsxs("div",{className:"mreq-timeline-item mreq-timeline-done",children:[a.jsx("div",{className:"mreq-timeline-dot"}),a.jsxs("span",{children:[de.estado==="rechazada"?"Rechazada":"Aprobada"," - ",new Date(de.fecha_aprobacion).toLocaleString("es-MX")]})]}),de.fecha_envio&&a.jsxs("div",{className:"mreq-timeline-item mreq-timeline-done",children:[a.jsx("div",{className:"mreq-timeline-dot"}),a.jsxs("span",{children:["Enviada - ",new Date(de.fecha_envio).toLocaleString("es-MX")]})]}),de.fecha_recepcion&&a.jsxs("div",{className:"mreq-timeline-item mreq-timeline-done",children:[a.jsx("div",{className:"mreq-timeline-dot"}),a.jsxs("span",{children:["Recibida - ",new Date(de.fecha_recepcion).toLocaleString("es-MX")]})]})]}),(()=>{const U=de.sucursal_origen_nombre===u,ge=de.sucursal_destino_nombre===u,_e=de.tipo==="requisicion",ze=de.estado==="pendiente"&&ge&&_e,Ie=de.estado==="aprobada"&&ge&&_e,st=de.estado==="enviada"&&(_e&&U||!_e&&ge);return a.jsxs("div",{className:"mreq-detalle-actions",children:[ze&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"mreq-btn-aprobar",onClick:()=>Xe("aprobarRequisicion",de.id),children:[a.jsx(gs,{size:16})," Aprobar"]}),a.jsxs("button",{className:"mreq-btn-rechazar",onClick:()=>Xe("rechazarRequisicion",de.id),children:[a.jsx(vs,{size:16})," Rechazar"]})]}),Ie&&a.jsxs("button",{className:"mreq-btn-enviar",onClick:ia,children:[a.jsx(zy,{size:16})," Enviar"]}),st&&a.jsxs("button",{className:"mreq-btn-recibir",onClick:Ga,children:[a.jsx($t,{size:16})," Dar Entrada"]})]})})()]})]})}),document.body),fe&&Bt.createPortal(a.jsx("div",{className:"modal-overlay-req",onClick:()=>Te(!1),children:a.jsxs("div",{className:"modal-req modal-req-sm",onClick:U=>U.stopPropagation(),children:[a.jsxs("div",{className:"mreq-header",children:[a.jsx("h3",{children:ie?"Editar Sucursal":"Nueva Sucursal"}),a.jsx("button",{className:"mreq-btn-close",onClick:()=>Te(!1),children:a.jsx(tt,{size:18})})]}),a.jsxs("form",{onSubmit:bn,children:[a.jsxs("div",{className:"mreq-field",children:[a.jsx("label",{children:"Nombre *"}),a.jsx("input",{type:"text",value:pe.nombre,onChange:U=>H(ge=>({...ge,nombre:U.target.value})),required:!0,autoFocus:!0})]}),a.jsxs("div",{className:"mreq-field",children:[a.jsx("label",{children:"Dirección"}),a.jsx("input",{type:"text",value:pe.direccion,onChange:U=>H(ge=>({...ge,direccion:U.target.value})),placeholder:"Opcional"})]}),a.jsxs("div",{className:"mreq-field",children:[a.jsx("label",{children:"Teléfono"}),a.jsx("input",{type:"text",value:pe.telefono,onChange:U=>H(ge=>({...ge,telefono:U.target.value})),placeholder:"Opcional"})]}),a.jsxs("div",{className:"mreq-actions",children:[a.jsx("button",{type:"button",className:"mreq-btn-cancel",onClick:()=>Te(!1),children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mreq-btn-save",children:ie?"Guardar Cambios":"Crear Sucursal"})]})]})]})}),document.body),a.jsx(Ft,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const LN=()=>Be.getApiUrl();function qN(){const[i,l]=g.useState(new Date().toISOString().split("T")[0]),[d,u]=g.useState(new Date().toISOString().split("T")[0]),[c,m]=g.useState(null),[v,y]=g.useState(!1),[h,p]=g.useState("todos"),[S,C]=g.useState("todos"),D=async()=>{y(!0);try{const _=await(await fetch(LN(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getRastreoInventario",fecha_inicio:i,fecha_fin:d,sucursal:Be.getSucursal(),caja:Be.getCaja()})})).json();_.success?m(_.data||[]):A.error(_.message||"Error al obtener datos")}catch{A.error("Error de conexion")}finally{y(!1)}},R=c?c.filter(b=>S==="producto"&&b.tipo!=="producto"||S==="ingrediente"&&b.tipo!=="ingrediente"?!1:h==="discrepancia"?b.discrepancia!==null&&Math.abs(b.discrepancia)>.01:h==="ok"?b.discrepancia!==null&&Math.abs(b.discrepancia)<=.01:!0):[],k=c?{totalProductos:c.filter(b=>b.tipo==="producto").length,totalIngredientes:c.filter(b=>b.tipo==="ingrediente").length,conDiscrepancia:c.filter(b=>b.discrepancia!==null&&Math.abs(b.discrepancia)>.01).length,sinDatos:c.filter(b=>b.stock_inicial===null&&b.tipo==="producto").length,ok:c.filter(b=>b.discrepancia!==null&&Math.abs(b.discrepancia)<=.01).length}:null;return a.jsxs("div",{className:"ri",children:[a.jsx(Ft,{position:"top-right",autoClose:3e3}),a.jsxs("div",{className:"ri-header",children:[a.jsxs("h2",{children:[a.jsx($t,{size:20})," Rastreo de Inventario"]}),a.jsxs("div",{className:"ri-filtros",children:[a.jsxs("div",{className:"ri-fechas",children:[a.jsx("label",{children:"Desde"}),a.jsx("input",{type:"date",value:i,onChange:b=>l(b.target.value)}),a.jsx("label",{children:"Hasta"}),a.jsx("input",{type:"date",value:d,onChange:b=>u(b.target.value)})]}),a.jsxs("button",{className:"ri-btn-buscar",onClick:D,disabled:v,children:[v?a.jsx(za,{size:16,className:"ri-spin"}):a.jsx(ha,{size:16}),v?"Buscando...":"Consultar"]})]})]}),c===null?a.jsxs("div",{className:"ri-empty",children:[a.jsx($t,{size:48,strokeWidth:1}),a.jsx("p",{children:"Selecciona un rango de fechas y consulta para ver el rastreo de inventario"})]}):a.jsxs(a.Fragment,{children:[k&&a.jsxs("div",{className:"ri-resumen",children:[a.jsxs("button",{className:`ri-card ${S==="todos"&&h==="todos"?"activo":""}`,onClick:()=>{C("todos"),p("todos")},children:[a.jsx("span",{className:"ri-card-num",children:k.totalProductos+k.totalIngredientes}),a.jsx("span",{className:"ri-card-label",children:"Todos"})]}),a.jsxs("button",{className:`ri-card ${S==="producto"?"activo":""}`,onClick:()=>{C("producto"),p("todos")},children:[a.jsx($t,{size:14}),a.jsx("span",{className:"ri-card-num",children:k.totalProductos}),a.jsx("span",{className:"ri-card-label",children:"Productos"})]}),a.jsxs("button",{className:`ri-card ${S==="ingrediente"?"activo":""}`,onClick:()=>{C("ingrediente"),p("todos")},children:[a.jsx(xl,{size:14}),a.jsx("span",{className:"ri-card-num",children:k.totalIngredientes}),a.jsx("span",{className:"ri-card-label",children:"Ingredientes"})]}),a.jsxs("button",{className:`ri-card ri-card-warn ${h==="discrepancia"?"activo":""}`,onClick:()=>{p("discrepancia"),C("todos")},children:[a.jsx(Mv,{size:14}),a.jsx("span",{className:"ri-card-num",children:k.conDiscrepancia}),a.jsx("span",{className:"ri-card-label",children:"Discrepancia"})]}),a.jsxs("button",{className:`ri-card ri-card-ok ${h==="ok"?"activo":""}`,onClick:()=>{p("ok"),C("todos")},children:[a.jsx(Ba,{size:14}),a.jsx("span",{className:"ri-card-num",children:k.ok}),a.jsx("span",{className:"ri-card-label",children:"Cuadrados"})]})]}),a.jsx("div",{className:"ri-tabla-wrap",children:a.jsxs("table",{className:"ri-tabla",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{className:"ri-th-nombre",children:"Item"}),a.jsx("th",{children:"Inicial"}),a.jsx("th",{className:"ri-th-mov ri-th-pos",children:"+Compras"}),a.jsx("th",{className:"ri-th-mov ri-th-pos",children:"+Produccion"}),a.jsx("th",{className:"ri-th-mov ri-th-pos",children:"+Trans. Ent."}),a.jsx("th",{className:"ri-th-mov ri-th-neg",children:"-Ventas"}),a.jsx("th",{className:"ri-th-mov ri-th-neg",children:"-Cons. Prod."}),a.jsx("th",{className:"ri-th-mov ri-th-neg",children:"-Trans. Sal."}),a.jsx("th",{className:"ri-th-mov ri-th-neg",children:"-Mermas"}),a.jsx("th",{children:"Esperado"}),a.jsx("th",{children:"Final"}),a.jsx("th",{className:"ri-th-disc",children:"Discrepancia"})]})}),a.jsx("tbody",{children:R.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:"12",className:"ri-sin-datos",children:"Sin resultados para este filtro"})}):R.map(b=>{const _=b.discrepancia!==null&&Math.abs(b.discrepancia)>.01;return a.jsxs("tr",{className:_?"ri-row-warn":"",children:[a.jsxs("td",{className:"ri-td-nombre",children:[a.jsx("span",{className:`ri-tipo-badge ${b.tipo==="ingrediente"?"ri-tipo-ing":"ri-tipo-prod"}`,children:b.tipo==="ingrediente"?"ING":"PROD"}),a.jsx("span",{className:"ri-prod-nombre",children:b.nombre}),a.jsx("span",{className:"ri-prod-unidad",children:b.unidad})]}),a.jsx("td",{className:"ri-td-num",children:b.stock_inicial!==null?b.stock_inicial.toFixed(2):a.jsx("span",{className:"ri-na",children:"-"})}),a.jsx("td",{className:"ri-td-num ri-td-pos",children:b.compras>0?"+"+b.compras.toFixed(2):a.jsx("span",{className:"ri-zero",children:"0"})}),a.jsx("td",{className:"ri-td-num ri-td-pos",children:b.produccion>0?"+"+b.produccion.toFixed(2):a.jsx("span",{className:"ri-zero",children:"0"})}),a.jsx("td",{className:"ri-td-num ri-td-pos",children:b.transferencias_entrada>0?"+"+b.transferencias_entrada.toFixed(2):a.jsx("span",{className:"ri-zero",children:"0"})}),a.jsx("td",{className:"ri-td-num ri-td-neg",children:b.ventas>0?"-"+b.ventas.toFixed(2):a.jsx("span",{className:"ri-zero",children:"0"})}),a.jsx("td",{className:"ri-td-num ri-td-neg",children:b.consumo_produccion>0?"-"+b.consumo_produccion.toFixed(2):a.jsx("span",{className:"ri-zero",children:"0"})}),a.jsx("td",{className:"ri-td-num ri-td-neg",children:b.transferencias_salida>0?"-"+b.transferencias_salida.toFixed(2):a.jsx("span",{className:"ri-zero",children:"0"})}),a.jsx("td",{className:"ri-td-num ri-td-neg",children:b.mermas>0?"-"+b.mermas.toFixed(2):a.jsx("span",{className:"ri-zero",children:"0"})}),a.jsx("td",{className:"ri-td-num ri-td-esperado",children:b.stock_esperado!==null?b.stock_esperado.toFixed(2):a.jsx("span",{className:"ri-na",children:"-"})}),a.jsx("td",{className:"ri-td-num ri-td-final",children:b.stock_final!==null?b.stock_final.toFixed(2):a.jsx("span",{className:"ri-na",children:"-"})}),a.jsx("td",{className:`ri-td-num ri-td-disc ${_?b.discrepancia<0?"neg":"pos":"ok"}`,children:b.discrepancia!==null?a.jsxs("span",{className:"ri-disc-val",children:[b.discrepancia>0&&"+",b.discrepancia.toFixed(2),_&&(b.discrepancia<0?a.jsx(Ev,{size:12}):a.jsx(zv,{size:12}))]}):a.jsx("span",{className:"ri-na",children:"-"})})]},`${b.tipo}-${b.id}`)})})]})}),a.jsxs("div",{className:"ri-leyenda",children:[a.jsxs("span",{children:[a.jsx("strong",{children:"Esperado"})," = Inicial + Compras + Produccion + Trans.Ent - Ventas - Cons.Prod - Trans.Sal - Mermas"]}),a.jsxs("span",{children:[a.jsx("strong",{children:"Discrepancia"})," = Final (fisico) - Esperado"]}),a.jsxs("span",{children:[a.jsx("strong",{children:"Nota:"})," Ingredientes no tienen conteo inicial/final (solo movimientos)"]})]})]})]})}const Xr=()=>Be.getApiUrl();function HN(){const{user:i}=Fa(),[l,d]=g.useState("conteo"),[u,c]=g.useState([]),[m,v]=g.useState([]),[y,h]=g.useState(!1),[p,S]=g.useState(!1),[C,D]=g.useState(""),[R,k]=g.useState(""),[b,_]=g.useState(!0),[O,q]=g.useState({}),[E,j]=g.useState(null);g.useEffect(()=>{l==="conteo"?N():G()},[l]);const N=async()=>{h(!0);try{const ce=await(await fetch(Xr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientesParaConteo"})})).json();if(ce.success){c(ce.data||[]);const ye={};(ce.data||[]).forEach(je=>{ye[je.id]=""}),q(ye)}else A.error(ce.message||"Error al cargar ingredientes")}catch{A.error("Error de conexion")}finally{h(!1)}},G=async()=>{h(!0);try{const ce=await(await fetch(Xr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getConteosIngredientes",sucursal:Be.getSucursal()})})).json();ce.success&&v(ce.data||[])}catch{A.error("Error de conexion")}finally{h(!1)}},w=(P,ce)=>{q(ye=>({...ye,[P]:ce}))},ae=Object.entries(O).filter(([,P])=>P!==""&&P!==null).length,oe=async()=>{const P=u.filter(ce=>O[ce.id]!==""&&O[ce.id]!==null).map(ce=>({ingrediente_id:ce.id,nombre:ce.nombre,unidad:ce.unidad,stock_fisico:parseFloat(O[ce.id])||0}));if(P.length===0){A.warning("Ingresa al menos un conteo");return}S(!0);try{const ye=await(await fetch(Xr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"registrarConteoIngredientes",items:P,notas:R,ajustar_stock:b,usuario_id:(i==null?void 0:i.id)||0,usuario_nombre:(i==null?void 0:i.nombre)||"",sucursal:Be.getSucursal()})})).json();ye.success?(A.success("Conteo registrado correctamente"),k(""),N()):A.error(ye.message||"Error al registrar")}catch{A.error("Error de conexion")}finally{S(!1)}},W=async P=>{try{const ye=await(await fetch(Xr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getConteoIngredienteDetalle",conteo_id:P})})).json();ye.success&&j(ye.data)}catch{A.error("Error al cargar detalle")}},V=u.filter(P=>P.nombre.toLowerCase().includes(C.toLowerCase()));return a.jsxs("div",{className:"ii",children:[a.jsx(Ft,{position:"top-right",autoClose:3e3}),a.jsxs("div",{className:"ii-header",children:[a.jsxs("h2",{children:[a.jsx(xl,{size:20})," Inventario de Ingredientes"]}),a.jsxs("div",{className:"ii-tabs",children:[a.jsxs("button",{className:`ii-tab ${l==="conteo"?"activo":""}`,onClick:()=>d("conteo"),children:[a.jsx(mi,{size:16})," Nuevo Conteo"]}),a.jsxs("button",{className:`ii-tab ${l==="historial"?"activo":""}`,onClick:()=>d("historial"),children:[a.jsx(fn,{size:16})," Historial"]})]})]}),l==="conteo"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ii-toolbar",children:[a.jsxs("div",{className:"ii-search",children:[a.jsx(ha,{size:16}),a.jsx("input",{type:"text",placeholder:"Buscar ingrediente...",value:C,onChange:P=>D(P.target.value)})]}),a.jsx("div",{className:"ii-toolbar-info",children:a.jsxs("span",{className:"ii-contados",children:[ae," / ",u.length," contados"]})})]}),a.jsx("div",{className:"ii-tabla-wrap",children:y?a.jsxs("div",{className:"ii-loading",children:[a.jsx(za,{size:24,className:"ii-spin"})," Cargando..."]}):a.jsxs("table",{className:"ii-tabla",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{className:"ii-th-nombre",children:"Ingrediente"}),a.jsx("th",{children:"Unidad"}),a.jsx("th",{className:"ii-th-fisico",children:"Cantidad"})]})}),a.jsx("tbody",{children:V.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:"3",className:"ii-sin-datos",children:"Sin ingredientes"})}):V.map(P=>{const ce=O[P.id]!==""&&O[P.id]!==null&&O[P.id]!==void 0;return a.jsxs("tr",{children:[a.jsx("td",{className:"ii-td-nombre",children:P.nombre}),a.jsx("td",{className:"ii-td-center",children:P.unidad}),a.jsx("td",{className:"ii-td-fisico",children:a.jsx("input",{type:"number",step:"0.01",min:"0",placeholder:"0.00",value:O[P.id]??"",onChange:ye=>w(P.id,ye.target.value),className:ce?"ii-input-filled":""})})]},P.id)})})]})}),a.jsxs("div",{className:"ii-footer",children:[a.jsxs("div",{className:"ii-footer-left",children:[a.jsx("input",{type:"text",className:"ii-notas",placeholder:"Notas del conteo (opcional)...",value:R,onChange:P=>k(P.target.value)}),a.jsxs("label",{className:"ii-check-ajustar",children:[a.jsx("input",{type:"checkbox",checked:b,onChange:P=>_(P.target.checked)}),"Ajustar stock al fisico"]})]}),a.jsxs("button",{className:"ii-btn-guardar",onClick:oe,disabled:p||ae===0,children:[p?a.jsx(za,{size:16,className:"ii-spin"}):a.jsx(iy,{size:16}),p?"Guardando...":"Guardar Conteo"]})]})]}):a.jsx("div",{className:"ii-tabla-wrap",children:y?a.jsxs("div",{className:"ii-loading",children:[a.jsx(za,{size:24,className:"ii-spin"})," Cargando..."]}):m.length===0?a.jsxs("div",{className:"ii-empty",children:[a.jsx(fn,{size:48,strokeWidth:1}),a.jsx("p",{children:"No hay conteos registrados"})]}):a.jsxs("table",{className:"ii-tabla",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Fecha"}),a.jsx("th",{children:"Usuario"}),a.jsx("th",{children:"Items"}),a.jsx("th",{children:"Notas"}),a.jsx("th",{children:"Acciones"})]})}),a.jsx("tbody",{children:m.map(P=>a.jsxs("tr",{children:[a.jsx("td",{className:"ii-td-fecha",children:new Date(P.fecha).toLocaleString("es-MX",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}),a.jsx("td",{children:P.usuario_nombre}),a.jsx("td",{className:"ii-td-center",children:P.total_items}),a.jsx("td",{className:"ii-td-notas",children:P.notas||"-"}),a.jsx("td",{className:"ii-td-center",children:a.jsxs("button",{className:"ii-btn-ver",onClick:()=>W(P.id),children:[a.jsx(xs,{size:14})," Ver"]})})]},P.id))})]})}),E&&Bt.createPortal(a.jsx("div",{className:"ii-modal-overlay",onClick:()=>j(null),children:a.jsxs("div",{className:"ii-modal",onClick:P=>P.stopPropagation(),children:[a.jsxs("div",{className:"ii-modal-header",children:[a.jsx("h3",{children:"Detalle del Conteo"}),a.jsxs("span",{className:"ii-modal-fecha",children:[new Date(E.conteo.fecha).toLocaleString("es-MX")," - ",E.conteo.usuario_nombre]})]}),E.conteo.notas&&a.jsx("p",{className:"ii-modal-notas",children:E.conteo.notas}),a.jsx("div",{className:"ii-modal-tabla-wrap",children:a.jsxs("table",{className:"ii-tabla",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{className:"ii-th-nombre",children:"Ingrediente"}),a.jsx("th",{children:"Unidad"}),a.jsx("th",{children:"Cantidad"})]})}),a.jsx("tbody",{children:E.items.map(P=>a.jsxs("tr",{children:[a.jsx("td",{className:"ii-td-nombre",children:P.nombre}),a.jsx("td",{className:"ii-td-center",children:P.unidad}),a.jsx("td",{className:"ii-td-num",children:P.stock_fisico.toFixed(2)})]},P.ingrediente_id))})]})}),a.jsx("div",{className:"ii-modal-footer",children:a.jsx("button",{className:"ii-btn-cerrar",onClick:()=>j(null),children:"Cerrar"})})]})}),document.body)]})}function VN(){const{login:i}=Fa(),[l,d]=g.useState({username:"",password:""}),[u,c]=g.useState(!1),[m,v]=g.useState(!1),y=p=>{const{name:S,value:C}=p.target;d(D=>({...D,[S]:C}))},h=async p=>{if(p.preventDefault(),!l.username||!l.password){A.error("Ingrese usuario y contraseña");return}v(!0);const S=await i(l.username,l.password);v(!1),S.success||A.error(S.message)};return a.jsxs("div",{className:"login-container",children:[a.jsxs("div",{className:"login-card",children:[a.jsxs("div",{className:"login-header",children:[a.jsxs("div",{className:"login-logo",children:[a.jsx("span",{children:"POS"}),a.jsx("span",{className:"logo-accent",children:"Torti"})]}),a.jsx("p",{className:"login-subtitle",children:"Sistema de Punto de Venta"})]}),a.jsxs("form",{onSubmit:h,className:"login-form",children:[a.jsxs("div",{className:"form-group",children:[a.jsx("label",{children:"Usuario"}),a.jsxs("div",{className:"input-icon",children:[a.jsx(Ju,{size:20}),a.jsx("input",{type:"text",name:"username",value:l.username,onChange:y,placeholder:"Ingrese su usuario",autoComplete:"username"})]})]}),a.jsxs("div",{className:"form-group",children:[a.jsx("label",{children:"Contraseña"}),a.jsxs("div",{className:"input-icon",children:[a.jsx(Lx,{size:20}),a.jsx("input",{type:u?"text":"password",name:"password",value:l.password,onChange:y,placeholder:"Ingrese su contraseña",autoComplete:"current-password"}),a.jsx("button",{type:"button",className:"toggle-password",onClick:()=>c(!u),children:u?a.jsx(fd,{size:20}):a.jsx(xs,{size:20})})]})]}),a.jsx("button",{type:"submit",className:"btn-login",disabled:m,children:m?"Ingresando...":"Ingresar"})]}),a.jsxs("div",{className:"login-footer",children:[a.jsxs("p",{children:["Usuario por defecto: ",a.jsx("strong",{children:"admin"})]}),a.jsxs("p",{children:["Contraseña: ",a.jsx("strong",{children:"password"})]})]})]}),a.jsx(Ft,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const BN=[{id:"ventas",permiso:"ver_ventas"},{id:"productos",permiso:"ver_productos"},{id:"categorias",permiso:"ver_categorias"},{id:"ingredientes",permiso:"ver_ingredientes"},{id:"producciones",permiso:"ver_producciones"},{id:"reporte_producciones",permiso:"ver_reporte_producciones"},{id:"clientes",permiso:"ver_clientes"},{id:"merma",permiso:"ver_merma"},{id:"compras",permiso:"ver_compras"},{id:"requisiciones",permiso:"ver_requisiciones"},{id:"caja",permiso:"ver_caja"},{id:"reportes",permiso:"ver_reportes"},{id:"rastreo_inventario",permiso:"ver_reportes"},{id:"inventario_ingredientes",permiso:"ver_ingredientes"},{id:"estadisticas",permiso:"ver_estadisticas"},{id:"usuarios",permiso:"ver_usuarios"},{id:"perfiles",permiso:"ver_perfiles"},{id:"configuracion",permiso:"ver_configuracion"}];function $N(){const{syncStatus:i,sincronizando:l,ultimaSync:d,syncError:u,ejecutarSync:c}=dd();if(!i.activa)return null;const m=v=>v?v.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit"}):null;return a.jsxs("div",{className:"sync-global-indicator",children:[a.jsxs("div",{className:`sync-global-status ${i.conectada&&!u?"sync-global-ok":"sync-global-off"}`,children:[a.jsx("span",{className:"sync-global-dot"}),a.jsx("span",{className:"sync-global-label",children:i.conectada&&!u?"Sincronizado":"Sin conexión"}),d&&a.jsx("span",{className:"sync-global-time",children:m(d)})]}),a.jsx("button",{className:"sync-global-btn",onClick:c,disabled:l,title:"Sincronizar ahora",children:a.jsx(za,{size:14,className:l?"sync-global-spinning":""})})]})}function FN(){const{isAuthenticated:i,loading:l,tienePermiso:d}=Fa(),[u,c]=g.useState(!1),[m,v]=g.useState(null);g.useEffect(()=>{if(i&&!m){const h=BN.find(p=>d(p.permiso));v((h==null?void 0:h.id)||"ventas")}},[i,d,m]);const y=()=>{switch(m){case"ventas":return a.jsx(_j,{});case"productos":return a.jsx(bN,{});case"categorias":return a.jsx(xN,{});case"ingredientes":return a.jsx(SN,{});case"producciones":return a.jsx(NN,{});case"reporte_producciones":return a.jsx(CN,{});case"clientes":return a.jsx(_N,{});case"merma":return a.jsx(ON,{});case"compras":return a.jsx(EN,{});case"requisiciones":return a.jsx(UN,{});case"caja":return a.jsx(zN,{});case"reportes":return a.jsx(MN,{});case"rastreo_inventario":return a.jsx(qN,{});case"inventario_ingredientes":return a.jsx(HN,{});case"estadisticas":return a.jsx(AN,{});case"configuracion":return a.jsx(kN,{});case"usuarios":return a.jsx(DN,{});case"perfiles":return a.jsx(RN,{});default:return null}};return l||i&&!m?a.jsxs("div",{className:"app-loading",children:[a.jsx("div",{className:"loading-spinner"}),a.jsx("p",{children:"Cargando..."})]}):i?a.jsx(Kb,{children:a.jsxs("div",{className:"app",children:[a.jsx(Ly,{isOpen:u,setIsOpen:c,activeMenu:m,setActiveMenu:v}),a.jsx(qy,{onClick:()=>c(!0)}),a.jsx($N,{}),a.jsx("main",{className:"main-content",children:y()})]})}):a.jsx(VN,{})}function PN(){return a.jsx(Ib,{children:a.jsx(FN,{})})}Xb.createRoot(document.getElementById("root")).render(a.jsx(ct.StrictMode,{children:a.jsx(PN,{})}));
