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 x in c)x!=="key"&&(m[x]=c[x])}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:{}},Ve={};/**
 * @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 yp;function Vb(){if(yp)return Ve;yp=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"),x=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),R=Symbol.iterator;function U(E){return E===null||typeof E!="object"?null:(E=R&&E[R]||E["@@iterator"],typeof E=="function"?E:null)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,T={};function N(E,O,ee){this.props=E,this.context=O,this.refs=T,this.updater=ee||D}N.prototype.isReactComponent={},N.prototype.setState=function(E,O){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,O,"setState")},N.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function H(){}H.prototype=N.prototype;function z(E,O,ee){this.props=E,this.context=O,this.refs=T,this.updater=ee||D}var j=z.prototype=new H;j.constructor=z,b(j,N.prototype),j.isPureReactComponent=!0;var C=Array.isArray;function P(){}var w={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function de(E,O,ee){var K=ee.ref;return{$$typeof:i,type:E,key:O,ref:K!==void 0?K:null,props:ee}}function J(E,O){return de(E.type,O,E.props)}function G(E){return typeof E=="object"&&E!==null&&E.$$typeof===i}function Y(E){var O={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(ee){return O[ee]})}var re=/\/+/g;function xe(E,O){return typeof E=="object"&&E!==null&&E.key!=null?Y(""+E.key):O.toString(36)}function je(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(P,P):(E.status="pending",E.then(function(O){E.status==="pending"&&(E.status="fulfilled",E.value=O)},function(O){E.status==="pending"&&(E.status="rejected",E.reason=O)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function $(E,O,ee,K,he){var pe=typeof E;(pe==="undefined"||pe==="boolean")&&(E=null);var Se=!1;if(E===null)Se=!0;else switch(pe){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(E.$$typeof){case i:case l:Se=!0;break;case S:return Se=E._init,$(Se(E._payload),O,ee,K,he)}}if(Se)return he=he(E),Se=K===""?"."+xe(E,0):K,C(he)?(ee="",Se!=null&&(ee=Se.replace(re,"$&/")+"/"),$(he,O,ee,"",function(ne){return ne})):he!=null&&(G(he)&&(he=J(he,ee+(he.key==null||E&&E.key===he.key?"":(""+he.key).replace(re,"$&/")+"/")+Se)),O.push(he)),1;Se=0;var qe=K===""?".":K+":";if(C(E))for(var De=0;De<E.length;De++)K=E[De],pe=qe+xe(K,De),Se+=$(K,O,ee,pe,he);else if(De=U(E),typeof De=="function")for(E=De.call(E),De=0;!(K=E.next()).done;)K=K.value,pe=qe+xe(K,De++),Se+=$(K,O,ee,pe,he);else if(pe==="object"){if(typeof E.then=="function")return $(je(E),O,ee,K,he);throw O=String(E),Error("Objects are not valid as a React child (found: "+(O==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.")}return Se}function se(E,O,ee){if(E==null)return E;var K=[],he=0;return $(E,K,"","",function(pe){return O.call(ee,pe,he++)}),K}function ve(E){if(E._status===-1){var O=E._result;O=O(),O.then(function(ee){(E._status===0||E._status===-1)&&(E._status=1,E._result=ee)},function(ee){(E._status===0||E._status===-1)&&(E._status=2,E._result=ee)}),E._status===-1&&(E._status=0,E._result=O)}if(E._status===1)return E._result.default;throw E._result}var Ce=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var O=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(O))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},me={map:se,forEach:function(E,O,ee){se(E,function(){O.apply(this,arguments)},ee)},count:function(E){var O=0;return se(E,function(){O++}),O},toArray:function(E){return se(E,function(O){return O})||[]},only:function(E){if(!G(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return Ve.Activity=_,Ve.Children=me,Ve.Component=N,Ve.Fragment=d,Ve.Profiler=c,Ve.PureComponent=z,Ve.StrictMode=u,Ve.Suspense=h,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,Ve.__COMPILER_RUNTIME={__proto__:null,c:function(E){return w.H.useMemoCache(E)}},Ve.cache=function(E){return function(){return E.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function(E,O,ee){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var K=b({},E.props),he=E.key;if(O!=null)for(pe in O.key!==void 0&&(he=""+O.key),O)!W.call(O,pe)||pe==="key"||pe==="__self"||pe==="__source"||pe==="ref"&&O.ref===void 0||(K[pe]=O[pe]);var pe=arguments.length-2;if(pe===1)K.children=ee;else if(1<pe){for(var Se=Array(pe),qe=0;qe<pe;qe++)Se[qe]=arguments[qe+2];K.children=Se}return de(E.type,he,K)},Ve.createContext=function(E){return E={$$typeof:v,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:m,_context:E},E},Ve.createElement=function(E,O,ee){var K,he={},pe=null;if(O!=null)for(K in O.key!==void 0&&(pe=""+O.key),O)W.call(O,K)&&K!=="key"&&K!=="__self"&&K!=="__source"&&(he[K]=O[K]);var Se=arguments.length-2;if(Se===1)he.children=ee;else if(1<Se){for(var qe=Array(Se),De=0;De<Se;De++)qe[De]=arguments[De+2];he.children=qe}if(E&&E.defaultProps)for(K in Se=E.defaultProps,Se)he[K]===void 0&&(he[K]=Se[K]);return de(E,pe,he)},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(E){return{$$typeof:x,render:E}},Ve.isValidElement=G,Ve.lazy=function(E){return{$$typeof:S,_payload:{_status:-1,_result:E},_init:ve}},Ve.memo=function(E,O){return{$$typeof:p,type:E,compare:O===void 0?null:O}},Ve.startTransition=function(E){var O=w.T,ee={};w.T=ee;try{var K=E(),he=w.S;he!==null&&he(ee,K),typeof K=="object"&&K!==null&&typeof K.then=="function"&&K.then(P,Ce)}catch(pe){Ce(pe)}finally{O!==null&&ee.types!==null&&(O.types=ee.types),w.T=O}},Ve.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},Ve.use=function(E){return w.H.use(E)},Ve.useActionState=function(E,O,ee){return w.H.useActionState(E,O,ee)},Ve.useCallback=function(E,O){return w.H.useCallback(E,O)},Ve.useContext=function(E){return w.H.useContext(E)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(E,O){return w.H.useDeferredValue(E,O)},Ve.useEffect=function(E,O){return w.H.useEffect(E,O)},Ve.useEffectEvent=function(E){return w.H.useEffectEvent(E)},Ve.useId=function(){return w.H.useId()},Ve.useImperativeHandle=function(E,O,ee){return w.H.useImperativeHandle(E,O,ee)},Ve.useInsertionEffect=function(E,O){return w.H.useInsertionEffect(E,O)},Ve.useLayoutEffect=function(E,O){return w.H.useLayoutEffect(E,O)},Ve.useMemo=function(E,O){return w.H.useMemo(E,O)},Ve.useOptimistic=function(E,O){return w.H.useOptimistic(E,O)},Ve.useReducer=function(E,O,ee){return w.H.useReducer(E,O,ee)},Ve.useRef=function(E){return w.H.useRef(E)},Ve.useState=function(E){return w.H.useState(E)},Ve.useSyncExternalStore=function(E,O,ee){return w.H.useSyncExternalStore(E,O,ee)},Ve.useTransition=function(){return w.H.useTransition()},Ve.version="19.2.3",Ve}var xp;function ud(){return xp||(xp=1,Tu.exports=Vb()),Tu.exports}var g=ud();const ht=gv(g),jp=Lb({__proto__:null,default:ht},[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($,se){var ve=$.length;$.push(se);e:for(;0<ve;){var Ce=ve-1>>>1,me=$[Ce];if(0<c(me,se))$[Ce]=se,$[ve]=me,ve=Ce;else break e}}function d($){return $.length===0?null:$[0]}function u($){if($.length===0)return null;var se=$[0],ve=$.pop();if(ve!==se){$[0]=ve;e:for(var Ce=0,me=$.length,E=me>>>1;Ce<E;){var O=2*(Ce+1)-1,ee=$[O],K=O+1,he=$[K];if(0>c(ee,ve))K<me&&0>c(he,ee)?($[Ce]=he,$[K]=ve,Ce=K):($[Ce]=ee,$[O]=ve,Ce=O);else if(K<me&&0>c(he,ve))$[Ce]=he,$[K]=ve,Ce=K;else break e}}return se}function c($,se){var ve=$.sortIndex-se.sortIndex;return ve!==0?ve:$.id-se.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,x=v.now();i.unstable_now=function(){return v.now()-x}}var h=[],p=[],S=1,_=null,R=3,U=!1,D=!1,b=!1,T=!1,N=typeof setTimeout=="function"?setTimeout:null,H=typeof clearTimeout=="function"?clearTimeout:null,z=typeof setImmediate<"u"?setImmediate:null;function j($){for(var se=d(p);se!==null;){if(se.callback===null)u(p);else if(se.startTime<=$)u(p),se.sortIndex=se.expirationTime,l(h,se);else break;se=d(p)}}function C($){if(b=!1,j($),!D)if(d(h)!==null)D=!0,P||(P=!0,Y());else{var se=d(p);se!==null&&je(C,se.startTime-$)}}var P=!1,w=-1,W=5,de=-1;function J(){return T?!0:!(i.unstable_now()-de<W)}function G(){if(T=!1,P){var $=i.unstable_now();de=$;var se=!0;try{e:{D=!1,b&&(b=!1,H(w),w=-1),U=!0;var ve=R;try{t:{for(j($),_=d(h);_!==null&&!(_.expirationTime>$&&J());){var Ce=_.callback;if(typeof Ce=="function"){_.callback=null,R=_.priorityLevel;var me=Ce(_.expirationTime<=$);if($=i.unstable_now(),typeof me=="function"){_.callback=me,j($),se=!0;break t}_===d(h)&&u(h),j($)}else u(h);_=d(h)}if(_!==null)se=!0;else{var E=d(p);E!==null&&je(C,E.startTime-$),se=!1}}break e}finally{_=null,R=ve,U=!1}se=void 0}}finally{se?Y():P=!1}}}var Y;if(typeof z=="function")Y=function(){z(G)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,xe=re.port2;re.port1.onmessage=G,Y=function(){xe.postMessage(null)}}else Y=function(){N(G,0)};function je($,se){w=N(function(){$(i.unstable_now())},se)}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($){$.callback=null},i.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<$?Math.floor(1e3/$):5},i.unstable_getCurrentPriorityLevel=function(){return R},i.unstable_next=function($){switch(R){case 1:case 2:case 3:var se=3;break;default:se=R}var ve=R;R=se;try{return $()}finally{R=ve}},i.unstable_requestPaint=function(){T=!0},i.unstable_runWithPriority=function($,se){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ve=R;R=$;try{return se()}finally{R=ve}},i.unstable_scheduleCallback=function($,se,ve){var Ce=i.unstable_now();switch(typeof ve=="object"&&ve!==null?(ve=ve.delay,ve=typeof ve=="number"&&0<ve?Ce+ve:Ce):ve=Ce,$){case 1:var me=-1;break;case 2:me=250;break;case 5:me=1073741823;break;case 4:me=1e4;break;default:me=5e3}return me=ve+me,$={id:S++,callback:se,priorityLevel:$,startTime:ve,expirationTime:me,sortIndex:-1},ve>Ce?($.sortIndex=ve,l(p,$),d(h)===null&&$===d(p)&&(b?(H(w),w=-1):b=!0,je(C,ve-Ce))):($.sortIndex=me,l(h,$),D||U||(D=!0,P||(P=!0,Y()))),$},i.unstable_shouldYield=J,i.unstable_wrapCallback=function($){var se=R;return function(){var ve=R;R=se;try{return $.apply(this,arguments)}finally{R=ve}}}})(zu)),zu}var Np;function $b(){return Np||(Np=1,Eu.exports=Bb()),Eu.exports}var Mu={exports:{}},Xt={};/**
 * @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 Xt;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 _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:_==null?null:""+_,children:h,containerInfo:p,implementation:S}}var v=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function x(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Xt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=u,Xt.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)},Xt.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()}},Xt.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))},Xt.prefetchDNS=function(h){typeof h=="string"&&u.d.D(h)},Xt.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var S=p.as,_=x(S,p.crossOrigin),R=typeof p.integrity=="string"?p.integrity:void 0,U=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;S==="style"?u.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:_,integrity:R,fetchPriority:U}):S==="script"&&u.d.X(h,{crossOrigin:_,integrity:R,fetchPriority:U,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Xt.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var S=x(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)},Xt.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var S=p.as,_=x(S,p.crossOrigin);u.d.L(h,S,{crossOrigin:_,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})}},Xt.preloadModule=function(h,p){if(typeof h=="string")if(p){var S=x(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)},Xt.requestFormReset=function(h){u.d.r(h)},Xt.unstable_batchedUpdates=function(h,p){return h(p)},Xt.useFormState=function(h,p,S){return v.H.useFormState(h,p,S)},Xt.useFormStatus=function(){return v.H.useHostTransitionStatus()},Xt.version="19.2.3",Xt}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 x(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,y=r.child;y;){if(y===n){f=!0,n=r,s=o;break}if(y===s){f=!0,s=r,n=o;break}y=y.sibling}if(!f){for(y=o.child;y;){if(y===n){f=!0,n=o,s=r;break}if(y===s){f=!0,s=o,n=r;break}y=y.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 _=Object.assign,R=Symbol.for("react.element"),U=Symbol.for("react.transitional.element"),D=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),H=Symbol.for("react.consumer"),z=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),J=Symbol.for("react.memo_cache_sentinel"),G=Symbol.iterator;function Y(e){return e===null||typeof e!="object"?null:(e=G&&e[G]||e["@@iterator"],typeof e=="function"?e:null)}var re=Symbol.for("react.client.reference");function xe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===re?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case N:return"Profiler";case T:return"StrictMode";case C:return"Suspense";case P:return"SuspenseList";case de:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case D:return"Portal";case z:return e.displayName||"Context";case H: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:xe(e.type)||"Memo";case W:t=e._payload,e=e._init;try{return xe(e(t))}catch{}}return null}var je=Array.isArray,$=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=d.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve={pending:!1,data:null,method:null,action:null},Ce=[],me=-1;function E(e){return{current:e}}function O(e){0>me||(e.current=Ce[me],Ce[me]=null,me--)}function ee(e,t){me++,Ce[me]=e.current,e.current=t}var K=E(null),he=E(null),pe=E(null),Se=E(null);function qe(e,t){switch(ee(pe,t),ee(he,e),ee(K,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}}O(K),ee(K,e)}function De(){O(K),O(he),O(pe)}function ne(e){e.memoizedState!==null&&ee(Se,e);var t=K.current,n=Bh(t,e.type);t!==n&&(ee(he,e),ee(K,n))}function Q(e){he.current===e&&(O(K),O(he)),Se.current===e&&(O(Se),nl._currentValue=ve)}var fe,q;function ce(e){if(fe===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);fe=t&&t[1]||"",q=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+fe+e+q}var Ne=!1;function Be(e,t){if(!e||Ne)return"";Ne=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(te){var Z=te}Reflect.construct(e,[],le)}else{try{le.call()}catch(te){Z=te}e.call(le.prototype)}}else{try{throw Error()}catch(te){Z=te}(le=e())&&typeof le.catch=="function"&&le.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],y=o[1];if(f&&y){var M=f.split(`
`),I=y.split(`
`);for(r=s=0;s<M.length&&!M[s].includes("DetermineComponentFrameRoot");)s++;for(;r<I.length&&!I[r].includes("DetermineComponentFrameRoot");)r++;if(s===M.length||r===I.length)for(s=M.length-1,r=I.length-1;1<=s&&0<=r&&M[s]!==I[r];)r--;for(;1<=s&&0<=r;s--,r--)if(M[s]!==I[r]){if(s!==1||r!==1)do if(s--,r--,0>r||M[s]!==I[r]){var ae=`
`+M[s].replace(" at new "," at ");return e.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",e.displayName)),ae}while(1<=s&&0<=r);break}}}finally{Ne=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ce(n):""}function Da(e,t){switch(e.tag){case 26:case 27:case 5:return ce(e.type);case 16:return ce("Lazy");case 13:return e.child!==t&&t!==null?ce("Suspense Fallback"):ce("Suspense");case 19:return ce("SuspenseList");case 0:case 15:return Be(e.type,!1);case 11:return Be(e.type.render,!1);case 1:return Be(e.type,!0);case 31:return ce("Activity");default:return""}}function ca(e){try{var t="",n=null;do t+=Da(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
Error generating stack: `+s.message+`
`+s.stack}}var oe=Object.prototype.hasOwnProperty,ze=i.unstable_scheduleCallback,He=i.unstable_cancelCallback,Ge=i.unstable_shouldYield,Tt=i.unstable_requestPaint,Nt=i.unstable_now,Ya=i.unstable_getCurrentPriorityLevel,Ra=i.unstable_ImmediatePriority,Xa=i.unstable_UserBlockingPriority,za=i.unstable_NormalPriority,Xn=i.unstable_LowPriority,Dt=i.unstable_IdlePriority,bn=i.log,In=i.unstable_setDisableYieldValue,Zt=null,wt=null;function ft(e){if(typeof bn=="function"&&In(e),wt&&typeof wt.setStrictMode=="function")try{wt.setStrictMode(Zt,e)}catch{}}var Ke=Math.clz32?Math.clz32:be,B=Math.log,ge=Math.LN2;function be(e){return e>>>=0,e===0?32:31-(B(e)/ge|0)|0}var Te=256,Lt=262144,Jt=4194304;function F(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 ye(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 y=s&134217727;return y!==0?(s=y&~o,s!==0?r=F(s):(f&=y,f!==0?r=F(f):n||(n=y&~e,n!==0&&(r=F(n))))):(y=s&~o,y!==0?r=F(y):f!==0?r=F(f):n||(n=s&~e,n!==0&&(r=F(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 k(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ue(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=Jt;return Jt<<=1,(Jt&62914560)===0&&(Jt=4194304),e}function Ae(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Je(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ot(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 y=e.entanglements,M=e.expirationTimes,I=e.hiddenUpdates;for(n=f&~n;0<n;){var ae=31-Ke(n),le=1<<ae;y[ae]=0,M[ae]=-1;var Z=I[ae];if(Z!==null)for(I[ae]=null,ae=0;ae<Z.length;ae++){var te=Z[ae];te!==null&&(te.lane&=-536870913)}n&=~le}s!==0&&yt(e,s,0),o!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=o&~(f&~t))}function yt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Ke(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-Ke(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=se.p;return e!==0?e:(e=window.event,e===void 0?32:up(e.type))}function _d(e,t){var n=se.p;try{return se.p=e,t()}finally{se.p=n}}var xn=Math.random().toString(36).slice(2),qt="__reactFiber$"+xn,ea="__reactProps$"+xn,Cs="__reactContainer$"+xn,vo="__reactEvents$"+xn,Tg="__reactListeners$"+xn,Og="__reactHandles$"+xn,Td="__reactResources$"+xn,bi="__reactMarker$"+xn;function go(e){delete e[qt],delete e[ea],delete e[vo],delete e[Tg],delete e[Og]}function _s(e){var t=e[qt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Cs]||n[qt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ih(e);e!==null;){if(n=e[qt])return n;e=Ih(e)}return t}e=n,n=e.parentNode}return null}function Ts(e){if(e=e[qt]||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 yi(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 Rt(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 oe.call(Md,e)?!0:oe.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 Ia(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 ya(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 xa(e){return e.replace(Ag,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function yo(e,t,n,s,r,o,f,y){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=""+ya(t)):e.value!==""+ya(t)&&(e.value=""+ya(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?xo(e,f,ya(t)):n!=null?xo(e,f,ya(n)):s!=null&&e.removeAttribute("value"),r==null&&o!=null&&(e.defaultChecked=!!o),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.name=""+ya(y):e.removeAttribute("name")}function kd(e,t,n,s,r,o,f,y){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?""+ya(n):"",t=t!=null?""+ya(t):n,y||t===e.value||(e.value=t),e.defaultValue=t}s=s??r,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=y?e.checked:!!s,e.defaultChecked=!!s,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),bo(e)}function xo(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=""+ya(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=""+ya(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+ya(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=ya(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 Qa(){}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[ea]||null;e:switch(e=t.stateNode,t.type){case"input":if(yo(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="'+xa(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var r=s[ea]||null;if(!r)throw Error(u(90));yo(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 xi(e,t){var n=e.stateNode;if(n===null)return null;var s=n[ea]||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 Za=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_o=!1;if(Za)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 jn=null,To=null,El=null;function Vd(){if(El)return El;var e,t=To,n=t.length,s,r="value"in jn?jn.value:jn.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 ta(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 y in e)e.hasOwnProperty(y)&&(n=e[y],this[y]=n?n(o):o[y]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Ml:Bd,this.isPropagationStopped=Bd,this}return _(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=ta(Jn),Si=_({},Jn,{view:0,detail:0}),Rg=ta(Si),Oo,Eo,Ni,wl=_({},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=ta(wl),Ug=_({},wl,{dataTransfer:0}),Lg=ta(Ug),qg=_({},Si,{relatedTarget:0}),zo=ta(qg),Hg=_({},Jn,{animationName:0,elapsedTime:0,pseudoElement:0}),Vg=ta(Hg),Bg=_({},Jn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),$g=ta(Bg),Fg=_({},Jn,{data:0}),Fd=ta(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=_({},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=ta(Ig),Zg=_({},wl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pd=ta(Zg),Jg=_({},Si,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mo}),Kg=ta(Jg),Wg=_({},Jn,{propertyName:0,elapsedTime:0,pseudoElement:0}),e0=ta(Wg),t0=_({},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=ta(t0),n0=_({},Jn,{newState:0,oldState:0}),s0=ta(n0),i0=[9,13,27,32],Ao=Za&&"CompositionEvent"in window,Ci=null;Za&&"documentMode"in document&&(Ci=document.documentMode);var l0=Za&&"TextEvent"in window&&!Ci,Gd=Za&&(!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=jn=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=yi(e);if(wd(t))return e}function Kd(e,t){if(e==="change")return t}var Wd=!1;if(Za){var wo;if(Za){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 ua=typeof Object.is=="function"?Object.is:p0;function Oi(e,t){if(ua(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(!oe.call(t,r)||!ua(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=Za&&"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={};Za&&(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"),y0=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 Ma(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)},ja=[],Us=0,Ho=0;function Rl(){for(var e=Us,t=Ho=Us=0;t<e;){var n=ja[t];ja[t++]=null;var s=ja[t];ja[t++]=null;var r=ja[t];ja[t++]=null;var o=ja[t];if(ja[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){ja[Us++]=e,ja[Us++]=t,ja[Us++]=n,ja[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-Ke(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 x0(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 da(e,t,n,s){return new x0(e,t,n,s)}function Bo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ja(e,t){var n=e.alternate;return n===null?(n=da(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,K.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case de:return e=da(31,n,t,r),e.elementType=de,e.lanes=o,e;case b:return ts(n.children,r,o,t);case T:f=8,r|=24;break;case N:return e=da(12,n,t,r|2),e.elementType=N,e.lanes=o,e;case C:return e=da(13,n,t,r),e.elementType=C,e.lanes=o,e;case P:return e=da(19,n,t,r),e.elementType=P,e.lanes=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case z:f=10;break e;case H:f=9;break e;case j:f=11;break e;case w:f=14;break e;case W:f=16,s=null;break e}f=29,n=Error(u(130,e===null?"null":typeof e,"")),s=null}return t=da(f,n,t,r),t.elementType=e,t.type=s,t.lanes=o,t}function ts(e,t,n,s){return e=da(7,e,s,t),e.lanes=n,e}function $o(e,t,n){return e=da(6,e,null,t),e.lanes=n,e}function gf(e){var t=da(18,null,null,0);return t.stateNode=e,t}function Fo(e,t,n){return t=da(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 Sa(e,t){if(typeof e=="object"&&e!==null){var n=bf.get(e);return n!==void 0?n:(t={value:e,source:t,stack:ca(t)},bf.set(e,t),t)}return{value:e,source:t,stack:ca(t)}}var qs=[],Hs=0,Hl=null,zi=0,Na=[],Ca=0,Sn=null,Ua=1,La="";function Ka(e,t){qs[Hs++]=zi,qs[Hs++]=Hl,Hl=e,zi=t}function yf(e,t,n){Na[Ca++]=Ua,Na[Ca++]=La,Na[Ca++]=Sn,Sn=e;var s=Ua;e=La;var r=32-Ke(s)-1;s&=~(1<<r),n+=1;var o=32-Ke(t)+r;if(30<o){var f=r-r%5;o=(s&(1<<f)-1).toString(32),s>>=f,r-=f,Ua=1<<32-Ke(t)+r|n<<r|s,La=o+e}else Ua=1<<o|n<<r|s,La=e}function Po(e){e.return!==null&&(Ka(e,1),yf(e,1,0))}function Go(e){for(;e===Hl;)Hl=qs[--Hs],qs[Hs]=null,zi=qs[--Hs],qs[Hs]=null;for(;e===Sn;)Sn=Na[--Ca],Na[Ca]=null,La=Na[--Ca],Na[Ca]=null,Ua=Na[--Ca],Na[Ca]=null}function xf(e,t){Na[Ca++]=Ua,Na[Ca++]=La,Na[Ca++]=Sn,Ua=t.id,La=t.overflow,Sn=e}var Ht=null,pt=null,Ze=!1,Nn=null,_a=!1,Yo=Error(u(519));function Cn(e){var t=Error(u(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Mi(Sa(t,e)),Yo}function jf(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[qt]=e,t[ea]=s,n){case"dialog":Xe("cancel",t),Xe("close",t);break;case"iframe":case"object":case"embed":Xe("load",t);break;case"video":case"audio":for(n=0;n<Ki.length;n++)Xe(Ki[n],t);break;case"source":Xe("error",t);break;case"img":case"image":case"link":Xe("error",t),Xe("load",t);break;case"details":Xe("toggle",t);break;case"input":Xe("invalid",t),kd(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Xe("invalid",t);break;case"textarea":Xe("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&&(Xe("beforetoggle",t),Xe("toggle",t)),s.onScroll!=null&&Xe("scroll",t),s.onScrollEnd!=null&&Xe("scrollend",t),s.onClick!=null&&(t.onclick=Qa),t=!0):t=!1,t||Cn(e,!0)}function Sf(e){for(Ht=e.return;Ht;)switch(Ht.tag){case 5:case 31:case 13:_a=!1;return;case 27:case 3:_a=!0;return;default:Ht=Ht.return}}function Vs(e){if(e!==Ht)return!1;if(!Ze)return Sf(e),Ze=!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&&pt&&Cn(e),Sf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));pt=Xh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));pt=Xh(e)}else t===27?(t=pt,qn(e.type)?(e=pu,pu=null,pt=e):pt=t):pt=Ht?Oa(e.stateNode.nextSibling):null;return!0}function as(){pt=Ht=null,Ze=!1}function Xo(){var e=Nn;return e!==null&&(ia===null?ia=e:ia.push.apply(ia,e),Nn=null),e}function Mi(e){Nn===null?Nn=[e]:Nn.push(e)}var Io=E(null),ns=null,Wa=null;function _n(e,t,n){ee(Io,t._currentValue),t._currentValue=n}function en(e){e._currentValue=Io.current,O(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 y=o;o=r;for(var M=0;M<t.length;M++)if(y.context===t[M]){o.lanes|=n,y=o.alternate,y!==null&&(y.lanes|=n),Qo(o.return,n,e),s||(f=null);break e}o=y.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 y=r.type;ua(r.pendingProps.value,f.value)||(e!==null?e.push(y):e=[y])}}else if(r===Se.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(!ua(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ss(e){ns=e,Wa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Vt(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},Wa===null){if(e===null)throw Error(u(308));Wa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Wa=Wa.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,Ot={$$typeof:z,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=$.S;$.S=function(e,t){oh=Nt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&C0(e,t),_f!==null&&_f(e,t)};var is=E(null);function Wo(){var e=is.current;return e!==null?e:mt.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:Ot._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(Qa,Qa),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(Qa,Qa);else{if(e=mt,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===R?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(V,L){if(e){var X=V.deletions;X===null?(V.deletions=[L],V.flags|=16):X.push(L)}}function n(V,L){if(!e)return null;for(;L!==null;)t(V,L),L=L.sibling;return null}function s(V){for(var L=new Map;V!==null;)V.key!==null?L.set(V.key,V):L.set(V.index,V),V=V.sibling;return L}function r(V,L){return V=Ja(V,L),V.index=0,V.sibling=null,V}function o(V,L,X){return V.index=X,e?(X=V.alternate,X!==null?(X=X.index,X<L?(V.flags|=67108866,L):X):(V.flags|=67108866,L)):(V.flags|=1048576,L)}function f(V){return e&&V.alternate===null&&(V.flags|=67108866),V}function y(V,L,X,ie){return L===null||L.tag!==6?(L=$o(X,V.mode,ie),L.return=V,L):(L=r(L,X),L.return=V,L)}function M(V,L,X,ie){var we=X.type;return we===b?ae(V,L,X.props.children,ie,X.key):L!==null&&(L.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===W&&ls(we)===L.type)?(L=r(L,X.props),Di(L,X),L.return=V,L):(L=ql(X.type,X.key,X.props,null,V.mode,ie),Di(L,X),L.return=V,L)}function I(V,L,X,ie){return L===null||L.tag!==4||L.stateNode.containerInfo!==X.containerInfo||L.stateNode.implementation!==X.implementation?(L=Fo(X,V.mode,ie),L.return=V,L):(L=r(L,X.children||[]),L.return=V,L)}function ae(V,L,X,ie,we){return L===null||L.tag!==7?(L=ts(X,V.mode,ie,we),L.return=V,L):(L=r(L,X),L.return=V,L)}function le(V,L,X){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=$o(""+L,V.mode,X),L.return=V,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case U:return X=ql(L.type,L.key,L.props,null,V.mode,X),Di(X,L),X.return=V,X;case D:return L=Fo(L,V.mode,X),L.return=V,L;case W:return L=ls(L),le(V,L,X)}if(je(L)||Y(L))return L=ts(L,V.mode,X,null),L.return=V,L;if(typeof L.then=="function")return le(V,Gl(L),X);if(L.$$typeof===z)return le(V,Bl(V,L),X);Yl(V,L)}return null}function Z(V,L,X,ie){var we=L!==null?L.key:null;if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return we!==null?null:y(V,L,""+X,ie);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case U:return X.key===we?M(V,L,X,ie):null;case D:return X.key===we?I(V,L,X,ie):null;case W:return X=ls(X),Z(V,L,X,ie)}if(je(X)||Y(X))return we!==null?null:ae(V,L,X,ie,null);if(typeof X.then=="function")return Z(V,L,Gl(X),ie);if(X.$$typeof===z)return Z(V,L,Bl(V,X),ie);Yl(V,X)}return null}function te(V,L,X,ie,we){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return V=V.get(X)||null,y(L,V,""+ie,we);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case U:return V=V.get(ie.key===null?X:ie.key)||null,M(L,V,ie,we);case D:return V=V.get(ie.key===null?X:ie.key)||null,I(L,V,ie,we);case W:return ie=ls(ie),te(V,L,X,ie,we)}if(je(ie)||Y(ie))return V=V.get(X)||null,ae(L,V,ie,we,null);if(typeof ie.then=="function")return te(V,L,X,Gl(ie),we);if(ie.$$typeof===z)return te(V,L,X,Bl(L,ie),we);Yl(L,ie)}return null}function Oe(V,L,X,ie){for(var we=null,We=null,Me=L,Fe=L=0,Qe=null;Me!==null&&Fe<X.length;Fe++){Me.index>Fe?(Qe=Me,Me=null):Qe=Me.sibling;var et=Z(V,Me,X[Fe],ie);if(et===null){Me===null&&(Me=Qe);break}e&&Me&&et.alternate===null&&t(V,Me),L=o(et,L,Fe),We===null?we=et:We.sibling=et,We=et,Me=Qe}if(Fe===X.length)return n(V,Me),Ze&&Ka(V,Fe),we;if(Me===null){for(;Fe<X.length;Fe++)Me=le(V,X[Fe],ie),Me!==null&&(L=o(Me,L,Fe),We===null?we=Me:We.sibling=Me,We=Me);return Ze&&Ka(V,Fe),we}for(Me=s(Me);Fe<X.length;Fe++)Qe=te(Me,V,Fe,X[Fe],ie),Qe!==null&&(e&&Qe.alternate!==null&&Me.delete(Qe.key===null?Fe:Qe.key),L=o(Qe,L,Fe),We===null?we=Qe:We.sibling=Qe,We=Qe);return e&&Me.forEach(function(Fn){return t(V,Fn)}),Ze&&Ka(V,Fe),we}function Ue(V,L,X,ie){if(X==null)throw Error(u(151));for(var we=null,We=null,Me=L,Fe=L=0,Qe=null,et=X.next();Me!==null&&!et.done;Fe++,et=X.next()){Me.index>Fe?(Qe=Me,Me=null):Qe=Me.sibling;var Fn=Z(V,Me,et.value,ie);if(Fn===null){Me===null&&(Me=Qe);break}e&&Me&&Fn.alternate===null&&t(V,Me),L=o(Fn,L,Fe),We===null?we=Fn:We.sibling=Fn,We=Fn,Me=Qe}if(et.done)return n(V,Me),Ze&&Ka(V,Fe),we;if(Me===null){for(;!et.done;Fe++,et=X.next())et=le(V,et.value,ie),et!==null&&(L=o(et,L,Fe),We===null?we=et:We.sibling=et,We=et);return Ze&&Ka(V,Fe),we}for(Me=s(Me);!et.done;Fe++,et=X.next())et=te(Me,V,Fe,et.value,ie),et!==null&&(e&&et.alternate!==null&&Me.delete(et.key===null?Fe:et.key),L=o(et,L,Fe),We===null?we=et:We.sibling=et,We=et);return e&&Me.forEach(function(Ub){return t(V,Ub)}),Ze&&Ka(V,Fe),we}function dt(V,L,X,ie){if(typeof X=="object"&&X!==null&&X.type===b&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case U:e:{for(var we=X.key;L!==null;){if(L.key===we){if(we=X.type,we===b){if(L.tag===7){n(V,L.sibling),ie=r(L,X.props.children),ie.return=V,V=ie;break e}}else if(L.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===W&&ls(we)===L.type){n(V,L.sibling),ie=r(L,X.props),Di(ie,X),ie.return=V,V=ie;break e}n(V,L);break}else t(V,L);L=L.sibling}X.type===b?(ie=ts(X.props.children,V.mode,ie,X.key),ie.return=V,V=ie):(ie=ql(X.type,X.key,X.props,null,V.mode,ie),Di(ie,X),ie.return=V,V=ie)}return f(V);case D:e:{for(we=X.key;L!==null;){if(L.key===we)if(L.tag===4&&L.stateNode.containerInfo===X.containerInfo&&L.stateNode.implementation===X.implementation){n(V,L.sibling),ie=r(L,X.children||[]),ie.return=V,V=ie;break e}else{n(V,L);break}else t(V,L);L=L.sibling}ie=Fo(X,V.mode,ie),ie.return=V,V=ie}return f(V);case W:return X=ls(X),dt(V,L,X,ie)}if(je(X))return Oe(V,L,X,ie);if(Y(X)){if(we=Y(X),typeof we!="function")throw Error(u(150));return X=we.call(X),Ue(V,L,X,ie)}if(typeof X.then=="function")return dt(V,L,Gl(X),ie);if(X.$$typeof===z)return dt(V,L,Bl(V,X),ie);Yl(V,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,L!==null&&L.tag===6?(n(V,L.sibling),ie=r(L,X),ie.return=V,V=ie):(n(V,L),ie=$o(X,V.mode,ie),ie.return=V,V=ie),f(V)):n(V,L)}return function(V,L,X,ie){try{ki=0;var we=dt(V,L,X,ie);return Gs=null,we}catch(Me){if(Me===Ps||Me===Fl)throw Me;var We=da(29,Me,null,V.mode);return We.lanes=ie,We.return=V,We}finally{}}}var os=Af(!0),wf=Af(!1),Tn=!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 On(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function En(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(tt&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;Tn=!1;var o=r.firstBaseUpdate,f=r.lastBaseUpdate,y=r.shared.pending;if(y!==null){r.shared.pending=null;var M=y,I=M.next;M.next=null,f===null?o=I:f.next=I,f=M;var ae=e.alternate;ae!==null&&(ae=ae.updateQueue,y=ae.lastBaseUpdate,y!==f&&(y===null?ae.firstBaseUpdate=I:y.next=I,ae.lastBaseUpdate=M))}if(o!==null){var le=r.baseState;f=0,ae=I=M=null,y=o;do{var Z=y.lane&-536870913,te=Z!==y.lane;if(te?(Ie&Z)===Z:(s&Z)===Z){Z!==0&&Z===$s&&(sc=!0),ae!==null&&(ae=ae.next={lane:0,tag:y.tag,payload:y.payload,callback:null,next:null});e:{var Oe=e,Ue=y;Z=t;var dt=n;switch(Ue.tag){case 1:if(Oe=Ue.payload,typeof Oe=="function"){le=Oe.call(dt,le,Z);break e}le=Oe;break e;case 3:Oe.flags=Oe.flags&-65537|128;case 0:if(Oe=Ue.payload,Z=typeof Oe=="function"?Oe.call(dt,le,Z):Oe,Z==null)break e;le=_({},le,Z);break e;case 2:Tn=!0}}Z=y.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:y.tag,payload:y.payload,callback:y.callback,next:null},ae===null?(I=ae=te,M=le):ae=ae.next=te,f|=Z;if(y=y.next,y===null){if(y=r.shared.pending,y===null)break;te=y,y=te.next,te.next=null,r.lastBaseUpdate=te,r.shared.pending=null}}while(!0);ae===null&&(M=le),r.baseState=M,r.firstBaseUpdate=I,r.lastBaseUpdate=ae,o===null&&(r.shared.lanes=0),kn|=f,e.lanes=f,e.memoizedState=le}}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=E(null),Xl=E(0);function Rf(e,t){e=un,ee(Xl,e),ee(Ys,t),un=e|t.baseLanes}function ic(){ee(Xl,un),ee(Ys,Ys.current)}function lc(){un=Xl.current,O(Ys),O(Xl)}var fa=E(null),Ta=null;function zn(e){var t=e.alternate;ee(Ct,Ct.current&1),ee(fa,e),Ta===null&&(t===null||Ys.current!==null||t.memoizedState!==null)&&(Ta=e)}function rc(e){ee(Ct,Ct.current),ee(fa,e),Ta===null&&(Ta=e)}function Uf(e){e.tag===22?(ee(Ct,Ct.current),ee(fa,e),Ta===null&&(Ta=e)):Mn()}function Mn(){ee(Ct,Ct.current),ee(fa,fa.current)}function ma(e){O(fa),Ta===e&&(Ta=null),O(Ct)}var Ct=E(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 tn=0,$e=null,ct=null,Et=null,Ql=!1,Xs=!1,cs=!1,Zl=0,qi=0,Is=null,T0=0;function xt(){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(!ua(e[n],t[n]))return!1;return!0}function cc(e,t,n,s,r,o){return tn=o,$e=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$.H=e===null||e.memoizedState===null?ym:Cc,cs=!1,o=n(s,r),cs=!1,Xs&&(o=qf(t,n,s,r)),Lf(e),o}function Lf(e){$.H=Bi;var t=ct!==null&&ct.next!==null;if(tn=0,Et=ct=$e=null,Ql=!1,qi=0,Is=null,t)throw Error(u(300));e===null||zt||(e=e.dependencies,e!==null&&Vl(e)&&(zt=!0))}function qf(e,t,n,s){$e=e;var r=0;do{if(Xs&&(Is=null),qi=0,Xs=!1,25<=r)throw Error(u(301));if(r+=1,Et=ct=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}$.H=xm,o=t(n,s)}while(Xs);return o}function O0(){var e=$.H,t=e.useState()[0];return t=typeof t.then=="function"?Hi(t):t,e=e.useState()[0],(ct!==null?ct.memoizedState:null)!==e&&($e.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}tn=0,Et=ct=$e=null,Xs=!1,qi=Zl=0,Is=null}function Kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Et===null?$e.memoizedState=Et=e:Et=Et.next=e,Et}function _t(){if(ct===null){var e=$e.alternate;e=e!==null?e.memoizedState:null}else e=ct.next;var t=Et===null?$e.memoizedState:Et.next;if(t!==null)Et=t,ct=e;else{if(e===null)throw $e.alternate===null?Error(u(467)):Error(u(310));ct=e,e={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},Et===null?$e.memoizedState=Et=e:Et=Et.next=e}return Et}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=$e,(Et===null?t.memoizedState:Et.next)===null&&(t=t.alternate,$.H=t===null||t.memoizedState===null?ym:Cc),e}function Kl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Hi(e);if(e.$$typeof===z)return Vt(e)}throw Error(u(438,String(e)))}function mc(e){var t=null,n=$e.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=$e.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(),$e.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]=J;return t.index++,n}function an(e,t){return typeof t=="function"?t(e):t}function Wl(e){var t=_t();return hc(t,ct,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 y=f=null,M=null,I=t,ae=!1;do{var le=I.lane&-536870913;if(le!==I.lane?(Ie&le)===le:(tn&le)===le){var Z=I.revertLane;if(Z===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null}),le===$s&&(ae=!0);else if((tn&Z)===Z){I=I.next,Z===$s&&(ae=!0);continue}else le={lane:0,revertLane:I.revertLane,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},M===null?(y=M=le,f=o):M=M.next=le,$e.lanes|=Z,kn|=Z;le=I.action,cs&&n(o,le),o=I.hasEagerState?I.eagerState:n(o,le)}else Z={lane:le,revertLane:I.revertLane,gesture:I.gesture,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},M===null?(y=M=Z,f=o):M=M.next=Z,$e.lanes|=le,kn|=le;I=I.next}while(I!==null&&I!==t);if(M===null?f=o:M.next=y,!ua(o,e.memoizedState)&&(zt=!0,ae&&(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=_t(),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);ua(o,t.memoizedState)||(zt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,s]}function Hf(e,t,n){var s=$e,r=_t(),o=Ze;if(o){if(n===void 0)throw Error(u(407));n=n()}else n=t();var f=!ua((ct||r).memoizedState,n);if(f&&(r.memoizedState=n,zt=!0),r=r.queue,bc($f.bind(null,s,r,e),[e]),r.getSnapshot!==t||f||Et!==null&&Et.memoizedState.tag&1){if(s.flags|=2048,Qs(9,{destroy:void 0},Bf.bind(null,s,r,n,t),null),mt===null)throw Error(u(349));o||(tn&127)!==0||Vf(s,t,n)}return n}function Vf(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=$e.updateQueue,t===null?(t=Jl(),$e.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!ua(e,n)}catch{return!0}}function Pf(e){var t=es(e,2);t!==null&&la(t,e,2)}function vc(e){var t=Kt();if(typeof e=="function"){var n=e;if(e=n(),cs){ft(!0);try{n()}finally{ft(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:an,lastRenderedState:e},t}function Gf(e,t,n,s){return e.baseState=n,hc(e,ct,typeof s=="function"?s:an)}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)}};$.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=$.T,f={};$.T=f;try{var y=n(r,s),M=$.S;M!==null&&M(f,y),Xf(e,t,y)}catch(I){gc(e,t,I)}finally{o!==null&&f.types!==null&&(o.types=f.types),$.T=o}}else try{o=n(r,s),Xf(e,t,o)}catch(I){gc(e,t,I)}}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(Ze){var n=mt.formState;if(n!==null){e:{var s=$e;if(Ze){if(pt){t:{for(var r=pt,o=_a;r.nodeType!==8;){if(!o){r=null;break t}if(r=Oa(r.nextSibling),r===null){r=null;break t}}o=r.data,r=o==="F!"||o==="F"?r:null}if(r){pt=Oa(r.nextSibling),s=r.data==="F!";break e}}Cn(s)}s=!1}s&&(t=n[0])}}return n=Kt(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zf,lastRenderedState:t},n.queue=s,n=vm.bind(null,$e,s),s.dispatch=n,s=vc(!1),o=Nc.bind(null,$e,!1,s.queue),s=Kt(),r={state:t,dispatch:null,action:e,pending:null},s.queue=r,n=E0.bind(null,$e,r,o,n),r.dispatch=n,s.memoizedState=e,[t,n,!1]}function Kf(e){var t=_t();return Wf(t,ct,e)}function Wf(e,t,n){if(t=hc(e,t,Zf)[0],e=Wl(an)[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=_t();var r=t.queue,o=r.dispatch;return n!==t.memoizedState&&($e.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=_t(),n=ct;if(n!==null)return Wf(t,n,e);_t(),t=t.memoizedState,n=_t();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=$e.updateQueue,t===null&&(t=Jl(),$e.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 _t().memoizedState}function er(e,t,n,s){var r=Kt();$e.flags|=e,r.memoizedState=Qs(1|t,{destroy:void 0},n,s===void 0?null:s)}function tr(e,t,n,s){var r=_t();s=s===void 0?null:s;var o=r.memoizedState.inst;ct!==null&&s!==null&&oc(s,ct.memoizedState.deps)?r.memoizedState=Qs(t,o,n,s):($e.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){$e.flags|=4;var t=$e.updateQueue;if(t===null)t=Jl(),$e.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function nm(e){var t=_t().memoizedState;return M0({ref:t,nextImpl:e}),function(){if((tt&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 yc(){}function om(e,t){var n=_t();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=_t();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&oc(t,s[1]))return s[0];if(s=e(),cs){ft(!0);try{e()}finally{ft(!1)}}return n.memoizedState=[s,t],s}function xc(e,t,n){return n===void 0||(tn&1073741824)!==0&&(Ie&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=uh(),$e.lanes|=e,kn|=e,n)}function um(e,t,n,s){return ua(n,t)?n:Ys.current!==null?(e=xc(e,n,s),ua(e,t)||(zt=!0),e):(tn&42)===0||(tn&1073741824)!==0&&(Ie&261930)===0?(zt=!0,e.memoizedState=n):(e=uh(),$e.lanes|=e,kn|=e,t)}function dm(e,t,n,s,r){var o=se.p;se.p=o!==0&&8>o?o:8;var f=$.T,y={};$.T=y,Nc(e,!1,t,n);try{var M=r(),I=$.S;if(I!==null&&I(y,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var ae=_0(M,s);Vi(e,t,ae,va(e))}else Vi(e,t,s,va(e))}catch(le){Vi(e,t,{then:function(){},status:"rejected",reason:le},va())}finally{se.p=o,f!==null&&y.types!==null&&(f.types=y.types),$.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,ve,n===null?A0:function(){return mm(e),n(s)})}function fm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ve,baseState:ve,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:an,lastRenderedState:ve},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:an,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,{},va())}function Sc(){return Vt(nl)}function hm(){return _t().memoizedState}function pm(){return _t().memoizedState}function w0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=va();e=On(n);var s=En(t,e,n);s!==null&&(la(s,t,n),Ri(s,t,n)),t={cache:Jo()},e.payload=t;return}t=t.return}}function k0(e,t,n){var s=va();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&&(la(n,e,s),bm(n,t,s)))}function vm(e,t,n){var s=va();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,y=o(f,n);if(r.hasEagerState=!0,r.eagerState=y,ua(y,f))return Ul(e,t,r,0),mt===null&&Rl(),!1}catch{}finally{}if(n=Vo(e,t,r,s),n!==null)return la(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&&la(t,e,2)}function ar(e){var t=e.alternate;return e===$e||t!==null&&t===$e}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:Vt,use:Kl,useCallback:xt,useContext:xt,useEffect:xt,useImperativeHandle:xt,useLayoutEffect:xt,useInsertionEffect:xt,useMemo:xt,useReducer:xt,useRef:xt,useState:xt,useDebugValue:xt,useDeferredValue:xt,useTransition:xt,useSyncExternalStore:xt,useId:xt,useHostTransitionStatus:xt,useFormState:xt,useActionState:xt,useOptimistic:xt,useMemoCache:xt,useCacheRefresh:xt};Bi.useEffectEvent=xt;var ym={readContext:Vt,use:Kl,useCallback:function(e,t){return Kt().memoizedState=[e,t===void 0?null:t],e},useContext:Vt,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=Kt();t=t===void 0?null:t;var s=e();if(cs){ft(!0);try{e()}finally{ft(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=Kt();if(n!==void 0){var r=n(t);if(cs){ft(!0);try{n(t)}finally{ft(!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,$e,e),[s.memoizedState,e]},useRef:function(e){var t=Kt();return e={current:e},t.memoizedState=e},useState:function(e){e=vc(e);var t=e.queue,n=vm.bind(null,$e,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:yc,useDeferredValue:function(e,t){var n=Kt();return xc(n,e,t)},useTransition:function(){var e=vc(!1);return e=dm.bind(null,$e,e.queue,!0,!1),Kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=$e,r=Kt();if(Ze){if(n===void 0)throw Error(u(407));n=n()}else{if(n=t(),mt===null)throw Error(u(349));(Ie&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=Kt(),t=mt.identifierPrefix;if(Ze){var n=La,s=Ua;n=(s&~(1<<32-Ke(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=Kt();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,$e,!0,n),n.dispatch=t,[e,t]},useMemoCache:mc,useCacheRefresh:function(){return Kt().memoizedState=w0.bind(null,$e)},useEffectEvent:function(e){var t=Kt(),n={impl:e};return t.memoizedState=n,function(){if((tt&2)!==0)throw Error(u(440));return n.impl.apply(void 0,arguments)}}},Cc={readContext:Vt,use:Kl,useCallback:om,useContext:Vt,useEffect:bc,useImperativeHandle:rm,useInsertionEffect:sm,useLayoutEffect:im,useMemo:cm,useReducer:Wl,useRef:tm,useState:function(){return Wl(an)},useDebugValue:yc,useDeferredValue:function(e,t){var n=_t();return um(n,ct.memoizedState,e,t)},useTransition:function(){var e=Wl(an)[0],t=_t().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=_t();return Gf(n,ct,e,t)},useMemoCache:mc,useCacheRefresh:pm};Cc.useEffectEvent=nm;var xm={readContext:Vt,use:Kl,useCallback:om,useContext:Vt,useEffect:bc,useImperativeHandle:rm,useInsertionEffect:sm,useLayoutEffect:im,useMemo:cm,useReducer:pc,useRef:tm,useState:function(){return pc(an)},useDebugValue:yc,useDeferredValue:function(e,t){var n=_t();return ct===null?xc(n,e,t):um(n,ct.memoizedState,e,t)},useTransition:function(){var e=pc(an)[0],t=_t().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=_t();return ct!==null?Gf(n,ct,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:mc,useCacheRefresh:pm};xm.useEffectEvent=nm;function _c(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:_({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Tc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=va(),r=On(s);r.payload=t,n!=null&&(r.callback=n),t=En(e,r,s),t!==null&&(la(t,e,s),Ri(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=va(),r=On(s);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=En(e,r,s),t!==null&&(la(t,e,s),Ri(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=va(),s=On(n);s.tag=2,t!=null&&(s.callback=t),t=En(e,s,n),t!==null&&(la(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=_({},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=On(n),n.tag=3,n.payload={element:null},n.callback=function(){nr(e,t)},n}function Om(e){return e=On(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"&&(Dn===null?Dn=new Set([this]):Dn.add(this));var y=s.stack;this.componentDidCatch(s.value,{componentStack:y!==null?y:""})})}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=fa.current,n!==null){switch(n.tag){case 31:case 13:return Ta===null?pr():n.alternate===null&&jt===0&&(jt=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(Ze)return t=fa.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(Sa(e,n)))):(s!==Yo&&(t=Error(u(423),{cause:s}),Mi(Sa(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,s=Sa(s,n),r=Oc(e.stateNode,s,r),nc(e,r),jt!==4&&(jt=2)),!1;var o=Error(u(520),{cause:s});if(o=Sa(o,n),Qi===null?Qi=[o]:Qi.push(o),jt!==4&&(jt=2),t===null)return!0;s=Sa(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"&&(Dn===null||!Dn.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)),zt=!1;function Bt(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 y in s)y!=="ref"&&(f[y]=s[y])}else f=s;return ss(t),s=cc(e,t,n,f,o,r),y=uc(),e!==null&&!zt?(dc(e,t,r),nn(e,t,r)):(Ze&&y&&Po(t),t.flags|=1,Bt(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 nn(e,t,r)}return t.flags|=1,e=Ja(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(zt=!1,t.pendingProps=s=o,Uc(e,r))(e.flags&131072)!==0&&(zt=!0);else return t.lanes=e.lanes,nn(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),Mn(),t.memoizedState=null):(e!==null&&$l(t,null),ic(),Mn());return Bt(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:Ot._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,ma(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(Ze){if(s.mode==="hidden")return e=sr(t,s),t.lanes=536870912,$i(null,e);if(rc(t),(e=pt)?(e=Yh(e,_a),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sn!==null?{id:Ua,overflow:La}:null,retryLane:536870912,hydrationErrors:null},n=gf(e),n.return=t,t.child=n,Ht=t,pt=null)):e=null,e===null)throw Cn(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(zt||Bs(e,t,n,!1),r=(n&e.childLanes)!==0,zt||r){if(s=mt,s!==null&&(f=gi(s,n),f!==0&&f!==o.retryLane))throw o.retryLane=f,es(e,f),la(s,e,f),Ec;pr(),t=Dm(e,t,n)}else e=o.treeContext,pt=Oa(f.nextSibling),Ht=t,Ze=!0,Nn=null,_a=!1,e!==null&&xf(t,e),t=sr(t,s),t.flags|=4096;return t}return e=Ja(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&&!zt?(dc(e,t,r),nn(e,t,r)):(Ze&&s&&Po(t),t.flags|=1,Bt(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&&!zt?(dc(e,t,o),nn(e,t,o)):(Ze&&s&&Po(t),t.flags|=1,Bt(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=Vt(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?Vt(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 y=t.memoizedProps,M=us(n,y);o.props=M;var I=o.context,ae=n.contextType;f=Ls,typeof ae=="object"&&ae!==null&&(f=Vt(ae));var le=n.getDerivedStateFromProps;ae=typeof le=="function"||typeof o.getSnapshotBeforeUpdate=="function",y=t.pendingProps!==y,ae||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(y||I!==f)&&Sm(t,o,s,f),Tn=!1;var Z=t.memoizedState;o.state=Z,Li(t,s,o,r),Ui(),I=t.memoizedState,y||Z!==I||Tn?(typeof le=="function"&&(_c(t,n,le,s),I=t.memoizedState),(M=Tn||jm(t,n,M,s,Z,I,f))?(ae||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=I),o.props=s,o.state=I,o.context=f,s=M):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{o=t.stateNode,ac(e,t),f=t.memoizedProps,ae=us(n,f),o.props=ae,le=t.pendingProps,Z=o.context,I=n.contextType,M=Ls,typeof I=="object"&&I!==null&&(M=Vt(I)),y=n.getDerivedStateFromProps,(I=typeof y=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(f!==le||Z!==M)&&Sm(t,o,s,M),Tn=!1,Z=t.memoizedState,o.state=Z,Li(t,s,o,r),Ui();var te=t.memoizedState;f!==le||Z!==te||Tn||e!==null&&e.dependencies!==null&&Vl(e.dependencies)?(typeof y=="function"&&(_c(t,n,y,s),te=t.memoizedState),(ae=Tn||jm(t,n,ae,s,Z,te,M)||e!==null&&e.dependencies!==null&&Vl(e.dependencies))?(I||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=ae):(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)):Bt(e,t,n,r),t.memoizedState=o.state,e=t.child):e=nn(e,t,r),e}function Lm(e,t,n,s){return as(),t.flags|=256,Bt(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|=pa),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:(Ct.current&2)!==0),f&&(r=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ze){if(r?zn(t):Mn(),(e=pt)?(e=Yh(e,_a),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sn!==null?{id:Ua,overflow:La}:null,retryLane:536870912,hydrationErrors:null},n=gf(e),n.return=t,t.child=n,Ht=t,pt=null)):e=null,e===null)throw Cn(t);return hu(e)?t.lanes=32:t.lanes=536870912,null}var y=s.children;return s=s.fallback,r?(Mn(),r=t.mode,y=lr({mode:"hidden",children:y},r),s=ts(s,r,n,null),y.return=t,s.return=t,y.sibling=s,t.child=y,s=t.child,s.memoizedState=Ac(n),s.childLanes=wc(e,f,n),t.memoizedState=Mc,$i(null,s)):(zn(t),kc(t,y))}var M=e.memoizedState;if(M!==null&&(y=M.dehydrated,y!==null)){if(o)t.flags&256?(zn(t),t.flags&=-257,t=Dc(e,t,n)):t.memoizedState!==null?(Mn(),t.child=e.child,t.flags|=128,t=null):(Mn(),y=s.fallback,r=t.mode,s=lr({mode:"visible",children:s.children},r),y=ts(y,r,n,null),y.flags|=2,s.return=t,y.return=t,s.sibling=y,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(zn(t),hu(y)){if(f=y.nextSibling&&y.nextSibling.dataset,f)var I=f.dgst;f=I,s=Error(u(419)),s.stack="",s.digest=f,Mi({value:s,source:null,stack:null}),t=Dc(e,t,n)}else if(zt||Bs(e,t,n,!1),f=(n&e.childLanes)!==0,zt||f){if(f=mt,f!==null&&(s=gi(f,n),s!==0&&s!==M.retryLane))throw M.retryLane=s,es(e,s),la(f,e,s),Ec;mu(y)||pr(),t=Dc(e,t,n)}else mu(y)?(t.flags|=192,t.child=e.child,t=null):(e=M.treeContext,pt=Oa(y.nextSibling),Ht=t,Ze=!0,Nn=null,_a=!1,e!==null&&xf(t,e),t=kc(t,s.children),t.flags|=4096);return t}return r?(Mn(),y=s.fallback,r=t.mode,M=e.child,I=M.sibling,s=Ja(M,{mode:"hidden",children:s.children}),s.subtreeFlags=M.subtreeFlags&65011712,I!==null?y=Ja(I,y):(y=ts(y,r,n,null),y.flags|=2),y.return=t,s.return=t,s.sibling=y,t.child=s,$i(null,s),s=t.child,y=e.child.memoizedState,y===null?y=Ac(n):(r=y.cachePool,r!==null?(M=Ot._currentValue,r=r.parent!==M?{parent:M,pool:M}:r):r=Tf(),y={baseLanes:y.baseLanes|n,cachePool:r}),s.memoizedState=y,s.childLanes=wc(e,f,n),t.memoizedState=Mc,$i(e.child,s)):(zn(t),n=e.child,e=n.sibling,n=Ja(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=da(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=Ct.current,y=(f&2)!==0;if(y?(f=f&1|2,t.flags|=128):f&=1,ee(Ct,f),Bt(e,t,s,n),s=Ze?zi:0,!y&&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 nn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),kn|=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=Ja(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ja(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:qe(t,t.stateNode.containerInfo),_n(t,Ot,e.memoizedState.cache),as();break;case 27:case 5:ne(t);break;case 4:qe(t,t.stateNode.containerInfo);break;case 10:_n(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?(zn(t),t.flags|=128,null):(n&t.child.childLanes)!==0?qm(e,t,n):(zn(t),e=nn(e,t,n),e!==null?e.sibling:null);zn(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(Ct,Ct.current),s)break;return null;case 22:return t.lanes=0,wm(e,t,n,t.pendingProps);case 24:_n(t,Ot,e.memoizedState.cache)}return nn(e,t,n)}function Bm(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)zt=!0;else{if(!Uc(e,n)&&(t.flags&128)===0)return zt=!1,U0(e,t,n);zt=(e.flags&131072)!==0}else zt=!1,Ze&&(t.flags&1048576)!==0&&yf(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=xe(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(qe(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,_n(t,Ot,s),s!==o.cache&&Zo(t,[Ot],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=Sa(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(pt=Oa(e.firstChild),Ht=t,Ze=!0,Nn=null,_a=!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=nn(e,t,n);break e}Bt(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:Ze||(n=t.type,e=t.pendingProps,s=Sr(pe.current).createElement(n),s[qt]=t,s[ea]=e,$t(s,n,e),Rt(s),t.stateNode=s):t.memoizedState=Kh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ne(t),e===null&&Ze&&(s=t.stateNode=Qh(t.type,t.pendingProps,pe.current),Ht=t,_a=!0,r=pt,qn(t.type)?(pu=r,pt=Oa(s.firstChild)):pt=r),Bt(e,t,t.pendingProps.children,n),ir(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ze&&((r=s=pt)&&(s=fb(s,t.type,t.pendingProps,_a),s!==null?(t.stateNode=s,Ht=t,pt=Oa(s.firstChild),_a=!1,r=!0):r=!1),r||Cn(t)),ne(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),Bt(e,t,s,n),t.child;case 6:return e===null&&Ze&&((e=n=pt)&&(n=mb(n,t.pendingProps,_a),n!==null?(t.stateNode=n,Ht=t,pt=null,e=!0):e=!1),e||Cn(t)),null;case 13:return qm(e,t,n);case 4:return qe(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=os(t,null,s,n):Bt(e,t,s,n),t.child;case 11:return zm(e,t,t.type,t.pendingProps,n);case 7:return Bt(e,t,t.pendingProps,n),t.child;case 8:return Bt(e,t,t.pendingProps.children,n),t.child;case 12:return Bt(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,_n(t,t.type,s.value),Bt(e,t,s.children,n),t.child;case 9:return r=t.type._context,s=t.pendingProps.children,ss(t),r=Vt(r),s=s(r),t.flags|=1,Bt(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=Vt(Ot),e===null?(r=Wo(),r===null&&(r=mt,o=Jo(),r.pooledCache=o,o.refCount++,o!==null&&(r.pooledCacheLanes|=n),r=o),t.memoizedState={parent:s,cache:r},tc(t),_n(t,Ot,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),_n(t,Ot,s)):(s=o.cache,_n(t,Ot,s),s!==r.cache&&Zo(t,[Ot],n,!0))),Bt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function sn(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(!Ze)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 vt(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 vt(t),null;case 1:return vt(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),en(Ot),De(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Vs(t)?sn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Xo())),vt(t),null;case 26:var r=t.type,o=t.memoizedState;return e===null?(sn(t),o!==null?(vt(t),$m(t,o)):(vt(t),Lc(t,r,null,s,n))):o?o!==e.memoizedState?(sn(t),vt(t),$m(t,o)):(vt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&sn(t),vt(t),Lc(t,r,e,s,n)),null;case 27:if(Q(t),n=pe.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&sn(t);else{if(!s){if(t.stateNode===null)throw Error(u(166));return vt(t),null}e=K.current,Vs(t)?jf(t):(e=Qh(r,s,n),t.stateNode=e,sn(t))}return vt(t),null;case 5:if(Q(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&sn(t);else{if(!s){if(t.stateNode===null)throw Error(u(166));return vt(t),null}if(o=K.current,Vs(t))jf(t);else{var f=Sr(pe.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[qt]=t,o[ea]=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($t(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&&sn(t)}}return vt(t),Lc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&sn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(u(166));if(e=pe.current,Vs(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,r=Ht,r!==null)switch(r.tag){case 27:case 5:s=r.memoizedProps}e[qt]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||qh(e.nodeValue,n)),e||Cn(t,!0)}else e=Sr(e).createTextNode(s),e[qt]=t,t.stateNode=e}return vt(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[qt]=t}else as(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;vt(t),e=!1}else n=Xo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ma(t),t):(ma(t),null);if((t.flags&128)!==0)throw Error(u(558))}return vt(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[qt]=t}else as(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;vt(t),r=!1}else r=Xo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(ma(t),t):(ma(t),null)}return ma(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),vt(t),null);case 4:return De(),e===null&&iu(t.stateNode.containerInfo),vt(t),null;case 10:return en(t.type),vt(t),null;case 19:if(O(Ct),s=t.memoizedState,s===null)return vt(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)Fi(s,!1);else{if(jt!==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(Ct,Ct.current&1|2),Ze&&Ka(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Nt()>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&&!Ze)return vt(t),null}else 2*Nt()-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=Nt(),e.sibling=null,n=Ct.current,ee(Ct,r?n&1|2:n&1),Ze&&Ka(t,s.treeForkCount),e):(vt(t),null);case 22:case 23:return ma(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&&(vt(t),t.subtreeFlags&6&&(t.flags|=8192)):vt(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&&O(is),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),en(Ot),vt(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 en(Ot),De(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Q(t),null;case 31:if(t.memoizedState!==null){if(ma(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(ma(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 O(Ct),null;case 4:return De(),null;case 10:return en(t.type),null;case 22:case 23:return ma(t),lc(),e!==null&&O(is),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return en(Ot),null;case 25:return null;default:return null}}function Fm(e,t){switch(Go(t),t.tag){case 3:en(Ot),De();break;case 26:case 27:case 5:Q(t);break;case 4:De();break;case 31:t.memoizedState!==null&&ma(t);break;case 13:ma(t);break;case 19:O(Ct);break;case 10:en(t.type);break;case 22:case 23:ma(t),lc(),e!==null&&O(is);break;case 24:en(Ot)}}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(y){lt(t,t.return,y)}}function An(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,y=f.destroy;if(y!==void 0){f.destroy=void 0,r=t;var M=n,I=y;try{I()}catch(ae){lt(r,M,ae)}}}s=s.next}while(s!==o)}}catch(ae){lt(t,t.return,ae)}}function Pm(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Df(t,n)}catch(s){lt(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){lt(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){lt(e,t,r)}}function qa(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(r){lt(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){lt(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){lt(e,e.return,r)}}function qc(e,t,n){try{var s=e.stateNode;lb(s,e.type,n,t),s[ea]=t}catch(r){lt(e,e.return,r)}}function Xm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&qn(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&&qn(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=Qa));else if(s!==4&&(s===27&&qn(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&&qn(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]);$t(t,s,n),t[qt]=e,t[ea]=n}catch(o){lt(e,e.return,o)}}var ln=!1,Mt=!1,Bc=!1,Qm=typeof WeakSet=="function"?WeakSet:Set,Ut=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,y=-1,M=-1,I=0,ae=0,le=e,Z=null;t:for(;;){for(var te;le!==n||r!==0&&le.nodeType!==3||(y=f+r),le!==o||s!==0&&le.nodeType!==3||(M=f+s),le.nodeType===3&&(f+=le.nodeValue.length),(te=le.firstChild)!==null;)Z=le,le=te;for(;;){if(le===e)break t;if(Z===n&&++I===r&&(y=f),Z===o&&++ae===s&&(M=f),(te=le.nextSibling)!==null)break;le=Z,Z=le.parentNode}le=te}n=y===-1||M===-1?null:{start:y,end:M}}else n=null}n=n||{start:0,end:0}}else n=null;for(cu={focusedElem:e,selectionRange:n},zr=!1,Ut=t;Ut!==null;)if(t=Ut,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ut=e;else for(;Ut!==null;){switch(t=Ut,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 Oe=us(n.type,r);e=s.getSnapshotBeforeUpdate(Oe,o),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ue){lt(n,n.return,Ue)}}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,Ut=e;break}Ut=t.return}}function Zm(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:on(e,n),s&4&&Pi(5,n);break;case 1:if(on(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(f){lt(n,n.return,f)}else{var r=us(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){lt(n,n.return,f)}}s&64&&Pm(n),s&512&&Gi(n,n.return);break;case 3:if(on(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){lt(n,n.return,f)}}break;case 27:t===null&&s&4&&Im(n);case 26:case 5:on(e,n),t===null&&s&4&&Ym(n),s&512&&Gi(n,n.return);break;case 12:on(e,n);break;case 31:on(e,n),s&4&&Wm(e,n);break;case 13:on(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||ln,!s){t=t!==null&&t.memoizedState!==null||Mt,r=ln;var o=Mt;ln=s,(Mt=t)&&!o?cn(e,n,(n.subtreeFlags&8772)!==0):on(e,n),ln=r,Mt=o}break;case 30:break;default:on(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 gt=null,aa=!1;function rn(e,t,n){for(n=n.child;n!==null;)Km(e,t,n),n=n.sibling}function Km(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(Zt,n)}catch{}switch(n.tag){case 26:Mt||qa(n,t),rn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Mt||qa(n,t);var s=gt,r=aa;qn(n.type)&&(gt=n.stateNode,aa=!1),rn(e,t,n),el(n.stateNode),gt=s,aa=r;break;case 5:Mt||qa(n,t);case 6:if(s=gt,r=aa,gt=null,rn(e,t,n),gt=s,aa=r,gt!==null)if(aa)try{(gt.nodeType===9?gt.body:gt.nodeName==="HTML"?gt.ownerDocument.body:gt).removeChild(n.stateNode)}catch(o){lt(n,t,o)}else try{gt.removeChild(n.stateNode)}catch(o){lt(n,t,o)}break;case 18:gt!==null&&(aa?(e=gt,Ph(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),ri(e)):Ph(gt,n.stateNode));break;case 4:s=gt,r=aa,gt=n.stateNode.containerInfo,aa=!0,rn(e,t,n),gt=s,aa=r;break;case 0:case 11:case 14:case 15:An(2,n,t),Mt||An(4,n,t),rn(e,t,n);break;case 1:Mt||(qa(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&Gm(n,t,s)),rn(e,t,n);break;case 21:rn(e,t,n);break;case 22:Mt=(s=Mt)||n.memoizedState!==null,rn(e,t,n),Mt=s;break;default:rn(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){lt(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){lt(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 na(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,y=f;e:for(;y!==null;){switch(y.tag){case 27:if(qn(y.type)){gt=y.stateNode,aa=!1;break e}break;case 5:gt=y.stateNode,aa=!1;break e;case 3:case 4:gt=y.stateNode.containerInfo,aa=!0;break e}y=y.return}if(gt===null)throw Error(u(160));Km(o,f,r),gt=null,aa=!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 Aa=null;function th(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:na(t,e),sa(e),s&4&&(An(3,e,e.return),Pi(3,e),An(5,e,e.return));break;case 1:na(t,e),sa(e),s&512&&(Mt||n===null||qa(n,n.return)),s&64&&ln&&(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=Aa;if(na(t,e),sa(e),s&512&&(Mt||n===null||qa(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[qt]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=r.createElement(s),r.head.insertBefore(o,r.querySelector("head > title"))),$t(o,s,n),o[qt]=e,Rt(o),s=o;break e;case"link":var f=tp("link","href",r).get(s+(n.href||""));if(f){for(var y=0;y<f.length;y++)if(o=f[y],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(y,1);break t}}o=r.createElement(s),$t(o,s,n),r.head.appendChild(o);break;case"meta":if(f=tp("meta","content",r).get(s+(n.content||""))){for(y=0;y<f.length;y++)if(o=f[y],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(y,1);break t}}o=r.createElement(s),$t(o,s,n),r.head.appendChild(o);break;default:throw Error(u(468,s))}o[qt]=e,Rt(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:na(t,e),sa(e),s&512&&(Mt||n===null||qa(n,n.return)),n!==null&&s&4&&qc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(na(t,e),sa(e),s&512&&(Mt||n===null||qa(n,n.return)),e.flags&32){r=e.stateNode;try{Ms(r,"")}catch(Oe){lt(e,e.return,Oe)}}s&4&&e.stateNode!=null&&(r=e.memoizedProps,qc(e,r,n!==null?n.memoizedProps:r)),s&1024&&(Bc=!0);break;case 6:if(na(t,e),sa(e),s&4){if(e.stateNode===null)throw Error(u(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(Oe){lt(e,e.return,Oe)}}break;case 3:if(_r=null,r=Aa,Aa=Nr(t.containerInfo),na(t,e),Aa=r,sa(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{ri(t.containerInfo)}catch(Oe){lt(e,e.return,Oe)}Bc&&(Bc=!1,ah(e));break;case 4:s=Aa,Aa=Nr(e.stateNode.containerInfo),na(t,e),sa(e),Aa=s;break;case 12:na(t,e),sa(e);break;case 31:na(t,e),sa(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,cr(e,s)));break;case 13:na(t,e),sa(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(dr=Nt()),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,I=ln,ae=Mt;if(ln=I||r,Mt=ae||M,na(t,e),Mt=ae,ln=I,sa(e),s&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||M||ln||Mt||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{y=M.stateNode;var le=M.memoizedProps.style,Z=le!=null&&le.hasOwnProperty("display")?le.display:null;y.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(Oe){lt(M,M.return,Oe)}}}else if(t.tag===6){if(n===null){M=t;try{M.stateNode.nodeValue=r?"":M.memoizedProps}catch(Oe){lt(M,M.return,Oe)}}}else if(t.tag===18){if(n===null){M=t;try{var te=M.stateNode;r?Gh(te,!0):Gh(M.stateNode,!1)}catch(Oe){lt(M,M.return,Oe)}}}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:na(t,e),sa(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,cr(e,s)));break;case 30:break;case 21:break;default:na(t,e),sa(e)}}function sa(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 y=Hc(e);or(e,y,f);break;case 3:case 4:var M=n.stateNode.containerInfo,I=Hc(e);Vc(e,I,M);break;default:throw Error(u(161))}}catch(ae){lt(e,e.return,ae)}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 on(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:An(4,t,t.return),ds(t);break;case 1:qa(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:qa(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 cn(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:cn(r,o,n),Pi(4,o);break;case 1:if(cn(r,o,n),s=o,r=s.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(I){lt(s,s.return,I)}if(s=o,r=s.updateQueue,r!==null){var y=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],y)}catch(I){lt(s,s.return,I)}}n&&f&64&&Pm(o),Gi(o,o.return);break;case 27:Im(o);case 26:case 5:cn(r,o,n),n&&s===null&&f&4&&Ym(o),Gi(o,o.return);break;case 12:cn(r,o,n);break;case 31:cn(r,o,n),n&&f&4&&Wm(r,o);break;case 13:cn(r,o,n),n&&f&4&&eh(r,o);break;case 22:o.memoizedState===null&&cn(r,o,n),Gi(o,o.return);break;case 30:break;default:cn(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 wa(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:wa(e,t,n,s),r&2048&&Pi(9,t);break;case 1:wa(e,t,n,s);break;case 3:wa(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){wa(e,t,n,s),e=t.stateNode;try{var o=t.memoizedProps,f=o.id,y=o.onPostCommit;typeof y=="function"&&y(f,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){lt(t,t.return,M)}}else wa(e,t,n,s);break;case 31:wa(e,t,n,s);break;case 13:wa(e,t,n,s);break;case 23:break;case 22:o=t.stateNode,f=t.alternate,t.memoizedState!==null?o._visibility&2?wa(e,t,n,s):Yi(e,t):o._visibility&2?wa(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:wa(e,t,n,s),r&2048&&Fc(t.alternate,t);break;default:wa(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,y=n,M=s,I=f.flags;switch(f.tag){case 0:case 11:case 15:Zs(o,f,y,M,r),Pi(8,f);break;case 23:break;case 22:var ae=f.stateNode;f.memoizedState!==null?ae._visibility&2?Zs(o,f,y,M,r):Yi(o,f):(ae._visibility|=2,Zs(o,f,y,M,r)),r&&I&2048&&$c(f.alternate,f);break;case 24:Zs(o,f,y,M,r),r&&I&2048&&Fc(f.alternate,f);break;default:Zs(o,f,y,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,Aa,e.memoizedState,e.memoizedProps);break;case 5:Js(e,t,n);break;case 3:case 4:var s=Aa;Aa=Nr(e.stateNode.containerInfo),Js(e,t,n),Aa=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];Ut=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&&An(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];Ut=s,rh(s,e)}ih(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:An(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(;Ut!==null;){var n=Ut;switch(n.tag){case 0:case 11:case 15:An(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,Ut=s;else e:for(n=e;Ut!==null;){s=Ut;var r=s.sibling,o=s.return;if(Jm(s),s===n){Ut=null;break e}if(r!==null){r.return=o,Ut=r;break e}Ut=o}}}var B0={getCacheForType:function(e){var t=Vt(Ot),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Vt(Ot).controller.signal}},$0=typeof WeakMap=="function"?WeakMap:Map,tt=0,mt=null,Ye=null,Ie=0,it=0,ha=null,wn=!1,Ks=!1,Pc=!1,un=0,jt=0,kn=0,fs=0,Gc=0,pa=0,Ws=0,Qi=null,ia=null,Yc=!1,dr=0,oh=0,fr=1/0,mr=null,Dn=null,kt=0,Rn=null,ei=null,dn=0,Xc=0,Ic=null,ch=null,Zi=0,Qc=null;function va(){return(tt&2)!==0&&Ie!==0?Ie&-Ie:$.T!==null?tu():yn()}function uh(){if(pa===0)if((Ie&536870912)===0||Ze){var e=Lt;Lt<<=1,(Lt&3932160)===0&&(Lt=262144),pa=e}else pa=536870912;return e=fa.current,e!==null&&(e.flags|=32),pa}function la(e,t,n){(e===mt&&(it===2||it===9)||e.cancelPendingCommit!==null)&&(ti(e,0),Un(e,Ie,pa,!1)),Je(e,n),((tt&2)===0||e!==mt)&&(e===mt&&((tt&2)===0&&(fs|=n),jt===4&&Un(e,Ie,pa,!1)),Ha(e))}function dh(e,t,n){if((tt&6)!==0)throw Error(u(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||k(e,t),r=s?G0(e,t):Jc(e,t,!0),o=s;do{if(r===0){Ks&&!s&&Un(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 y=e;r=Qi;var M=y.current.memoizedState.isDehydrated;if(M&&(ti(y,f).flags|=256),f=Jc(y,f,!1),f!==2){if(Pc&&!M){y.errorRecoveryDisabledLanes|=o,fs|=o,r=4;break e}o=ia,ia=r,o!==null&&(ia===null?ia=o:ia.push.apply(ia,o))}r=f}if(o=!1,r!==2)continue}}if(r===1){ti(e,0),Un(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:Un(s,t,pa,!wn);break e;case 2:ia=null;break;case 3:case 5:break;default:throw Error(u(329))}if((t&62914560)===t&&(r=dr+300-Nt(),10<r)){if(Un(s,t,pa,!wn),ye(s,0,!0)!==0)break e;dn=t,s.timeoutHandle=$h(fh.bind(null,s,n,ia,mr,Yc,t,pa,fs,Ws,wn,o,"Throttled",-0,0),r);break e}fh(s,n,ia,mr,Yc,t,pa,fs,Ws,wn,o,null,-0,0)}}break}while(!0);Ha(e)}function fh(e,t,n,s,r,o,f,y,M,I,ae,le,Z,te){if(e.timeoutHandle=-1,le=t.subtreeFlags,le&8192||(le&16785408)===16785408){le={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qa},sh(t,o,le);var Oe=(o&62914560)===o?dr-Nt():(o&4194048)===o?oh-Nt():0;if(Oe=Ob(le,Oe),Oe!==null){dn=o,e.cancelPendingCommit=Oe(xh.bind(null,e,t,o,n,s,r,f,y,M,ae,le,null,Z,te)),Un(e,o,f,!I);return}}xh(e,t,o,n,s,r,f,y,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(!ua(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 Un(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-Ke(r),f=1<<o;s[o]=-1,r&=~f}n!==0&&yt(e,n,t)}function hr(){return(tt&6)===0?(Ji(0),!1):!0}function Zc(){if(Ye!==null){if(it===0)var e=Ye.return;else e=Ye,Wa=ns=null,fc(e),Gs=null,ki=0,e=Ye;for(;e!==null;)Fm(e.alternate,e),e=e.return;Ye=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()),dn=0,Zc(),mt=e,Ye=n=Ja(e.current,null),Ie=t,it=0,ha=null,wn=!1,Ks=k(e,t),Pc=!1,Ws=pa=Gc=fs=kn=jt=0,ia=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-Ke(s),o=1<<r;t|=e[r],s&=~o}return un=t,Rl(),n}function mh(e,t){$e=null,$.H=Bi,t===Ps||t===Fl?(t=zf(),it=3):t===ec?(t=zf(),it=4):it=t===Ec?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ha=t,Ye===null&&(jt=1,nr(e,Sa(t,e.current)))}function hh(){var e=fa.current;return e===null?!0:(Ie&4194048)===Ie?Ta===null:(Ie&62914560)===Ie||(Ie&536870912)!==0?e===Ta:!1}function ph(){var e=$.H;return $.H=Bi,e===null?Bi:e}function vh(){var e=$.A;return $.A=B0,e}function pr(){jt=4,wn||(Ie&4194048)!==Ie&&fa.current!==null||(Ks=!0),(kn&134217727)===0&&(fs&134217727)===0||mt===null||Un(mt,Ie,pa,!1)}function Jc(e,t,n){var s=tt;tt|=2;var r=ph(),o=vh();(mt!==e||Ie!==t)&&(mr=null,ti(e,t)),t=!1;var f=jt;e:do try{if(it!==0&&Ye!==null){var y=Ye,M=ha;switch(it){case 8:Zc(),f=6;break e;case 3:case 2:case 9:case 6:fa.current===null&&(t=!0);var I=it;if(it=0,ha=null,ai(e,y,M,I),n&&Ks){f=0;break e}break;default:I=it,it=0,ha=null,ai(e,y,M,I)}}P0(),f=jt;break}catch(ae){mh(e,ae)}while(!0);return t&&e.shellSuspendCounter++,Wa=ns=null,tt=s,$.H=r,$.A=o,Ye===null&&(mt=null,Ie=0,Rl()),f}function P0(){for(;Ye!==null;)gh(Ye)}function G0(e,t){var n=tt;tt|=2;var s=ph(),r=vh();mt!==e||Ie!==t?(mr=null,fr=Nt()+500,ti(e,t)):Ks=k(e,t);e:do try{if(it!==0&&Ye!==null){t=Ye;var o=ha;t:switch(it){case 1:it=0,ha=null,ai(e,t,o,1);break;case 2:case 9:if(Of(o)){it=0,ha=null,bh(t);break}t=function(){it!==2&&it!==9||mt!==e||(it=7),Ha(e)},o.then(t,t);break e;case 3:it=7;break e;case 4:it=5;break e;case 7:Of(o)?(it=0,ha=null,bh(t)):(it=0,ha=null,ai(e,t,o,7));break;case 5:var f=null;switch(Ye.tag){case 26:f=Ye.memoizedState;case 5:case 27:var y=Ye;if(f?np(f):y.stateNode.complete){it=0,ha=null;var M=y.sibling;if(M!==null)Ye=M;else{var I=y.return;I!==null?(Ye=I,vr(I)):Ye=null}break t}}it=0,ha=null,ai(e,t,o,5);break;case 6:it=0,ha=null,ai(e,t,o,6);break;case 8:Zc(),jt=6;break e;default:throw Error(u(462))}}Y0();break}catch(ae){mh(e,ae)}while(!0);return Wa=ns=null,$.H=s,$.A=r,tt=n,Ye!==null?0:(mt=null,Ie=0,Rl(),jt)}function Y0(){for(;Ye!==null&&!Ge();)gh(Ye)}function gh(e){var t=Bm(e.alternate,e,un);e.memoizedProps=e.pendingProps,t===null?vr(e):Ye=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,Ie);break;case 11:t=Rm(n,t,t.pendingProps,t.type.render,t.ref,Ie);break;case 5:fc(t);default:Fm(n,t),t=Ye=vf(t,un),t=Bm(n,t,un)}e.memoizedProps=e.pendingProps,t===null?vr(e):Ye=t}function ai(e,t,n,s){Wa=ns=null,fc(t),Gs=null,ki=0;var r=t.return;try{if(D0(e,r,t,n,Ie)){jt=1,nr(e,Sa(n,e.current)),Ye=null;return}}catch(o){if(r!==null)throw Ye=r,o;jt=1,nr(e,Sa(n,e.current)),Ye=null;return}t.flags&32768?(Ze||s===1?e=!0:Ks||(Ie&536870912)!==0?e=!1:(wn=e=!0,(s===2||s===9||s===3||s===6)&&(s=fa.current,s!==null&&s.tag===13&&(s.flags|=16384))),yh(t,e)):vr(t)}function vr(e){var t=e;do{if((t.flags&32768)!==0){yh(t,wn);return}e=t.return;var n=L0(t.alternate,t,un);if(n!==null){Ye=n;return}if(t=t.sibling,t!==null){Ye=t;return}Ye=t=e}while(t!==null);jt===0&&(jt=5)}function yh(e,t){do{var n=q0(e.alternate,e);if(n!==null){n.flags&=32767,Ye=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ye=e;return}Ye=e=n}while(e!==null);jt=6,Ye=null}function xh(e,t,n,s,r,o,f,y,M){e.cancelPendingCommit=null;do gr();while(kt!==0);if((tt&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,ot(e,n,o,f,y,M),e===mt&&(Ye=mt=null,Ie=0),ei=t,Rn=e,dn=n,Xc=o,Ic=r,ch=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Z0(za,function(){return _h(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=$.T,$.T=null,r=se.p,se.p=2,f=tt,tt|=4;try{H0(e,t,n)}finally{tt=f,se.p=r,$.T=s}}kt=1,jh(),Sh(),Nh()}}function jh(){if(kt===1){kt=0;var e=Rn,t=ei,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=$.T,$.T=null;var s=se.p;se.p=2;var r=tt;tt|=4;try{th(t,e);var o=cu,f=rf(e.containerInfo),y=o.focusedElem,M=o.selectionRange;if(f!==y&&y&&y.ownerDocument&&lf(y.ownerDocument.documentElement,y)){if(M!==null&&Do(y)){var I=M.start,ae=M.end;if(ae===void 0&&(ae=I),"selectionStart"in y)y.selectionStart=I,y.selectionEnd=Math.min(ae,y.value.length);else{var le=y.ownerDocument||document,Z=le&&le.defaultView||window;if(Z.getSelection){var te=Z.getSelection(),Oe=y.textContent.length,Ue=Math.min(M.start,Oe),dt=M.end===void 0?Ue:Math.min(M.end,Oe);!te.extend&&Ue>dt&&(f=dt,dt=Ue,Ue=f);var V=sf(y,Ue),L=sf(y,dt);if(V&&L&&(te.rangeCount!==1||te.anchorNode!==V.node||te.anchorOffset!==V.offset||te.focusNode!==L.node||te.focusOffset!==L.offset)){var X=le.createRange();X.setStart(V.node,V.offset),te.removeAllRanges(),Ue>dt?(te.addRange(X),te.extend(L.node,L.offset)):(X.setEnd(L.node,L.offset),te.addRange(X))}}}}for(le=[],te=y;te=te.parentNode;)te.nodeType===1&&le.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;y<le.length;y++){var ie=le[y];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}zr=!!ou,cu=ou=null}finally{tt=r,se.p=s,$.T=n}}e.current=t,kt=2}}function Sh(){if(kt===2){kt=0;var e=Rn,t=ei,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=$.T,$.T=null;var s=se.p;se.p=2;var r=tt;tt|=4;try{Zm(e,t.alternate,t)}finally{tt=r,se.p=s,$.T=n}}kt=3}}function Nh(){if(kt===4||kt===3){kt=0,Tt();var e=Rn,t=ei,n=dn,s=ch;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?kt=5:(kt=0,ei=Rn=null,Ch(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Dn=null),Qn(n),t=t.stateNode,wt&&typeof wt.onCommitFiberRoot=="function")try{wt.onCommitFiberRoot(Zt,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=$.T,r=se.p,se.p=2,$.T=null;try{for(var o=e.onRecoverableError,f=0;f<s.length;f++){var y=s[f];o(y.value,{componentStack:y.stack})}}finally{$.T=t,se.p=r}}(dn&3)!==0&&gr(),Ha(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(kt!==5)return!1;var e=Rn,t=Xc;Xc=0;var n=Qn(dn),s=$.T,r=se.p;try{se.p=32>n?32:n,$.T=null,n=Ic,Ic=null;var o=Rn,f=dn;if(kt=0,ei=Rn=null,dn=0,(tt&6)!==0)throw Error(u(331));var y=tt;if(tt|=4,lh(o.current),nh(o,o.current,f,n),tt=y,Ji(0,!1),wt&&typeof wt.onPostCommitFiberRoot=="function")try{wt.onPostCommitFiberRoot(Zt,o)}catch{}return!0}finally{se.p=r,$.T=s,Ch(e,t)}}function Th(e,t,n){t=Sa(n,t),t=Oc(e.stateNode,t,2),e=En(e,t,2),e!==null&&(Je(e,2),Ha(e))}function lt(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"&&(Dn===null||!Dn.has(s))){e=Sa(n,e),n=Om(2),s=En(t,n,2),s!==null&&(Em(n,s,t,e),Je(s,2),Ha(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,mt===e&&(Ie&n)===n&&(jt===4||jt===3&&(Ie&62914560)===Ie&&300>Nt()-dr?(tt&2)===0&&ti(e,0):Gc|=n,Ws===Ie&&(Ws=0)),Ha(e)}function Oh(e,t){t===0&&(t=_e()),e=es(e,t),e!==null&&(Je(e,t),Ha(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 ze(e,t)}var br=null,ni=null,Wc=!1,yr=!1,eu=!1,Ln=0;function Ha(e){e!==ni&&e.next===null&&(ni===null?br=ni=e:ni=ni.next=e),yr=!0,Wc||(Wc=!0,K0())}function Ji(e,t){if(!eu&&yr){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,y=s.pingedLanes;o=(1<<31-Ke(42|e)+1)-1,o&=r&~(f&~y),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(n=!0,Ah(s,o))}else o=Ie,o=ye(s,s===mt?o:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(o&3)===0||k(s,o)||(n=!0,Ah(s,o));s=s.next}while(n);eu=!1}}function J0(){Eh()}function Eh(){yr=Wc=!1;var e=0;Ln!==0&&ob()&&(e=Ln);for(var t=Nt(),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)&&(yr=!0)),s=r}kt!==0&&kt!==5||Ji(e),Ln!==0&&(Ln=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-Ke(o),y=1<<f,M=r[f];M===-1?((y&n)===0||(y&s)!==0)&&(r[f]=ue(y,t)):M<=t&&(e.expiredLanes|=y),o&=~y}if(t=mt,n=Ie,n=ye(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(it===2||it===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&He(s),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||k(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&He(s),Qn(n)){case 2:case 8:n=Xa;break;case 32:n=za;break;case 268435456:n=Dt;break;default:n=za}return s=Mh.bind(null,e),n=ze(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&He(s),e.callbackPriority=2,e.callbackNode=null,2}function Mh(e,t){if(kt!==0&&kt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(gr()&&e.callbackNode!==n)return null;var s=Ie;return s=ye(e,e===mt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(dh(e,s,t),zh(e,Nt()),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(){(tt&6)!==0?ze(Ra,J0):Eh()})}function tu(){if(Ln===0){var e=$s;e===0&&(e=Te,Te<<=1,(Te&261888)===0&&(Te=256)),Ln=e}return Ln}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[ea]||null).action),f=s.submitter;f&&(t=(t=f[ea]||null)?wh(t.formAction):f.getAttribute("formAction"),t!==null&&(o=t,f=null));var y=new Al("action","action",null,s,r);e.push({event:y,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ln!==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"&&(y.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);Ma(eb,"on"+tb)}Ma(uf,"onAnimationEnd"),Ma(df,"onAnimationIteration"),Ma(ff,"onAnimationStart"),Ma("dblclick","onDoubleClick"),Ma("focusin","onFocus"),Ma("focusout","onBlur"),Ma(g0,"onTransitionRun"),Ma(b0,"onTransitionStart"),Ma(y0,"onTransitionCancel"),Ma(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 y=s[f],M=y.instance,I=y.currentTarget;if(y=y.listener,M!==o&&r.isPropagationStopped())break e;o=y,r.currentTarget=I;try{o(r)}catch(ae){Dl(ae)}r.currentTarget=null,o=M}else for(f=0;f<s.length;f++){if(y=s[f],M=y.instance,I=y.currentTarget,y=y.listener,M!==o&&r.isPropagationStopped())break e;o=y,r.currentTarget=I;try{o(r)}catch(ae){Dl(ae)}r.currentTarget=null,o=M}}}}function Xe(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 xr="_reactListening"+Math.random().toString(36).slice(2);function iu(e){if(!e[xr]){e[xr]=!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[xr]||(t[xr]=!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=xu}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 y=s.stateNode.containerInfo;if(y===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(;y!==null;){if(f=_s(y),f===null)return;if(M=f.tag,M===5||M===6||M===26||M===27){s=o=f;continue e}y=y.parentNode}}s=s.return}Hd(function(){var I=o,ae=No(n),le=[];e:{var Z=hf.get(e);if(Z!==void 0){var te=Al,Oe=e;switch(e){case"keypress":if(zl(n)===0)break e;case"keydown":case"keyup":te=Qg;break;case"focusin":Oe="focus",te=zo;break;case"focusout":Oe="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 Ue=(t&4)!==0,dt=!Ue&&(e==="scroll"||e==="scrollend"),V=Ue?Z!==null?Z+"Capture":null:Z;Ue=[];for(var L=I,X;L!==null;){var ie=L;if(X=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||X===null||V===null||(ie=xi(L,V),ie!=null&&Ue.push(Wi(L,ie,X))),dt)break;L=L.return}0<Ue.length&&(Z=new te(Z,Oe,null,n,ae),le.push({event:Z,listeners:Ue}))}}if((t&7)===0){e:{if(Z=e==="mouseover"||e==="pointerover",te=e==="mouseout"||e==="pointerout",Z&&n!==So&&(Oe=n.relatedTarget||n.fromElement)&&(_s(Oe)||Oe[Cs]))break e;if((te||Z)&&(Z=ae.window===ae?ae:(Z=ae.ownerDocument)?Z.defaultView||Z.parentWindow:window,te?(Oe=n.relatedTarget||n.toElement,te=I,Oe=Oe?_s(Oe):null,Oe!==null&&(dt=m(Oe),Ue=Oe.tag,Oe!==dt||Ue!==5&&Ue!==27&&Ue!==6)&&(Oe=null)):(te=null,Oe=I),te!==Oe)){if(Ue=$d,ie="onMouseLeave",V="onMouseEnter",L="mouse",(e==="pointerout"||e==="pointerover")&&(Ue=Pd,ie="onPointerLeave",V="onPointerEnter",L="pointer"),dt=te==null?Z:yi(te),X=Oe==null?Z:yi(Oe),Z=new Ue(ie,L+"leave",te,n,ae),Z.target=dt,Z.relatedTarget=X,ie=null,_s(ae)===I&&(Ue=new Ue(V,L+"enter",Oe,n,ae),Ue.target=X,Ue.relatedTarget=dt,ie=Ue),dt=ie,te&&Oe)t:{for(Ue=nb,V=te,L=Oe,X=0,ie=V;ie;ie=Ue(ie))X++;ie=0;for(var we=L;we;we=Ue(we))ie++;for(;0<X-ie;)V=Ue(V),X--;for(;0<ie-X;)L=Ue(L),ie--;for(;X--;){if(V===L||L!==null&&V===L.alternate){Ue=V;break t}V=Ue(V),L=Ue(L)}Ue=null}else Ue=null;te!==null&&Uh(le,Z,te,Ue,!1),Oe!==null&&dt!==null&&Uh(le,dt,Oe,Ue,!0)}}e:{if(Z=I?yi(I):window,te=Z.nodeName&&Z.nodeName.toLowerCase(),te==="select"||te==="input"&&Z.type==="file")var We=Kd;else if(Zd(Z))if(Wd)We=h0;else{We=f0;var Me=d0}else te=Z.nodeName,!te||te.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?I&&jo(I.elementType)&&(We=Kd):We=m0;if(We&&(We=We(e,I))){Jd(le,We,n,ae);break e}Me&&Me(e,Z,I),e==="focusout"&&I&&Z.type==="number"&&I.memoizedProps.value!=null&&xo(Z,"number",Z.value)}switch(Me=I?yi(I):window,e){case"focusin":(Zd(Me)||Me.contentEditable==="true")&&(Ds=Me,Ro=I,Ei=null);break;case"focusout":Ei=Ro=Ds=null;break;case"mousedown":Uo=!0;break;case"contextmenu":case"mouseup":case"dragend":Uo=!1,of(le,n,ae);break;case"selectionchange":if(v0)break;case"keydown":case"keyup":of(le,n,ae)}var Fe;if(Ao)e:{switch(e){case"compositionstart":var Qe="onCompositionStart";break e;case"compositionend":Qe="onCompositionEnd";break e;case"compositionupdate":Qe="onCompositionUpdate";break e}Qe=void 0}else ks?Id(e,n)&&(Qe="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Qe="onCompositionStart");Qe&&(Gd&&n.locale!=="ko"&&(ks||Qe!=="onCompositionStart"?Qe==="onCompositionEnd"&&ks&&(Fe=Vd()):(jn=ae,To="value"in jn?jn.value:jn.textContent,ks=!0)),Me=jr(I,Qe),0<Me.length&&(Qe=new Fd(Qe,e,null,n,ae),le.push({event:Qe,listeners:Me}),Fe?Qe.data=Fe:(Fe=Qd(n),Fe!==null&&(Qe.data=Fe)))),(Fe=l0?r0(e,n):o0(e,n))&&(Qe=jr(I,"onBeforeInput"),0<Qe.length&&(Me=new Fd("onBeforeInput","beforeinput",null,n,ae),le.push({event:Me,listeners:Qe}),Me.data=Fe)),W0(le,e,I,n,ae)}Dh(le,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=xi(e,n),r!=null&&s.unshift(Wi(e,r,o)),r=xi(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 y=n,M=y.alternate,I=y.stateNode;if(y=y.tag,M!==null&&M===s)break;y!==5&&y!==26&&y!==27||I===null||(M=I,r?(I=xi(n,o),I!=null&&f.unshift(Wi(n,I,M))):r||(I=xi(n,o),I!=null&&f.push(Wi(n,I,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 ut(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"&&ut(e,t,"name",r.name,r,null),ut(e,t,"formEncType",r.formEncType,r,null),ut(e,t,"formMethod",r.formMethod,r,null),ut(e,t,"formTarget",r.formTarget,r,null)):(ut(e,t,"encType",r.encType,r,null),ut(e,t,"method",r.method,r,null),ut(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=Qa);break;case"onScroll":s!=null&&Xe("scroll",e);break;case"onScrollEnd":s!=null&&Xe("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":Xe("beforetoggle",e),Xe("toggle",e),Cl(e,"popover",s);break;case"xlinkActuate":Ia(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Ia(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Ia(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Ia(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Ia(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Ia(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Ia(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Ia(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Ia(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&&Xe("scroll",e);break;case"onScrollEnd":s!=null&&Xe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Qa);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[ea]||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 $t(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Xe("error",e),Xe("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:ut(e,t,o,f,n,null)}}r&&ut(e,t,"srcSet",n.srcSet,n,null),s&&ut(e,t,"src",n.src,n,null);return;case"input":Xe("invalid",e);var y=o=f=r=null,M=null,I=null;for(s in n)if(n.hasOwnProperty(s)){var ae=n[s];if(ae!=null)switch(s){case"name":r=ae;break;case"type":f=ae;break;case"checked":M=ae;break;case"defaultChecked":I=ae;break;case"value":o=ae;break;case"defaultValue":y=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(u(137,t));break;default:ut(e,t,s,ae,n,null)}}kd(e,o,y,M,I,f,r,!1);return;case"select":Xe("invalid",e),s=f=o=null;for(r in n)if(n.hasOwnProperty(r)&&(y=n[r],y!=null))switch(r){case"value":o=y;break;case"defaultValue":f=y;break;case"multiple":s=y;default:ut(e,t,r,y,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":Xe("invalid",e),o=r=s=null;for(f in n)if(n.hasOwnProperty(f)&&(y=n[f],y!=null))switch(f){case"value":s=y;break;case"defaultValue":r=y;break;case"children":o=y;break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(u(91));break;default:ut(e,t,f,y,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:ut(e,t,M,s,n,null)}return;case"dialog":Xe("beforetoggle",e),Xe("toggle",e),Xe("cancel",e),Xe("close",e);break;case"iframe":case"object":Xe("load",e);break;case"video":case"audio":for(s=0;s<Ki.length;s++)Xe(Ki[s],e);break;case"image":Xe("error",e),Xe("load",e);break;case"details":Xe("toggle",e);break;case"embed":case"source":case"link":Xe("error",e),Xe("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(I in n)if(n.hasOwnProperty(I)&&(s=n[I],s!=null))switch(I){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:ut(e,t,I,s,n,null)}return;default:if(jo(t)){for(ae in n)n.hasOwnProperty(ae)&&(s=n[ae],s!==void 0&&ru(e,t,ae,s,n,void 0));return}}for(y in n)n.hasOwnProperty(y)&&(s=n[y],s!=null&&ut(e,t,y,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,y=null,M=null,I=null,ae=null;for(te in n){var le=n[te];if(n.hasOwnProperty(te)&&le!=null)switch(te){case"checked":break;case"value":break;case"defaultValue":M=le;default:s.hasOwnProperty(te)||ut(e,t,te,null,s,le)}}for(var Z in s){var te=s[Z];if(le=n[Z],s.hasOwnProperty(Z)&&(te!=null||le!=null))switch(Z){case"type":o=te;break;case"name":r=te;break;case"checked":I=te;break;case"defaultChecked":ae=te;break;case"value":f=te;break;case"defaultValue":y=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(u(137,t));break;default:te!==le&&ut(e,t,Z,te,s,le)}}yo(e,f,y,M,I,ae,o,r);return;case"select":te=f=y=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)||ut(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":y=o;break;case"multiple":f=o;default:o!==M&&ut(e,t,r,o,s,M)}t=y,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(y in n)if(r=n[y],n.hasOwnProperty(y)&&r!=null&&!s.hasOwnProperty(y))switch(y){case"value":break;case"children":break;default:ut(e,t,y,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&&ut(e,t,f,r,s,o)}Dd(e,Z,te);return;case"option":for(var Oe in n)if(Z=n[Oe],n.hasOwnProperty(Oe)&&Z!=null&&!s.hasOwnProperty(Oe))switch(Oe){case"selected":e.selected=!1;break;default:ut(e,t,Oe,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:ut(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 Ue in n)Z=n[Ue],n.hasOwnProperty(Ue)&&Z!=null&&!s.hasOwnProperty(Ue)&&ut(e,t,Ue,null,s,Z);for(I in s)if(Z=s[I],te=n[I],s.hasOwnProperty(I)&&Z!==te&&(Z!=null||te!=null))switch(I){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(u(137,t));break;default:ut(e,t,I,Z,s,te)}return;default:if(jo(t)){for(var dt in n)Z=n[dt],n.hasOwnProperty(dt)&&Z!==void 0&&!s.hasOwnProperty(dt)&&ru(e,t,dt,void 0,s,Z);for(ae in s)Z=s[ae],te=n[ae],!s.hasOwnProperty(ae)||Z===te||Z===void 0&&te===void 0||ru(e,t,ae,Z,s,te);return}}for(var V in n)Z=n[V],n.hasOwnProperty(V)&&Z!=null&&!s.hasOwnProperty(V)&&ut(e,t,V,null,s,Z);for(le in s)Z=s[le],te=n[le],!s.hasOwnProperty(le)||Z===te||Z==null&&te==null||ut(e,t,le,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,y=r.duration;if(o&&y&&Hh(f)){for(f=0,y=r.responseEnd,s+=1;s<n.length;s++){var M=n[s],I=M.startTime;if(I>y)break;var ae=M.transferSize,le=M.initiatorType;ae&&Hh(le)&&(M=M.responseEnd,f+=ae*(M<y?1:(y-I)/(M-I)))}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 qn(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,y=o.nodeName;o[bi]||y==="SCRIPT"||y==="STYLE"||y==="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=Oa(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=Oa(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=Oa(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 Oa(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 Oa(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 Ea=new Map,Zh=new Set;function Nr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var fn=se.d;se.d={f:pb,r:vb,D:gb,C:bb,L:yb,m:xb,X:Sb,S:jb,M:Nb};function pb(){var e=fn.f(),t=hr();return e||t}function vb(e){var t=Ts(e);t!==null&&t.tag===5&&t.type==="form"?mm(t):fn.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=xa(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"),$t(t,"link",e),Rt(t),s.head.appendChild(t)))}}function gb(e){fn.D(e),Jh("dns-prefetch",e,null)}function bb(e,t){fn.C(e,t),Jh("preconnect",e,t)}function yb(e,t,n){fn.L(e,t,n);var s=si;if(s&&e&&t){var r='link[rel="preload"][as="'+xa(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+xa(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+xa(n.imageSizes)+'"]')):r+='[href="'+xa(e)+'"]';var o=r;switch(t){case"style":o=ii(e);break;case"script":o=li(e)}Ea.has(o)||(e=_({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Ea.set(o,e),s.querySelector(r)!==null||t==="style"&&s.querySelector(tl(o))||t==="script"&&s.querySelector(al(o))||(t=s.createElement("link"),$t(t,"link",e),Rt(t),s.head.appendChild(t)))}}function xb(e,t){fn.m(e,t);var n=si;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+xa(s)+'"][href="'+xa(e)+'"]',o=r;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=li(e)}if(!Ea.has(o)&&(e=_({rel:"modulepreload",href:e},t),Ea.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"),$t(s,"link",e),Rt(s),n.head.appendChild(s)}}}function jb(e,t,n){fn.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 y={loading:0,preload:null};if(f=s.querySelector(tl(o)))y.loading=5;else{e=_({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Ea.get(o))&&vu(e,n);var M=f=s.createElement("link");Rt(M),$t(M,"link",e),M._p=new Promise(function(I,ae){M.onload=I,M.onerror=ae}),M.addEventListener("load",function(){y.loading|=1}),M.addEventListener("error",function(){y.loading|=2}),y.loading|=4,Cr(f,t,s)}f={type:"stylesheet",instance:f,count:1,state:y},r.set(o,f)}}}function Sb(e,t){fn.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=_({src:e,async:!0},t),(t=Ea.get(r))&&gu(e,t),o=n.createElement("script"),Rt(o),$t(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},s.set(r,o))}}function Nb(e,t){fn.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=_({src:e,async:!0,type:"module"},t),(t=Ea.get(r))&&gu(e,t),o=n.createElement("script"),Rt(o),$t(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=pe.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),Ea.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},Ea.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="'+xa(e)+'"'}function tl(e){return'link[rel="stylesheet"]['+e+"]"}function Wh(e){return _({},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}),$t(t,"link",n),Rt(t),e.head.appendChild(t))}function li(e){return'[src="'+xa(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~="'+xa(n.href)+'"]');if(s)return t.instance=s,Rt(s),s;var r=_({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Rt(s),$t(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,Rt(o),o;s=Wh(n),(r=Ea.get(r))&&vu(s,r),o=(e.ownerDocument||e).createElement("link"),Rt(o);var f=o;return f._p=new Promise(function(y,M){f.onload=y,f.onerror=M}),$t(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,Rt(r),r):(s=n,(r=Ea.get(o))&&(s=_({},n),gu(s,r)),e=e.ownerDocument||e,r=e.createElement("script"),Rt(r),$t(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 y=s[f];if(y.dataset.precedence===t)o=y;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[qt]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var f=o.getAttribute(t)||"";f=e+f;var y=s.get(f);y?y.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,Rt(o);return}o=t.ownerDocument||t,s=Wh(s),(r=Ea.get(r))&&vu(s,r),o=o.createElement("link"),Rt(o);var f=o;f._p=new Promise(function(y,M){f.onload=y,f.onerror=M}),$t(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:z,Provider:null,Consumer:null,_currentValue:ve,_currentValue2:ve,_threadCount:0};function zb(e,t,n,s,r,o,f,y,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=Ae(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ae(0),this.hiddenUpdates=Ae(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,y,M,I,ae,le){return e=new zb(e,t,n,f,M,I,ae,le,y),t=1,o===!0&&(t|=24),o=da(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=On(t),s.payload={element:n},o=o===void 0?null:o,o!==null&&(s.callback=o),n=En(e,s,t),n!==null&&(la(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 yu(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&&la(t,e,67108864),yu(e,67108864)}}function cp(e){if(e.tag===13||e.tag===31){var t=va();t=Ns(t);var n=es(e,t);n!==null&&la(n,e,t),yu(e,t)}}var zr=!0;function Mb(e,t,n,s){var r=$.T;$.T=null;var o=se.p;try{se.p=2,xu(e,t,n,s)}finally{se.p=o,$.T=r}}function Ab(e,t,n,s){var r=$.T;$.T=null;var o=se.p;try{se.p=8,xu(e,t,n,s)}finally{se.p=o,$.T=r}}function xu(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=F(o.pendingLanes);if(f!==0){var y=o;for(y.pendingLanes|=2,y.entangledLanes|=2;f;){var M=1<<31-Ke(f);y.entanglements[1]|=M,f&=~M}Ha(o),(tt&6)===0&&(fr=Nt()+500,Ji(0))}}break;case 31:case 13:y=es(o,2),y!==null&&la(y,o,2),hr(),yu(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=x(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(Ya()){case Ra:return 2;case Xa:return 8;case za:case Xn:return 32;case Dt:return 268435456;default:return 32}default:return 32}}var Nu=!1,Hn=null,Vn=null,Bn=null,sl=new Map,il=new Map,$n=[],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":Hn=null;break;case"dragenter":case"dragleave":Vn=null;break;case"mouseover":case"mouseout":Bn=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 Hn=ll(Hn,e,t,n,s,r),!0;case"dragenter":return Vn=ll(Vn,e,t,n,s,r),!0;case"mouseover":return Bn=ll(Bn,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=x(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,Hn!==null&&Ar(Hn)&&(Hn=null),Vn!==null&&Ar(Vn)&&(Vn=null),Bn!==null&&Ar(Bn)&&(Bn=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)}Hn!==null&&wr(Hn,e),Vn!==null&&wr(Vn,e),Bn!==null&&wr(Bn,e),sl.forEach(t),il.forEach(t);for(var n=0;n<$n.length;n++){var s=$n[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<$n.length&&(n=$n[0],n.blockedOn===null);)fp(n),n.blockedOn===null&&$n.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[ea]||null;if(typeof o=="function")f||hp(n);else if(f){var y=null;if(o&&o.hasAttribute("formAction")){if(r=o,f=o[ea]||null)y=f.formAction;else if(Su(r)!==null)continue}else y=f.action;typeof y=="function"?n[s+1]=y:(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=va();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<$n.length&&t!==0&&t<$n[n].priority;n++);$n.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"));se.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:$,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Rr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Rr.isDisabled&&Rr.supportsFiber)try{Zt=Rr.inject(Rb),wt=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,y=_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&&(y=n.onRecoverableError),n.formState!==void 0&&(M=n.formState)),t=sp(e,1,!0,t,n??null,s,r,M,o,f,y,pp),t.context=ip(null),n=t.current,s=va(),s=Ns(s),r=On(s),r.callback=null,En(n,r,s),n=s,t.current.lanes=n,Je(t,n),Ha(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:"https://colchonesdisai.com/app_torti/api_torti/api.php",sucursal:"",caja:""},Pe={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=()=>Pe.getApiUrl(),yv=g.createContext();function Ib({children:i}){const[l,d]=g.useState(null),[u,c]=g.useState([]),[m,v]=g.useState(!0),[x,h]=g.useState(!1);g.useEffect(()=>{localStorage.removeItem("pos_torti_user"),v(!1)},[]);const D={user:l,permisos:u,loading:m,isAuthenticated:x,login:async(b,T)=>{try{const H=await(await fetch(zp(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"login",username:b,password:T})})).json();if(H.success){const z=H.data;return d(z),c(z.permisos||[]),h(!0),{success:!0,message:"Login exitoso"}}else return{success:!1,message:H.message}}catch(N){return console.error("Error en login:",N),{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 T=`ver_${b}`;return u.includes(T)},cambiarPassword:async(b,T)=>{if(!l)return{success:!1,message:"Usuario no autenticado"};try{const H=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:T})})).json();return{success:H.success,message:H.message}}catch(N){return console.error("Error al cambiar password:",N),{success:!1,message:"Error de conexion"}}}};return a.jsx(yv.Provider,{value:D,children:i})}function Ga(){const i=g.useContext(yv);if(!i)throw new Error("useAuth debe usarse dentro de AuthProvider");return i}const Mp=()=>Pe.getApiUrl(),xv=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),[x,h]=g.useState(!1),[p,S]=g.useState(Zb().intervalo),[_,R]=g.useState([]),U=g.useRef(null),D=g.useRef(null),b=g.useCallback(C=>{R(P=>[C,...P].slice(0,Qb))},[]),T=g.useCallback(async()=>{try{const P=await(await fetch(Mp(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"estadoSync"})})).json();P.success&&(d(P.data),h(!1))}catch{d(P=>({...P,conectada:!1})),h(!0)}},[]),N=g.useCallback(async(C=!1)=>{var w;if(u)return{success:!1,message:"Ya se está sincronizando"};c(!0),h(!1);const P=Date.now();try{const de=await(await fetch(Mp(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"sincronizar"})})).json(),J=((Date.now()-P)/1e3).toFixed(1);return de.success?(v(new Date),await T(),b({fecha:new Date,exito:!0,mensaje:de.message,stats:((w=de.data)==null?void 0:w.stats)||null,duracion:J,tipo:C?"manual":"auto"}),{success:!0,message:de.message}):(h(!0),b({fecha:new Date,exito:!1,mensaje:de.message,stats:null,duracion:J,tipo:C?"manual":"auto"}),{success:!1,message:de.message})}catch{const de=((Date.now()-P)/1e3).toFixed(1);return h(!0),b({fecha:new Date,exito:!1,mensaje:"Error de conexión al sincronizar",stats:null,duracion:de,tipo:C?"manual":"auto"}),{success:!1,message:"Error de conexión al sincronizar"}}finally{c(!1)}},[u,T,b]);g.useEffect(()=>{D.current=N},[N]);const H=g.useCallback(C=>{S(C),Jb({intervalo:C})},[]);g.useEffect(()=>{T()},[T]),g.useEffect(()=>{var C;return U.current&&(clearInterval(U.current),U.current=null),l.activa&&p>0&&(m||(C=D.current)==null||C.call(D,!1),U.current=setInterval(()=>{var P;(P=D.current)==null||P.call(D,!1)},p*60*1e3)),()=>{U.current&&clearInterval(U.current)}},[l.activa,p]);const z=g.useCallback(()=>{R([])},[]),j={syncStatus:l,sincronizando:u,ultimaSync:m,syncError:x,intervalo:p,logs:_,ejecutarSync:N,cargarEstadoSync:T,setIntervalo:H,limpiarLogs:z};return a.jsx(xv.Provider,{value:j,children:i})}function dd(){const i=g.useContext(xv);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 ey={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 ty=g.forwardRef(({color:i="currentColor",size:l=24,strokeWidth:d=2,absoluteStrokeWidth:u,className:c="",children:m,iconNode:v,...x},h)=>g.createElement("svg",{ref:h,...ey,width:l,height:l,stroke:i,strokeWidth:u?Number(d)*24/Number(l):d,className:Sv("lucide",c),...x},[...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 Ee=(i,l)=>{const d=g.forwardRef(({className:u,...c},m)=>g.createElement(ty,{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 ay=[["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=Ee("Activity",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 ny=[["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=Ee("ArrowLeftRight",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 sy=[["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"}]],iy=Ee("Calculator",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:"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=Ee("Calendar",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=[["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"}]],oy=Ee("ChartColumn",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 cy=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Gn=Ee("Check",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 uy=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Cv=Ee("ChevronDown",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 dy=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],fy=Ee("ChevronLeft",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 my=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_v=Ee("ChevronRight",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:"m18 15-6-6-6 6",key:"153udz"}]],py=Ee("ChevronUp",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 vy=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],mn=Ee("CircleCheckBig",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:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],Ur=Ee("CirclePlus",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 by=[["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=Ee("CircleX",by);/**
 * @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 yy=[["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=Ee("ClipboardList",yy);/**
 * @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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],bs=Ee("Clock",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=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Sy=Ee("CreditCard",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=[["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"}]],Cy=Ee("Database",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 _y=[["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"}]],Ty=Ee("Delete",_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 Oy=[["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=Ee("DollarSign",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:"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=Ee("EyeOff",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 zy=[["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"}]],ys=Ee("Eye",zy);/**
 * @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:"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=Ee("Factory",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 Ay=[["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=Ee("FileText",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 wy=[["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=Ee("FolderOpen",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:"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"}]],Dy=Ee("Funnel",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 Ry=[["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=Ee("Leaf",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 Uy=[["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"}]],Ly=Ee("Lock",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 qy=[["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"}]],Hy=Ee("LogOut",qy);/**
 * @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:"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"}]],By=Ee("MapPin",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 $y=[["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"}]],Fy=Ee("Menu",$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 Py=[["path",{d:"M5 12h14",key:"1ays0h"}]],Gy=Ee("Minus",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 Yy=[["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"}]],Xy=Ee("Monitor",Yy);/**
 * @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 Iy=[["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"}]],Gt=Ee("Package",Iy);/**
 * @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 Qy=[["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"}]],Zy=Ee("Pause",Qy);/**
 * @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:"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"}]],xs=Ee("Pen",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 Ky=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],Wy=Ee("Play",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 ex=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ra=Ee("Plus",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 tx=[["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"}]],ka=Ee("RefreshCw",tx);/**
 * @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:"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"}]],nx=Ee("RotateCcw",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 sx=[["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"}]],ix=Ee("Save",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:"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=Ee("Scale",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=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],ba=Ee("Search",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 ox=[["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"}]],cx=Ee("Send",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 ux=[["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"}]],dx=Ee("Server",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 fx=[["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=Ee("Settings",fx);/**
 * @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:"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=Ee("Shield",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:"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=Ee("ShoppingBag",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 px=[["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=Ee("ShoppingCart",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 vx=[["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=Ee("Store",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:"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"}]],bx=Ee("Sun",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 yx=[["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"}]],xx=Ee("Tag",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=[["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"}]],Sx=Ee("Tags",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=[["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=Ee("Target",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 Cx=[["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"}]],Qt=Ee("Trash2",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 _x=[["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=Ee("TrendingDown",_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 Tx=[["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=Ee("TrendingUp",Tx);/**
 * @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=[["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=Ee("TriangleAlert",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:"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"}]],zx=Ee("Truck",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 Mx=[["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"}]],Ax=Ee("UserCog",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 wx=[["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=Ee("User",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:"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=Ee("Users",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 Dx=[["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"}]],yl=Ee("Wheat",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 Rx=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],rt=Ee("X",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=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Lx=Ee("Zap",Ux),qx=[{icon:Ov,label:"Ventas",id:"ventas",permiso:"ver_ventas"},{icon:Qu,label:"Catalogos",id:"_catalogos",group:!0,children:[{icon:Gt,label:"Productos",id:"productos",permiso:"ver_productos"},{icon:Sx,label:"Categorias",id:"categorias",permiso:"ver_categorias"},{icon:yl,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:oy,label:"Reportes",id:"_reportes",group:!0,children:[{icon:mi,label:"Reporte Producciones",id:"reporte_producciones",permiso:"ver_reporte_producciones"},{icon:Gt,label:"Rastreo Inventario",id:"rastreo_inventario",permiso:"ver_reportes"}]},{icon:Kr,label:"Administracion",id:"_admin",group:!0,children:[{icon:Ax,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 Hx({isOpen:i,setIsOpen:l,activeMenu:d,setActiveMenu:u}){const{user:c,permisos:m,logout:v,tienePermiso:x}=Ga(),[h,p]=g.useState({}),S=U=>{p(D=>({...D,[U]:!D[U]}))},_=U=>U.some(D=>D.id===d),R=()=>{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(rt,{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:qx.map(U=>{if(U.group){const D=U.children.filter(T=>x(T.permiso));if(D.length===0)return null;const b=h[U.id]||_(U.children);return a.jsxs("div",{className:"sidebar-group",children:[a.jsxs("button",{className:`sidebar-item sidebar-group-toggle ${b?"group-open":""}`,onClick:()=>S(U.id),children:[a.jsx(U.icon,{size:20}),a.jsx("span",{children:U.label}),a.jsx(Cv,{size:16,className:`sidebar-chevron ${b?"rotated":""}`})]}),a.jsx("div",{className:`sidebar-group-children ${b?"expanded":""}`,children:D.map(T=>a.jsxs("button",{className:`sidebar-item sidebar-child ${d===T.id?"active":""}`,onClick:()=>{u(T.id),l(!1)},children:[a.jsx(T.icon,{size:16}),a.jsx("span",{children:T.label})]},T.id))})]},U.id)}return x(U.permiso)?a.jsxs("button",{className:`sidebar-item ${d===U.id?"active":""}`,onClick:()=>{u(U.id),l(!1)},children:[a.jsx(U.icon,{size:20}),a.jsx("span",{children:U.label})]},U.id):null})}),a.jsx("div",{className:"sidebar-footer",children:a.jsxs("button",{className:"sidebar-item logout",onClick:R,children:[a.jsx(Hy,{size:20}),a.jsx("span",{children:"Cerrar Sesion"})]})})]})]})}function Vx({onClick:i}){return a.jsx("button",{className:"menu-button",onClick:i,children:a.jsx(Fy,{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 gs(){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 Bx(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))}Bx(`: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 xl=i=>typeof i=="number"&&!isNaN(i),js=i=>typeof i=="string",pn=i=>typeof i=="function",$x=i=>js(i)||xl(i),Ku=i=>js(i)||pn(i)?i:null,Fx=(i,l)=>i===!1||xl(i)&&i>0?i:l,Wu=i=>g.isValidElement(i)||js(i)||pn(i)||xl(i);function Px(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 Gx({enter:i,exit:l,appendPosition:d=!1,collapse:u=!0,collapseDuration:c=300}){return function({children:m,position:v,preventExitTransition:x,done:h,nodeRef:p,isIn:S,playToast:_}){let R=d?`${i}--${v}`:i,U=d?`${l}--${v}`:l,D=g.useRef(0);return g.useLayoutEffect(()=>{let b=p.current,T=R.split(" "),N=H=>{H.target===p.current&&(_(),b.removeEventListener("animationend",N),b.removeEventListener("animationcancel",N),D.current===0&&H.type!=="animationcancel"&&b.classList.remove(...T))};b.classList.add(...T),b.addEventListener("animationend",N),b.addEventListener("animationcancel",N)},[]),g.useEffect(()=>{let b=p.current,T=()=>{b.removeEventListener("animationend",T),u?Px(b,h,c):h()};S||(x?T():(D.current=1,b.className+=` ${U}`,b.addEventListener("animationend",T)))},[S]),ht.createElement(ht.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}):pn(i)?i({closeToast:l.closeToast,toastProps:l,data:l.data,isPaused:d}):i}function Yx({closeToast:i,theme:l,ariaLabel:d="close"}){return ht.createElement("button",{className:`Toastify__close-button Toastify__close-button--${l}`,type:"button",onClick:u=>{u.stopPropagation(),i(!0)},"aria-label":d},ht.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},ht.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 Xx({delay:i,isRunning:l,closeToast:d,type:u="default",hide:c,className:m,controlledProgress:v,progress:x,rtl:h,isIn:p,theme:S}){let _=c||v&&x===0,R={animationDuration:`${i}ms`,animationPlayState:l?"running":"paused"};v&&(R.transform=`scaleX(${x})`);let U=gs("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}),D=pn(m)?m({rtl:h,type:u,defaultClassName:U}):gs(U,m),b={[v&&x>=1?"onTransitionEnd":"onAnimationEnd"]:v&&x<1?null:()=>{p&&d()}};return ht.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":_},ht.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${S} Toastify__progress-bar--${u}`}),ht.createElement("div",{role:"progressbar","aria-hidden":_?"true":"false","aria-label":"notification timer",className:D,style:R,...b}))}var Ix=1,kv=()=>`${Ix++}`;function Qx(i,l,d){let u=1,c=0,m=[],v=[],x=l,h=new Map,p=new Set,S=H=>(p.add(H),()=>p.delete(H)),_=()=>{v=Array.from(h.values()),p.forEach(H=>H())},R=({containerId:H,toastId:z,updateId:j})=>{let C=H?H!==i:i!==1,P=h.has(z)&&j==null;return C||P},U=(H,z)=>{h.forEach(j=>{var C;(z==null||z===j.props.toastId)&&((C=j.toggle)==null||C.call(j,H))})},D=H=>{var z,j;(j=(z=H.props)==null?void 0:z.onClose)==null||j.call(z,H.removalReason),H.isActive=!1},b=H=>{if(H==null)h.forEach(D);else{let z=h.get(H);z&&D(z)}_()},T=()=>{c-=m.length,m=[]},N=H=>{var z,j;let{toastId:C,updateId:P}=H.props,w=P==null;H.staleId&&h.delete(H.staleId),H.isActive=!0,h.set(C,H),_(),d(Rp(H,w?"added":"updated")),w&&((j=(z=H.props).onOpen)==null||j.call(z))};return{id:i,props:x,observe:S,toggle:U,removeToast:b,toasts:h,clearQueue:T,buildToast:(H,z)=>{if(R(z))return;let{toastId:j,updateId:C,data:P,staleId:w,delay:W}=z,de=C==null;de&&c++;let J={...x,style:x.toastStyle,key:u++,...Object.fromEntries(Object.entries(z).filter(([Y,re])=>re!=null)),toastId:j,updateId:C,data:P,isIn:!1,className:Ku(z.className||x.toastClassName),progressClassName:Ku(z.progressClassName||x.progressClassName),autoClose:z.isLoading?!1:Fx(z.autoClose,x.autoClose),closeToast(Y){h.get(j).removalReason=Y,b(j)},deleteToast(){let Y=h.get(j);if(Y!=null){if(d(Rp(Y,"removed")),h.delete(j),c--,c<0&&(c=0),m.length>0){N(m.shift());return}_()}}};J.closeButton=x.closeButton,z.closeButton===!1||Wu(z.closeButton)?J.closeButton=z.closeButton:z.closeButton===!0&&(J.closeButton=Wu(x.closeButton)?x.closeButton:!0);let G={content:H,props:J,staleId:w};x.limit&&x.limit>0&&c>x.limit&&de?m.push(G):xl(W)?setTimeout(()=>{N(G)},W):N(G)},setProps(H){x=H},setToggle:(H,z)=>{let j=h.get(H);j&&(j.toggle=z)},isToastActive:H=>{var z;return(z=h.get(H))==null?void 0:z.isActive},getSnapshot:()=>v}}var Wt=new Map,pl=[],ed=new Set,Zx=i=>ed.forEach(l=>l(i)),Dv=()=>Wt.size>0;function Jx(){pl.forEach(i=>Uv(i.content,i.options)),pl=[]}var Kx=(i,{containerId:l})=>{var d;return(d=Wt.get(l||1))==null?void 0:d.toasts.get(i)};function Rv(i,l){var d;if(l)return!!((d=Wt.get(l))!=null&&d.isToastActive(i));let u=!1;return Wt.forEach(c=>{c.isToastActive(i)&&(u=!0)}),u}function Wx(i){if(!Dv()){pl=pl.filter(l=>i!=null&&l.options.toastId!==i);return}if(i==null||$x(i))Wt.forEach(l=>{l.removeToast(i)});else if(i&&("containerId"in i||"id"in i)){let l=Wt.get(i.containerId);l?l.removeToast(i.id):Wt.forEach(d=>{d.removeToast(i.id)})}}var e1=(i={})=>{Wt.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}),Wt.forEach(d=>{d.buildToast(i,l)}))}function t1(i){var l;(l=Wt.get(i.containerId||1))==null||l.setToggle(i.id,i.fn)}function Lv(i,l){Wt.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 a1(i){let l=i.containerId||1;return{subscribe(d){let u=Qx(l,i,Zx);Wt.set(l,u);let c=u.observe(d);return Jx(),()=>{c(),Wt.delete(l)}},setProps(d){var u;(u=Wt.get(l))==null||u.setProps(d)},getSnapshot(){var d;return(d=Wt.get(l))==null?void 0:d.getSnapshot()}}}function n1(i){return ed.add(i),()=>{ed.delete(i)}}function s1(i){return i&&(js(i.toastId)||xl(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:s1(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 i1(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},x=(p,S,_)=>{if(S==null){A.dismiss(m);return}let R={type:p,...v,...c,data:_},U=js(S)?{render:S}:S;return m?A.update(m,{...R,...U}):A(U.render,{...R,...U}),_},h=pn(i)?i():i;return h.then(p=>x("success",u,p)).catch(p=>x("error",d,p)),h}A.promise=i1;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 l1(i){Wx(i)}A.dismiss=l1;A.clearWaitingQueue=e1;A.isActive=Rv;A.update=(i,l={})=>{let d=Kx(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=n1;A.play=i=>Lv(!0,i);A.pause=i=>Lv(!1,i);function r1(i){var l;let{subscribe:d,getSnapshot:u,setProps:c}=g.useRef(a1(i)).current;c(i);let m=(l=g.useSyncExternalStore(d,u,u))==null?void 0:l.slice();function v(x){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=>x(p[0],p[1]))}return{getToastToRender:v,isToastActive:Rv,count:m==null?void 0:m.length}}function o1(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:x,pauseOnHover:h,closeToast:p,onClick:S,closeOnClick:_}=i;t1({id:i.toastId,containerId:i.containerId,fn:d}),g.useEffect(()=>{if(i.pauseOnFocusLoss)return R(),()=>{U()}},[i.pauseOnFocusLoss]);function R(){document.hasFocus()||N(),window.addEventListener("focus",T),window.addEventListener("blur",N)}function U(){window.removeEventListener("focus",T),window.removeEventListener("blur",N)}function D(w){if(i.draggable===!0||i.draggable===w.pointerType){H();let W=m.current;v.canCloseOnClick=!0,v.canDrag=!0,W.style.transition="none",i.draggableDirection==="x"?(v.start=w.clientX,v.removalDistance=W.offsetWidth*(i.draggablePercent/100)):(v.start=w.clientY,v.removalDistance=W.offsetHeight*(i.draggablePercent===80?i.draggablePercent*1.5:i.draggablePercent)/100)}}function b(w){let{top:W,bottom:de,left:J,right:G}=m.current.getBoundingClientRect();w.nativeEvent.type!=="touchend"&&i.pauseOnHover&&w.clientX>=J&&w.clientX<=G&&w.clientY>=W&&w.clientY<=de?N():T()}function T(){d(!0)}function N(){d(!1)}function H(){v.didMove=!1,document.addEventListener("pointermove",j),document.addEventListener("pointerup",C)}function z(){document.removeEventListener("pointermove",j),document.removeEventListener("pointerup",C)}function j(w){let W=m.current;if(v.canDrag&&W){v.didMove=!0,l&&N(),i.draggableDirection==="x"?v.delta=w.clientX-v.start:v.delta=w.clientY-v.start,v.start!==w.clientX&&(v.canCloseOnClick=!1);let de=i.draggableDirection==="x"?`${v.delta}px, var(--y)`:`0, calc(${v.delta}px + var(--y))`;W.style.transform=`translate3d(${de},0)`,W.style.opacity=`${1-Math.abs(v.delta/v.removalDistance)}`}}function C(){z();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 P={onPointerDown:D,onPointerUp:b};return x&&h&&(P.onMouseEnter=N,i.stacked||(P.onMouseLeave=T)),_&&(P.onClick=w=>{S&&S(w),v.canCloseOnClick&&p(!0)}),{playToast:T,pauseToast:N,isRunning:l,preventExitTransition:u,toastRef:m,eventHandlers:P}}var c1=typeof window<"u"?g.useLayoutEffect:g.useEffect,co=({theme:i,type:l,isLoading:d,...u})=>ht.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:i==="colored"?"currentColor":`var(--toastify-icon-color-${l})`,...u});function u1(i){return ht.createElement(co,{...i},ht.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 d1(i){return ht.createElement(co,{...i},ht.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 f1(i){return ht.createElement(co,{...i},ht.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 m1(i){return ht.createElement(co,{...i},ht.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 h1(){return ht.createElement("div",{className:"Toastify__spinner"})}var td={info:d1,warning:u1,success:f1,error:m1,spinner:h1},p1=i=>i in td;function v1({theme:i,type:l,isLoading:d,icon:u}){let c=null,m={theme:i,type:l};return u===!1||(pn(u)?c=u({...m,isLoading:d}):g.isValidElement(u)?c=g.cloneElement(u,m):d?c=td.spinner():p1(l)&&(c=td[l](m))),c}var g1=i=>{let{isRunning:l,preventExitTransition:d,toastRef:u,eventHandlers:c,playToast:m}=o1(i),{closeButton:v,children:x,autoClose:h,onClick:p,type:S,hideProgressBar:_,closeToast:R,transition:U,position:D,className:b,style:T,progressClassName:N,updateId:H,role:z,progress:j,rtl:C,toastId:P,deleteToast:w,isIn:W,isLoading:de,closeOnClick:J,theme:G,ariaLabel:Y}=i,re=gs("Toastify__toast",`Toastify__toast-theme--${G}`,`Toastify__toast--${S}`,{"Toastify__toast--rtl":C},{"Toastify__toast--close-on-click":J}),xe=pn(b)?b({rtl:C,position:D,type:S,defaultClassName:re}):gs(re,b),je=v1(i),$=!!j||!h,se={closeToast:R,type:S,theme:G},ve=null;return v===!1||(pn(v)?ve=v(se):g.isValidElement(v)?ve=g.cloneElement(v,se):ve=Yx(se)),ht.createElement(U,{isIn:W,done:w,position:D,preventExitTransition:d,nodeRef:u,playToast:m},ht.createElement("div",{id:P,tabIndex:0,onClick:p,"data-in":W,className:xe,...c,style:T,ref:u,...W&&{role:z,"aria-label":Y}},je!=null&&ht.createElement("div",{className:gs("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!de})},je),wv(x,i,!l),ve,!i.customProgressBar&&ht.createElement(Xx,{...H&&!$?{key:`p-${H}`}:{},rtl:C,theme:G,delay:h,isRunning:l,isIn:W,closeToast:R,hide:_,type:S,className:N,controlledProgress:$,progress:j||0})))},b1=(i,l=!1)=>({enter:`Toastify--animate Toastify__${i}-enter`,exit:`Toastify--animate Toastify__${i}-exit`,appendPosition:l}),y1=Gx(b1("bounce",!0)),x1={position:"top-right",transition:y1,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 Yt(i){let l={...x1,...i},d=i.stacked,[u,c]=g.useState(!0),m=g.useRef(null),{getToastToRender:v,isToastActive:x,count:h}=r1(l),{className:p,style:S,rtl:_,containerId:R,hotKeys:U}=l;function D(T){let N=gs("Toastify__toast-container",`Toastify__toast-container--${T}`,{"Toastify__toast-container--rtl":_});return pn(p)?p({position:T,rtl:_,defaultClassName:N}):gs(N,Ku(p))}function b(){d&&(c(!0),A.play())}return c1(()=>{var T;if(d){let N=m.current.querySelectorAll('[data-in="true"]'),H=12,z=(T=l.position)==null?void 0:T.includes("top"),j=0,C=0;Array.from(N).reverse().forEach((P,w)=>{let W=P;W.classList.add("Toastify__toast--stacked"),w>0&&(W.dataset.collapsed=`${u}`),W.dataset.pos||(W.dataset.pos=z?"top":"bot");let de=j*(u?.2:1)+(u?0:H*w);W.style.setProperty("--y",`${z?de:de*-1}px`),W.style.setProperty("--g",`${H}`),W.style.setProperty("--s",`${1-(u?C:0)}`),j+=W.offsetHeight,C+=.025})}},[u,h,d]),g.useEffect(()=>{function T(N){var H;let z=m.current;U(N)&&((H=z.querySelector('[tabIndex="0"]'))==null||H.focus(),c(!1),A.pause()),N.key==="Escape"&&(document.activeElement===z||z!=null&&z.contains(document.activeElement))&&(c(!0),A.play())}return document.addEventListener("keydown",T),()=>{document.removeEventListener("keydown",T)}},[U]),ht.createElement("section",{ref:m,className:"Toastify",id:R,onMouseEnter:()=>{d&&(c(!1),A.pause())},onMouseLeave:b,"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text","aria-label":l["aria-label"]},v((T,N)=>{let H=N.length?{...S}:{...S,pointerEvents:"none"};return ht.createElement("div",{tabIndex:-1,className:D(T),"data-stacked":d,style:H,key:`c-${T}`},N.map(({content:z,props:j})=>ht.createElement(g1,{...j,stacked:d,collapseAll:b,isIn:x(j.toastId,j.containerId),key:`t-${j.key}`},z)))}))}const j1=""+new URL("20 pesos-CUb7mBC6.jpeg",import.meta.url).href,S1=""+new URL("50 pesos-CWd8U7PQ.jpeg",import.meta.url).href,N1=""+new URL("100 pesos-D1GVNH0C.jpeg",import.meta.url).href,C1=""+new URL("200 pesos-e7FYIHhe.jpeg",import.meta.url).href,_1=""+new URL("500 pesos-By2-Zx2u.jpeg",import.meta.url).href,T1=""+new URL("1000 pesos-C0SNOCZD.jpeg",import.meta.url).href,Va=()=>Pe.getApiUrl();function O1(){const{user:i}=Ga(),[l,d]=g.useState([]),[u,c]=g.useState([]),[m,v]=g.useState("todas"),[x,h]=g.useState([]),[p,S]=g.useState(""),[_,R]=g.useState("efectivo"),[U,D]=g.useState(!0),[b,T]=g.useState(!1),[N,H]=g.useState(null),[z,j]=g.useState(""),[C,P]=g.useState("cantidad"),[w,W]=g.useState(null),[de,J]=g.useState(!1),[G,Y]=g.useState(null),[re,xe]=g.useState([]),[je,$]=g.useState(!1),[se,ve]=g.useState(""),[Ce,me]=g.useState([]),[E,O]=g.useState(null),[ee,K]=g.useState(null),[he,pe]=g.useState(void 0),[Se,qe]=g.useState(""),[De,ne]=g.useState([]),[Q,fe]=g.useState({}),[q,ce]=g.useState(!1);g.useEffect(()=>{Ne()},[]);const Ne=async()=>{try{const ye=await(await fetch(Va(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getTurnoActivo",sucursal:Pe.getSucursal(),caja:Pe.getCaja()})})).json();ye.success?ye.data?(pe(ye.data),ca(),ze(),oe()):(pe(null),Be()):pe(null)}catch{pe(null)}finally{D(!1)}},Be=async()=>{try{const ye=await(await fetch(Va(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductosContarInicio"})})).json();if(ye.success){ne(ye.data||[]);const k={};(ye.data||[]).forEach(ue=>{k[ue.id]={stock_fisico:""}}),fe(k)}}catch(F){console.error("Error al cargar productos para inicio:",F)}},Da=async()=>{const F=parseFloat(Se);if(isNaN(F)||F<0){A.warning("Ingresa un fondo de caja valido");return}if(De.length>0){const ye=De.filter(k=>{var ue;return((ue=Q[k.id])==null?void 0:ue.stock_fisico)===""});if(ye.length>0){A.warning(`Faltan ${ye.length} producto(s) por contar`);return}}ce(!0);try{const ye=De.map(_e=>{var Ae;return{producto_id:_e.id,nombre:_e.nombre,stock_sistema:_e.stock,stock_fisico:parseFloat((Ae=Q[_e.id])==null?void 0:Ae.stock_fisico)||0,unidad:_e.unidad}}),ue=await(await fetch(Va(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"iniciarTurno",usuario_id:(i==null?void 0:i.id)||null,sucursal:Pe.getSucursal(),caja:Pe.getCaja(),fondo_caja:F,inventario:ye})})).json();ue.success?(A.success("Turno iniciado correctamente"),pe(ue.data),ca(),ze(),oe()):A.error(ue.message||"Error al iniciar turno")}catch{A.error("Error de conexion")}finally{ce(!1)}},ca=async()=>{try{const ye=await(await fetch(Va(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductosPOS"})})).json();if(ye.success){d(ye.data||[]);const k=[...new Set(ye.data.map(ue=>ue.categoria).filter(Boolean))];c(k)}}catch{A.error("Error al cargar productos")}finally{D(!1)}},oe=async()=>{try{const ye=await(await fetch(Va(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getClientes"})})).json();ye.success&&me(ye.data||[])}catch(F){console.error("Error al cargar clientes:",F)}},ze=async()=>{try{const ye=await(await fetch(Va(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getPedidosPausados"})})).json();ye.success&&xe(ye.data||[])}catch(F){console.error("Error al cargar pedidos pausados:",F)}},He=Ce.filter(F=>F.nombre.toLowerCase().includes(se.toLowerCase())||F.telefono&&F.telefono.includes(se)),Ge=F=>{Y(F),$(!1),ve("")},Tt=async()=>{if(!G){A.warning("Selecciona un cliente para pausar el pedido");return}if(x.length===0){A.warning("Agrega productos al carrito");return}try{const ye=await(await fetch(Va(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"pausarPedido",cliente_id:G.id,items:x,reemplazar:ee!==null,usuario_id:(i==null?void 0:i.id)||null,sucursal:Pe.getSucursal(),caja:Pe.getCaja()})})).json();ye.success?(A.success(`Pedido pausado para ${G.nombre}`),h([]),Y(null),K(null),ze()):A.error(ye.message||"Error al pausar pedido")}catch{A.error("Error de conexion")}},Nt=async F=>{try{const k=await(await fetch(Va(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"retomarPedido",pedido_id:F.id})})).json();k.success?(h(k.data.items),Y({id:k.data.cliente_id,nombre:k.data.cliente_nombre}),K(F.id),A.info(`Pedido de ${k.data.cliente_nombre} cargado`)):A.error(k.message||"Error al retomar pedido")}catch{A.error("Error de conexion")}},Ya=F=>{O(F),h(F.items),Y({id:F.cliente_id,nombre:F.cliente_nombre}),J(!0)},Ra=async F=>{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 k=await(await fetch(Va(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"cancelarPedidoPausado",pedido_id:F})})).json();k.success?(A.dismiss(),A.success("Pedido cancelado"),ze()):A.error(k.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})},Xa=m==="todas"?l:l.filter(F=>F.categoria===m),za=F=>{var k;H(F),j("");const ye=["kg","g","litro","lt","l","ml"].includes((k=F.unidad)==null?void 0:k.toLowerCase());P(ye?"pesos":"cantidad")},Xn=()=>{const F=parseFloat(z);if(!F||F<=0){A.warning(C==="pesos"?"Ingresa un monto valido":"Ingresa una cantidad valida");return}let ye=F;C==="pesos"&&(ye=F/N.precio,N.unidad==="kg"||N.unidad==="g"?ye=Math.round(ye*1e3)/1e3:ye=Math.round(ye)),h(k=>k.find(_e=>_e.id===N.id)?k.map(_e=>_e.id===N.id?{..._e,cantidad:_e.cantidad+ye}:_e):[...k,{...N,cantidad:ye}]),H(null),j("")},Dt=()=>{const F=parseFloat(z)||0;if(!N)return{cantidad:0,pesos:0};const ye=N.unidad==="kg"||N.unidad==="g";if(C==="pesos"){let k=F/N.precio;return ye?k=Math.round(k*1e3)/1e3:k=Math.round(k),{cantidad:k,pesos:F}}else return{cantidad:F,pesos:F*N.precio}},bn=(F,ye)=>{h(k=>k.map(ue=>{if(ue.id===F){const _e=ue.cantidad+ye;return _e<=0?null:{...ue,cantidad:_e}}return ue}).filter(Boolean))},In=F=>{h(ye=>ye.filter(k=>k.id!==F))},Zt=()=>{h([]),S("")},wt=()=>{if(x.length===0){A.warning("Agrega productos al carrito");return}S(""),R("efectivo"),J(!0)},ft=()=>{J(!1),S(""),O(null)},Ke=Math.round(x.reduce((F,ye)=>F+ye.precio*ye.cantidad,0)*100)/100,B=parseFloat(p)||0,ge=B-Ke,be=F=>{S(ye=>{const k=parseFloat(ye)||0;return String(k+F)})},Te=()=>{S(String(Ke.toFixed(2)))},Lt=async()=>{if(x.length===0){A.warning("Agrega productos al carrito");return}if(_==="efectivo"&&B<Ke){A.warning("El pago es menor al total");return}T(!0);try{let F;E?F={tipo:"cobrarPedidoPausado",pedido_id:E.id,items:x,pago:_==="efectivo"?B:Ke,metodo_pago:_,cobro_parcial:!1,usuario_id:(i==null?void 0:i.id)||null,sucursal:Pe.getSucursal(),caja:Pe.getCaja()}:F={tipo:"crearVenta",items:x,pago:_==="efectivo"?B:Ke,metodo_pago:_,cliente_id:(G==null?void 0:G.id)||null,usuario_id:(i==null?void 0:i.id)||null,sucursal:Pe.getSucursal(),caja:Pe.getCaja()};const k=await(await fetch(Va(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)})).json();k.success?(J(!1),W({folio:k.data.folio,items:[...x],total:k.data.total,pago:k.data.pago,cambio:k.data.cambio,metodoPago:_,fecha:new Date().toLocaleString()}),A.success(`Venta ${k.data.folio} completada`),h([]),S(""),Y(null),O(null),ca(),ze()):A.error(k.message||"Error al procesar venta")}catch{A.error("Error de conexion")}finally{T(!1)}},Jt=F=>{if(N)if(F==="C")j("");else{if(F==="."&&z.includes("."))return;j(ye=>ye+F)}else if(F==="C")S("");else{if(F==="."&&p.includes("."))return;S(ye=>ye+F)}};return U||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(bx,{size:32}),a.jsx("h2",{children:"Iniciar Turno"}),a.jsxs("p",{children:[Pe.getSucursal()," - ",Pe.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:Se,onChange:F=>qe(F.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(F=>a.jsxs("button",{onClick:()=>qe(String(F)),className:"turno-fondo-btn",children:["$",F]},F))})]})]}),De.length>0&&a.jsxs("div",{className:"turno-seccion",children:[a.jsxs("h3",{children:[a.jsx(Gt,{size:18})," Inventario Inicial (",De.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:De.map(F=>{var ue,_e;const ye=parseFloat((ue=Q[F.id])==null?void 0:ue.stock_fisico),k=isNaN(ye)?null:ye-F.stock;return a.jsxs("div",{className:"turno-inv-row",children:[a.jsx("span",{className:"turno-inv-nombre",children:F.nombre}),a.jsxs("span",{className:"turno-inv-sistema",children:[F.stock," ",F.unidad]}),a.jsx("input",{type:"number",value:((_e=Q[F.id])==null?void 0:_e.stock_fisico)??"",onChange:Ae=>fe(Je=>({...Je,[F.id]:{stock_fisico:Ae.target.value}})),className:"turno-inv-input",placeholder:"0",min:"0",step:"0.01"}),a.jsx("span",{className:`turno-inv-dif ${k!==null?k<0?"negativa":k>0?"positiva":"":""}`,children:k!==null?(k>=0?"+":"")+k.toFixed(2):"-"})]},F.id)})})]})]})]}),a.jsx("div",{className:"turno-footer",children:a.jsxs("button",{className:"turno-btn-iniciar",onClick:Da,disabled:q,children:[a.jsx(bs,{size:20}),q?"Iniciando...":"INICIAR TURNO"]})})]}),a.jsx(Yt,{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(F=>a.jsx("button",{className:`cat-btn ${m===F?"activa":""}`,onClick:()=>v(F),children:F},F))]}),a.jsx("div",{className:"pos-grid",children:Xa.map(F=>a.jsxs("button",{className:"pos-producto-btn",onClick:()=>za(F),children:[a.jsx("span",{className:"prod-nombre",children:F.nombre}),a.jsxs("span",{className:"prod-precio",children:["$",F.precio.toFixed(2)]}),a.jsxs("span",{className:"prod-unidad",children:["/",F.unidad]})]},F.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"]}),x.length>0&&a.jsxs("button",{className:"btn-limpiar",onClick:Zt,children:[a.jsx(Qt,{size:16})," Limpiar"]})]}),a.jsx("div",{className:"cliente-selector",children:G?a.jsxs("div",{className:"cliente-seleccionado",children:[a.jsx(Ju,{size:16}),a.jsx("span",{children:G.nombre}),a.jsx("button",{className:"btn-quitar-cliente",onClick:()=>Y(null),children:a.jsx(rt,{size:14})})]}):a.jsxs("button",{className:"btn-seleccionar-cliente",onClick:()=>$(!0),children:[a.jsx(Ju,{size:16})," Seleccionar Cliente"]})}),a.jsx("div",{className:"carrito-items",children:x.length===0?a.jsx("p",{className:"carrito-vacio",children:"Sin productos"}):x.map(F=>a.jsxs("div",{className:"carrito-item",children:[a.jsxs("div",{className:"item-info",children:[a.jsx("span",{className:"item-nombre",children:F.nombre}),a.jsxs("span",{className:"item-precio",children:["$",F.precio.toFixed(2)," x ",F.cantidad," ",F.unidad]})]}),a.jsxs("div",{className:"item-acciones",children:[a.jsxs("span",{className:"item-subtotal",children:["$",(F.precio*F.cantidad).toFixed(2)]}),a.jsx("button",{onClick:()=>bn(F.id,F.unidad==="kg"||F.unidad==="g"?-.25:-1),className:"btn-cant",children:a.jsx(Gy,{size:14})}),a.jsx("button",{onClick:()=>bn(F.id,F.unidad==="kg"||F.unidad==="g"?.25:1),className:"btn-cant",children:a.jsx(ra,{size:14})}),a.jsx("button",{onClick:()=>In(F.id),className:"btn-cant btn-eliminar",children:a.jsx(rt,{size:14})})]})]},F.id))}),a.jsxs("div",{className:"carrito-total",children:[a.jsx("span",{children:"TOTAL"}),a.jsxs("span",{className:"total-monto",children:["$",Ke.toFixed(2)]})]}),a.jsxs("div",{className:"pos-pago",children:[G&&x.length>0&&a.jsxs("button",{className:"btn-pausar",onClick:Tt,children:[a.jsx(Zy,{size:18})," PAUSAR"]}),a.jsxs("button",{className:"btn-cobrar",onClick:wt,disabled:x.length===0,children:[a.jsx(fl,{size:20}),"COBRAR $",Ke.toFixed(2)]})]})]}),re.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 (",re.length,")"]})}),a.jsx("div",{className:"pedidos-pausados-lista",children:re.map(F=>a.jsxs("div",{className:"pedido-pausado-item",children:[a.jsxs("div",{className:"pedido-info",children:[a.jsx("span",{className:"pedido-cliente",children:F.cliente_nombre}),a.jsxs("span",{className:"pedido-total",children:["$",F.total.toFixed(2)]}),a.jsxs("span",{className:"pedido-items",children:[F.items.length," items"]})]}),a.jsxs("div",{className:"pedido-acciones",children:[a.jsx("button",{className:"btn-retomar",onClick:()=>Nt(F),title:"Retomar",children:a.jsx(Wy,{size:14})}),a.jsx("button",{className:"btn-cobrar-pausado",onClick:()=>Ya(F),title:"Cobrar",children:a.jsx(fl,{size:14})}),a.jsx("button",{className:"btn-cancelar-pausado",onClick:()=>Ra(F.id),title:"Cancelar",children:a.jsx(rt,{size:14})})]})]},F.id))})]}),N&&a.jsx("div",{className:"modal-overlay",onClick:()=>H(null),children:a.jsxs("div",{className:"modal modal-cantidad",onClick:F=>F.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:N.nombre}),a.jsx("button",{className:"btn-icon",onClick:()=>H(null),children:a.jsx(rt,{size:20})})]}),a.jsxs("div",{className:"cantidad-content",children:[a.jsxs("p",{className:"cantidad-precio",children:["$",N.precio.toFixed(2)," / ",N.unidad]}),a.jsxs("div",{className:"modo-captura",children:[a.jsxs("button",{className:`modo-btn ${C==="cantidad"?"activo":""}`,onClick:()=>{P("cantidad"),j("")},children:["Por ",N.unidad]}),a.jsx("button",{className:`modo-btn ${C==="pesos"?"activo":""}`,onClick:()=>{P("pesos"),j("")},children:"Por $Pesos"})]}),a.jsx("input",{type:"text",value:z,onChange:F=>j(F.target.value),placeholder:C==="pesos"?"Monto en $":`Cantidad en ${N.unidad}`,className:"cantidad-input",autoFocus:!0}),a.jsx("div",{className:"cantidad-rapida",children:C==="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"})]}):N.unidad==="kg"||N.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(F=>a.jsx("button",{onClick:()=>Jt(F),className:"numpad-btn",children:F},F))}),z&&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:[N.unidad==="kg"||N.unidad==="g"?Dt().cantidad.toFixed(3):Math.round(Dt().cantidad)," ",N.unidad]})]}),a.jsxs("div",{className:"resultado-linea resultado-total",children:[a.jsx("span",{children:"Total:"}),a.jsxs("span",{className:"resultado-valor",children:["$",Dt().pesos.toFixed(2)]})]})]})]}),a.jsxs("div",{className:"modal-actions",children:[a.jsx("button",{className:"btn-secondary",onClick:()=>H(null),children:"Cancelar"}),a.jsx("button",{className:"btn-primary",onClick:Xn,children:"Agregar"})]})]})}),de&&a.jsx("div",{className:"modal-overlay",onClick:ft,children:a.jsxs("div",{className:"modal modal-pago",onClick:F=>F.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:"Cobrar Venta"}),a.jsx("button",{className:"btn-icon",onClick:ft,children:a.jsx(rt,{size:20})})]}),a.jsxs("div",{className:"pago-content",children:[a.jsxs("div",{className:"metodo-pago",children:[a.jsxs("button",{className:`metodo-btn ${_==="efectivo"?"activo":""}`,onClick:()=>R("efectivo"),children:[a.jsx(fl,{size:18})," Efectivo"]}),a.jsxs("button",{className:`metodo-btn ${_==="tarjeta"?"activo":""}`,onClick:()=>R("tarjeta"),children:[a.jsx(Sy,{size:18})," Tarjeta"]})]}),_==="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:["$",Ke.toFixed(2)]})]}),a.jsxs("div",{className:"pago-input-row",children:[a.jsx("label",{children:"Recibido:"}),a.jsx("input",{type:"text",value:p,onChange:F=>S(F.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(F=>a.jsx("button",{onClick:()=>Jt(F),className:"numpad-btn",children:F},F))}),a.jsx("button",{onClick:Te,className:"btn-exacto-full",children:"Pago Exacto"}),B>0&&a.jsxs("div",{className:`cambio-display ${ge>=0?"positivo":"negativo"}`,children:[a.jsx("span",{children:"Cambio:"}),a.jsxs("span",{className:"cambio-monto",children:["$",ge.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:()=>be(20),className:"btn-billete b20",children:[a.jsx("img",{src:j1,alt:"$20",className:"billete-img"}),a.jsx("span",{className:"billete-valor",children:"$20"})]}),a.jsxs("button",{onClick:()=>be(50),className:"btn-billete b50",children:[a.jsx("img",{src:S1,alt:"$50",className:"billete-img"}),a.jsx("span",{className:"billete-valor",children:"$50"})]}),a.jsxs("button",{onClick:()=>be(100),className:"btn-billete b100",children:[a.jsx("img",{src:N1,alt:"$100",className:"billete-img"}),a.jsx("span",{className:"billete-valor",children:"$100"})]}),a.jsxs("button",{onClick:()=>be(200),className:"btn-billete b200",children:[a.jsx("img",{src:C1,alt:"$200",className:"billete-img"}),a.jsx("span",{className:"billete-valor",children:"$200"})]}),a.jsxs("button",{onClick:()=>be(500),className:"btn-billete b500",children:[a.jsx("img",{src:_1,alt:"$500",className:"billete-img"}),a.jsx("span",{className:"billete-valor",children:"$500"})]}),a.jsxs("button",{onClick:()=>be(1e3),className:"btn-billete b1000",children:[a.jsx("img",{src:T1,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:()=>be(1),className:"btn-moneda m1",children:"$1"}),a.jsx("button",{onClick:()=>be(2),className:"btn-moneda m2",children:"$2"}),a.jsx("button",{onClick:()=>be(5),className:"btn-moneda m5",children:"$5"}),a.jsx("button",{onClick:()=>be(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:["$",Ke.toFixed(2)]})]}),a.jsx("p",{className:"tarjeta-instruccion",children:"Procesa el pago con tarjeta y confirma"})]}),a.jsxs("button",{className:"btn-confirmar-pago",onClick:Lt,disabled:b||_==="efectivo"&&B<Ke,children:[a.jsx(Gn,{size:20}),b?"Procesando...":"CONFIRMAR PAGO"]})]})]})}),w&&a.jsx("div",{className:"modal-overlay",onClick:()=>W(null),children:a.jsxs("div",{className:"modal modal-cambio",onClick:F=>F.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(Gn,{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:()=>W(null),children:[a.jsx(Gn,{size:18})," Listo"]})]})}),je&&a.jsx("div",{className:"modal-overlay",onClick:()=>$(!1),children:a.jsxs("div",{className:"modal modal-cliente",onClick:F=>F.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:"Seleccionar Cliente"}),a.jsx("button",{className:"btn-icon",onClick:()=>$(!1),children:a.jsx(rt,{size:20})})]}),a.jsx("div",{className:"cliente-busqueda",children:a.jsx("input",{type:"text",placeholder:"Buscar por nombre o telefono...",value:se,onChange:F=>ve(F.target.value),autoFocus:!0})}),a.jsx("div",{className:"clientes-lista",children:He.length===0?a.jsx("p",{className:"sin-clientes",children:"No se encontraron clientes"}):He.map(F=>a.jsxs("button",{className:"cliente-item",onClick:()=>Ge(F),children:[a.jsx("span",{className:"cliente-nombre",children:F.nombre}),F.telefono&&a.jsx("span",{className:"cliente-tel",children:F.telefono})]},F.id))})]})}),a.jsx(Yt,{position:"top-right",autoClose:2e3,hideProgressBar:!0,newestOnTop:!0})]})}var Pt=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 E1(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=E1(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 Re(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 z1(i){if(Array.isArray(i))return i}function M1(i,l){var d=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(d!=null){var u,c,m,v,x=[],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)&&(x.push(u.value),x.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 x}}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 A1(){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 hn(i,l){return z1(i)||M1(i,l)||Hv(i,l)||A1()}function w1(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 gn(i,l){if(i==null)return{};var d,u,c=w1(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 k1=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function D1(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,x=i.inputValue,h=i.menuIsOpen,p=i.onChange,S=i.onInputChange,_=i.onMenuClose,R=i.onMenuOpen,U=i.value,D=gn(i,k1),b=g.useState(x!==void 0?x:d),T=hn(b,2),N=T[0],H=T[1],z=g.useState(h!==void 0?h:c),j=hn(z,2),C=j[0],P=j[1],w=g.useState(U!==void 0?U:v),W=hn(w,2),de=W[0],J=W[1],G=g.useCallback(function(ve,Ce){typeof p=="function"&&p(ve,Ce),J(ve)},[p]),Y=g.useCallback(function(ve,Ce){var me;typeof S=="function"&&(me=S(ve,Ce)),H(me!==void 0?me:ve)},[S]),re=g.useCallback(function(){typeof R=="function"&&R(),P(!0)},[R]),xe=g.useCallback(function(){typeof _=="function"&&_(),P(!1)},[_]),je=x!==void 0?x:N,$=h!==void 0?h:C,se=U!==void 0?U:de;return Re(Re({},D),{},{inputValue:je,menuIsOpen:$,onChange:G,onInputChange:Y,onMenuClose:xe,onMenuOpen:re,value:se})}function Le(){return Le=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},Le.apply(null,arguments)}function R1(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 U1(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 L1(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 q1(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function H1(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 q1(i)}function V1(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 H1(this,d)}}function B1(i){if(Array.isArray(i))return ad(i)}function $1(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function F1(){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 B1(i)||$1(i)||Hv(i)||F1()}function P1(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 G1(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 Y1=(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(G1(this));var c=this.tags[this.tags.length-1];if(this.isSpeedy){var m=P1(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})(),It="-ms-",eo="-moz-",at="-webkit-",Bv="comm",pd="rule",vd="decl",X1="@import",$v="@keyframes",I1="@layer",Q1=Math.abs,uo=String.fromCharCode,Z1=Object.assign;function J1(i,l){return Ft(i,0)^45?(((l<<2^Ft(i,0))<<2^Ft(i,1))<<2^Ft(i,2))<<2^Ft(i,3):0}function Fv(i){return i.trim()}function K1(i,l){return(i=l.exec(i))?i[0]:i}function nt(i,l,d){return i.replace(l,d)}function sd(i,l){return i.indexOf(l)}function Ft(i,l){return i.charCodeAt(l)|0}function vl(i,l,d){return i.slice(l,d)}function $a(i){return i.length}function gd(i){return i.length}function Lr(i,l){return l.push(i),i}function W1(i,l){return i.map(l).join("")}var fo=1,pi=1,Pv=0,oa=0,At=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 Z1(mo("",null,null,"",null,null,0),i,{length:-i.length},l)}function ej(){return At}function tj(){return At=oa>0?Ft(vi,--oa):0,pi--,At===10&&(pi=1,fo--),At}function ga(){return At=oa<Pv?Ft(vi,oa++):0,pi++,At===10&&(pi=1,fo++),At}function Pa(){return Ft(vi,oa)}function Ir(){return oa}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=$a(vi=i),oa=0,[]}function Yv(i){return vi="",i}function Qr(i){return Fv(Sl(oa-1,id(i===91?i+2:i===40?i+1:i)))}function aj(i){for(;(At=Pa())&&At<33;)ga();return gl(i)>2||gl(At)>3?"":" "}function nj(i,l){for(;--l&&ga()&&!(At<48||At>102||At>57&&At<65||At>70&&At<97););return Sl(i,Ir()+(l<6&&Pa()==32&&ga()==32))}function id(i){for(;ga();)switch(At){case i:return oa;case 34:case 39:i!==34&&i!==39&&id(At);break;case 40:i===41&&id(i);break;case 92:ga();break}return oa}function sj(i,l){for(;ga()&&i+At!==57;)if(i+At===84&&Pa()===47)break;return"/*"+Sl(l,oa-1)+"*"+uo(i===47?i:ga())}function ij(i){for(;!gl(Pa());)ga();return Sl(i,oa)}function lj(i){return Yv(Zr("",null,null,null,[""],i=Gv(i),0,[0],i))}function Zr(i,l,d,u,c,m,v,x,h){for(var p=0,S=0,_=v,R=0,U=0,D=0,b=1,T=1,N=1,H=0,z="",j=c,C=m,P=u,w=z;T;)switch(D=H,H=ga()){case 40:if(D!=108&&Ft(w,_-1)==58){sd(w+=nt(Qr(H),"&","&\f"),"&\f")!=-1&&(N=-1);break}case 34:case 39:case 91:w+=Qr(H);break;case 9:case 10:case 13:case 32:w+=aj(D);break;case 92:w+=nj(Ir()-1,7);continue;case 47:switch(Pa()){case 42:case 47:Lr(rj(sj(ga(),Ir()),l,d),h);break;default:w+="/"}break;case 123*b:x[p++]=$a(w)*N;case 125*b:case 59:case 0:switch(H){case 0:case 125:T=0;case 59+S:N==-1&&(w=nt(w,/\f/g,"")),U>0&&$a(w)-_&&Lr(U>32?Hp(w+";",u,d,_-1):Hp(nt(w," ","")+";",u,d,_-2),h);break;case 59:w+=";";default:if(Lr(P=qp(w,l,d,p,S,c,x,z,j=[],C=[],_),m),H===123)if(S===0)Zr(w,l,P,P,j,m,_,x,C);else switch(R===99&&Ft(w,3)===110?100:R){case 100:case 108:case 109:case 115:Zr(i,P,P,u&&Lr(qp(i,P,P,0,0,c,x,z,c,j=[],_),C),c,C,_,x,u?j:C);break;default:Zr(w,P,P,P,[""],C,0,x,C)}}p=S=U=0,b=N=1,z=w="",_=v;break;case 58:_=1+$a(w),U=D;default:if(b<1){if(H==123)--b;else if(H==125&&b++==0&&tj()==125)continue}switch(w+=uo(H),H*b){case 38:N=S>0?1:(w+="\f",-1);break;case 44:x[p++]=($a(w)-1)*N,N=1;break;case 64:Pa()===45&&(w+=Qr(ga())),R=Pa(),S=_=$a(z=w+=ij(Ir())),H++;break;case 45:D===45&&$a(w)==2&&(b=0)}}return m}function qp(i,l,d,u,c,m,v,x,h,p,S){for(var _=c-1,R=c===0?m:[""],U=gd(R),D=0,b=0,T=0;D<u;++D)for(var N=0,H=vl(i,_+1,_=Q1(b=v[D])),z=i;N<U;++N)(z=Fv(b>0?R[N]+" "+H:nt(H,/&\f/g,R[N])))&&(h[T++]=z);return mo(i,l,d,c===0?pd:x,h,p,S)}function rj(i,l,d){return mo(i,l,d,Bv,uo(ej()),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 oj(i,l,d,u){switch(i.type){case I1:if(i.children.length)break;case X1: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 $a(d=fi(i.children,u))?i.return=i.value+"{"+d+"}":""}function cj(i){var l=gd(i);return function(d,u,c,m){for(var v="",x=0;x<l;x++)v+=i[x](d,u,c,m)||"";return v}}function uj(i){return function(l){l.root||(l=l.return)&&i(l)}}function dj(i){var l=Object.create(null);return function(d){return l[d]===void 0&&(l[d]=i(d)),l[d]}}var fj=function(l,d,u){for(var c=0,m=0;c=m,m=Pa(),c===38&&m===12&&(d[u]=1),!gl(m);)ga();return Sl(l,oa)},mj=function(l,d){var u=-1,c=44;do switch(gl(c)){case 0:c===38&&Pa()===12&&(d[u]=1),l[u]+=fj(oa-1,d,u);break;case 2:l[u]+=Qr(c);break;case 4:if(c===44){l[++u]=Pa()===58?"&\f":"",d[u]=l[u].length;break}default:l[u]+=uo(c)}while(c=ga());return l},hj=function(l,d){return Yv(mj(Gv(l),d))},Vp=new WeakMap,pj=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=hj(d,m),x=u.props,h=0,p=0;h<v.length;h++)for(var S=0;S<x.length;S++,p++)l.props[p]=m[h]?v[h].replace(/&\f/g,x[S]):x[S]+" "+v[h]}}},vj=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(J1(i,l)){case 5103:return at+"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 at+i+i;case 5349:case 4246:case 4810:case 6968:case 2756:return at+i+eo+i+It+i+i;case 6828:case 4268:return at+i+It+i+i;case 6165:return at+i+It+"flex-"+i+i;case 5187:return at+i+nt(i,/(\w+).+(:[^]+)/,at+"box-$1$2"+It+"flex-$1$2")+i;case 5443:return at+i+It+"flex-item-"+nt(i,/flex-|-self/,"")+i;case 4675:return at+i+It+"flex-line-pack"+nt(i,/align-content|flex-|-self/,"")+i;case 5548:return at+i+It+nt(i,"shrink","negative")+i;case 5292:return at+i+It+nt(i,"basis","preferred-size")+i;case 6060:return at+"box-"+nt(i,"-grow","")+at+i+It+nt(i,"grow","positive")+i;case 4554:return at+nt(i,/([^-])(transform)/g,"$1"+at+"$2")+i;case 6187:return nt(nt(nt(i,/(zoom-|grab)/,at+"$1"),/(image-set)/,at+"$1"),i,"")+i;case 5495:case 3959:return nt(i,/(image-set\([^]*)/,at+"$1$`$1");case 4968:return nt(nt(i,/(.+:)(flex-)?(.*)/,at+"box-pack:$3"+It+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+at+i+i;case 4095:case 3583:case 4068:case 2532:return nt(i,/(.+)-inline(.+)/,at+"$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($a(i)-1-l>6)switch(Ft(i,l+1)){case 109:if(Ft(i,l+4)!==45)break;case 102:return nt(i,/(.+:)(.+)-([^]+)/,"$1"+at+"$2-$3$1"+eo+(Ft(i,l+3)==108?"$3":"$2-$3"))+i;case 115:return~sd(i,"stretch")?Xv(nt(i,"stretch","fill-available"),l)+i:i}break;case 4949:if(Ft(i,l+1)!==115)break;case 6444:switch(Ft(i,$a(i)-3-(~sd(i,"!important")&&10))){case 107:return nt(i,":",":"+at)+i;case 101:return nt(i,/(.+:)([^;!]+)(;|!.+)?/,"$1"+at+(Ft(i,14)===45?"inline-":"")+"box$3$1"+at+"$2$3$1"+It+"$2box$3")+i}break;case 5936:switch(Ft(i,l+11)){case 114:return at+i+It+nt(i,/[svh]\w+-[tblr]{2}/,"tb")+i;case 108:return at+i+It+nt(i,/[svh]\w+-[tblr]{2}/,"tb-rl")+i;case 45:return at+i+It+nt(i,/[svh]\w+-[tblr]{2}/,"lr")+i}return at+i+It+i+i}return i}var gj=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:nt(l.value,"@","@"+at)})],c);case pd:if(l.length)return W1(l.props,function(m){switch(K1(m,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return fi([cl(l,{props:[nt(m,/:(read-\w+)/,":"+eo+"$1")]})],c);case"::placeholder":return fi([cl(l,{props:[nt(m,/:(plac\w+)/,":"+at+"input-$1")]}),cl(l,{props:[nt(m,/:(plac\w+)/,":"+eo+"$1")]}),cl(l,{props:[nt(m,/:(plac\w+)/,It+"input-$1")]})],c)}return""})}},bj=[gj],yj=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 T=b.getAttribute("data-emotion");T.indexOf(" ")!==-1&&(document.head.appendChild(b),b.setAttribute("data-s",""))})}var c=l.stylisPlugins||bj,m={},v,x=[];v=l.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+d+' "]'),function(b){for(var T=b.getAttribute("data-emotion").split(" "),N=1;N<T.length;N++)m[T[N]]=!0;x.push(b)});var h,p=[pj,vj];{var S,_=[oj,uj(function(b){S.insert(b)})],R=cj(p.concat(c,_)),U=function(T){return fi(lj(T),R)};h=function(T,N,H,z){S=H,U(T?T+"{"+N.styles+"}":N.styles),z&&(D.inserted[N.name]=!0)}}var D={key:d,sheet:new Y1({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 D.sheet.hydrate(x),D},wu={exports:{}},st={};/** @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 xj(){if(Bp)return st;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,x=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,_=i?Symbol.for("react.suspense"):60113,R=i?Symbol.for("react.suspense_list"):60120,U=i?Symbol.for("react.memo"):60115,D=i?Symbol.for("react.lazy"):60116,b=i?Symbol.for("react.block"):60121,T=i?Symbol.for("react.fundamental"):60117,N=i?Symbol.for("react.responder"):60118,H=i?Symbol.for("react.scope"):60119;function z(C){if(typeof C=="object"&&C!==null){var P=C.$$typeof;switch(P){case l:switch(C=C.type,C){case h:case p:case u:case m:case c:case _:return C;default:switch(C=C&&C.$$typeof,C){case x:case S:case D:case U:case v:return C;default:return P}}case d:return P}}}function j(C){return z(C)===p}return st.AsyncMode=h,st.ConcurrentMode=p,st.ContextConsumer=x,st.ContextProvider=v,st.Element=l,st.ForwardRef=S,st.Fragment=u,st.Lazy=D,st.Memo=U,st.Portal=d,st.Profiler=m,st.StrictMode=c,st.Suspense=_,st.isAsyncMode=function(C){return j(C)||z(C)===h},st.isConcurrentMode=j,st.isContextConsumer=function(C){return z(C)===x},st.isContextProvider=function(C){return z(C)===v},st.isElement=function(C){return typeof C=="object"&&C!==null&&C.$$typeof===l},st.isForwardRef=function(C){return z(C)===S},st.isFragment=function(C){return z(C)===u},st.isLazy=function(C){return z(C)===D},st.isMemo=function(C){return z(C)===U},st.isPortal=function(C){return z(C)===d},st.isProfiler=function(C){return z(C)===m},st.isStrictMode=function(C){return z(C)===c},st.isSuspense=function(C){return z(C)===_},st.isValidElementType=function(C){return typeof C=="string"||typeof C=="function"||C===u||C===p||C===m||C===c||C===_||C===R||typeof C=="object"&&C!==null&&(C.$$typeof===D||C.$$typeof===U||C.$$typeof===v||C.$$typeof===x||C.$$typeof===S||C.$$typeof===T||C.$$typeof===N||C.$$typeof===H||C.$$typeof===b)},st.typeOf=z,st}var $p;function jj(){return $p||($p=1,wu.exports=xj()),wu.exports}var ku,Fp;function Sj(){if(Fp)return ku;Fp=1;var i=jj(),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(D){return i.isMemo(D)?c:m[D.$$typeof]||l}var x=Object.defineProperty,h=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,S=Object.getOwnPropertyDescriptor,_=Object.getPrototypeOf,R=Object.prototype;function U(D,b,T){if(typeof b!="string"){if(R){var N=_(b);N&&N!==R&&U(D,N,T)}var H=h(b);p&&(H=H.concat(p(b)));for(var z=v(D),j=v(b),C=0;C<H.length;++C){var P=H[C];if(!d[P]&&!(T&&T[P])&&!(j&&j[P])&&!(z&&z[P])){var w=S(b,P);try{x(D,P,w)}catch{}}}}return D}return ku=U,ku}Sj();var Nj=!0;function Cj(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||Nj===!1)&&l.registered[c]===void 0&&(l.registered[c]=d.styles)},_j=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 Tj(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 Oj={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},Ej=/[A-Z]|^ms/g,zj=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Qv=function(l){return l.charCodeAt(1)===45},Pp=function(l){return l!=null&&typeof l!="boolean"},Du=dj(function(i){return Qv(i)?i:i.replace(Ej,"-$&").toLowerCase()}),Gp=function(l,d){switch(l){case"animation":case"animationName":if(typeof d=="string")return d.replace(zj,function(u,c,m){return Fa={name:c,styles:m,next:Fa},c})}return Oj[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 Fa={name:c.name,styles:c.styles,next:Fa},c.name;var m=d;if(m.styles!==void 0){var v=m.next;if(v!==void 0)for(;v!==void 0;)Fa={name:v.name,styles:v.styles,next:Fa},v=v.next;var x=m.styles+";";return x}return Mj(i,l,d)}case"function":{if(i!==void 0){var h=Fa,p=d(i);return Fa=h,bl(i,l,p)}break}}var S=d;return S}function Mj(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 x=v;Pp(x)&&(u+=Du(m)+":"+Gp(m,x)+";")}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,Fa;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="";Fa=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 x=1;x<i.length;x++)if(c+=bl(d,l,i[x]),u){var h=m;c+=h[x]}Yp.lastIndex=0;for(var p="",S;(S=Yp.exec(c))!==null;)p+="-"+S[1];var _=Tj(c)+p;return{name:_,styles:c,next:Fa}}var Aj=function(l){return l()},wj=jp.useInsertionEffect?jp.useInsertionEffect:!1,kj=wj||Aj,Jv=g.createContext(typeof HTMLElement<"u"?yj({key:"css"}):null);Jv.Provider;var Dj=function(l){return g.forwardRef(function(d,u){var c=g.useContext(Jv);return l(d,c,u)})},Rj=g.createContext({}),bd={}.hasOwnProperty,ld="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Uj=function(l,d){var u={};for(var c in d)bd.call(d,c)&&(u[c]=d[c]);return u[ld]=l,u},Lj=function(l){var d=l.cache,u=l.serialized,c=l.isStringTag;return Iv(d,u,c),kj(function(){return _j(d,u,c)}),null},qj=Dj(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=Cj(l.registered,m,i.className):i.className!=null&&(v=i.className+" ");var x=Zv(m,void 0,g.useContext(Rj));v+=l.key+"-"+x.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(Lj,{cache:l,serialized:x,isStringTag:typeof c=="string"}),g.createElement(c,h))}),Hj=qj,ke=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]=Hj,m[1]=Uj(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={}))})(ke||(ke={}));function yd(){for(var i=arguments.length,l=new Array(i),d=0;d<i;d++)l[d]=arguments[d];return Zv(l)}function Vj(){var i=yd.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 Bj(i,l){return l||(l=i.slice(0)),Object.freeze(Object.defineProperties(i,{raw:{value:Object.freeze(l)}}))}const $j=Math.min,Fj=Math.max,to=Math.round,qr=Math.floor,ao=i=>({x:i,y:i});function Pj(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 vn(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 vn(i).Node:!1}function Gj(i){return ho()?i instanceof Element||i instanceof vn(i).Element:!1}function xd(i){return ho()?i instanceof HTMLElement||i instanceof vn(i).HTMLElement:!1}function Xp(i){return!ho()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof vn(i).ShadowRoot}const Yj=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)&&!Yj.has(c)}function Xj(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ij=new Set(["html","body","#document"]);function Qj(i){return Ij.has(Kv(i))}function jd(i){return vn(i).getComputedStyle(i)}function Zj(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=Zj(i);return Qj(l)?i.ownerDocument?i.ownerDocument.body:i.body:xd(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=vn(c);if(m){const x=rd(v);return l.concat(v,v.visualViewport||[],tg(c)?c:[],x&&d?no(x):[])}return l.concat(c,no(c,[],d))}function rd(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function Jj(i){const l=jd(i);let d=parseFloat(l.width)||0,u=parseFloat(l.height)||0;const c=xd(i),m=c?i.offsetWidth:d,v=c?i.offsetHeight:u,x=to(d)!==m||to(u)!==v;return x&&(d=m,u=v),{width:d,height:u,$:x}}function Sd(i){return Gj(i)?i:i.contextElement}function Ip(i){const l=Sd(i);if(!xd(l))return ao(1);const d=l.getBoundingClientRect(),{width:u,height:c,$:m}=Jj(l);let v=(m?to(d.width):d.width)/u,x=(m?to(d.height):d.height)/c;return(!v||!Number.isFinite(v))&&(v=1),(!x||!Number.isFinite(x))&&(x=1),{x:v,y:x}}const Kj=ao(0);function Wj(i){const l=vn(i);return!Xj()||!l.visualViewport?Kj:{x:l.visualViewport.offsetLeft,y:l.visualViewport.offsetTop}}function e2(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 x=e2()?Wj(m):ao(0);let h=(c.left+x.x)/v.x,p=(c.top+x.y)/v.y,S=c.width/v.x,_=c.height/v.y;if(m){const R=vn(m),U=u;let D=R,b=rd(D);for(;b&&u&&U!==D;){const T=Ip(b),N=b.getBoundingClientRect(),H=jd(b),z=N.left+(b.clientLeft+parseFloat(H.paddingLeft))*T.x,j=N.top+(b.clientTop+parseFloat(H.paddingTop))*T.y;h*=T.x,p*=T.y,S*=T.x,_*=T.y,h+=z,p+=j,D=vn(b),b=rd(D)}}return Pj({width:S,height:_,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 t2(i,l){let d=null,u;const c=Wv(i);function m(){var x;clearTimeout(u),(x=d)==null||x.disconnect(),d=null}function v(x,h){x===void 0&&(x=!1),h===void 0&&(h=1),m();const p=i.getBoundingClientRect(),{left:S,top:_,width:R,height:U}=p;if(x||l(),!R||!U)return;const D=qr(_),b=qr(c.clientWidth-(S+R)),T=qr(c.clientHeight-(_+U)),N=qr(S),z={rootMargin:-D+"px "+-b+"px "+-T+"px "+-N+"px",threshold:Fj(0,$j(1,h))||1};let j=!0;function C(P){const w=P[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(C,{...z,root:c.ownerDocument})}catch{d=new IntersectionObserver(C,z)}d.observe(i)}return v(!0),m}function a2(i,l,d,u){u===void 0&&(u={});const{ancestorScroll:c=!0,ancestorResize:m=!0,elementResize:v=typeof ResizeObserver=="function",layoutShift:x=typeof IntersectionObserver=="function",animationFrame:h=!1}=u,p=Sd(i),S=c||m?[...p?no(p):[],...no(l)]:[];S.forEach(N=>{c&&N.addEventListener("scroll",d,{passive:!0}),m&&N.addEventListener("resize",d)});const _=p&&x?t2(p,d):null;let R=-1,U=null;v&&(U=new ResizeObserver(N=>{let[H]=N;H&&H.target===p&&U&&(U.unobserve(l),cancelAnimationFrame(R),R=requestAnimationFrame(()=>{var z;(z=U)==null||z.observe(l)})),d()}),p&&!h&&U.observe(p),U.observe(l));let D,b=h?Qp(i):null;h&&T();function T(){const N=Qp(i);b&&!ng(b,N)&&d(),b=N,D=requestAnimationFrame(T)}return d(),()=>{var N;S.forEach(H=>{c&&H.removeEventListener("scroll",d),m&&H.removeEventListener("resize",d)}),_==null||_(),(N=U)==null||N.disconnect(),U=null,h&&cancelAnimationFrame(D)}}var od=g.useLayoutEffect,n2=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],so=function(){};function s2(i,l){return l?l[0]==="-"?i+l:i+"__"+l:i}function i2(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(s2(i,v)));return m.filter(function(x){return x}).map(function(x){return String(x).trim()}).join(" ")}var Zp=function(l){return h2(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=gn(l,n2);return Re({},d)},St=function(l,d,u){var c=l.cx,m=l.getStyles,v=l.getClassNames,x=l.className;return{css:m(d,l),className:c(u??{},v(d,l),x)}};function po(i){return[document.documentElement,document.body,window].indexOf(i)>-1}function l2(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 r2(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 o2(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,x=0;function h(){x+=v;var p=o2(x,c,m,d);io(i,p),x<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 c2(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 u2(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var lg=!1,d2={get passive(){return lg=!0}},Vr=typeof window<"u"?window:{};Vr.addEventListener&&Vr.removeEventListener&&(Vr.addEventListener("p",so,d2),Vr.removeEventListener("p",so,!1));var f2=lg;function m2(i){return i!=null}function h2(i){return Array.isArray(i)}function Br(i,l,d){return i?l:d}var p2=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 x=hn(v,1),h=x[0];return!u.includes(h)});return m.reduce(function(v,x){var h=hn(x,2),p=h[0],S=h[1];return v[p]=S,v},{})},v2=["children","innerProps"],g2=["children","innerProps"];function b2(i){var l=i.maxHeight,d=i.menuEl,u=i.minHeight,c=i.placement,m=i.shouldScroll,v=i.isFixedPosition,x=i.controlHeight,h=r2(d),p={placement:"bottom",maxHeight:l};if(!d||!d.offsetParent)return p;var S=h.getBoundingClientRect(),_=S.height,R=d.getBoundingClientRect(),U=R.bottom,D=R.height,b=R.top,T=d.offsetParent.getBoundingClientRect(),N=T.top,H=v?window.innerHeight:l2(h),z=ig(h),j=parseInt(getComputedStyle(d).marginBottom,10),C=parseInt(getComputedStyle(d).marginTop,10),P=N-C,w=H-b,W=P+z,de=_-z-b,J=U-H+z+j,G=z+b-C,Y=160;switch(c){case"auto":case"bottom":if(w>=D)return{placement:"bottom",maxHeight:l};if(de>=D&&!v)return m&&Hr(h,J,Y),{placement:"bottom",maxHeight:l};if(!v&&de>=u||v&&w>=u){m&&Hr(h,J,Y);var re=v?w-j:de-j;return{placement:"bottom",maxHeight:re}}if(c==="auto"||v){var xe=l,je=v?P:W;return je>=u&&(xe=Math.min(je-j-x,l)),{placement:"top",maxHeight:xe}}if(c==="bottom")return m&&io(h,J),{placement:"bottom",maxHeight:l};break;case"top":if(P>=D)return{placement:"top",maxHeight:l};if(W>=D&&!v)return m&&Hr(h,G,Y),{placement:"top",maxHeight:l};if(!v&&W>=u||v&&P>=u){var $=l;return(!v&&W>=u||v&&P>=u)&&($=v?P-C:W-C),m&&Hr(h,G,Y),{placement:"top",maxHeight:$}}return{placement:"bottom",maxHeight:l};default:throw new Error('Invalid placement provided "'.concat(c,'".'))}return p}function y2(i){var l={bottom:"top",top:"bottom"};return i?l[i]:"bottom"}var rg=function(l){return l==="auto"?"bottom":l},x2=function(l,d){var u,c=l.placement,m=l.theme,v=m.borderRadius,x=m.spacing,h=m.colors;return Re((u={label:"menu"},ml(u,y2(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:x.menuGutter,marginTop:x.menuGutter})},og=g.createContext(null),j2=function(l){var d=l.children,u=l.minMenuHeight,c=l.maxMenuHeight,m=l.menuPlacement,v=l.menuPosition,x=l.menuShouldScrollIntoView,h=l.theme,p=g.useContext(og)||{},S=p.setPortalPlacement,_=g.useRef(null),R=g.useState(c),U=hn(R,2),D=U[0],b=U[1],T=g.useState(null),N=hn(T,2),H=N[0],z=N[1],j=h.spacing.controlHeight;return od(function(){var C=_.current;if(C){var P=v==="fixed",w=x&&!P,W=b2({maxHeight:c,menuEl:C,minHeight:u,placement:m,shouldScroll:w,isFixedPosition:P,controlHeight:j});b(W.maxHeight),z(W.placement),S==null||S(W.placement)}},[c,m,v,x,u,S,j]),d({ref:_,placerProps:Re(Re({},l),{},{placement:H||rg(m),maxHeight:D})})},S2=function(l){var d=l.children,u=l.innerRef,c=l.innerProps;return ke("div",Le({},St(l,"menu",{menu:!0}),{ref:u},c),d)},N2=S2,C2=function(l,d){var u=l.maxHeight,c=l.theme.spacing.baseUnit;return Re({maxHeight:u,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},d?{}:{paddingBottom:c,paddingTop:c})},_2=function(l){var d=l.children,u=l.innerProps,c=l.innerRef,m=l.isMulti;return ke("div",Le({},St(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 Re({textAlign:"center"},d?{}:{color:m.neutral40,padding:"".concat(c*2,"px ").concat(c*3,"px")})},T2=cg,O2=cg,E2=function(l){var d=l.children,u=d===void 0?"No options":d,c=l.innerProps,m=gn(l,v2);return ke("div",Le({},St(Re(Re({},m),{},{children:u,innerProps:c}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),c),u)},z2=function(l){var d=l.children,u=d===void 0?"Loading...":d,c=l.innerProps,m=gn(l,g2);return ke("div",Le({},St(Re(Re({},m),{},{children:u,innerProps:c}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),c),u)},M2=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}},A2=function(l){var d=l.appendTo,u=l.children,c=l.controlElement,m=l.innerProps,v=l.menuPlacement,x=l.menuPosition,h=g.useRef(null),p=g.useRef(null),S=g.useState(rg(v)),_=hn(S,2),R=_[0],U=_[1],D=g.useMemo(function(){return{setPortalPlacement:U}},[]),b=g.useState(null),T=hn(b,2),N=T[0],H=T[1],z=g.useCallback(function(){if(c){var w=c2(c),W=x==="fixed"?0:window.pageYOffset,de=w[R]+W;(de!==(N==null?void 0:N.offset)||w.left!==(N==null?void 0:N.rect.left)||w.width!==(N==null?void 0:N.rect.width))&&H({offset:de,rect:w})}},[c,x,R,N==null?void 0:N.offset,N==null?void 0:N.rect.left,N==null?void 0:N.rect.width]);od(function(){z()},[z]);var j=g.useCallback(function(){typeof p.current=="function"&&(p.current(),p.current=null),c&&h.current&&(p.current=a2(c,h.current,z,{elementResize:"ResizeObserver"in window}))},[c,z]);od(function(){j()},[j]);var C=g.useCallback(function(w){h.current=w,j()},[j]);if(!d&&x!=="fixed"||!N)return null;var P=ke("div",Le({ref:C},St(Re(Re({},l),{},{offset:N.offset,position:x,rect:N.rect}),"menuPortal",{"menu-portal":!0}),m),u);return ke(og.Provider,{value:D},d?Pt.createPortal(P,d):P)},w2=function(l){var d=l.isDisabled,u=l.isRtl;return{label:"container",direction:u?"rtl":void 0,pointerEvents:d?"none":void 0,position:"relative"}},k2=function(l){var d=l.children,u=l.innerProps,c=l.isDisabled,m=l.isRtl;return ke("div",Le({},St(l,"container",{"--is-disabled":c,"--is-rtl":m}),u),d)},D2=function(l,d){var u=l.theme.spacing,c=l.isMulti,m=l.hasValue,v=l.selectProps.controlShouldRenderValue;return Re({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")})},R2=function(l){var d=l.children,u=l.innerProps,c=l.isMulti,m=l.hasValue;return ke("div",Le({},St(l,"valueContainer",{"value-container":!0,"value-container--is-multi":c,"value-container--has-value":m}),u),d)},U2=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},L2=function(l){var d=l.children,u=l.innerProps;return ke("div",Le({},St(l,"indicatorsContainer",{indicators:!0}),u),d)},Wp,q2=["size"],H2=["innerProps","isRtl","size"],V2={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},ug=function(l){var d=l.size,u=gn(l,q2);return ke("svg",Le({height:d,width:d,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:V2},u))},Nd=function(l){return ke(ug,Le({size:20},l),ke("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 ke(ug,Le({size:20},l),ke("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 Re({label:"indicatorContainer",display:"flex",transition:"color 150ms"},d?{}:{color:u?v.neutral60:v.neutral20,padding:m*2,":hover":{color:u?v.neutral80:v.neutral40}})},B2=fg,$2=function(l){var d=l.children,u=l.innerProps;return ke("div",Le({},St(l,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),u),d||ke(dg,null))},F2=fg,P2=function(l){var d=l.children,u=l.innerProps;return ke("div",Le({},St(l,"clearIndicator",{indicator:!0,"clear-indicator":!0}),u),d||ke(Nd,null))},G2=function(l,d){var u=l.isDisabled,c=l.theme,m=c.spacing.baseUnit,v=c.colors;return Re({label:"indicatorSeparator",alignSelf:"stretch",width:1},d?{}:{backgroundColor:u?v.neutral10:v.neutral20,marginBottom:m*2,marginTop:m*2})},Y2=function(l){var d=l.innerProps;return ke("span",Le({},d,St(l,"indicatorSeparator",{"indicator-separator":!0})))},X2=Vj(Wp||(Wp=Bj([`
  0%, 80%, 100% { opacity: 0; }
  40% { opacity: 1; }
`]))),I2=function(l,d){var u=l.isFocused,c=l.size,m=l.theme,v=m.colors,x=m.spacing.baseUnit;return Re({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:x*2})},Ru=function(l){var d=l.delay,u=l.offset;return ke("span",{css:yd({animation:"".concat(X2," 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"},"","")})},Q2=function(l){var d=l.innerProps,u=l.isRtl,c=l.size,m=c===void 0?4:c,v=gn(l,H2);return ke("div",Le({},St(Re(Re({},v),{},{innerProps:d,isRtl:u,size:m}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),d),ke(Ru,{delay:0,offset:u}),ke(Ru,{delay:160,offset:!0}),ke(Ru,{delay:320,offset:!u}))},Z2=function(l,d){var u=l.isDisabled,c=l.isFocused,m=l.theme,v=m.colors,x=m.borderRadius,h=m.spacing;return Re({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:x,borderStyle:"solid",borderWidth:1,boxShadow:c?"0 0 0 1px ".concat(v.primary):void 0,"&:hover":{borderColor:c?v.primary:v.neutral30}})},J2=function(l){var d=l.children,u=l.isDisabled,c=l.isFocused,m=l.innerRef,v=l.innerProps,x=l.menuIsOpen;return ke("div",Le({ref:m},St(l,"control",{control:!0,"control--is-disabled":u,"control--is-focused":c,"control--menu-is-open":x}),v,{"aria-disabled":u||void 0}),d)},K2=J2,W2=["data"],eS=function(l,d){var u=l.theme.spacing;return d?{}:{paddingBottom:u.baseUnit*2,paddingTop:u.baseUnit*2}},tS=function(l){var d=l.children,u=l.cx,c=l.getStyles,m=l.getClassNames,v=l.Heading,x=l.headingProps,h=l.innerProps,p=l.label,S=l.theme,_=l.selectProps;return ke("div",Le({},St(l,"group",{group:!0}),h),ke(v,Le({},x,{selectProps:_,theme:S,getStyles:c,getClassNames:m,cx:u}),p),ke("div",null,d))},aS=function(l,d){var u=l.theme,c=u.colors,m=u.spacing;return Re({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"})},nS=function(l){var d=sg(l);d.data;var u=gn(d,W2);return ke("div",Le({},St(l,"groupHeading",{"group-heading":!0}),u))},sS=tS,iS=["innerRef","isDisabled","isHidden","inputClassName"],lS=function(l,d){var u=l.isDisabled,c=l.value,m=l.theme,v=m.spacing,x=m.colors;return Re(Re({visibility:u?"hidden":"visible",transform:c?"translateZ(0)":""},rS),d?{}:{margin:v.baseUnit/2,paddingBottom:v.baseUnit/2,paddingTop:v.baseUnit/2,color:x.neutral80})},mg={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},rS={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":Re({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},mg)},oS=function(l){return Re({label:"input",color:"inherit",background:0,opacity:l?0:1,width:"100%"},mg)},cS=function(l){var d=l.cx,u=l.value,c=sg(l),m=c.innerRef,v=c.isDisabled,x=c.isHidden,h=c.inputClassName,p=gn(c,iS);return ke("div",Le({},St(l,"input",{"input-container":!0}),{"data-value":u||""}),ke("input",Le({className:d({input:!0},h),ref:m,style:oS(x),disabled:v},p)))},uS=cS,dS=function(l,d){var u=l.theme,c=u.spacing,m=u.borderRadius,v=u.colors;return Re({label:"multiValue",display:"flex",minWidth:0},d?{}:{backgroundColor:v.neutral10,borderRadius:m/2,margin:c.baseUnit/2})},fS=function(l,d){var u=l.theme,c=u.borderRadius,m=u.colors,v=l.cropWithEllipsis;return Re({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})},mS=function(l,d){var u=l.theme,c=u.spacing,m=u.borderRadius,v=u.colors,x=l.isFocused;return Re({alignItems:"center",display:"flex"},d?{}:{borderRadius:m/2,backgroundColor:x?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 ke("div",u,d)},hS=hg,pS=hg;function vS(i){var l=i.children,d=i.innerProps;return ke("div",Le({role:"button"},d),l||ke(Nd,{size:14}))}var gS=function(l){var d=l.children,u=l.components,c=l.data,m=l.innerProps,v=l.isDisabled,x=l.removeProps,h=l.selectProps,p=u.Container,S=u.Label,_=u.Remove;return ke(p,{data:c,innerProps:Re(Re({},St(l,"multiValue",{"multi-value":!0,"multi-value--is-disabled":v})),m),selectProps:h},ke(S,{data:c,innerProps:Re({},St(l,"multiValueLabel",{"multi-value__label":!0})),selectProps:h},d),ke(_,{data:c,innerProps:Re(Re({},St(l,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(d||"option")},x),selectProps:h}))},bS=gS,yS=function(l,d){var u=l.isDisabled,c=l.isFocused,m=l.isSelected,v=l.theme,x=v.spacing,h=v.colors;return Re({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(x.baseUnit*2,"px ").concat(x.baseUnit*3,"px"),":active":{backgroundColor:u?void 0:m?h.primary:h.primary50}})},xS=function(l){var d=l.children,u=l.isDisabled,c=l.isFocused,m=l.isSelected,v=l.innerRef,x=l.innerProps;return ke("div",Le({},St(l,"option",{option:!0,"option--is-disabled":u,"option--is-focused":c,"option--is-selected":m}),{ref:v,"aria-disabled":u},x),d)},jS=xS,SS=function(l,d){var u=l.theme,c=u.spacing,m=u.colors;return Re({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},d?{}:{color:m.neutral50,marginLeft:c.baseUnit/2,marginRight:c.baseUnit/2})},NS=function(l){var d=l.children,u=l.innerProps;return ke("div",Le({},St(l,"placeholder",{placeholder:!0}),u),d)},CS=NS,_S=function(l,d){var u=l.isDisabled,c=l.theme,m=c.spacing,v=c.colors;return Re({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})},TS=function(l){var d=l.children,u=l.isDisabled,c=l.innerProps;return ke("div",Le({},St(l,"singleValue",{"single-value":!0,"single-value--is-disabled":u}),c),d)},OS=TS,ES={ClearIndicator:P2,Control:K2,DropdownIndicator:$2,DownChevron:dg,CrossIcon:Nd,Group:sS,GroupHeading:nS,IndicatorsContainer:L2,IndicatorSeparator:Y2,Input:uS,LoadingIndicator:Q2,Menu:N2,MenuList:_2,MenuPortal:A2,LoadingMessage:z2,NoOptionsMessage:E2,MultiValue:bS,MultiValueContainer:hS,MultiValueLabel:pS,MultiValueRemove:vS,Option:jS,Placeholder:CS,SelectContainer:k2,SingleValue:OS,ValueContainer:R2},zS=function(l){return Re(Re({},ES),l.components)},ev=Number.isNaN||function(l){return typeof l=="number"&&l!==l};function MS(i,l){return!!(i===l||ev(i)&&ev(l))}function AS(i,l){if(i.length!==l.length)return!1;for(var d=0;d<i.length;d++)if(!MS(i[d],l[d]))return!1;return!0}function wS(i,l){l===void 0&&(l=AS);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 kS={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"},DS=function(l){return ke("span",Le({css:kS},l))},tv=DS,RS={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,x=l.selectValue,h=l.isDisabled,p=l.isSelected,S=l.isAppleDevice,_=function(b,T){return b&&b.length?"".concat(b.indexOf(T)+1," of ").concat(b.length):""};if(d==="value"&&x)return"value ".concat(v," focused, ").concat(_(x,u),".");if(d==="menu"&&S){var R=h?" disabled":"",U="".concat(p?" selected":"").concat(R);return"".concat(v).concat(U,", ").concat(_(c,u),".")}return""},onFilter:function(l){var d=l.inputValue,u=l.resultsMessage;return"".concat(u).concat(d?" for search term "+d:"",".")}},US=function(l){var d=l.ariaSelection,u=l.focusedOption,c=l.focusedValue,m=l.focusableOptions,v=l.isFocused,x=l.selectValue,h=l.selectProps,p=l.id,S=l.isAppleDevice,_=h.ariaLiveMessages,R=h.getOptionLabel,U=h.inputValue,D=h.isMulti,b=h.isOptionDisabled,T=h.isSearchable,N=h.menuIsOpen,H=h.options,z=h.screenReaderStatus,j=h.tabSelectsValue,C=h.isLoading,P=h["aria-label"],w=h["aria-live"],W=g.useMemo(function(){return Re(Re({},RS),_||{})},[_]),de=g.useMemo(function(){var je="";if(d&&W.onChange){var $=d.option,se=d.options,ve=d.removedValue,Ce=d.removedValues,me=d.value,E=function(qe){return Array.isArray(qe)?null:qe},O=ve||$||E(me),ee=O?R(O):"",K=se||Ce||void 0,he=K?K.map(R):[],pe=Re({isDisabled:O&&b(O,x),label:ee,labels:he},d);je=W.onChange(pe)}return je},[d,W,b,x,R]),J=g.useMemo(function(){var je="",$=u||c,se=!!(u&&x&&x.includes(u));if($&&W.onFocus){var ve={focused:$,label:R($),isDisabled:b($,x),isSelected:se,options:m,context:$===u?"menu":"value",selectValue:x,isAppleDevice:S};je=W.onFocus(ve)}return je},[u,c,R,b,W,m,x,S]),G=g.useMemo(function(){var je="";if(N&&H.length&&!C&&W.onFilter){var $=z({count:m.length});je=W.onFilter({inputValue:U,resultsMessage:$})}return je},[m,U,N,W,H,z,C]),Y=(d==null?void 0:d.action)==="initial-input-focus",re=g.useMemo(function(){var je="";if(W.guidance){var $=c?"value":N?"menu":"input";je=W.guidance({"aria-label":P,context:$,isDisabled:u&&b(u,x),isMulti:D,isSearchable:T,tabSelectsValue:j,isInitialFocus:Y})}return je},[P,u,c,D,b,T,N,W,x,j,Y]),xe=ke(g.Fragment,null,ke("span",{id:"aria-selection"},de),ke("span",{id:"aria-focused"},J),ke("span",{id:"aria-results"},G),ke("span",{id:"aria-guidance"},re));return ke(g.Fragment,null,ke(tv,{id:p},Y&&xe),ke(tv,{"aria-live":w,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},v&&!Y&&xe))},LS=US,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ⓩｚźẑżžẓẕƶȥɀⱬꝣ"}],qS=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(qS,function(d){return pg[d]})},HS=wS(vg),av=function(l){return l.replace(/^\s+|\s+$/g,"")},VS=function(l){return"".concat(l.label," ").concat(l.value)},BS=function(l){return function(d,u){if(d.data.__isNew__)return!0;var c=Re({ignoreCase:!0,ignoreAccents:!0,stringify:VS,trim:!0,matchFrom:"any"},l),m=c.ignoreCase,v=c.ignoreAccents,x=c.stringify,h=c.trim,p=c.matchFrom,S=h?av(u):u,_=h?av(x(d)):x(d);return m&&(S=S.toLowerCase(),_=_.toLowerCase()),v&&(S=HS(S),_=vg(_)),p==="start"?_.substr(0,S.length)===S:_.indexOf(S)>-1}},$S=["innerRef"];function FS(i){var l=i.innerRef,d=gn(i,$S),u=p2(d,"onExited","in","enter","exit","appear");return ke("input",Le({ref:l},u,{css:yd({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 PS=function(l){l.cancelable&&l.preventDefault(),l.stopPropagation()};function GS(i){var l=i.isEnabled,d=i.onBottomArrive,u=i.onBottomLeave,c=i.onTopArrive,m=i.onTopLeave,v=g.useRef(!1),x=g.useRef(!1),h=g.useRef(0),p=g.useRef(null),S=g.useCallback(function(T,N){if(p.current!==null){var H=p.current,z=H.scrollTop,j=H.scrollHeight,C=H.clientHeight,P=p.current,w=N>0,W=j-C-z,de=!1;W>N&&v.current&&(u&&u(T),v.current=!1),w&&x.current&&(m&&m(T),x.current=!1),w&&N>W?(d&&!v.current&&d(T),P.scrollTop=j,de=!0,v.current=!0):!w&&-N>z&&(c&&!x.current&&c(T),P.scrollTop=0,de=!0,x.current=!0),de&&PS(T)}},[d,u,c,m]),_=g.useCallback(function(T){S(T,T.deltaY)},[S]),R=g.useCallback(function(T){h.current=T.changedTouches[0].clientY},[]),U=g.useCallback(function(T){var N=h.current-T.changedTouches[0].clientY;S(T,N)},[S]),D=g.useCallback(function(T){if(T){var N=f2?{passive:!1}:!1;T.addEventListener("wheel",_,N),T.addEventListener("touchstart",R,N),T.addEventListener("touchmove",U,N)}},[U,R,_]),b=g.useCallback(function(T){T&&(T.removeEventListener("wheel",_,!1),T.removeEventListener("touchstart",R,!1),T.removeEventListener("touchmove",U,!1))},[U,R,_]);return g.useEffect(function(){if(l){var T=p.current;return D(T),function(){b(T)}}},[l,D,b]),function(T){p.current=T}}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 YS(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(D){var b=S&&S[D];c.current[D]=b}),u&&ul<1){var _=parseInt(c.current.paddingRight,10)||0,R=document.body?document.body.clientWidth:0,U=window.innerWidth-R+_||0;Object.keys(sv).forEach(function(D){var b=sv[D];S&&(S[D]=b)}),S&&(S.paddingRight="".concat(U,"px"))}p&&ov()&&(p.addEventListener("touchmove",iv,oi),h&&(h.addEventListener("touchstart",rv,oi),h.addEventListener("touchmove",lv,oi))),ul+=1}},[u]),x=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(_){var R=c.current[_];S&&(S[_]=R)}),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(){x(h)}}},[l,v,x]),function(h){m.current=h}}var XS=function(l){var d=l.target;return d.ownerDocument.activeElement&&d.ownerDocument.activeElement.blur()},IS={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function QS(i){var l=i.children,d=i.lockEnabled,u=i.captureEnabled,c=u===void 0?!0:u,m=i.onBottomArrive,v=i.onBottomLeave,x=i.onTopArrive,h=i.onTopLeave,p=GS({isEnabled:c,onBottomArrive:m,onBottomLeave:v,onTopArrive:x,onTopLeave:h}),S=YS({isEnabled:d}),_=function(U){p(U),S(U)};return ke(g.Fragment,null,d&&ke("div",{onClick:XS,css:IS}),l(_))}var ZS={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},JS=function(l){var d=l.name,u=l.onFocus;return ke("input",{required:!0,name:d,tabIndex:-1,"aria-hidden":"true",onFocus:u,css:ZS,value:"",onChange:function(){}})},KS=JS;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 WS(){return Cd(/^iPhone/i)}function gg(){return Cd(/^Mac/i)}function eN(){return Cd(/^iPad/i)||gg()&&navigator.maxTouchPoints>1}function tN(){return WS()||eN()}function aN(){return gg()||tN()}var nN=function(l){return l.label},sN=function(l){return l.label},iN=function(l){return l.value},lN=function(l){return!!l.isDisabled},rN={clearIndicator:F2,container:w2,control:Z2,dropdownIndicator:B2,group:eS,groupHeading:aS,indicatorsContainer:U2,indicatorSeparator:G2,input:lS,loadingIndicator:I2,loadingMessage:O2,menu:x2,menuList:C2,menuPortal:M2,multiValue:dS,multiValueLabel:fS,multiValueRemove:mS,noOptionsMessage:T2,option:yS,placeholder:SS,singleValue:_S,valueContainer:D2},oN={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%)"},cN=4,bg=4,uN=38,dN=bg*2,fN={baseUnit:bg,controlHeight:uN,menuGutter:dN},Hu={borderRadius:cN,colors:oN,spacing:fN},mN={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:Kp(),captureMenuScroll:!Kp(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:BS(),formatGroupLabel:nN,getOptionLabel:sN,getOptionValue:iN,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:lN,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!u2(),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=xg(i,l),x=lo(i,l);return{type:"option",data:l,isDisabled:c,isSelected:m,label:v,value:x,index:u}}function Jr(i,l){return i.options.map(function(d,u){if("options"in d){var c=d.options.map(function(v,x){return uv(i,v,l,x)}).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(m2)}function yg(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 hN(i,l){return yg(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,x=l.value;return(!Cg(i)||!m)&&Ng(i,{label:v,value:x,data:c},u)}function pN(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 vN(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},xg=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},gN=1,_g=(function(i){L1(d,i);var l=V1(d);function d(u){var c;if(R1(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,_=S.onChange,R=S.name;p.name=R,c.ariaOnChange(h,p),_(h,p)},c.setValue=function(h,p,S){var _=c.props,R=_.closeMenuOnSelect,U=_.isMulti,D=_.inputValue;c.onInputChange("",{action:"set-value",prevInputValue:D}),R&&(c.setState({inputIsHiddenAfterUpdate:!U}),c.onMenuClose()),c.setState({clearFocusValueOnUpdate:!0}),c.onChange(h,{action:p,option:S})},c.selectOption=function(h){var p=c.props,S=p.blurInputOnSelect,_=p.isMulti,R=p.name,U=c.state.selectValue,D=_&&c.isOptionSelected(h,U),b=c.isOptionDisabled(h,U);if(D){var T=c.getOptionValue(h);c.setValue(U.filter(function(N){return c.getOptionValue(N)!==T}),"deselect-option",h)}else if(!b)_?c.setValue([].concat(hd(U),[h]),"select-option",h):c.setValue(h,"select-option");else{c.ariaOnChange(h,{action:"select-option",option:h,name:R});return}S&&c.blurInput()},c.removeValue=function(h){var p=c.props.isMulti,S=c.state.selectValue,_=c.getOptionValue(h),R=S.filter(function(D){return c.getOptionValue(D)!==_}),U=Br(p,R,R[0]||null);c.onChange(U,{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],_=p.slice(0,p.length-1),R=Br(h,_,_[0]||null);S&&c.onChange(R,{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 i2.apply(void 0,[c.props.classNamePrefix].concat(p))},c.getOptionLabel=function(h){return xg(c.props,h)},c.getOptionValue=function(h){return lo(c.props,h)},c.getStyles=function(h,p){var S=c.props.unstyled,_=rN[h](p,S);_.boxSizing="border-box";var R=c.props.styles[h];return R?R(_,p):_},c.getClassNames=function(h,p){var S,_;return(S=(_=c.props.classNames)[h])===null||S===void 0?void 0:S.call(_,p)},c.getElementId=function(h){return"".concat(c.state.instancePrefix,"-").concat(h)},c.getComponents=function(){return zS(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 yg(c.buildCategorizedOptions())},c.getFocusableOptions=function(){return c.props.menuIsOpen?c.buildFocusableOptions():[]},c.ariaOnChange=function(h,p){c.setState({ariaSelection:Re({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,_=p.menuIsOpen;c.focusInput(),_?(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 _=Math.abs(S.clientX-c.initialTouchX),R=Math.abs(S.clientY-c.initialTouchY),U=5;c.userIsDragging=_>U||R>U}},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,_=p.backspaceRemovesValue,R=p.escapeClearsValue,U=p.inputValue,D=p.isClearable,b=p.isDisabled,T=p.menuIsOpen,N=p.onKeyDown,H=p.tabSelectsValue,z=p.openMenuOnFocus,j=c.state,C=j.focusedOption,P=j.focusedValue,w=j.selectValue;if(!b&&!(typeof N=="function"&&(N(h),h.defaultPrevented))){switch(c.blockOptionHover=!0,h.key){case"ArrowLeft":if(!S||U)return;c.focusValue("previous");break;case"ArrowRight":if(!S||U)return;c.focusValue("next");break;case"Delete":case"Backspace":if(U)return;if(P)c.removeValue(P);else{if(!_)return;S?c.popValue():D&&c.clearValue()}break;case"Tab":if(c.isComposing||h.shiftKey||!T||!H||!C||z&&c.isOptionSelected(C,w))return;c.selectOption(C);break;case"Enter":if(h.keyCode===229)break;if(T){if(!C||c.isComposing)return;c.selectOption(C);break}return;case"Escape":T?(c.setState({inputIsHiddenAfterUpdate:!1}),c.onInputChange("",{action:"menu-close",prevInputValue:U}),c.onMenuClose()):D&&R&&c.clearValue();break;case" ":if(U)return;if(!T){c.openMenu("first");break}if(!C)return;c.selectOption(C);break;case"ArrowUp":T?c.focusOption("up"):c.openMenu("last");break;case"ArrowDown":T?c.focusOption("down"):c.openMenu("first");break;case"PageUp":if(!T)return;c.focusOption("pageup");break;case"PageDown":if(!T)return;c.focusOption("pagedown");break;case"Home":if(!T)return;c.focusOption("first");break;case"End":if(!T)return;c.focusOption("last");break;default:return}h.preventDefault()}},c.state.instancePrefix="react-select-"+(c.props.instanceId||++gN),c.state.selectValue=Zp(u.value),u.menuIsOpen&&c.state.selectValue.length){var m=c.getFocusableOptionsWithIds(),v=c.buildFocusableOptions(),x=v.indexOf(c.state.selectValue[0]);c.state.focusableOptionsWithIds=m,c.state.focusedOption=v[x],c.state.focusedOptionId=Vu(m,v[x])}return c}return U1(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),aN()&&this.setState({isAppleDevice:!0})}},{key:"componentDidUpdate",value:function(c){var m=this.props,v=m.isDisabled,x=m.menuIsOpen,h=this.state.isFocused;(h&&!v&&c.isDisabled||h&&x&&!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,x=v.selectValue,h=v.isFocused,p=this.buildFocusableOptions(),S=c==="first"?0:p.length-1;if(!this.props.isMulti){var _=p.indexOf(x[0]);_>-1&&(S=_)}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,x=m.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var h=v.indexOf(x);x||(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,x=this.getFocusableOptions();if(x.length){var h=0,p=x.indexOf(v);v||(p=-1),c==="up"?h=p>0?p-1:x.length-1:c==="down"?h=(p+1)%x.length:c==="pageup"?(h=p-m,h<0&&(h=0)):c==="pagedown"?(h=p+m,h>x.length-1&&(h=x.length-1)):c==="last"&&(h=x.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:x[h],focusedValue:null,focusedOptionId:this.getFocusedOptionId(x[h])})}}},{key:"getTheme",value:(function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(Hu):Re(Re({},Hu),this.props.theme):Hu})},{key:"getCommonProps",value:function(){var c=this.clearValue,m=this.cx,v=this.getStyles,x=this.getClassNames,h=this.getValue,p=this.selectOption,S=this.setValue,_=this.props,R=_.isMulti,U=_.isRtl,D=_.options,b=this.hasValue();return{clearValue:c,cx:m,getStyles:v,getClassNames:x,getValue:h,hasValue:b,isMulti:R,isRtl:U,options:D,selectOption:p,selectProps:_,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,x=this.state.selectValue;return this.props.formatOptionLabel(c,{context:m,inputValue:v,selectValue:x})}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,x=c.inputId,h=c.inputValue,p=c.tabIndex,S=c.form,_=c.menuIsOpen,R=c.required,U=this.getComponents(),D=U.Input,b=this.state,T=b.inputIsHidden,N=b.ariaSelection,H=this.commonProps,z=x||this.getElementId("input"),j=Re(Re(Re({"aria-autocomplete":"list","aria-expanded":_,"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":R,role:"combobox","aria-activedescendant":this.state.isAppleDevice?void 0:this.state.focusedOptionId||""},_&&{"aria-controls":this.getElementId("listbox")}),!v&&{"aria-readonly":!0}),this.hasValue()?(N==null?void 0:N.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return v?g.createElement(D,Le({},H,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:z,innerRef:this.getInputRef,isDisabled:m,isHidden:T,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:p,form:S,type:"text",value:h},j)):g.createElement(FS,Le({id:z,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,x=m.MultiValueContainer,h=m.MultiValueLabel,p=m.MultiValueRemove,S=m.SingleValue,_=m.Placeholder,R=this.commonProps,U=this.props,D=U.controlShouldRenderValue,b=U.isDisabled,T=U.isMulti,N=U.inputValue,H=U.placeholder,z=this.state,j=z.selectValue,C=z.focusedValue,P=z.isFocused;if(!this.hasValue()||!D)return N?null:g.createElement(_,Le({},R,{key:"placeholder",isDisabled:b,isFocused:P,innerProps:{id:this.getElementId("placeholder")}}),H);if(T)return j.map(function(W,de){var J=W===C,G="".concat(c.getOptionLabel(W),"-").concat(c.getOptionValue(W));return g.createElement(v,Le({},R,{components:{Container:x,Label:h,Remove:p},isFocused:J,isDisabled:b,key:G,index:de,removeProps:{onClick:function(){return c.removeValue(W)},onTouchEnd:function(){return c.removeValue(W)},onMouseDown:function(re){re.preventDefault()}},data:W}),c.formatOptionLabel(W,"value"))});if(N)return null;var w=j[0];return g.createElement(S,Le({},R,{data:w,isDisabled:b}),this.formatOptionLabel(w,"value"))}},{key:"renderClearIndicator",value:function(){var c=this.getComponents(),m=c.ClearIndicator,v=this.commonProps,x=this.props,h=x.isDisabled,p=x.isLoading,S=this.state.isFocused;if(!this.isClearable()||!m||h||!this.hasValue()||p)return null;var _={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return g.createElement(m,Le({},v,{innerProps:_,isFocused:S}))}},{key:"renderLoadingIndicator",value:function(){var c=this.getComponents(),m=c.LoadingIndicator,v=this.commonProps,x=this.props,h=x.isDisabled,p=x.isLoading,S=this.state.isFocused;if(!m||!p)return null;var _={"aria-hidden":"true"};return g.createElement(m,Le({},v,{innerProps:_,isDisabled:h,isFocused:S}))}},{key:"renderIndicatorSeparator",value:function(){var c=this.getComponents(),m=c.DropdownIndicator,v=c.IndicatorSeparator;if(!m||!v)return null;var x=this.commonProps,h=this.props.isDisabled,p=this.state.isFocused;return g.createElement(v,Le({},x,{isDisabled:h,isFocused:p}))}},{key:"renderDropdownIndicator",value:function(){var c=this.getComponents(),m=c.DropdownIndicator;if(!m)return null;var v=this.commonProps,x=this.props.isDisabled,h=this.state.isFocused,p={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return g.createElement(m,Le({},v,{innerProps:p,isDisabled:x,isFocused:h}))}},{key:"renderMenu",value:function(){var c=this,m=this.getComponents(),v=m.Group,x=m.GroupHeading,h=m.Menu,p=m.MenuList,S=m.MenuPortal,_=m.LoadingMessage,R=m.NoOptionsMessage,U=m.Option,D=this.commonProps,b=this.state.focusedOption,T=this.props,N=T.captureMenuScroll,H=T.inputValue,z=T.isLoading,j=T.loadingMessage,C=T.minMenuHeight,P=T.maxMenuHeight,w=T.menuIsOpen,W=T.menuPlacement,de=T.menuPosition,J=T.menuPortalTarget,G=T.menuShouldBlockScroll,Y=T.menuShouldScrollIntoView,re=T.noOptionsMessage,xe=T.onMenuScrollToTop,je=T.onMenuScrollToBottom;if(!w)return null;var $=function(ee,K){var he=ee.type,pe=ee.data,Se=ee.isDisabled,qe=ee.isSelected,De=ee.label,ne=ee.value,Q=b===pe,fe=Se?void 0:function(){return c.onOptionHover(pe)},q=Se?void 0:function(){return c.selectOption(pe)},ce="".concat(c.getElementId("option"),"-").concat(K),Ne={id:ce,onClick:q,onMouseMove:fe,onMouseOver:fe,tabIndex:-1,role:"option","aria-selected":c.state.isAppleDevice?void 0:qe};return g.createElement(U,Le({},D,{innerProps:Ne,data:pe,isDisabled:Se,isSelected:qe,key:ce,label:De,type:he,value:ne,isFocused:Q,innerRef:Q?c.getFocusedOptionRef:void 0}),c.formatOptionLabel(ee.data,"menu"))},se;if(this.hasOptions())se=this.getCategorizedOptions().map(function(O){if(O.type==="group"){var ee=O.data,K=O.options,he=O.index,pe="".concat(c.getElementId("group"),"-").concat(he),Se="".concat(pe,"-heading");return g.createElement(v,Le({},D,{key:pe,data:ee,options:K,Heading:x,headingProps:{id:Se,data:O.data},label:c.formatGroupLabel(O.data)}),O.options.map(function(qe){return $(qe,"".concat(he,"-").concat(qe.index))}))}else if(O.type==="option")return $(O,"".concat(O.index))});else if(z){var ve=j({inputValue:H});if(ve===null)return null;se=g.createElement(_,D,ve)}else{var Ce=re({inputValue:H});if(Ce===null)return null;se=g.createElement(R,D,Ce)}var me={minMenuHeight:C,maxMenuHeight:P,menuPlacement:W,menuPosition:de,menuShouldScrollIntoView:Y},E=g.createElement(j2,Le({},D,me),function(O){var ee=O.ref,K=O.placerProps,he=K.placement,pe=K.maxHeight;return g.createElement(h,Le({},D,me,{innerRef:ee,innerProps:{onMouseDown:c.onMenuMouseDown,onMouseMove:c.onMenuMouseMove},isLoading:z,placement:he}),g.createElement(QS,{captureEnabled:N,onTopArrive:xe,onBottomArrive:je,lockEnabled:G},function(Se){return g.createElement(p,Le({},D,{innerRef:function(De){c.getMenuListRef(De),Se(De)},innerProps:{role:"listbox","aria-multiselectable":D.isMulti,id:c.getElementId("listbox")},isLoading:z,maxHeight:pe,focusedOption:b}),se)}))});return J||de==="fixed"?g.createElement(S,Le({},D,{appendTo:J,controlElement:this.controlRef,menuPlacement:W,menuPosition:de}),E):E}},{key:"renderFormField",value:function(){var c=this,m=this.props,v=m.delimiter,x=m.isDisabled,h=m.isMulti,p=m.name,S=m.required,_=this.state.selectValue;if(S&&!this.hasValue()&&!x)return g.createElement(KS,{name:p,onFocus:this.onValueInputFocus});if(!(!p||x))if(h)if(v){var R=_.map(function(b){return c.getOptionValue(b)}).join(v);return g.createElement("input",{name:p,type:"hidden",value:R})}else{var U=_.length>0?_.map(function(b,T){return g.createElement("input",{key:"i-".concat(T),name:p,type:"hidden",value:c.getOptionValue(b)})}):g.createElement("input",{name:p,type:"hidden",value:""});return g.createElement("div",null,U)}else{var D=_[0]?this.getOptionValue(_[0]):"";return g.createElement("input",{name:p,type:"hidden",value:D})}}},{key:"renderLiveRegion",value:function(){var c=this.commonProps,m=this.state,v=m.ariaSelection,x=m.focusedOption,h=m.focusedValue,p=m.isFocused,S=m.selectValue,_=this.getFocusableOptions();return g.createElement(LS,Le({},c,{id:this.getElementId("live-region"),ariaSelection:v,focusedOption:x,focusedValue:h,isFocused:p,selectValue:S,focusableOptions:_,isAppleDevice:this.state.isAppleDevice}))}},{key:"render",value:function(){var c=this.getComponents(),m=c.Control,v=c.IndicatorsContainer,x=c.SelectContainer,h=c.ValueContainer,p=this.props,S=p.className,_=p.id,R=p.isDisabled,U=p.menuIsOpen,D=this.state.isFocused,b=this.commonProps=this.getCommonProps();return g.createElement(x,Le({},b,{className:S,innerProps:{id:_,onKeyDown:this.onKeyDown},isDisabled:R,isFocused:D}),this.renderLiveRegion(),g.createElement(m,Le({},b,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:R,isFocused:D,menuIsOpen:U}),g.createElement(h,Le({},b,{isDisabled:R}),this.renderPlaceholderOrValue(),this.renderInput()),g.createElement(v,Le({},b,{isDisabled:R}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(c,m){var v=m.prevProps,x=m.clearFocusValueOnUpdate,h=m.inputIsHiddenAfterUpdate,p=m.ariaSelection,S=m.isFocused,_=m.prevWasFocused,R=m.instancePrefix,U=c.options,D=c.value,b=c.menuIsOpen,T=c.inputValue,N=c.isMulti,H=Zp(D),z={};if(v&&(D!==v.value||U!==v.options||b!==v.menuIsOpen||T!==v.inputValue)){var j=b?hN(c,H):[],C=b?dv(Jr(c,H),"".concat(R,"-option")):[],P=x?pN(m,H):null,w=vN(m,j),W=Vu(C,w);z={selectValue:H,focusedOption:w,focusedOptionId:W,focusableOptionsWithIds:C,focusedValue:P,clearFocusValueOnUpdate:!1}}var de=h!=null&&c!==v?{inputIsHidden:h,inputIsHiddenAfterUpdate:void 0}:{},J=p,G=S&&_;return S&&!G&&(J={value:Br(N,H,H[0]||null),options:H,action:"initial-input-focus"},G=!_),(p==null?void 0:p.action)==="initial-input-focus"&&(J=null),Re(Re(Re({},z),de),{},{prevProps:c,ariaSelection:J,prevWasFocused:G})}}]),d})(g.Component);_g.defaultProps=mN;var bN=g.forwardRef(function(i,l){var d=D1(i);return g.createElement(_g,Le({ref:l},d))}),bt=bN;const ms=()=>Pe.getApiUrl(),yN=["kg","g","pza","bolsa","paquete","litro","ml"],Bu=yN.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 xN(){const[i,l]=g.useState([]),[d,u]=g.useState([]),[c,m]=g.useState([]),[v,x]=g.useState(""),[h,p]=g.useState(""),[S,_]=g.useState(!1),[R,U]=g.useState(null),[D,b]=g.useState(!0),[T,N]=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,productos_salida:!1,produccion_directa:!1}),[H,z]=g.useState(!1),[j,C]=g.useState(null),[P,w]=g.useState([]),[W,de]=g.useState([]),[J,G]=g.useState(!1),Y=c.map(q=>({value:q.id,label:q.nombre})),re=d.map(q=>({value:q.id,label:`${q.nombre} (${q.unidad})`,unidad:q.unidad})),xe=i.filter(q=>q.id!==(j==null?void 0:j.id)).map(q=>({value:q.id,label:`${q.nombre} ($${q.precio})`,unidad:q.unidad,precio:q.precio}));g.useEffect(()=>{je(),$(),se()},[]);const je=async()=>{try{const ce=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductos"})})).json();ce.success?l(ce.data||[]):A.error(ce.message||"Error al cargar productos")}catch{A.error("Error de conexion con el servidor")}finally{b(!1)}},$=async()=>{try{const ce=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCategoriasProductos"})})).json();ce.success&&m(ce.data||[])}catch(q){console.error("Error al cargar categorias:",q)}},se=async()=>{try{const ce=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientes"})})).json();ce.success&&u(ce.data||[])}catch(q){console.error("Error al cargar ingredientes:",q)}},ve=i.filter(q=>{const ce=q.nombre.toLowerCase().includes(v.toLowerCase())||q.codigo&&q.codigo.toLowerCase().includes(v.toLowerCase())||q.descripcion&&q.descripcion.toLowerCase().includes(v.toLowerCase()),Ne=!h||q.categoria_id===h;return ce&&Ne}),Ce=(q=null)=>{q?(U(q),N({nombre:q.nombre,descripcion:q.descripcion||"",precio:q.precio,categoria_id:q.categoria_id||"",unidad:q.unidad||"pza",stock:q.stock,stockMinimo:q.stockMinimo,codigo:q.codigo||"",envasado_origen:q.envasado_origen===1||q.envasado_origen===!0,contabilizar_corte:q.contabilizar_corte===1||q.contabilizar_corte===!0||q.contabilizar_corte===void 0,contar_al_inicio:q.contar_al_inicio===1||q.contar_al_inicio===!0,no_venta:q.no_venta===1||q.no_venta===!0,no_descuento_inventario:q.no_descuento_inventario===1||q.no_descuento_inventario===!0,productos_salida:q.productos_salida===1||q.productos_salida===!0,produccion_directa:q.produccion_directa===1||q.produccion_directa===!0})):(U(null),N({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,productos_salida:!1,produccion_directa:!1})),_(!0)},me=()=>{_(!1),U(null)},E=q=>{const{name:ce,value:Ne}=q.target;N(Be=>({...Be,[ce]:Ne}))},O=async q=>{q.preventDefault();const ce={tipo:R?"actualizarProducto":"crearProducto",...T,precio:parseFloat(T.precio)||0,stock:parseFloat(T.stock)||0,stockMinimo:parseFloat(T.stockMinimo)||0,categoria_id:T.categoria_id||null,envasado_origen:T.envasado_origen?1:0,contabilizar_corte:T.contabilizar_corte?1:0,contar_al_inicio:T.contar_al_inicio?1:0,no_venta:T.no_venta?1:0,no_descuento_inventario:T.no_descuento_inventario?1:0,productos_salida:T.productos_salida?1:0,produccion_directa:T.produccion_directa?1:0};R&&(ce.id=R.id);try{const Be=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ce)})).json();Be.success?(A.success(R?"Producto actualizado correctamente":"Producto creado correctamente"),je(),me()):A.error(Be.message||"Error al guardar producto")}catch{A.error("Error de conexion con el servidor")}},ee=q=>{const ce=i.find(Ne=>Ne.id===q);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar "',ce==null?void 0:ce.nombre,'"?']}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const Be=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarProducto",id:q})})).json();Be.success?(A.dismiss(),A.success("Producto eliminado"),je()):A.error(Be.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})},K=async q=>{C(q),G(!0),z(!0);try{const Ne=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getReceta",producto_id:q.id})})).json();Ne.success?(w(Ne.data.ingredientes||[]),de(Ne.data.componentes||[])):(w([]),de([]))}catch{A.error("Error al cargar receta"),w([]),de([])}finally{G(!1)}},he=()=>{z(!1),C(null),w([]),de([])},pe=()=>{w([...P,{ingrediente_id:"",nombre:"",cantidad:1,unidad:"pza"}])},Se=(q,ce,Ne)=>{const Be=[...P];Be[q][ce]=Ne,w(Be)},qe=q=>{w(P.filter((ce,Ne)=>Ne!==q))},De=()=>{de([...W,{componente_id:"",nombre:"",cantidad:1,unidad:"pza"}])},ne=(q,ce,Ne)=>{const Be=[...W];Be[q][ce]=Ne,de(Be)},Q=q=>{de(W.filter((ce,Ne)=>Ne!==q))},fe=async()=>{const q=P.filter(Ne=>Ne.ingrediente_id&&Ne.cantidad>0),ce=W.filter(Ne=>Ne.componente_id&&Ne.cantidad>0);try{const Be=await(await fetch(ms(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"guardarReceta",producto_id:j.id,ingredientes:q,componentes:ce})})).json();Be.success?(A.success("Receta guardada correctamente"),je(),he()):A.error(Be.message||"Error al guardar receta")}catch{A.error("Error de conexion")}};return D?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:()=>Ce(),children:[a.jsx(ra,{size:20}),"Nuevo Producto"]})]}),a.jsxs("div",{className:"productos-filtros",children:[a.jsxs("div",{className:"search-box",children:[a.jsx(ba,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por nombre, codigo o descripcion...",value:v,onChange:q=>x(q.target.value)})]}),a.jsx(bt,{value:h?Y.find(q=>q.value===h):null,onChange:q=>p(q?q.value:""),options:Y,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:ve.map(q=>a.jsxs("tr",{className:q.stock<=q.stockMinimo?"stock-bajo":"",children:[a.jsx("td",{children:a.jsxs("div",{className:"producto-nombre",children:[a.jsxs("strong",{children:[q.nombre,q.tiene_receta===1&&a.jsx("span",{className:"receta-badge",title:"Tiene receta",children:a.jsx(mi,{size:12})})]}),q.descripcion&&a.jsx("small",{children:q.descripcion})]})}),a.jsx("td",{children:q.categoria&&a.jsx("span",{className:"categoria-badge",children:q.categoria})}),a.jsxs("td",{children:["$",Number(q.precio).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]}),a.jsx("td",{children:q.unidad}),a.jsx("td",{children:q.stock}),a.jsx("td",{children:q.stockMinimo}),a.jsx("td",{children:q.codigo||"-"}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon btn-receta",onClick:()=>K(q),title:"Receta",children:a.jsx(mi,{size:14})}),a.jsx("button",{className:"btn-icon",onClick:()=>Ce(q),title:"Editar",children:a.jsx(xs,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>ee(q.id),title:"Eliminar",children:a.jsx(Qt,{size:14})})]})]},q.id))})]}),ve.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron productos"})]}),S&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-productos",onClick:me,children:a.jsxs("div",{className:"modal-productos",onClick:q=>q.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:R?"Editar Producto":"Nuevo Producto"}),a.jsx("button",{className:"btn-close",onClick:me,children:a.jsx(rt,{size:18})})]}),a.jsxs("form",{onSubmit:O,children:[a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Nombre *"}),a.jsx("input",{type:"text",name:"nombre",value:T.nombre,onChange:E,required:!0})]}),a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Descripcion"}),a.jsx("input",{type:"text",name:"descripcion",value:T.descripcion,onChange:E})]}),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:T.precio,onChange:E,required:!0,min:"0",step:"0.01"})]}),a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Unidad"}),a.jsx(bt,{value:T.unidad?{value:T.unidad,label:T.unidad}:null,onChange:q=>N(ce=>({...ce,unidad:q?q.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:T.stock,onChange:E,step:"0.01"})]}),a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Stock Minimo"}),a.jsx("input",{type:"number",name:"stockMinimo",value:T.stockMinimo,onChange:E,step:"0.01"})]})]}),a.jsxs("div",{className:"mp-row",children:[a.jsxs("div",{className:"mp-field",children:[a.jsx("label",{children:"Categoria"}),a.jsx(bt,{value:T.categoria_id?Y.find(q=>q.value===T.categoria_id):null,onChange:q=>N(ce=>({...ce,categoria_id:q?q.value:""})),options:Y,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:T.codigo,onChange:E,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:T.envasado_origen,onChange:q=>N(ce=>({...ce,envasado_origen:q.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:T.contabilizar_corte,onChange:q=>N(ce=>({...ce,contabilizar_corte:q.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:T.contar_al_inicio,onChange:q=>N(ce=>({...ce,contar_al_inicio:q.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:T.no_venta,onChange:q=>N(ce=>({...ce,no_venta:q.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:T.no_descuento_inventario,onChange:q=>N(ce=>({...ce,no_descuento_inventario:q.target.checked}))}),a.jsx("span",{className:"mp-check-box"}),"No descontar de inventario"]}),a.jsxs("label",{className:"mp-check-label",children:[a.jsx("input",{type:"checkbox",name:"productos_salida",checked:T.productos_salida,onChange:q=>N(ce=>({...ce,productos_salida:q.target.checked}))}),a.jsx("span",{className:"mp-check-box"}),"Producto de salida"]}),a.jsxs("label",{className:"mp-check-label",children:[a.jsx("input",{type:"checkbox",name:"produccion_directa",checked:T.produccion_directa,onChange:q=>N(ce=>({...ce,produccion_directa:q.target.checked}))}),a.jsx("span",{className:"mp-check-box"}),"Produccion directa"]})]}),a.jsxs("div",{className:"mp-actions",children:[a.jsx("button",{type:"button",className:"mp-btn-cancel",onClick:me,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mp-btn-save",children:R?"Guardar Cambios":"Crear Producto"})]})]})]})}),document.body),H&&Pt.createPortal(a.jsx("div",{className:"modal-overlay",onClick:he,children:a.jsxs("div",{className:"modal modal-receta",onClick:q=>q.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(rt,{size:20})})]}),a.jsx("div",{className:"receta-content",children:J?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:pe,children:[a.jsx(ra,{size:14})," Agregar"]})]}),P.length===0?a.jsx("p",{className:"receta-vacia",children:"Sin ingredientes en la receta"}):a.jsx("div",{className:"receta-items",children:P.map((q,ce)=>a.jsxs("div",{className:"receta-item",children:[a.jsx(bt,{value:q.ingrediente_id?re.find(Ne=>Ne.value===q.ingrediente_id):null,onChange:Ne=>{Se(ce,"ingrediente_id",Ne?Ne.value:""),Se(ce,"nombre",Ne?Ne.label:""),Se(ce,"unidad",Ne?Ne.unidad:"pza")},options:re,styles:hs,placeholder:"Seleccionar ingrediente...",className:"receta-select",noOptionsMessage:()=>"Sin ingredientes"}),a.jsx("input",{type:"number",value:q.cantidad,onChange:Ne=>Se(ce,"cantidad",parseFloat(Ne.target.value)||0),min:"0",step:"0.01",className:"receta-cantidad"}),a.jsx(bt,{value:{value:q.unidad,label:q.unidad},onChange:Ne=>Se(ce,"unidad",Ne?Ne.value:"pza"),options:Bu,styles:hs,className:"receta-unidad"}),a.jsx("button",{type:"button",className:"btn-icon btn-danger",onClick:()=>qe(ce),children:a.jsx(Qt,{size:14})})]},ce))})]}),a.jsxs("div",{className:"receta-seccion",children:[a.jsxs("div",{className:"receta-seccion-header",children:[a.jsxs("h4",{children:[a.jsx(Gt,{size:16})," Productos"]}),a.jsxs("button",{type:"button",className:"btn-sm btn-primary",onClick:De,children:[a.jsx(ra,{size:14})," Agregar"]})]}),W.length===0?a.jsx("p",{className:"receta-vacia",children:"Sin productos en la receta"}):a.jsx("div",{className:"receta-items",children:W.map((q,ce)=>a.jsxs("div",{className:"receta-item",children:[a.jsx(bt,{value:q.componente_id?xe.find(Ne=>Ne.value===q.componente_id):null,onChange:Ne=>{ne(ce,"componente_id",Ne?Ne.value:""),ne(ce,"nombre",Ne?Ne.label:""),ne(ce,"unidad",Ne?Ne.unidad:"pza")},options:xe,styles:hs,placeholder:"Seleccionar producto...",className:"receta-select",noOptionsMessage:()=>"Sin productos"}),a.jsx("input",{type:"number",value:q.cantidad,onChange:Ne=>ne(ce,"cantidad",parseFloat(Ne.target.value)||0),min:"0",step:"0.01",className:"receta-cantidad"}),a.jsx(bt,{value:{value:q.unidad,label:q.unidad},onChange:Ne=>ne(ce,"unidad",Ne?Ne.value:"pza"),options:Bu,styles:hs,className:"receta-unidad"}),a.jsx("button",{type:"button",className:"btn-icon btn-danger",onClick:()=>Q(ce),children:a.jsx(Qt,{size:14})})]},ce))})]})]})}),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:fe,disabled:J,children:"Guardar Receta"})]})]})}),document.body),a.jsx(Yt,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const $u=()=>Pe.getApiUrl();function jN(){const[i,l]=g.useState([]),[d,u]=g.useState(""),[c,m]=g.useState(!1),[v,x]=g.useState(null),[h,p]=g.useState(!0),[S,_]=g.useState({nombre:"",descripcion:"",color:"#f97316"});g.useEffect(()=>{R()},[]);const R=async()=>{try{const C=await(await fetch($u(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCategoriasProductos"})})).json();C.success?l(C.data||[]):A.error(C.message||"Error al cargar categorias")}catch{A.error("Error de conexion con el servidor")}finally{p(!1)}},U=i.filter(j=>j.nombre.toLowerCase().includes(d.toLowerCase())||j.descripcion&&j.descripcion.toLowerCase().includes(d.toLowerCase())),D=(j=null)=>{j?(x(j),_({nombre:j.nombre,descripcion:j.descripcion||"",color:j.color||"#f97316"})):(x(null),_({nombre:"",descripcion:"",color:"#f97316"})),m(!0)},b=()=>{m(!1),x(null)},T=j=>{const{name:C,value:P}=j.target;_(w=>({...w,[C]:P}))},N=async j=>{if(j.preventDefault(),!S.nombre.trim()){A.warning("El nombre es requerido");return}const C={tipo:v?"actualizarCategoriaProducto":"crearCategoriaProducto",nombre:S.nombre.trim(),descripcion:S.descripcion.trim(),color:S.color};v&&(C.id=v.id);try{const w=await(await fetch($u(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})).json();w.success?(A.success(v?"Categoria actualizada":"Categoria creada"),R(),b()):A.error(w.message||"Error al guardar categoria")}catch{A.error("Error de conexion con el servidor")}},H=j=>{const C=i.find(P=>P.id===j);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar "',C==null?void 0:C.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"),R()):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})},z=["#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:()=>D(),children:[a.jsx(ra,{size:20}),"Nueva Categoria"]})]}),a.jsxs("div",{className:"categorias-filtros",children:[a.jsxs("div",{className:"search-box",children:[a.jsx(ba,{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:[U.length," categoria",U.length!==1?"s":""]})]}),a.jsx("div",{className:"categorias-grid",children:U.length===0?a.jsx("p",{className:"sin-resultados",children:"No se encontraron categorias"}):U.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:()=>D(j),title:"Editar",children:a.jsx(xs,{size:16})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>H(j.id),title:"Eliminar",children:a.jsx(Qt,{size:16})})]})]},j.id))}),c&&Pt.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(rt,{size:20})})]}),a.jsxs("form",{onSubmit:N,children:[a.jsxs("div",{className:"mk-field",children:[a.jsx("label",{children:"Nombre *"}),a.jsx("input",{type:"text",name:"nombre",value:S.nombre,onChange:T,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:T,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:z.map(j=>a.jsx("button",{type:"button",className:`mk-color-option ${S.color===j?"activo":""}`,style:{backgroundColor:j},onClick:()=>_(C=>({...C,color:j})),title:j},j))}),a.jsxs("div",{className:"mk-color-custom",children:[a.jsx("input",{type:"color",name:"color",value:S.color,onChange:T,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(Yt,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const Pn=()=>Pe.getApiUrl(),SN=["Verduras","Carnes","Lácteos","Granos","Especias","Otros"],NN=["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 CN(){const[i,l]=g.useState("ingredientes"),[d,u]=g.useState([]),[c,m]=g.useState(SN),[v,x]=g.useState([]),[h,p]=g.useState(NN),[S,_]=g.useState(""),[R,U]=g.useState(""),[D,b]=g.useState(""),[T,N]=g.useState(!1),[H,z]=g.useState(!1),[j,C]=g.useState(null),[P,w]=g.useState(null),[W,de]=g.useState(!0),[J,G]=g.useState({nombre:"",cantidad:"",unidad:"",precio:"",proveedor:"",stockMinimo:"",categoria:"Otros"}),[Y,re]=g.useState({nombre:""}),xe=c.map(Q=>({value:Q,label:Q})),je=h.map(Q=>({value:Q,label:Q}));g.useEffect(()=>{$(),se(),ve(),Ce()},[]);const $=async()=>{try{const fe=await(await fetch(Pn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientes"})})).json();fe.success?u(fe.data||[]):A.error(fe.message||"Error al cargar ingredientes")}catch(Q){A.error("Error de conexión con el servidor"),console.error(Q)}finally{de(!1)}},se=async()=>{try{const fe=await(await fetch(Pn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCategoriasIngredientes"})})).json();fe.success&&fe.data&&m(fe.data)}catch(Q){console.error("Error al cargar categorías:",Q)}},ve=async()=>{try{const fe=await(await fetch(Pn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCategoriasIngredientesDetalle"})})).json();fe.success&&fe.data&&x(fe.data)}catch(Q){console.error("Error al cargar detalle categorías:",Q)}},Ce=async()=>{try{const fe=await(await fetch(Pn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getUnidades"})})).json();fe.success&&fe.data&&p(fe.data)}catch(Q){console.error("Error al cargar unidades:",Q)}},me=d.filter(Q=>{const fe=Q.nombre.toLowerCase().includes(S.toLowerCase())||Q.proveedor&&Q.proveedor.toLowerCase().includes(S.toLowerCase()),q=!D||Q.categoria===D;return fe&&q}),E=v.filter(Q=>Q.nombre.toLowerCase().includes(R.toLowerCase())),O=(Q=null)=>{Q?(C(Q),G({nombre:Q.nombre,cantidad:Q.cantidad,unidad:Q.unidad,precio:Q.precio,proveedor:Q.proveedor||"",stockMinimo:Q.stockMinimo,categoria:Q.categoria})):(C(null),G({nombre:"",cantidad:"",unidad:"",precio:"",proveedor:"",stockMinimo:"",categoria:"Otros"})),N(!0)},ee=()=>{N(!1),C(null)},K=(Q=null)=>{Q?(w(Q),re({nombre:Q.nombre})):(w(null),re({nombre:""})),z(!0)},he=()=>{z(!1),w(null)},pe=Q=>{const{name:fe,value:q}=Q.target;G(ce=>({...ce,[fe]:q}))},Se=async Q=>{Q.preventDefault();const fe={tipo:j?"actualizarIngrediente":"crearIngrediente",...J,cantidad:parseFloat(J.cantidad)||0,precio:parseFloat(J.precio)||0,stockMinimo:parseFloat(J.stockMinimo)||0};j&&(fe.id=j.id);try{const ce=await(await fetch(Pn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)})).json();ce.success?(A.success(j?"Ingrediente actualizado correctamente":"Ingrediente creado correctamente"),$(),ee()):A.error(ce.message||"Error al guardar ingrediente")}catch(q){A.error("Error de conexión con el servidor"),console.error(q)}},qe=async Q=>{Q.preventDefault();const fe={tipo:P?"actualizarCategoriaIngrediente":"crearCategoriaIngrediente",nombre:Y.nombre.trim()};P&&(fe.id=P.id);try{const ce=await(await fetch(Pn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)})).json();ce.success?(A.success(P?"Categoría actualizada correctamente":"Categoría creada correctamente"),se(),ve(),he()):A.error(ce.message||"Error al guardar categoría")}catch(q){A.error("Error de conexión con el servidor"),console.error(q)}},De=Q=>{const fe=d.find(q=>q.id===Q);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar "',fe==null?void 0:fe.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(Pn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarIngrediente",id:Q})})).json();ce.success?(A.dismiss(),A.success("Ingrediente eliminado"),$()):A.error(ce.message||"Error al eliminar")}catch(q){A.error("Error de conexión"),console.error(q)}},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=Q=>{const fe=v.find(q=>q.id===Q);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar categoría "',fe==null?void 0:fe.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(Pn(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarCategoriaIngrediente",id:Q})})).json();ce.success?(A.dismiss(),A.success("Categoría eliminada"),se(),ve()):A.error(ce.message||"Error al eliminar")}catch(q){A.error("Error de conexión"),console.error(q)}},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 W?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"?O():K(),children:[a.jsx(ra,{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(Gt,{size:16}),"Ingredientes"]}),a.jsxs("button",{className:`ing-tab ${i==="categorias"?"ing-tab-active":""}`,onClick:()=>l("categorias"),children:[a.jsx(xx,{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(ba,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por nombre o proveedor...",value:S,onChange:Q=>_(Q.target.value)})]}),a.jsx(bt,{value:D?{value:D,label:D}:null,onChange:Q=>b(Q?Q.value:""),options:xe,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:me.map(Q=>a.jsxs("tr",{className:Q.cantidad<=Q.stockMinimo?"stock-bajo":"",children:[a.jsx("td",{children:Q.nombre}),a.jsx("td",{children:Q.cantidad}),a.jsx("td",{children:Q.unidad}),a.jsxs("td",{children:["$",Number(Q.precio).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]}),a.jsx("td",{children:Q.proveedor||"-"}),a.jsx("td",{children:Q.stockMinimo}),a.jsx("td",{children:a.jsx("span",{className:"categoria-badge",children:Q.categoria})}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>O(Q),children:a.jsx(xs,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>De(Q.id),children:a.jsx(Qt,{size:14})})]})]},Q.id))})]}),me.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(ba,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar categoría...",value:R,onChange:Q=>U(Q.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:E.map(Q=>a.jsxs("tr",{children:[a.jsx("td",{children:Q.nombre}),a.jsx("td",{children:a.jsx("span",{className:"categoria-badge",children:Q.total_ingredientes})}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>K(Q),children:a.jsx(xs,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>ne(Q.id),children:a.jsx(Qt,{size:14})})]})]},Q.id))})]}),E.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron categorías"})]})]}),T&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-ingredientes",onClick:ee,children:a.jsxs("div",{className:"modal-ingredientes",onClick:Q=>Q.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(rt,{size:20})})]}),a.jsxs("form",{onSubmit:Se,children:[a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Nombre"}),a.jsx("input",{type:"text",name:"nombre",value:J.nombre,onChange:pe,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:J.cantidad,onChange:pe,required:!0,min:"0",step:"0.01"})]}),a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Unidad"}),a.jsx(bt,{value:J.unidad?{value:J.unidad,label:J.unidad}:null,onChange:Q=>G(fe=>({...fe,unidad:Q?Q.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:J.precio,onChange:pe,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:J.stockMinimo,onChange:pe,required:!0,min:"0"})]})]}),a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Proveedor"}),a.jsx("input",{type:"text",name:"proveedor",value:J.proveedor,onChange:pe})]}),a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Categoría"}),a.jsx(bt,{value:J.categoria?{value:J.categoria,label:J.categoria}:null,onChange:Q=>G(fe=>({...fe,categoria:Q?Q.value:"Otros"})),options:xe,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),H&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-ingredientes",onClick:he,children:a.jsxs("div",{className:"modal-ingredientes",onClick:Q=>Q.stopPropagation(),children:[a.jsxs("div",{className:"mi-header",children:[a.jsx("h3",{children:P?"Editar Categoría":"Nueva Categoría"}),a.jsx("button",{className:"mi-btn-close",onClick:he,children:a.jsx(rt,{size:20})})]}),a.jsxs("form",{onSubmit:qe,children:[a.jsxs("div",{className:"mi-field",children:[a.jsx("label",{children:"Nombre de la categoría"}),a.jsx("input",{type:"text",value:Y.nombre,onChange:Q=>re({nombre:Q.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:P?"Guardar Cambios":"Crear Categoría"})]})]})]})}),document.body),a.jsx(Yt,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const ps=()=>Pe.getApiUrl();function _N(){const{user:i}=Ga(),[l,d]=g.useState([]),[u,c]=g.useState(!0),[m,v]=g.useState(null),[x,h]=g.useState([]),[p,S]=g.useState([]),[_,R]=g.useState(""),[U,D]=g.useState(!1),[b,T]=g.useState(null),[N,H]=g.useState(null),[z,j]=g.useState("0"),[C,P]=g.useState(!1),[w,W]=g.useState("ingrediente"),[de,J]=g.useState([]),[G,Y]=g.useState([]),[re,xe]=g.useState([]),[je,$]=g.useState([]),[se,ve]=g.useState([]),[Ce,me]=g.useState(null),[E,O]=g.useState({peso_inicial:"",peso_final:"",items:[]}),[ee,K]=g.useState(!1),[he,pe]=g.useState("ingrediente"),[Se,qe]=g.useState(!1);g.useEffect(()=>{De(),ne(),Q(),fe()},[]),g.useEffect(()=>{var ge,be,Te,Lt;if(!b){j("0");return}let B="0";b.tipo==="ingrediente"?B=String(((ge=x[b.index])==null?void 0:ge.cantidad_usada)??0):b.tipo==="componente"?B=String(((be=p[b.index])==null?void 0:be.cantidad_usada)??0):b.tipo==="extra_ing"?B=String(((Te=re[b.index])==null?void 0:Te.cantidad_usada)??0):b.tipo==="extra_prod"?B=String(((Lt=je[b.index])==null?void 0:Lt.cantidad_usada)??0):b.tipo==="salida"&&(B=_||"0"),j(B)},[b]);const De=async()=>{try{const ge=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductosConReceta"})})).json();ge.success&&d(ge.data||[])}catch{A.error("Error al cargar productos")}finally{c(!1)}},ne=async()=>{try{const ge=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientes"})})).json();ge.success&&J(ge.data||[])}catch(B){console.error("Error al cargar ingredientes:",B)}},Q=async()=>{try{const ge=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductos"})})).json();ge.success&&Y(ge.data||[])}catch(B){console.error("Error al cargar productos:",B)}},fe=async()=>{try{const ge=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProduccionesHoy"})})).json();ge.success&&ve(ge.data||[])}catch(B){console.error("Error al cargar producciones de hoy:",B)}},q=B=>{me(B),O({peso_inicial:"",peso_final:"",items:[]})},ce=()=>{me(null),O({peso_inicial:"",peso_final:"",items:[]}),K(!1)},Ne=(B,ge)=>{if(E.items.some(Te=>Te.tipo===ge&&Te.item_id===B.id)){A.warning("Este item ya está en la lista");return}O({...E,items:[...E.items,{tipo:ge,item_id:B.id,nombre:B.nombre,cantidad:0,unidad:B.unidad}]}),K(!1)},Be=B=>{const ge=E.items.filter((be,Te)=>Te!==B);O({...E,items:ge})},Da=(B,ge)=>{const be=[...E.items];be[B].cantidad=Math.max(0,parseFloat(ge)||0),O({...E,items:be})},ca=async()=>{if(Ce){if(!E.peso_inicial||parseFloat(E.peso_inicial)<=0){A.warning("Ingresa el peso inicial");return}if(!E.peso_final||parseFloat(E.peso_final)<=0){A.warning("Ingresa el peso final");return}qe(!0);try{const ge=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"registrarAjusteProduccion",produccion_id:Ce.id,peso_inicial:parseFloat(E.peso_inicial),peso_final:parseFloat(E.peso_final),usuario_id:i==null?void 0:i.id,items:E.items.filter(be=>be.cantidad>0).map(be=>({tipo:be.tipo,item_id:be.item_id,cantidad:be.cantidad,unidad:be.unidad}))})})).json();if(ge.success){const be=parseFloat(E.peso_final)-parseFloat(E.peso_inicial);A.success(`Ajuste registrado: ${be>=0?"+":""}${be.toFixed(3)} ${Ce.unidad}`),ce(),fe()}else A.error(ge.message||"Error al registrar ajuste")}catch{A.error("Error de conexion")}finally{qe(!1)}}},oe=async B=>{try{const be=await(await fetch(ps(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getReceta",producto_id:B})})).json();be.success&&(h(be.data.ingredientes.map(Te=>({...Te,cantidad_usada:0,cantidad_receta:Te.cantidad}))),S(be.data.componentes.map(Te=>({...Te,cantidad_usada:0,cantidad_receta:Te.cantidad}))))}catch{A.error("Error al cargar receta")}},ze=B=>{v(B),R(""),H(null),T(null),oe(B.id)},He=()=>{v(null),h([]),S([]),R(""),xe([]),$([]),T(null),H(null),P(!1)},Ge=(m==null?void 0:m.produccion_directa)===1,Tt=()=>{if(!N)return 0;const ge=(N.tipo==="ingrediente"?x:p)[N.index];return!ge||!ge.cantidad_receta||ge.cantidad_receta<=0?0:Dt(ge.cantidad_usada/ge.cantidad_receta)},Nt=B=>{const ge=x.some(Te=>Te.ingrediente_id===B.id),be=re.some(Te=>Te.ingrediente_id===B.id);if(ge||be){A.warning("Este ingrediente ya está en la lista");return}xe([...re,{ingrediente_id:B.id,nombre:B.nombre,unidad:B.unidad,cantidad_usada:0,cantidad_receta:0,es_extra:!0}]),P(!1)},Ya=B=>{const ge=p.some(Te=>Te.componente_id===B.id),be=je.some(Te=>Te.componente_id===B.id);if(ge||be){A.warning("Este producto ya está en la lista");return}$([...je,{componente_id:B.id,nombre:B.nombre,unidad:B.unidad,cantidad_usada:0,cantidad_receta:0,es_extra:!0}]),P(!1)},Ra=B=>{const ge=re.filter((be,Te)=>Te!==B);xe(ge),(b==null?void 0:b.tipo)==="extra_ing"&&(b==null?void 0:b.index)===B&&T(null)},Xa=B=>{const ge=je.filter((be,Te)=>Te!==B);$(ge),(b==null?void 0:b.tipo)==="extra_prod"&&(b==null?void 0:b.index)===B&&T(null)},za=(B,ge)=>{const be=[...re];be[B].cantidad_usada=Dt(Math.max(0,parseFloat(ge)||0)),xe(be)},Xn=(B,ge)=>{const be=[...je];be[B].cantidad_usada=Dt(Math.max(0,parseFloat(ge)||0)),$(be)},Dt=B=>Math.round(B*1e3)/1e3,bn=(B,ge)=>{var Jt;const be=Dt(Math.max(0,parseFloat(ge)||0));if(!Ge){const F=[...x];F[B].cantidad_usada=be,h(F);return}const Te=(N==null?void 0:N.tipo)==="ingrediente"&&(N==null?void 0:N.index)===B,Lt=!N;if(Lt&&H({tipo:"ingrediente",index:B}),Lt||Te){const F=((Jt=x[B])==null?void 0:Jt.cantidad_receta)||0,ye=F>0?be/F:0;h(k=>k.map((ue,_e)=>_e===B?{...ue,cantidad_usada:be}:{...ue,cantidad_usada:Dt((ue.cantidad_receta||0)*ye)})),S(k=>k.map(ue=>({...ue,cantidad_usada:Dt((ue.cantidad_receta||0)*ye)})))}else h(F=>F.map((ye,k)=>k===B?{...ye,cantidad_usada:be}:ye))},In=(B,ge)=>{var Jt;const be=Dt(Math.max(0,parseFloat(ge)||0));if(!Ge){const F=[...p];F[B].cantidad_usada=be,S(F);return}const Te=(N==null?void 0:N.tipo)==="componente"&&(N==null?void 0:N.index)===B,Lt=!N;if(Lt&&H({tipo:"componente",index:B}),Lt||Te){const F=((Jt=p[B])==null?void 0:Jt.cantidad_receta)||0,ye=F>0?be/F:0;S(k=>k.map((ue,_e)=>_e===B?{...ue,cantidad_usada:be}:{...ue,cantidad_usada:Dt((ue.cantidad_receta||0)*ye)})),h(k=>k.map(ue=>({...ue,cantidad_usada:Dt((ue.cantidad_receta||0)*ye)})))}else S(F=>F.map((ye,k)=>k===B?{...ye,cantidad_usada:be}:ye))},Zt=B=>{b&&(b.tipo==="ingrediente"?bn(b.index,B):b.tipo==="componente"?In(b.index,B):b.tipo==="extra_ing"?za(b.index,B):b.tipo==="extra_prod"?Xn(b.index,B):b.tipo==="salida"&&R(B))},wt=()=>{var B,ge,be,Te;return b?b.tipo==="ingrediente"?(B=x[b.index])==null?void 0:B.nombre:b.tipo==="componente"?(ge=p[b.index])==null?void 0:ge.nombre:b.tipo==="extra_ing"?((be=re[b.index])==null?void 0:be.nombre)+" (extra)":b.tipo==="extra_prod"?((Te=je[b.index])==null?void 0:Te.nombre)+" (extra)":b.tipo==="salida"?"Cantidad producida":"Selecciona un campo":"Selecciona un campo"},ft=B=>{if(!b)return;let ge=z;if(B==="C")ge="0";else if(B==="CE")ge=z.slice(0,-1)||"0";else if(B==="."){if(z.includes("."))return;ge=z+"."}else if(z==="0")ge=B;else{const be=z.split(".");if(be.length===2&&be[1].length>=3)return;ge=z+B}j(ge),Zt(ge)},Ke=async()=>{if(!m){A.warning("Selecciona un producto");return}const B=Ge?Tt():parseFloat(_);if(!B||B<=0){A.warning(Ge?"Ingresa la cantidad de algun ingrediente de la receta":"Ingresa la cantidad producida");return}D(!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:B,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:[...x.filter(Te=>Te.cantidad_usada>0).map(Te=>({ingrediente_id:Te.ingrediente_id,cantidad_usada:Te.cantidad_usada,cantidad_receta:Te.cantidad_receta||0,unidad:Te.unidad})),...re.filter(Te=>Te.cantidad_usada>0).map(Te=>({ingrediente_id:Te.ingrediente_id,cantidad_usada:Te.cantidad_usada,cantidad_receta:0,unidad:Te.unidad}))],componentes:[...p.filter(Te=>Te.cantidad_usada>0).map(Te=>({componente_id:Te.componente_id,cantidad_usada:Te.cantidad_usada,cantidad_receta:Te.cantidad_receta||0,unidad:Te.unidad})),...je.filter(Te=>Te.cantidad_usada>0).map(Te=>({componente_id:Te.componente_id,cantidad_usada:Te.cantidad_usada,cantidad_receta:0,unidad:Te.unidad}))],descontar_inventario:!0})})).json();be.success?(A.success(`Produccion registrada: ${B} ${m.unidad} de ${m.nombre}`),He(),De(),fe()):A.error(be.message||"Error al registrar")}catch{A.error("Error de conexion")}finally{D(!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(bs,{size:18})," Hoy"]})}),Ce?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:Ce.producto_nombre}),a.jsxs("small",{children:[Ce.cantidad_producida," ",Ce.unidad]})]}),a.jsx("button",{className:"btn-cerrar-ajuste",onClick:ce,children:a.jsx(rt,{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:E.peso_inicial,onChange:B=>O({...E,peso_inicial:B.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:E.peso_final,onChange:B=>O({...E,peso_final:B.target.value}),placeholder:"0",step:"0.001"})]})]}),E.peso_inicial&&E.peso_final&&a.jsxs("div",{className:`ajuste-diferencia ${parseFloat(E.peso_final)-parseFloat(E.peso_inicial)>=0?"positivo":"negativo"}`,children:["Diferencia: ",(parseFloat(E.peso_final)-parseFloat(E.peso_inicial)).toFixed(3)," ",Ce.unidad]}),a.jsxs("div",{className:"ajuste-items",children:[a.jsx("h5",{children:"Agregados:"}),E.items.length===0?a.jsx("p",{className:"sin-items",children:"Sin items agregados"}):E.items.map((B,ge)=>a.jsxs("div",{className:"ajuste-item",children:[a.jsx("span",{className:"ajuste-item-nombre",children:B.nombre}),a.jsx("input",{type:"number",value:B.cantidad,onChange:be=>Da(ge,be.target.value),min:"0",step:"0.001"}),a.jsx("small",{children:B.unidad}),a.jsx("button",{className:"btn-quitar-item",onClick:()=>Be(ge),children:a.jsx(rt,{size:14})})]},ge)),a.jsxs("button",{className:"btn-agregar-item-ajuste",onClick:()=>K(!0),children:[a.jsx(Ur,{size:14})," Agregar"]})]})]}),a.jsx("div",{className:"ajuste-footer",children:a.jsxs("button",{className:"btn-guardar-ajuste",onClick:ca,disabled:Se,children:[a.jsx(Gn,{size:18}),Se?"Guardando...":"Guardar Ajuste"]})})]}):a.jsx("div",{className:"prod-hoy-lista",children:se.length===0?a.jsx("p",{className:"sin-producciones",children:"Sin producciones hoy"}):se.map(B=>a.jsxs("div",{className:"prod-hoy-item",onClick:()=>q(B),children:[a.jsxs("div",{className:"prod-hoy-info",children:[a.jsx("span",{className:"prod-hoy-nombre",children:B.producto_nombre}),a.jsx("span",{className:"prod-hoy-hora",children:B.hora.slice(0,5)})]}),a.jsxs("div",{className:"prod-hoy-cant",children:[B.cantidad_producida," ",B.unidad,B.num_ajustes>0&&a.jsxs("span",{className:"badge-ajustes",children:["+",B.num_ajustes]})]}),a.jsx(_v,{size:16,className:"prod-hoy-arrow"})]},B.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(B=>a.jsxs("button",{className:`prod-producto-btn ${(m==null?void 0:m.id)===B.id?"seleccionado":""} ${B.produccion_directa===1?"directa":""}`,onClick:()=>ze(B),children:[B.produccion_directa===1&&a.jsx("span",{className:"prod-directa-badge",title:"Produccion directa",children:a.jsx(Lx,{size:10})}),a.jsx("span",{className:"prod-nombre",children:B.nombre}),a.jsx("span",{className:"prod-unidad",children:B.unidad})]},B.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:He,children:a.jsx(nx,{size:18})})]}),a.jsxs("div",{className:"prod-receta-content",children:[x.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:x.map((B,ge)=>{const be=Ge&&(N==null?void 0:N.tipo)==="ingrediente"&&(N==null?void 0:N.index)===ge;return a.jsxs("div",{className:`prod-item-compacto ${(b==null?void 0:b.tipo)==="ingrediente"&&(b==null?void 0:b.index)===ge?"activo":""} ${be?"pivote":""}`,onClick:()=>T({tipo:"ingrediente",index:ge}),children:[a.jsxs("span",{className:"item-nombre",children:[B.nombre,be&&a.jsx("span",{className:"pivote-badge",title:"Pivote",children:"P"})]}),a.jsxs("span",{className:"item-valor",children:[B.cantidad_usada," ",a.jsx("small",{children:B.unidad})]})]},ge)})})]}),p.length>0&&a.jsxs("div",{className:"prod-seccion",children:[a.jsxs("h4",{children:[a.jsx(Gt,{size:16})," Productos"]}),a.jsx("div",{className:"prod-items",children:p.map((B,ge)=>{const be=Ge&&(N==null?void 0:N.tipo)==="componente"&&(N==null?void 0:N.index)===ge;return a.jsxs("div",{className:`prod-item-compacto ${(b==null?void 0:b.tipo)==="componente"&&(b==null?void 0:b.index)===ge?"activo":""} ${be?"pivote":""}`,onClick:()=>T({tipo:"componente",index:ge}),children:[a.jsxs("span",{className:"item-nombre",children:[B.nombre,be&&a.jsx("span",{className:"pivote-badge",title:"Pivote",children:"P"})]}),a.jsxs("span",{className:"item-valor",children:[B.cantidad_usada," ",a.jsx("small",{children:B.unidad})]})]},ge)})})]}),x.length===0&&p.length===0&&a.jsx("div",{className:"prod-sin-receta",children:a.jsx("p",{children:"Sin ingredientes"})}),re.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:re.map((B,ge)=>a.jsxs("div",{className:`prod-item-compacto extra ${(b==null?void 0:b.tipo)==="extra_ing"&&(b==null?void 0:b.index)===ge?"activo":""}`,onClick:()=>T({tipo:"extra_ing",index:ge}),children:[a.jsx("span",{className:"item-nombre",children:B.nombre}),a.jsxs("span",{className:"item-valor",children:[B.cantidad_usada," ",a.jsx("small",{children:B.unidad})]}),a.jsx("button",{className:"btn-eliminar-extra",onClick:be=>{be.stopPropagation(),Ra(ge)},children:a.jsx(rt,{size:14})})]},ge))})]}),je.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:je.map((B,ge)=>a.jsxs("div",{className:`prod-item-compacto extra ${(b==null?void 0:b.tipo)==="extra_prod"&&(b==null?void 0:b.index)===ge?"activo":""}`,onClick:()=>T({tipo:"extra_prod",index:ge}),children:[a.jsx("span",{className:"item-nombre",children:B.nombre}),a.jsxs("span",{className:"item-valor",children:[B.cantidad_usada," ",a.jsx("small",{children:B.unidad})]}),a.jsx("button",{className:"btn-eliminar-extra",onClick:be=>{be.stopPropagation(),Xa(ge)},children:a.jsx(rt,{size:14})})]},ge))})]}),a.jsxs("button",{className:"btn-agregar-extra",onClick:()=>P(!0),children:[a.jsx(Ur,{size:16})," Agregar extra"]}),Ge?a.jsxs("div",{className:"prod-seccion",children:[a.jsxs("h4",{children:[a.jsx(Gn,{size:16})," Se producira"]}),a.jsxs("div",{className:"prod-item-compacto salida salida-directa",children:[a.jsx("span",{className:"item-nombre",children:"Calculado"}),a.jsxs("span",{className:"item-valor grande",children:[Tt()||"0"," ",a.jsx("small",{children:m.unidad})]})]})]}):a.jsxs("div",{className:"prod-seccion",children:[a.jsxs("h4",{children:[a.jsx(Gn,{size:16})," Producido"]}),a.jsxs("div",{className:`prod-item-compacto salida ${(b==null?void 0:b.tipo)==="salida"?"activo":""}`,onClick:()=>T({tipo:"salida",index:0}),children:[a.jsx("span",{className:"item-nombre",children:"Cantidad"}),a.jsxs("span",{className:"item-valor grande",children:[_||"0"," ",a.jsx("small",{children:m.unidad})]})]})]})]}),a.jsx("div",{className:"prod-footer-mini",children:a.jsxs("button",{className:"btn-registrar",onClick:Ke,disabled:U||(Ge?Tt()<=0:!_||parseFloat(_)<=0),children:[a.jsx(Gn,{size:20}),U?"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:wt()}),a.jsx("span",{className:"teclado-valor",children:z||"0"})]}),a.jsxs("div",{className:"teclado-rapidos",children:[a.jsx("button",{onClick:()=>{b&&(j("1"),Zt("1"))},children:"1"}),a.jsx("button",{onClick:()=>{b&&(j("2"),Zt("2"))},children:"2"}),a.jsx("button",{onClick:()=>{b&&(j("5"),Zt("5"))},children:"5"}),a.jsx("button",{onClick:()=>{b&&(j("10"),Zt("10"))},children:"10"})]}),a.jsxs("div",{className:"teclado-grid",children:[a.jsx("button",{className:"tecla",onClick:()=>ft("7"),children:"7"}),a.jsx("button",{className:"tecla",onClick:()=>ft("8"),children:"8"}),a.jsx("button",{className:"tecla",onClick:()=>ft("9"),children:"9"}),a.jsx("button",{className:"tecla",onClick:()=>ft("4"),children:"4"}),a.jsx("button",{className:"tecla",onClick:()=>ft("5"),children:"5"}),a.jsx("button",{className:"tecla",onClick:()=>ft("6"),children:"6"}),a.jsx("button",{className:"tecla",onClick:()=>ft("1"),children:"1"}),a.jsx("button",{className:"tecla",onClick:()=>ft("2"),children:"2"}),a.jsx("button",{className:"tecla",onClick:()=>ft("3"),children:"3"}),a.jsx("button",{className:"tecla",onClick:()=>ft("0"),children:"0"}),a.jsx("button",{className:"tecla",onClick:()=>ft("."),children:"."}),a.jsx("button",{className:"tecla borrar",onClick:()=>ft("CE"),children:a.jsx(Ty,{size:20})})]}),a.jsx("button",{className:"tecla-limpiar",onClick:()=>ft("C"),children:"C"})]}),ee&&a.jsx("div",{className:"modal-overlay",onClick:()=>K(!1),children:a.jsxs("div",{className:"modal-extras",onClick:B=>B.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:()=>K(!1),children:a.jsx(rt,{size:20})})]}),a.jsxs("div",{className:"modal-extras-tabs",children:[a.jsxs("button",{className:`tab-extra ${he==="ingrediente"?"activo":""}`,onClick:()=>pe("ingrediente"),children:[a.jsx(hl,{size:16})," Ingredientes"]}),a.jsxs("button",{className:`tab-extra ${he==="producto"?"activo":""}`,onClick:()=>pe("producto"),children:[a.jsx(Gt,{size:16})," Productos"]})]}),a.jsx("div",{className:"modal-extras-lista",children:he==="ingrediente"?de.map(B=>a.jsxs("button",{className:"item-seleccionable",onClick:()=>Ne(B,"ingrediente"),children:[a.jsx("span",{children:B.nombre}),a.jsx("small",{children:B.unidad})]},B.id)):G.filter(B=>!B.envasado_origen).map(B=>a.jsxs("button",{className:"item-seleccionable",onClick:()=>Ne(B,"producto"),children:[a.jsx("span",{children:B.nombre}),a.jsx("small",{children:B.unidad})]},B.id))})]})}),C&&a.jsx("div",{className:"modal-overlay",onClick:()=>P(!1),children:a.jsxs("div",{className:"modal-extras",onClick:B=>B.stopPropagation(),children:[a.jsxs("div",{className:"modal-extras-header",children:[a.jsx("h4",{children:"Agregar Extra"}),a.jsx("button",{className:"btn-cerrar-modal",onClick:()=>P(!1),children:a.jsx(rt,{size:20})})]}),a.jsxs("div",{className:"modal-extras-tabs",children:[a.jsxs("button",{className:`tab-extra ${w==="ingrediente"?"activo":""}`,onClick:()=>W("ingrediente"),children:[a.jsx(hl,{size:16})," Ingredientes"]}),a.jsxs("button",{className:`tab-extra ${w==="producto"?"activo":""}`,onClick:()=>W("producto"),children:[a.jsx(Gt,{size:16})," Productos"]})]}),a.jsx("div",{className:"modal-extras-lista",children:w==="ingrediente"?de.map(B=>a.jsxs("button",{className:"item-seleccionable",onClick:()=>Nt(B),children:[a.jsx("span",{children:B.nombre}),a.jsx("small",{children:B.unidad})]},B.id)):G.filter(B=>!B.envasado_origen).map(B=>a.jsxs("button",{className:"item-seleccionable",onClick:()=>Ya(B),children:[a.jsx("span",{children:B.nombre}),a.jsx("small",{children:B.unidad})]},B.id))})]})}),a.jsx(Yt,{position:"top-center",autoClose:2e3,hideProgressBar:!0,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!1,draggable:!1,pauseOnHover:!1,theme:"light"})]})}const mv=()=>Pe.getApiUrl();function TN(){const[i,l]=g.useState(!1),[d,u]=g.useState(null),[c,m]=g.useState([]),[v,x]=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,_]=g.useState(0),[R,U]=g.useState({});g.useEffect(()=>{D()},[]),g.useEffect(()=>{b()},[v,h,S]);const D=async()=>{try{const C=await(await fetch(mv(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductosConReceta"})})).json();C.success&&m(C.data||[])}catch(j){console.error("Error al cargar productos:",j)}},b=async()=>{l(!0);try{const C=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();C.success?u(C.data):A.error(C.message||"Error al cargar reporte")}catch{A.error("Error de conexión")}finally{l(!1)}},T=j=>{U(C=>({...C,[j]:!C[j]}))},N=j=>new Date(j+"T00:00:00").toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}),H=(j,C)=>j===0?"neutral":C>10?"alto":C>5?"medio":j>0?"bajo":"negativo",z=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=>x(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(Dy,{size:14})," Producto"]}),a.jsxs("select",{value:S,onChange:j=>_(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 C,P;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 ${z(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:((C=j.desviacion_absoluta)==null?void 0:C.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?"+":"",((P=j.desviacion_neta)==null?void 0:P.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 ${z(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(Gt,{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:()=>T(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:[N(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:R[j.id]?a.jsx(py,{size:18}):a.jsx(Cv,{size:18})})]}),R[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(C=>a.jsxs("tr",{className:H(C.desviacion,Math.abs(C.porcentaje_desviacion)),children:[a.jsx("td",{children:C.nombre}),a.jsxs("td",{children:[C.cantidad_receta," ",C.unidad]}),a.jsxs("td",{children:[C.cantidad_usada," ",C.unidad]}),a.jsxs("td",{className:C.desviacion>0?"valor-negativo":C.desviacion<0?"valor-positivo":"",children:[C.desviacion>0?"+":"",C.desviacion.toFixed(3)]}),a.jsxs("td",{className:Math.abs(C.porcentaje_desviacion)>10?"valor-alerta":"",children:[C.porcentaje_desviacion>0?"+":"",C.porcentaje_desviacion,"%"]}),a.jsxs("td",{className:C.costo_desviacion>0?"valor-negativo":"",children:["$",C.costo_desviacion.toFixed(2)]})]},C.id))})]})]}),j.componentes.length>0&&a.jsxs("div",{className:"detalle-seccion",children:[a.jsxs("h5",{children:[a.jsx(Gt,{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(C=>a.jsxs("tr",{className:H(C.desviacion,Math.abs(C.porcentaje_desviacion)),children:[a.jsx("td",{children:C.nombre}),a.jsxs("td",{children:[C.cantidad_receta," ",C.unidad]}),a.jsxs("td",{children:[C.cantidad_usada," ",C.unidad]}),a.jsxs("td",{className:C.desviacion>0?"valor-negativo":C.desviacion<0?"valor-positivo":"",children:[C.desviacion>0?"+":"",C.desviacion.toFixed(3)]}),a.jsxs("td",{className:Math.abs(C.porcentaje_desviacion)>10?"valor-alerta":"",children:[C.porcentaje_desviacion>0?"+":"",C.porcentaje_desviacion,"%"]}),a.jsxs("td",{className:C.costo_desviacion>0?"valor-negativo":"",children:["$",C.costo_desviacion.toFixed(2)]})]},C.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(Yt,{position:"top-center",autoClose:2e3,hideProgressBar:!0,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!1,draggable:!1,pauseOnHover:!1,theme:"light"})]})}const Pu=()=>Pe.getApiUrl();function ON(){const[i,l]=g.useState([]),[d,u]=g.useState(""),[c,m]=g.useState(!1),[v,x]=g.useState(null),[h,p]=g.useState(!0),[S,_]=g.useState({nombre:"",telefono:"",email:"",direccion:""});g.useEffect(()=>{R()},[]);const R=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)}},U=i.filter(z=>{const j=d.toLowerCase();return z.nombre.toLowerCase().includes(j)||z.telefono&&z.telefono.toLowerCase().includes(j)||z.email&&z.email.toLowerCase().includes(j)||z.direccion&&z.direccion.toLowerCase().includes(j)}),D=(z=null)=>{z?(x(z),_({nombre:z.nombre,telefono:z.telefono||"",email:z.email||"",direccion:z.direccion||""})):(x(null),_({nombre:"",telefono:"",email:"",direccion:""})),m(!0)},b=()=>{m(!1),x(null)},T=z=>{const{name:j,value:C}=z.target;_(P=>({...P,[j]:C}))},N=async z=>{z.preventDefault();const j={tipo:v?"actualizarCliente":"crearCliente",...S};v&&(j.id=v.id);try{const P=await(await fetch(Pu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)})).json();P.success?(A.success(v?"Cliente actualizado correctamente":"Cliente creado correctamente"),R(),b()):A.error(P.message||"Error al guardar cliente")}catch{A.error("Error de conexion con el servidor")}},H=z=>{const j=i.find(C=>C.id===z);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 P=await(await fetch(Pu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarCliente",id:z})})).json();P.success?(A.dismiss(),A.success("Cliente eliminado"),R()):A.error(P.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:()=>D(),children:[a.jsx(ra,{size:20}),"Nuevo Cliente"]})]}),a.jsx("div",{className:"clientes-filtros",children:a.jsxs("div",{className:"search-box",children:[a.jsx(ba,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por nombre, telefono, email o direccion...",value:d,onChange:z=>u(z.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:U.map(z=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("div",{className:"cliente-nombre",children:a.jsx("strong",{children:z.nombre})})}),a.jsx("td",{children:z.telefono||"-"}),a.jsx("td",{children:z.email||"-"}),a.jsx("td",{children:z.direccion||"-"}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>D(z),title:"Editar",children:a.jsx(xs,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>H(z.id),title:"Eliminar",children:a.jsx(Qt,{size:14})})]})]},z.id))})]}),U.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron clientes"})]}),c&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-clientes",onClick:b,children:a.jsxs("div",{className:"modal-clientes",onClick:z=>z.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(rt,{size:18})})]}),a.jsxs("form",{onSubmit:N,children:[a.jsxs("div",{className:"mcli-field",children:[a.jsx("label",{children:"Nombre *"}),a.jsx("input",{type:"text",name:"nombre",value:S.nombre,onChange:T,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:T,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:T,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:T,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(Yt,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const ci=()=>Pe.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"}],EN=[{value:"producto",label:"Producto",icon:Gt},{value:"produccion",label:"Producción",icon:hi},{value:"ingrediente",label:"Ingrediente",icon:yl}],$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 zN(){const{user:i}=Ga(),[l,d]=g.useState([]),[u,c]=g.useState([]),[m,v]=g.useState([]),[x,h]=g.useState([]),[p,S]=g.useState(""),[_,R]=g.useState(""),[U,D]=g.useState(""),[b,T]=g.useState(""),[N,H]=g.useState(!1),[z,j]=g.useState(!0),[C,P]=g.useState(!1),[w,W]=g.useState({tipo_item:"",item_id:"",cantidad:"",unidad:"",motivo:"",observaciones:""}),de=EN.map(O=>({value:O.value,label:O.label}));g.useEffect(()=>{J(),G(),Y(),re()},[]);const J=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)}},G=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(O){console.error("Error al cargar productos:",O)}},Y=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(O){console.error("Error al cargar ingredientes:",O)}},re=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(O){console.error("Error al cargar producciones:",O)}},xe=()=>{switch(w.tipo_item){case"producto":return u.map(O=>({value:O.id,label:`${O.nombre} (Stock: ${O.stock} ${O.unidad})`,unidad:O.unidad}));case"ingrediente":return m.map(O=>({value:O.id,label:`${O.nombre} (Stock: ${O.cantidad} ${O.unidad})`,unidad:O.unidad}));case"produccion":return x.map(O=>({value:O.id,label:`${O.producto_nombre} - ${O.fecha} (${O.cantidad_producida} ${O.unidad})`,unidad:O.unidad}));default:return[]}},je=l.filter(O=>{const ee=!p||O.item_nombre.toLowerCase().includes(p.toLowerCase())||O.motivo_label.toLowerCase().includes(p.toLowerCase()),K=!_||O.tipo_item===_,he=!U||O.fecha>=U,pe=!b||O.fecha<=b;return ee&&K&&he&&pe}),$=()=>{W({tipo_item:"",item_id:"",cantidad:"",unidad:"",motivo:"",observaciones:""}),H(!0)},se=()=>{H(!1)},ve=async O=>{if(O.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}P(!0);try{const K=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();K.success?(A.success("Merma registrada correctamente"),J(),G(),Y(),re(),se()):A.error(K.message||"Error al registrar merma")}catch{A.error("Error de conexion con el servidor")}finally{P(!1)}},Ce=O=>{const ee=l.find(K=>K.id===O);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:O})})).json();he.success?(A.dismiss(),A.success("Merma eliminada y stock restaurado"),J(),G(),Y(),re()):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})},me=O=>{switch(O){case"producto":return a.jsx(Gt,{size:14});case"ingrediente":return a.jsx(yl,{size:14});case"produccion":return a.jsx(hi,{size:14});default:return null}},E=O=>{switch(O){case"producto":return"merma-badge-producto";case"ingrediente":return"merma-badge-ingrediente";case"produccion":return"merma-badge-produccion";default:return""}};return z?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:$,children:[a.jsx(ra,{size:20}),"Registrar Merma"]})]}),a.jsxs("div",{className:"merma-filtros",children:[a.jsxs("div",{className:"search-box",children:[a.jsx(ba,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por nombre o motivo...",value:p,onChange:O=>S(O.target.value)})]}),a.jsx(bt,{value:_?de.find(O=>O.value===_):null,onChange:O=>R(O?O.value:""),options:de,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:U,onChange:O=>D(O.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:O=>T(O.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(O=>a.jsxs("tr",{children:[a.jsx("td",{children:new Date(O.fecha+"T00:00:00").toLocaleDateString("es-MX")}),a.jsx("td",{children:a.jsxs("span",{className:`merma-tipo-badge ${E(O.tipo_item)}`,children:[me(O.tipo_item),O.tipo_item==="produccion"?"Producción":O.tipo_item.charAt(0).toUpperCase()+O.tipo_item.slice(1)]})}),a.jsx("td",{children:a.jsx("strong",{children:O.item_nombre})}),a.jsxs("td",{className:"merma-cantidad-cell",children:[O.cantidad," ",O.unidad]}),a.jsx("td",{children:O.motivo_label}),a.jsx("td",{children:O.observaciones||"-"}),a.jsx("td",{children:O.usuario_nombre}),a.jsx("td",{className:"acciones",children:a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>Ce(O.id),title:"Eliminar",children:a.jsx(Qt,{size:14})})})]},O.id))})]}),je.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron registros de merma"})]}),N&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-merma",onClick:se,children:a.jsxs("div",{className:"modal-merma",onClick:O=>O.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:"Registrar Merma"}),a.jsx("button",{className:"btn-close",onClick:se,children:a.jsx(rt,{size:18})})]}),a.jsxs("form",{onSubmit:ve,children:[a.jsxs("div",{className:"mmer-row",children:[a.jsxs("div",{className:"mmer-field",children:[a.jsx("label",{children:"Tipo *"}),a.jsx(bt,{value:w.tipo_item?de.find(O=>O.value===w.tipo_item):null,onChange:O=>{W(ee=>({...ee,tipo_item:O?O.value:"",item_id:"",unidad:""}))},options:de,styles:$r,placeholder:"Seleccionar tipo..."})]}),a.jsxs("div",{className:"mmer-field",children:[a.jsx("label",{children:"Motivo *"}),a.jsx(bt,{value:w.motivo?hv.find(O=>O.value===w.motivo):null,onChange:O=>W(ee=>({...ee,motivo:O?O.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(bt,{value:w.item_id?xe().find(O=>O.value===parseInt(w.item_id)):null,onChange:O=>{W(ee=>({...ee,item_id:O?O.value:"",unidad:O?O.unidad:""}))},options:xe(),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:O=>W(ee=>({...ee,cantidad:O.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:O=>W(ee=>({...ee,observaciones:O.target.value})),placeholder:"Detalles adicionales...",rows:2})]}),a.jsxs("div",{className:"mmer-actions",children:[a.jsx("button",{type:"button",className:"mmer-btn-cancel",onClick:se,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mmer-btn-save",disabled:C,children:C?"Guardando...":"Registrar Merma"})]})]})]})}),document.body),a.jsx(Yt,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const ui=()=>Pe.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 0 0 0.125rem",color:"#1e293b"}),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:1e4}),singleValue:i=>({...i,color:"#1e293b"}),placeholder:i=>({...i,color:"#94a3b8"})};function MN(){var qe,De;const{user:i}=Ga(),[l,d]=g.useState([]),[u,c]=g.useState([]),[m,v]=g.useState([]),[x,h]=g.useState(""),[p,S]=g.useState(""),[_,R]=g.useState(""),[U,D]=g.useState(!1),[b,T]=g.useState(!1),[N,H]=g.useState(null),[z,j]=g.useState(!0),[C,P]=g.useState(!1),[w,W]=g.useState({proveedor:"",metodo_pago:"efectivo",observaciones:""}),[de,J]=g.useState([]),G=u.filter(ne=>ne.envasado_origen===1||ne.envasado_origen===!0).map(ne=>({value:`prod_${ne.id}`,id:ne.id,tipo:"producto",label:`${ne.nombre} (${ne.unidad})`,unidad:ne.unidad})),re=[{label:"Ingredientes",options:m.map(ne=>({value:`ing_${ne.id}`,id:ne.id,tipo:"ingrediente",label:`${ne.nombre} (${ne.unidad})`,unidad:ne.unidad}))},{label:"Productos envasados",options:G}];g.useEffect(()=>{xe(),je(),$()},[]);const xe=async()=>{try{const Q=await(await fetch(ui(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCompras"})})).json();Q.success?d(Q.data||[]):A.error(Q.message||"Error al cargar compras")}catch{A.error("Error de conexion con el servidor")}finally{j(!1)}},je=async()=>{try{const Q=await(await fetch(ui(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductos"})})).json();Q.success&&c(Q.data||[])}catch(ne){console.error("Error al cargar productos:",ne)}},$=async()=>{try{const Q=await(await fetch(ui(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientes"})})).json();Q.success&&v(Q.data||[])}catch(ne){console.error("Error al cargar ingredientes:",ne)}},se=l.filter(ne=>{const Q=!x||ne.proveedor&&ne.proveedor.toLowerCase().includes(x.toLowerCase())||ne.id.toString().includes(x),fe=!p||ne.fecha>=p,q=!_||ne.fecha<=_;return Q&&fe&&q}),ve=()=>{W({proveedor:"",metodo_pago:"efectivo",observaciones:""}),J([]),D(!0)},Ce=()=>{D(!1)},me=()=>{J([...de,{tipo:"",item_id:"",nombre:"",cantidad:"",precio_unitario:"",unidad:"",_selectValue:null}])},E=(ne,Q,fe)=>{const q=[...de];q[ne][Q]=fe,J(q)},O=ne=>{J(de.filter((Q,fe)=>fe!==ne))},ee=ne=>{const Q=parseFloat(ne.cantidad)||0,fe=parseFloat(ne.precio_unitario)||0;return Q*fe},K=()=>de.reduce((ne,Q)=>ne+ee(Q),0),he=async ne=>{ne.preventDefault();const Q=de.filter(fe=>fe.item_id&&fe.cantidad>0&&fe.precio_unitario>0);if(Q.length===0){A.error("Agrega al menos un item con cantidad y precio");return}P(!0);try{const q=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:K(),usuario_id:i==null?void 0:i.id,items:Q.map(ce=>({tipo_item:ce.tipo,item_id:ce.item_id,cantidad:parseFloat(ce.cantidad),precio_unitario:parseFloat(ce.precio_unitario),unidad:ce.unidad}))})})).json();q.success?(A.success("Compra registrada correctamente"),xe(),je(),$(),Ce()):A.error(q.message||"Error al registrar compra")}catch{A.error("Error de conexion con el servidor")}finally{P(!1)}},pe=async ne=>{try{const fe=await(await fetch(ui(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getCompraDetalle",id:ne.id})})).json();fe.success?(H(fe.data),T(!0)):A.error(fe.message||"Error al cargar detalle")}catch{A.error("Error de conexion")}},Se=ne=>{l.find(Q=>Q.id===ne),A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:["¿Eliminar compra #",ne,"?"]}),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 fe=await(await fetch(ui(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarCompra",id:ne})})).json();fe.success?(A.dismiss(),A.success("Compra eliminada y stock revertido"),xe(),je(),$()):A.error(fe.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 z?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:ve,children:[a.jsx(ra,{size:20}),"Nueva Compra"]})]}),a.jsxs("div",{className:"compras-filtros",children:[a.jsxs("div",{className:"search-box",children:[a.jsx(ba,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por proveedor o # compra...",value:x,onChange:ne=>h(ne.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:ne=>S(ne.target.value)})]}),a.jsxs("div",{className:"compras-fecha-input",children:[a.jsx(Yn,{size:14}),a.jsx("input",{type:"date",value:_,onChange:ne=>R(ne.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:se.map(ne=>{var Q;return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsxs("strong",{children:["#",ne.id]})}),a.jsx("td",{children:new Date(ne.fecha+"T00:00:00").toLocaleDateString("es-MX")}),a.jsx("td",{children:ne.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}),ne.total_items]})}),a.jsx("td",{children:a.jsx("span",{className:`compras-pago-badge compras-pago-${ne.metodo_pago}`,children:((Q=Fr.find(fe=>fe.value===ne.metodo_pago))==null?void 0:Q.label)||ne.metodo_pago})}),a.jsxs("td",{className:"compras-total-cell",children:["$",Number(ne.total).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]}),a.jsx("td",{children:ne.usuario_nombre}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>pe(ne),title:"Ver detalle",children:a.jsx(ys,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>Se(ne.id),title:"Eliminar",children:a.jsx(Qt,{size:14})})]})]},ne.id)})})]}),se.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron compras"})]}),U&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-compras",onClick:Ce,children:a.jsxs("div",{className:"modal-compras",onClick:ne=>ne.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{children:"Nueva Compra"}),a.jsx("button",{className:"btn-close",onClick:Ce,children:a.jsx(rt,{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:ne=>W(Q=>({...Q,proveedor:ne.target.value})),placeholder:"Opcional"})]}),a.jsxs("div",{className:"mcom-field",children:[a.jsx("label",{children:"Metodo de Pago *"}),a.jsx(bt,{value:Fr.find(ne=>ne.value===w.metodo_pago),onChange:ne=>W(Q=>({...Q,metodo_pago:ne?ne.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:ne=>W(Q=>({...Q,observaciones:ne.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:me,children:[a.jsx(ra,{size:14})," Agregar producto / ingrediente"]})]}),de.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"})]}),de.map((ne,Q)=>a.jsxs("div",{className:"mcom-item-row",children:[a.jsx("div",{className:"mcom-col-item",children:a.jsx(bt,{value:ne._selectValue,onChange:fe=>{const q=[...de];q[Q]={...q[Q],tipo:fe?fe.tipo:"",item_id:fe?fe.id:"",nombre:fe?fe.label:"",unidad:fe?fe.unidad:"",_selectValue:fe},J(q)},options:re,styles:pv,placeholder:"Seleccionar...",noOptionsMessage:()=>"Sin resultados",menuPortalTarget:document.body,menuPosition:"fixed"})}),a.jsx("div",{className:"mcom-col-cant",children:a.jsx("input",{type:"number",value:ne.cantidad,onChange:fe=>E(Q,"cantidad",fe.target.value),min:"0",step:"0.01",placeholder:"0"})}),a.jsx("div",{className:"mcom-col-unit",children:a.jsx("input",{type:"text",value:ne.unidad,readOnly:!0,disabled:!0})}),a.jsx("div",{className:"mcom-col-precio",children:a.jsx("input",{type:"number",value:ne.precio_unitario,onChange:fe=>E(Q,"precio_unitario",fe.target.value),min:"0",step:"0.01",placeholder:"$0.00"})}),a.jsxs("div",{className:"mcom-col-subtotal",children:["$",ee(ne).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:()=>O(Q),children:a.jsx(Qt,{size:13})})})]},Q))]}),de.length>0&&a.jsxs("div",{className:"mcom-total-row",children:[a.jsx("strong",{children:"Total:"}),a.jsxs("span",{children:["$",K().toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]})]})]}),a.jsxs("div",{className:"mcom-actions",children:[a.jsx("button",{type:"button",className:"mcom-btn-cancel",onClick:Ce,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mcom-btn-save",disabled:C,children:C?"Guardando...":"Registrar Compra"})]})]})]})}),document.body),b&&N&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-compras",onClick:()=>T(!1),children:a.jsxs("div",{className:"modal-compras modal-compras-detalle",onClick:ne=>ne.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsxs("h3",{children:["Compra #",N.id]}),a.jsx("button",{className:"btn-close",onClick:()=>T(!1),children:a.jsx(rt,{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(N.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:N.proveedor||"Sin proveedor"})]}),a.jsxs("div",{className:"mcom-detalle-info-item",children:[a.jsx("span",{children:"Metodo de pago:"}),a.jsx("strong",{children:((qe=Fr.find(ne=>ne.value===N.metodo_pago))==null?void 0:qe.label)||N.metodo_pago})]}),a.jsxs("div",{className:"mcom-detalle-info-item",children:[a.jsx("span",{children:"Registrado por:"}),a.jsx("strong",{children:N.usuario_nombre})]}),N.observaciones&&a.jsxs("div",{className:"mcom-detalle-info-item",children:[a.jsx("span",{children:"Observaciones:"}),a.jsx("strong",{children:N.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:(De=N.items)==null?void 0:De.map((ne,Q)=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("span",{className:`merma-tipo-badge ${ne.tipo_item==="producto"?"merma-badge-producto":"merma-badge-ingrediente"}`,children:ne.tipo_item==="producto"?"Producto":"Ingrediente"})}),a.jsx("td",{children:a.jsx("strong",{children:ne.item_nombre})}),a.jsxs("td",{children:[ne.cantidad," ",ne.unidad]}),a.jsxs("td",{children:["$",Number(ne.precio_unitario).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]}),a.jsx("td",{children:a.jsxs("strong",{children:["$",Number(ne.subtotal).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]})})]},Q))})]}),a.jsxs("div",{className:"mcom-detalle-total",children:[a.jsx("span",{children:"Total:"}),a.jsxs("strong",{children:["$",Number(N.total).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]})]})]})]})}),document.body),a.jsx(Yt,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const di=()=>Pe.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 AN(){const{user:i}=Ga(),[l,d]=g.useState(!0),[u,c]=g.useState(null),[m,v]=g.useState([]),[x,h]=g.useState({}),[p,S]=g.useState(""),[_,R]=g.useState(""),[U,D]=g.useState(!1),[b,T]=g.useState(null),[N,H]=g.useState([]),[z,j]=g.useState({}),[C,P]=g.useState([]),[w,W]=g.useState({}),[de,J]=g.useState(null),[G,Y]=g.useState(1),re=Pe.getSucursal(),xe=Pe.getCaja();g.useEffect(()=>{je()},[]);const je=async()=>{d(!0),await Promise.all([se(),ve(),Ce(),me(),$()]),d(!1)},$=async()=>{try{const ze=await(await fetch(di(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getTurnoActivo",caja:xe,sucursal:re})})).json();ze.success&&ze.data&&(J(ze.data),S(String(ze.data.fondo_caja)))}catch(oe){console.error("Error al cargar turno:",oe)}},se=async()=>{try{const ze=await(await fetch(di(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getResumenCaja",caja:xe,sucursal:re})})).json();ze.success&&c(ze.data)}catch(oe){console.error("Error al cargar resumen:",oe)}},ve=async()=>{try{const ze=await(await fetch(di(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getPedidosPausadosActivos",caja:xe,sucursal:re})})).json();ze.success&&v(ze.data||[])}catch(oe){console.error("Error al cargar pedidos:",oe)}},Ce=async()=>{try{const ze=await(await fetch(di(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductosContabilizar"})})).json();ze.success&&H(ze.data||[])}catch(oe){console.error("Error al cargar productos:",oe)}},me=async()=>{try{const ze=await(await fetch(di(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductosSalida"})})).json();ze.success&&P(ze.data||[])}catch(oe){console.error("Error al cargar productos de salida:",oe)}},E=(oe,ze)=>{W(He=>({...He,[oe]:ze===""?"":parseFloat(ze)||0}))},O=(oe,ze)=>{if(oe.key==="Enter"){oe.preventDefault();const Ge=document.querySelectorAll(".cj-sal-list input")[ze+1];Ge?(Ge.focus(),Ge.select()):oe.target.blur()}},ee=(oe,ze)=>{j(He=>({...He,[oe]:ze===""?"":parseFloat(ze)||0}))},K=()=>N.length===0?!0:N.every(oe=>z[oe.id]!==void 0&&z[oe.id]!==""),he=(oe,ze)=>{if(oe.key==="Enter"){oe.preventDefault();const Ge=document.querySelectorAll(".cj-inv-list input")[ze+1];Ge?(Ge.focus(),Ge.select()):oe.target.blur()}},pe=(oe,ze)=>{const He=ze===""?0:parseInt(ze)||0;h(Ge=>({...Ge,[oe]:He}))},Se=()=>Gu.reduce((oe,ze)=>oe+ze.valor*(x[ze.valor]||0),0),qe=()=>{if(!u)return 0;const oe=parseFloat(p)||0;return u.efectivo+oe},De=()=>Se()-qe(),ne=["arqueo",...N.length>0?["inventario"]:[],...C.length>0?["salidas"]:[],"confirmar"],Q=ne.length,fe=ne[G-1],q=()=>fe==="arqueo"?!(!de&&!p&&p!==0):fe==="inventario"?K():!0,ce=()=>!(m.length>0||!re||!xe||!u||u.num_ventas===0||!K()),Ne=async()=>{if(!ce())return;D(!0);const oe=N.map(He=>({producto_id:He.id,nombre:He.nombre,unidad:He.unidad,stock_esperado:He.stock,stock_fisico:z[He.id]||0})),ze=C.filter(He=>parseFloat(w[He.id])>0).map(He=>({producto_id:He.id,nombre:He.nombre,unidad:He.unidad,cantidad:parseFloat(w[He.id])||0}));try{const Ge=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:xe,sucursal:re,efectivo_fisico:Se(),fondo_caja:parseFloat(p)||0,detalle_arqueo:x,notas:_,inventario:oe,salidas:ze})})).json();Ge.success?(A.success("Corte de caja realizado correctamente"),T(Ge.data),h({}),S(""),R(""),j({}),W({}),Y(1),je()):A.error(Ge.message||"Error al realizar corte")}catch{A.error("Error de conexion")}D(!1)},Be=oe=>new Intl.NumberFormat("es-MX",{style:"currency",currency:"MXN"}).format(oe);if(l)return a.jsx("div",{className:"cj",children:a.jsxs("div",{className:"cj-loading",children:[a.jsx(ka,{className:"cj-spin",size:28}),a.jsx("span",{children:"Cargando..."})]})});const Da=m.length>0||!re||!xe,ca=u&&u.num_ventas===0;return a.jsxs("div",{className:"cj",children:[a.jsx(Yt,{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(iy,{size:20})," Corte de Caja"]}),a.jsxs("span",{className:"cj-meta",children:[re," - ",xe]})]}),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:Be(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:Be(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:Be(u.tarjeta)})]})]}),de&&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:Be(de.fondo_caja)})]})]}),Da&&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."})]}),ca&&!Da&&a.jsxs("div",{className:"cj-alerta cj-alerta-warn",children:[a.jsx(bs,{size:16}),a.jsxs("span",{children:["No hay ventas registradas",u.es_primer_corte?"":" desde el ultimo corte","."]})]}),!Da&&!ca&&a.jsxs("div",{className:"cj-alerta cj-alerta-ok",children:[a.jsx(mn,{size:16}),a.jsx("span",{children:"Listo para corte"})]})]}),a.jsxs("div",{className:"cj-main",children:[a.jsx("div",{className:"cj-stepper",children:ne.map((oe,ze)=>{const He={arqueo:"Arqueo",inventario:"Inventario",salidas:"Salidas",confirmar:"Confirmar"},Ge=ze+1;return a.jsxs("div",{style:{display:"contents"},children:[a.jsxs("button",{className:`cj-step ${G===Ge?"activo":G>Ge?"completo":""}`,onClick:()=>G>=Ge&&Y(Ge),children:[a.jsx("span",{className:"cj-step-num",children:Ge}),a.jsx("span",{className:"cj-step-label",children:He[oe]})]}),ze<ne.length-1&&a.jsx("div",{className:"cj-step-line"})]},oe)})}),fe==="arqueo"&&a.jsx("div",{className:"cj-paso",children:a.jsxs("div",{className:"cj-paso-content",children:[!de&&a.jsxs("div",{className:"cj-fondo",children:[a.jsx("label",{children:"Fondo de caja inicial"}),a.jsx("input",{type:"number",value:p,onChange:oe=>S(oe.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(oe=>oe.tipo==="billete").map(oe=>a.jsxs("div",{className:`cj-denom ${(x[oe.valor]||0)>0?"tiene":""}`,children:[a.jsx("span",{className:"cj-denom-label",children:oe.label}),a.jsx("input",{type:"number",min:"0",value:x[oe.valor]||"",onChange:ze=>pe(oe.valor,ze.target.value),placeholder:"0"}),a.jsx("span",{className:"cj-denom-sub",children:Be((x[oe.valor]||0)*oe.valor)})]},oe.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(oe=>oe.tipo==="moneda").map(oe=>a.jsxs("div",{className:`cj-denom moneda ${(x[oe.valor]||0)>0?"tiene":""}`,children:[a.jsx("span",{className:"cj-denom-label",children:oe.label}),a.jsx("input",{type:"number",min:"0",value:x[oe.valor]||"",onChange:ze=>pe(oe.valor,ze.target.value),placeholder:"0"}),a.jsx("span",{className:"cj-denom-sub",children:Be((x[oe.valor]||0)*oe.valor)})]},oe.valor))})]}),a.jsxs("div",{className:"cj-arqueo-total",children:[a.jsx("span",{children:"Total Contado"}),a.jsx("span",{className:"cj-arqueo-total-val",children:Be(Se())})]})]})}),fe==="inventario"&&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.",!K()&&a.jsxs("span",{className:"cj-inv-pend",children:[" ",N.filter(oe=>z[oe.id]===void 0||z[oe.id]==="").length," pendiente(s)"]})]}),a.jsx("div",{className:"cj-inv-list",children:N.map((oe,ze)=>{const He=z[oe.id],Ge=He!==void 0&&He!=="";return a.jsxs("div",{className:`cj-inv-item ${Ge?"ok":""}`,children:[a.jsx("span",{className:"cj-inv-nombre",children:oe.nombre}),a.jsxs("div",{className:"cj-inv-input",children:[a.jsx("input",{type:"number",min:"0",step:"0.01",value:He??"",onChange:Tt=>ee(oe.id,Tt.target.value),onKeyDown:Tt=>he(Tt,ze),placeholder:"Fisico"}),a.jsx("span",{className:"cj-inv-unidad",children:oe.unidad})]})]},oe.id)})})]})}),fe==="salidas"&&a.jsx("div",{className:"cj-paso",children:a.jsxs("div",{className:"cj-paso-content",children:[a.jsx("p",{className:"cj-inv-desc",children:"Registra las cantidades de salida. Si el producto tiene receta, al realizar el corte se descontara su inventario."}),a.jsx("div",{className:"cj-inv-list cj-sal-list",children:C.map((oe,ze)=>{const He=w[oe.id],Ge=He!==void 0&&He!==""&&parseFloat(He)>0;return a.jsxs("div",{className:`cj-inv-item ${Ge?"ok":""}`,children:[a.jsxs("span",{className:"cj-inv-nombre",children:[oe.nombre,oe.tiene_receta===1&&a.jsx("span",{className:"cj-sal-receta",title:"Tiene receta",children:"R"})]}),a.jsxs("div",{className:"cj-inv-input",children:[a.jsx("input",{type:"number",min:"0",step:"0.01",value:He??"",onChange:Tt=>E(oe.id,Tt.target.value),onKeyDown:Tt=>O(Tt,ze),placeholder:"0"}),a.jsx("span",{className:"cj-inv-unidad",children:oe.unidad})]})]},oe.id)})})]})}),fe==="confirmar"&&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:Be(qe())}),a.jsxs("span",{className:"cj-confirm-detail",children:["Ventas ",Be((u==null?void 0:u.efectivo)||0)," + Fondo ",Be(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:Be(Se())}),a.jsx("span",{className:"cj-confirm-detail",children:"Arqueo fisico"})]}),a.jsxs("div",{className:`cj-confirm-card cj-confirm-dif ${De()>=0?"pos":"neg"}`,children:[a.jsx("span",{className:"cj-confirm-label",children:"Diferencia"}),a.jsx("span",{className:"cj-confirm-val",children:Be(De())}),a.jsx("span",{className:"cj-confirm-detail",children:De()>0?"Sobrante":De()<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:_,onChange:oe=>R(oe.target.value),placeholder:"Observaciones del corte...",rows:2})]}),a.jsx("button",{className:"cj-btn-corte",onClick:Ne,disabled:U||!ce(),children:U?a.jsxs(a.Fragment,{children:[a.jsx(ka,{size:18,className:"cj-spin"})," Procesando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(mn,{size:18})," Realizar Corte de Caja"]})})]})}),a.jsxs("div",{className:"cj-nav",children:[G>1&&a.jsxs("button",{className:"cj-nav-btn",onClick:()=>Y(G-1),children:[a.jsx(fy,{size:16})," Anterior"]}),a.jsx("div",{style:{flex:1}}),G<Q&&a.jsxs("button",{className:"cj-nav-btn cj-nav-next",onClick:()=>q()&&Y(G+1),disabled:!q(),children:["Siguiente ",a.jsx(_v,{size:16})]})]})]}),b&&a.jsx("div",{className:"cj-modal-overlay",onClick:()=>T(null),children:a.jsxs("div",{className:"cj-modal",onClick:oe=>oe.stopPropagation(),children:[a.jsxs("div",{className:"cj-modal-header",children:[a.jsx(mn,{size:24}),a.jsx("h3",{children:"Corte Realizado"}),a.jsx("button",{className:"cj-modal-close",onClick:()=>T(null),children:a.jsx(rt,{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:Be(b.ventas_total)})]}),a.jsxs("div",{className:"cj-result-item",children:[a.jsx("span",{children:"Efectivo"}),a.jsx("strong",{children:Be(b.ventas_efectivo)})]}),a.jsxs("div",{className:"cj-result-item",children:[a.jsx("span",{children:"Tarjeta"}),a.jsx("strong",{children:Be(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:Be(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((oe,ze)=>a.jsxs("div",{className:"cj-result-inv-row",children:[a.jsx("span",{children:oe.nombre}),a.jsx("span",{children:oe.stock_fisico}),a.jsxs("span",{className:oe.diferencia<0?"neg":oe.diferencia>0?"pos":"",children:[oe.diferencia>=0?"+":"",oe.diferencia.toFixed(1)]})]},ze))]}),b.salidas&&b.salidas.length>0&&a.jsxs("div",{className:"cj-result-inv",children:[a.jsx("h4",{children:"Salidas"}),b.salidas.map((oe,ze)=>a.jsxs("div",{className:"cj-result-inv-row",children:[a.jsxs("span",{children:[oe.nombre,oe.tiene_receta===1&&a.jsx("span",{className:"cj-sal-receta",children:"R"})]}),a.jsxs("span",{children:[oe.cantidad," ",oe.unidad]}),a.jsx("span",{})]},ze))]})]}),a.jsxs("button",{className:"cj-modal-ok",onClick:()=>T(null),children:[a.jsx(mn,{size:16})," Entendido"]})]})})]})}function wN(){return a.jsx("div",{className:"reportes",children:a.jsx("h2",{children:"Módulo de Reportes"})})}function kN(){return a.jsx("div",{className:"estadisticas",children:a.jsx("h2",{children:"Módulo de Estadísticas"})})}const Yu=()=>Pe.getApiUrl(),DN=[{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 RN(){const{syncStatus:i,sincronizando:l,ultimaSync:d,syncError:u,intervalo:c,logs:m,ejecutarSync:v,setIntervalo:x,limpiarLogs:h,cargarEstadoSync:p}=dd(),[S,_]=g.useState("general"),[R,U]=g.useState({sucursal:"",caja:"",apiUrl:""}),[D,b]=g.useState({host:"",usuario:"",password:"",nombre:"",puerto:3306,activa:!1}),[T,N]=g.useState(!1),[H,z]=g.useState(!1),[j,C]=g.useState(null),[P,w]=g.useState(!1),[W,de]=g.useState(null),[J,G]=g.useState(!1),[Y,re]=g.useState(null),[xe,je]=g.useState(!0);g.useEffect(()=>{$()},[]);const $=async()=>{const K=Pe.getAll();U({sucursal:K.sucursal||"",caja:K.caja||"",apiUrl:K.apiUrl||""});try{const pe=await(await fetch(Yu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getConfiguracion"})})).json();pe.success&&pe.data&&(U(Se=>({...Se,sucursal:pe.data.sucursal||Se.sucursal,caja:pe.data.caja||Se.caja})),b({host:pe.data.db_remota_host||"",usuario:pe.data.db_remota_usuario||"",password:pe.data.db_remota_password||"",nombre:pe.data.db_remota_nombre||"",puerto:pe.data.db_remota_puerto||3306,activa:pe.data.db_remota_activa||!1}))}catch(he){console.error("Error al cargar configuracion:",he)}je(!1)},se=K=>{const{name:he,value:pe}=K.target;U(Se=>({...Se,[he]:pe})),C(null),he==="apiUrl"&&de(null)},ve=K=>{const{name:he,value:pe,type:Se,checked:qe}=K.target;b(De=>({...De,[he]:Se==="checkbox"?qe:pe})),C(null),re(null)},Ce=async()=>{if(!R.apiUrl.trim()){de({success:!1,message:"Ingrese una URL"});return}w(!0),de(null);const K=await Pe.testConnection(R.apiUrl);de(K),w(!1)},me=async()=>{if(!D.host.trim()||!D.usuario.trim()||!D.nombre.trim()){re({success:!1,message:"Complete los campos requeridos"});return}G(!0),re(null);try{const he=await(await fetch(Yu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"probarConexionRemota",host:D.host,usuario:D.usuario,password:D.password,nombre:D.nombre,puerto:D.puerto})})).json();re({success:he.success,message:he.message})}catch{re({success:!1,message:"Error al probar conexion"})}G(!1)},E=async()=>{if(!R.sucursal.trim()){C({tipo:"error",texto:"El nombre de la sucursal es requerido"});return}if(!R.caja.trim()){C({tipo:"error",texto:"El nombre de la caja es requerido"});return}if(!R.apiUrl.trim()){C({tipo:"error",texto:"La URL de la API es requerida"});return}z(!0),Pe.save({apiUrl:R.apiUrl,sucursal:R.sucursal,caja:R.caja});try{const he=await(await fetch(Yu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"actualizarConfiguracion",sucursal:R.sucursal,caja:R.caja,db_remota_host:D.host,db_remota_usuario:D.usuario,db_remota_password:D.password,db_remota_nombre:D.nombre,db_remota_puerto:D.puerto,db_remota_activa:D.activa})})).json();z(!1),he.success?(C({tipo:"exito",texto:"Configuracion guardada correctamente"}),p()):C({tipo:"error",texto:he.message||"Error al guardar"})}catch{z(!1),C({tipo:"error",texto:"Error de conexion al guardar"})}},O=async()=>{await v(!0)},ee=K=>K?K.toLocaleString("es-MX",{day:"2-digit",month:"2-digit",year:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-";return xe?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:()=>_("general"),children:[a.jsx(kp,{size:15})," General"]}),a.jsxs("button",{className:`cfg-tab ${S==="sync"?"cfg-tab-active":""}`,onClick:()=>_("sync"),children:[a.jsx(ka,{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:R.sucursal,onChange:se,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:R.caja,onChange:se,placeholder:"Ej: Caja 1"})]})]})]}),a.jsxs("div",{className:"config-section",children:[a.jsxs("h3",{children:[a.jsx(dx,{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:R.apiUrl,onChange:se,placeholder:"http://localhost/api_torti/api.php"}),a.jsx("button",{type:"button",className:"btn-probar",onClick:Ce,disabled:P,children:P?a.jsxs(a.Fragment,{children:[a.jsx(ka,{size:14,className:"spinning"})," Probando..."]}):a.jsx(a.Fragment,{children:"Probar"})})]}),W&&a.jsx("div",{className:`estado-conexion ${W.success?"exito":"error"}`,children:W.success?a.jsxs(a.Fragment,{children:[a.jsx(mn,{size:14})," ",W.message]}):a.jsxs(a.Fragment,{children:[a.jsx(vs,{size:14})," ",W.message]})})]})]}),a.jsxs("div",{className:"config-section",children:[a.jsxs("h3",{children:[a.jsx(Cy,{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:D.activa,onChange:ve}),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:D.host,onChange:ve,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:D.puerto,onChange:ve,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:D.usuario,onChange:ve,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:T?"text":"password",id:"db_password",name:"password",value:D.password,onChange:ve,placeholder:"Contrasena"}),a.jsx("button",{type:"button",className:"btn-toggle-password",onClick:()=>N(!T),children:T?a.jsx(fd,{size:16}):a.jsx(ys,{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:D.nombre,onChange:ve,placeholder:"Nombre de la BD"}),a.jsx("button",{type:"button",className:"btn-probar",onClick:me,disabled:J,children:J?a.jsxs(a.Fragment,{children:[a.jsx(ka,{size:14,className:"spinning"})," Probando..."]}):a.jsx(a.Fragment,{children:"Probar"})})]}),Y&&a.jsx("div",{className:`estado-conexion ${Y.success?"exito":"error"}`,children:Y.success?a.jsxs(a.Fragment,{children:[a.jsx(mn,{size:14})," ",Y.message]}):a.jsxs(a.Fragment,{children:[a.jsx(vs,{size:14})," ",Y.message]})})]})]}),j&&a.jsxs("div",{className:`config-mensaje ${j.tipo}`,children:[j.tipo==="exito"?a.jsx(mn,{size:16}):a.jsx(vs,{size:16}),j.texto]}),a.jsx("div",{className:"config-actions",children:a.jsx("button",{className:"btn-guardar",onClick:E,disabled:H,children:H?"Guardando...":"Guardar Configuracion"})}),a.jsxs("div",{className:"config-info",children:[a.jsx(Xy,{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:O,disabled:l||!i.activa,children:[a.jsx(ka,{size:14,className:l?"spinning":""}),l?"Sincronizando...":"Sincronizar ahora"]})})]}),a.jsxs("div",{className:"config-section",children:[a.jsxs("h3",{children:[a.jsx(bs,{size:16})," Sincronizacion Automatica"]}),a.jsx("div",{className:"cfg-intervalo-grid",children:DN.map(K=>a.jsx("button",{className:`cfg-intervalo-btn ${c===K.value?"cfg-intervalo-active":""}`,onClick:()=>x(K.value),children:K.label},K.value))}),a.jsxs("div",{className:"config-info",style:{marginTop:"clamp(0.3rem, 0.6vh, 0.5rem)"},children:[a.jsx(bs,{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(Qt,{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((K,he)=>a.jsxs("tr",{className:K.exito?"":"cfg-log-error",children:[a.jsx("td",{children:K.fecha.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),a.jsx("td",{children:a.jsx("span",{className:`cfg-log-tipo ${K.tipo==="manual"?"cfg-log-manual":"cfg-log-auto"}`,children:K.tipo==="manual"?"Manual":"Auto"})}),a.jsx("td",{children:a.jsxs("span",{className:`cfg-log-estado ${K.exito?"cfg-log-ok":"cfg-log-fail"}`,children:[K.exito?a.jsx(mn,{size:12}):a.jsx(vs,{size:12}),K.exito?"OK":"Error"]})}),a.jsx("td",{className:"cfg-log-msg",children:K.mensaje}),a.jsxs("td",{children:[K.duracion,"s"]})]},he))})]})})]})]})]})}const Pr=()=>Pe.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 UN(){const[i,l]=g.useState([]),[d,u]=g.useState([]),[c,m]=g.useState(""),[v,x]=g.useState(""),[h,p]=g.useState(!1),[S,_]=g.useState(null),[R,U]=g.useState(!0),[D,b]=g.useState(!1),[T,N]=g.useState({username:"",password:"",nombre:"",email:"",telefono:"",perfil_id:""}),H=d.map(G=>({value:G.id,label:G.nombre}));g.useEffect(()=>{z(),j()},[]);const z=async()=>{try{const Y=await(await fetch(Pr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getUsuarios"})})).json();Y.success?l(Y.data||[]):A.error(Y.message||"Error al cargar usuarios")}catch{A.error("Error de conexion con el servidor")}finally{U(!1)}},j=async()=>{try{const Y=await(await fetch(Pr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getPerfiles"})})).json();Y.success&&u(Y.data||[])}catch(G){console.error("Error al cargar perfiles:",G)}},C=i.filter(G=>{const Y=G.nombre.toLowerCase().includes(c.toLowerCase())||G.username.toLowerCase().includes(c.toLowerCase())||G.email&&G.email.toLowerCase().includes(c.toLowerCase()),re=!v||G.perfil_id===v;return Y&&re}),P=(G=null)=>{G?(_(G),N({username:G.username,password:"",nombre:G.nombre,email:G.email||"",telefono:G.telefono||"",perfil_id:G.perfil_id})):(_(null),N({username:"",password:"",nombre:"",email:"",telefono:"",perfil_id:""})),b(!1),p(!0)},w=()=>{p(!1),_(null)},W=G=>{const{name:Y,value:re}=G.target;N(xe=>({...xe,[Y]:re}))},de=async G=>{if(G.preventDefault(),!S&&!T.password){A.error("La contraseña es requerida para nuevos usuarios");return}const Y={tipo:S?"actualizarUsuario":"crearUsuario",...T,perfil_id:parseInt(T.perfil_id)};S&&(Y.id=S.id,T.password||delete Y.password);try{const xe=await(await fetch(Pr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Y)})).json();xe.success?(A.success(S?"Usuario actualizado correctamente":"Usuario creado correctamente"),z(),w()):A.error(xe.message||"Error al guardar usuario")}catch{A.error("Error de conexion con el servidor")}},J=G=>{const Y=i.find(re=>re.id===G);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar usuario "',Y==null?void 0:Y.nombre,'"?']}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const xe=await(await fetch(Pr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarUsuario",id:G})})).json();xe.success?(A.dismiss(),A.success("Usuario eliminado"),z()):A.error(xe.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 R?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:()=>P(),children:[a.jsx(ra,{size:20}),"Nuevo Usuario"]})]}),a.jsxs("div",{className:"usuarios-filtros",children:[a.jsxs("div",{className:"search-box",children:[a.jsx(ba,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por nombre, usuario o email...",value:c,onChange:G=>m(G.target.value)})]}),a.jsx(bt,{value:v?H.find(G=>G.value===v):null,onChange:G=>x(G?G.value:""),options:H,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:C.map(G=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("strong",{children:G.username})}),a.jsx("td",{children:G.nombre}),a.jsx("td",{children:G.email||"-"}),a.jsx("td",{children:G.telefono||"-"}),a.jsx("td",{children:a.jsx("span",{className:"perfil-badge",children:G.perfil})}),a.jsx("td",{children:G.ultimo_acceso?new Date(G.ultimo_acceso).toLocaleString():"Nunca"}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>P(G),children:a.jsx(xs,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>J(G.id),children:a.jsx(Qt,{size:14})})]})]},G.id))})]}),C.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron usuarios"})]}),h&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-usuarios",onClick:w,children:a.jsxs("div",{className:"modal-usuarios",onClick:G=>G.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(rt,{size:18})})]}),a.jsxs("form",{onSubmit:de,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:T.username,onChange:W,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:D?"text":"password",name:"password",value:T.password,onChange:W,required:!S,placeholder:S?"Dejar vacio para mantener":""}),a.jsx("button",{type:"button",className:"musr-toggle-password",onClick:()=>b(!D),children:D?a.jsx(fd,{size:18}):a.jsx(ys,{size:18})})]})]})]}),a.jsxs("div",{className:"musr-field",children:[a.jsx("label",{children:"Nombre Completo *"}),a.jsx("input",{type:"text",name:"nombre",value:T.nombre,onChange:W,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:T.email,onChange:W})]}),a.jsxs("div",{className:"musr-field",children:[a.jsx("label",{children:"Telefono"}),a.jsx("input",{type:"text",name:"telefono",value:T.telefono,onChange:W})]})]}),a.jsxs("div",{className:"musr-field",children:[a.jsx("label",{children:"Perfil *"}),a.jsx(bt,{value:T.perfil_id?H.find(G=>G.value===T.perfil_id):null,onChange:G=>N(Y=>({...Y,perfil_id:G?G.value:""})),options:H,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(Yt,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const Gr=()=>Pe.getApiUrl();function LN(){const[i,l]=g.useState([]),[d,u]=g.useState([]),[c,m]=g.useState(""),[v,x]=g.useState(!1),[h,p]=g.useState(null),[S,_]=g.useState(!0),[R,U]=g.useState({nombre:"",descripcion:"",permisos:[]});g.useEffect(()=>{D(),b()},[]);const D=async()=>{try{const G=await(await fetch(Gr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getPerfiles"})})).json();G.success?l(G.data||[]):A.error(G.message||"Error al cargar perfiles")}catch{A.error("Error de conexion con el servidor")}finally{_(!1)}},b=async()=>{try{const G=await(await fetch(Gr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getPermisos"})})).json();G.success&&u(G.data||[])}catch(J){console.error("Error al cargar permisos:",J)}},T=i.filter(J=>J.nombre.toLowerCase().includes(c.toLowerCase())||J.descripcion&&J.descripcion.toLowerCase().includes(c.toLowerCase())),N=(J=null)=>{J?(p(J),U({nombre:J.nombre,descripcion:J.descripcion||"",permisos:J.permisos||[]})):(p(null),U({nombre:"",descripcion:"",permisos:[]})),x(!0)},H=()=>{x(!1),p(null)},z=J=>{const{name:G,value:Y}=J.target;U(re=>({...re,[G]:Y}))},j=J=>{U(G=>({...G,permisos:G.permisos.includes(J)?G.permisos.filter(Y=>Y!==J):[...G.permisos,J]}))},C=()=>{U(J=>({...J,permisos:d.map(G=>G.codigo)}))},P=()=>{U(J=>({...J,permisos:[]}))},w=async J=>{if(J.preventDefault(),!R.nombre){A.error("El nombre es requerido");return}const G={tipo:h?"actualizarPerfil":"crearPerfil",...R};h&&(G.id=h.id);try{const re=await(await fetch(Gr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(G)})).json();re.success?(A.success(h?"Perfil actualizado correctamente":"Perfil creado correctamente"),D(),H()):A.error(re.message||"Error al guardar perfil")}catch{A.error("Error de conexion con el servidor")}},W=J=>{const G=i.find(Y=>Y.id===J);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar perfil "',G==null?void 0:G.nombre,'"?']}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[a.jsx("button",{onClick:async()=>{try{const re=await(await fetch(Gr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarPerfil",id:J})})).json();re.success?(A.dismiss(),A.success("Perfil eliminado"),D()):A.error(re.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=d.reduce((J,G)=>{const Y=G.modulo;return J[Y]||(J[Y]=[]),J[Y].push(G),J},{});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:()=>N(),children:[a.jsx(ra,{size:20}),"Nuevo Perfil"]})]}),a.jsx("div",{className:"perfiles-filtros",children:a.jsxs("div",{className:"search-box",children:[a.jsx(ba,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar perfil...",value:c,onChange:J=>m(J.target.value)})]})}),a.jsx("div",{className:"perfiles-grid",children:T.map(J=>{var G,Y,re,xe;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:J.nombre}),a.jsx("p",{children:J.descripcion||"Sin descripcion"})]}),a.jsxs("div",{className:"perfil-actions",children:[a.jsx("button",{className:"btn-icon",onClick:()=>N(J),children:a.jsx(xs,{size:16})}),J.nombre!=="Administrador"&&a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>W(J.id),children:a.jsx(Qt,{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:[J.total_usuarios," usuario",J.total_usuarios!==1?"s":""]})]}),a.jsxs("div",{className:"stat",children:[a.jsx(Zu,{size:16}),a.jsxs("span",{children:[((G=J.permisos)==null?void 0:G.length)||0," permiso",(((Y=J.permisos)==null?void 0:Y.length)||0)!==1?"s":""]})]})]}),a.jsxs("div",{className:"perfil-permisos",children:[(re=J.permisos)==null?void 0:re.slice(0,5).map(je=>a.jsx("span",{className:"permiso-tag",children:je.replace("ver_","")},je)),((xe=J.permisos)==null?void 0:xe.length)>5&&a.jsxs("span",{className:"permiso-tag more",children:["+",J.permisos.length-5]})]})]})]},J.id)})}),T.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron perfiles"}),v&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-perfiles",onClick:H,children:a.jsxs("div",{className:"modal-perfiles",onClick:J=>J.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:H,children:a.jsx(rt,{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:R.nombre,onChange:z,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:R.descripcion,onChange:z})]})]}),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:C,children:"Seleccionar todos"}),a.jsx("button",{type:"button",className:"mperf-btn-link",onClick:P,children:"Deseleccionar todos"})]})]}),a.jsx("div",{className:"mperf-permisos-grid",children:Object.entries(de).map(([J,G])=>a.jsxs("div",{className:"mperf-permiso-group",children:[a.jsx("h5",{children:J.charAt(0).toUpperCase()+J.slice(1)}),G.map(Y=>a.jsxs("label",{className:"mperf-check-label",children:[a.jsx("input",{type:"checkbox",checked:R.permisos.includes(Y.codigo),onChange:()=>j(Y.codigo)}),a.jsx("span",{className:"mperf-check-box"}),a.jsxs("span",{className:"mperf-permiso-label",children:[a.jsx("strong",{children:Y.nombre}),a.jsx("small",{children:Y.descripcion})]})]},Y.codigo))]},J))})]}),a.jsxs("div",{className:"mperf-actions",children:[a.jsx("button",{type:"button",className:"mperf-btn-cancel",onClick:H,children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mperf-btn-save",children:h?"Guardar Cambios":"Crear Perfil"})]})]})]})}),document.body),a.jsx(Yt,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const Ba=()=>Pe.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 qN(){const{user:i}=Ga(),{ejecutarSync:l,sincronizando:d}=dd(),u=Pe.getSucursal(),[c,m]=g.useState("transferencias"),[v,x]=g.useState([]),[h,p]=g.useState([]),[S,_]=g.useState([]),[R,U]=g.useState([]),[D,b]=g.useState(!0),[T,N]=g.useState(!1),[H,z]=g.useState(""),[j,C]=g.useState(""),[P,w]=g.useState(""),[W,de]=g.useState(""),[J,G]=g.useState(""),[Y,re]=g.useState(!1),[xe,je]=g.useState(!1),[$,se]=g.useState(!1),[ve,Ce]=g.useState(!1),[me,E]=g.useState(null),[O,ee]=g.useState({sucursal_destino_id:"",observaciones:""}),[K,he]=g.useState({sucursal_destino_id:"",observaciones:""}),[pe,Se]=g.useState([]),[qe,De]=g.useState({}),[ne,Q]=g.useState(null),[fe,q]=g.useState({nombre:"",direccion:"",telefono:""}),[ce,Ne]=g.useState(""),Be=S.map(k=>({value:`prod_${k.id}`,id:k.id,tipo:"producto",label:`${k.nombre} (${k.unidad||"pza"})`,unidad:k.unidad||"pza",stock:k.stock})),ca=[{label:"Ingredientes",options:R.map(k=>({value:`ing_${k.id}`,id:k.id,tipo:"ingrediente",label:`${k.nombre} (${k.unidad})`,unidad:k.unidad,stock:k.cantidad}))},{label:"Productos",options:Be}],oe=h.find(k=>k.nombre===u),He=h.filter(k=>k.nombre!==u).map(k=>({value:k.id,label:k.nombre}));g.useEffect(()=>{Ge()},[]);const Ge=async()=>{await Promise.all([Tt(),Nt(),Ya(),Ra()]),b(!1)},Tt=async()=>{try{const ue=await(await fetch(Ba(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getTransferencias"})})).json();ue.success&&x(ue.data||[])}catch(k){console.error(k)}},Nt=async()=>{try{const ue=await(await fetch(Ba(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getSucursales"})})).json();ue.success&&p(ue.data||[])}catch(k){console.error(k)}},Ya=async()=>{try{const ue=await(await fetch(Ba(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getProductos"})})).json();ue.success&&_(ue.data||[])}catch(k){console.error(k)}},Ra=async()=>{try{const ue=await(await fetch(Ba(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientes"})})).json();ue.success&&U(ue.data||[])}catch(k){console.error(k)}},Xa=v.filter(k=>{const ue=H.toLowerCase(),_e=!H||k.sucursal_origen_nombre.toLowerCase().includes(ue)||k.sucursal_destino_nombre.toLowerCase().includes(ue)||k.id.toString().includes(ue),Ae=!j||k.tipo===j,Je=!P||k.estado===P,ot=!W||k.fecha>=W,yt=!J||k.fecha<=J;return _e&&Ae&&Je&&ot&&yt}),za=h.filter(k=>k.nombre.toLowerCase().includes(ce.toLowerCase())),Xn=()=>{Se([...pe,{tipo:"",item_id:"",item_nombre:"",cantidad:"",unidad:"",_selectValue:null,stock:0}])},Dt=k=>{Se(pe.filter((ue,_e)=>_e!==k))},bn=()=>{ee({sucursal_destino_id:"",observaciones:""}),Se([]),re(!0)},In=async k=>{k.preventDefault();const ue=pe.filter(Ae=>Ae.item_id&&parseFloat(Ae.cantidad)>0);if(ue.length===0){A.error("Agrega al menos un item con cantidad");return}if(!O.sucursal_destino_id){A.error("Selecciona una sucursal a quien solicitar");return}const _e=h.find(Ae=>Ae.id===O.sucursal_destino_id);N(!0);try{const Je=await(await fetch(Ba(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"crearRequisicion",sucursal_origen_id:(oe==null?void 0:oe.id)||0,sucursal_origen_nombre:u,sucursal_destino_id:O.sucursal_destino_id,sucursal_destino_nombre:(_e==null?void 0:_e.nombre)||"",observaciones:O.observaciones,usuario_id:i==null?void 0:i.id,items:ue.map(ot=>({tipo_item:ot.tipo,item_id:ot.item_id,item_nombre:ot.item_nombre,cantidad:parseFloat(ot.cantidad),unidad:ot.unidad}))})})).json();Je.success?(A.success("Requisición creada"),Tt(),l(),re(!1)):A.error(Je.message)}catch{A.error("Error de conexión")}finally{N(!1)}},Zt=()=>{he({sucursal_destino_id:"",observaciones:""}),Se([]),je(!0)},wt=async k=>{k.preventDefault();const ue=pe.filter(Ae=>Ae.item_id&&parseFloat(Ae.cantidad)>0);if(ue.length===0){A.error("Agrega al menos un item con cantidad");return}if(!K.sucursal_destino_id){A.error("Selecciona una sucursal destino");return}const _e=h.find(Ae=>Ae.id===K.sucursal_destino_id);N(!0);try{const Je=await(await fetch(Ba(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"crearEnvioDirecto",sucursal_origen_id:(oe==null?void 0:oe.id)||0,sucursal_origen_nombre:u,sucursal_destino_id:K.sucursal_destino_id,sucursal_destino_nombre:(_e==null?void 0:_e.nombre)||"",observaciones:K.observaciones,usuario_id:i==null?void 0:i.id,items:ue.map(ot=>({tipo_item:ot.tipo,item_id:ot.item_id,item_nombre:ot.item_nombre,cantidad:parseFloat(ot.cantidad),unidad:ot.unidad}))})})).json();Je.success?(A.success("Envío registrado. Stock descontado."),Tt(),Ya(),Ra(),l(),je(!1)):A.error(Je.message)}catch{A.error("Error de conexión")}finally{N(!1)}},ft=async k=>{var ue;try{const Ae=await(await fetch(Ba(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getTransferenciaDetalle",id:k.id})})).json();if(Ae.success){E(Ae.data);const Je={};(ue=Ae.data.items)==null||ue.forEach(ot=>{Je[ot.id]={enviada:ot.cantidad_enviada>0?ot.cantidad_enviada:ot.cantidad_solicitada,recibida:ot.cantidad_recibida>0?ot.cantidad_recibida:ot.cantidad_enviada}}),De(Je),se(!0)}else A.error(Ae.message)}catch{A.error("Error de conexión")}},Ke=async(k,ue,_e={})=>{try{const Je=await(await fetch(Ba(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:k,id:ue,usuario_id:i==null?void 0:i.id,..._e})})).json();Je.success?(A.success(Je.message),Tt(),Ya(),Ra(),l(),se(!1)):A.error(Je.message)}catch{A.error("Error de conexión")}},B=()=>{if(!me)return;const k=me.items.map(ue=>{var _e;return{id:ue.id,cantidad_enviada:parseFloat((_e=qe[ue.id])==null?void 0:_e.enviada)||0}});Ke("enviarRequisicion",me.id,{items:k})},ge=()=>{if(!me)return;const k=me.items.map(ue=>{var _e;return{id:ue.id,cantidad_recibida:parseFloat((_e=qe[ue.id])==null?void 0:_e.recibida)||0}});Ke("recibirTransferencia",me.id,{items:k})},be=(k=null)=>{k?(Q(k),q({nombre:k.nombre,direccion:k.direccion||"",telefono:k.telefono||""})):(Q(null),q({nombre:"",direccion:"",telefono:""})),Ce(!0)},Te=async k=>{k.preventDefault();const ue={tipo:ne?"actualizarSucursal":"crearSucursal",...fe};ne&&(ue.id=ne.id);try{const Ae=await(await fetch(Ba(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ue)})).json();Ae.success?(A.success(ne?"Sucursal actualizada":"Sucursal creada"),Nt(),Ce(!1)):A.error(Ae.message)}catch{A.error("Error de conexión")}},Lt=k=>{const ue=h.find(_e=>_e.id===k);A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:['¿Eliminar sucursal "',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 Ae=await(await fetch(Ba(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"eliminarSucursal",id:k})})).json();Ae.success?(A.dismiss(),A.success("Sucursal eliminada"),Nt()):A.error(Ae.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})},Jt=k=>{A.warn(a.jsxs("div",{children:[a.jsxs("p",{children:["¿Cancelar transferencia #",k,"?"]}),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 Ke("cancelarTransferencia",k)},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})},F=k=>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:Xn,children:[a.jsx(ra,{size:14})," Agregar Producto/ingrediente"]})]}),pe.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"}),k&&a.jsx("span",{className:"mreq-col-stock",children:"Stock"}),a.jsx("span",{className:"mreq-col-del"})]}),pe.map((ue,_e)=>a.jsxs("div",{className:"mreq-item-row",children:[a.jsx("div",{className:"mreq-col-item",children:a.jsx(bt,{value:ue._selectValue,onChange:Ae=>{const Je=[...pe];Je[_e]={...Je[_e],tipo:Ae?Ae.tipo:"",item_id:Ae?Ae.id:"",item_nombre:Ae?Ae.label.split(" (")[0]:"",unidad:Ae?Ae.unidad:"",stock:Ae?Ae.stock:0,_selectValue:Ae},Se(Je)},options:ca,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:ue.cantidad,onChange:Ae=>{const Je=[...pe];Je[_e].cantidad=Ae.target.value,Se(Je)},min:"0",step:"0.01",placeholder:"0"})}),a.jsx("div",{className:"mreq-col-unit",children:a.jsx("input",{type:"text",value:ue.unidad,readOnly:!0,disabled:!0})}),k&&a.jsx("div",{className:"mreq-col-stock",children:a.jsx("span",{className:ue.stock>0?"req-stock-ok":"req-stock-low",children:ue.stock})}),a.jsx("div",{className:"mreq-col-del",children:a.jsx("button",{type:"button",className:"btn-icon btn-danger",onClick:()=>Dt(_e),children:a.jsx(Qt,{size:13})})})]},_e))]})]});if(D)return a.jsx("div",{className:"requisiciones",children:a.jsx("p",{children:"Cargando..."})});const ye={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:ye[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:bn,children:[a.jsx(mi,{size:16})," Nueva Requisición"]}),a.jsxs("button",{className:"btn-primary",onClick:Zt,children:[a.jsx(cx,{size:16})," Nuevo Envío"]})]}),c==="sucursales"&&a.jsxs("button",{className:"btn-primary",onClick:()=>be(),children:[a.jsx(ra,{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(By,{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(ba,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar por # o sucursal...",value:H,onChange:k=>z(k.target.value)})]}),a.jsx(bt,{value:j?{value:j,label:Xu[j]}:null,onChange:k=>C(k?k.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(bt,{value:P?{value:P,label:Yr[P]}:null,onChange:k=>w(k?k.value:""),options:Object.entries(Yr).map(([k,ue])=>({value:k,label:ue})),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:W,onChange:k=>de(k.target.value)})]}),a.jsxs("div",{className:"req-fecha-input",children:[a.jsx(Yn,{size:14}),a.jsx("input",{type:"date",value:J,onChange:k=>G(k.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:Xa.map(k=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsxs("strong",{children:["#",k.id]})}),a.jsx("td",{children:new Date(k.fecha+"T00:00:00").toLocaleDateString("es-MX")}),a.jsx("td",{children:a.jsx("span",{className:`req-tipo-badge req-tipo-${k.tipo}`,children:Xu[k.tipo]})}),a.jsx("td",{children:k.sucursal_origen_nombre}),a.jsx("td",{children:k.sucursal_destino_nombre}),a.jsx("td",{children:a.jsxs("span",{className:"req-items-badge",children:[a.jsx(Gt,{size:12})," ",k.total_items]})}),a.jsx("td",{children:a.jsx("span",{className:`req-estado-badge req-estado-${k.estado}`,children:Yr[k.estado]})}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>ft(k),title:"Ver detalle",children:a.jsx(ys,{size:14})}),k.estado!=="recibida"&&k.estado!=="cancelada"&&k.estado!=="rechazada"&&a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>Jt(k.id),title:"Cancelar",children:a.jsx(vs,{size:14})})]})]},k.id))})]}),Xa.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(ba,{size:20}),a.jsx("input",{type:"text",placeholder:"Buscar sucursal...",value:ce,onChange:k=>Ne(k.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:za.map(k=>a.jsxs("tr",{children:[a.jsxs("td",{children:[a.jsx("strong",{children:k.nombre}),k.nombre===u&&a.jsx("span",{className:"req-badge-actual",children:"Actual"})]}),a.jsx("td",{children:k.direccion||a.jsx("span",{style:{color:"#94a3b8"},children:"-"})}),a.jsx("td",{children:k.telefono||a.jsx("span",{style:{color:"#94a3b8"},children:"-"})}),a.jsxs("td",{className:"acciones",children:[a.jsx("button",{className:"btn-icon",onClick:()=>be(k),title:"Editar",children:a.jsx(ys,{size:14})}),a.jsx("button",{className:"btn-icon btn-danger",onClick:()=>Lt(k.id),title:"Eliminar",children:a.jsx(Qt,{size:14})})]})]},k.id))})]}),za.length===0&&a.jsx("p",{className:"sin-resultados",children:"No se encontraron sucursales"})]})]}),Y&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-req",onClick:()=>re(!1),children:a.jsxs("div",{className:"modal-req",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"mreq-header",children:[a.jsx("h3",{children:"Nueva Requisición"}),a.jsx("button",{className:"mreq-btn-close",onClick:()=>re(!1),children:a.jsx(rt,{size:18})})]}),a.jsxs("form",{onSubmit:In,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(bt,{value:He.find(k=>k.value===O.sucursal_destino_id)||null,onChange:k=>ee(ue=>({...ue,sucursal_destino_id:k?k.value:""})),options:He,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:O.observaciones,onChange:k=>ee(ue=>({...ue,observaciones:k.target.value})),placeholder:"Opcional"})]})]}),F(!1),a.jsxs("div",{className:"mreq-actions",children:[a.jsx("button",{type:"button",className:"mreq-btn-cancel",onClick:()=>re(!1),children:"Cancelar"}),a.jsx("button",{type:"submit",className:"mreq-btn-save",disabled:T,children:T?"Guardando...":"Crear Requisición"})]})]})]})}),document.body),xe&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-req",onClick:()=>je(!1),children:a.jsxs("div",{className:"modal-req",onClick:k=>k.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(rt,{size:18})})]}),a.jsxs("form",{onSubmit:wt,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(bt,{value:He.find(k=>k.value===K.sucursal_destino_id)||null,onChange:k=>he(ue=>({...ue,sucursal_destino_id:k?k.value:""})),options:He,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:K.observaciones,onChange:k=>he(ue=>({...ue,observaciones:k.target.value})),placeholder:"Opcional"})]})]}),F(!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:T,children:T?"Guardando...":"Registrar Envío"})]})]})]})}),document.body),$&&me&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-req",onClick:()=>se(!1),children:a.jsxs("div",{className:"modal-req modal-req-detalle",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"mreq-header",children:[a.jsxs("h3",{children:["Transferencia #",me.id]}),a.jsx("button",{className:"mreq-btn-close",onClick:()=>se(!1),children:a.jsx(rt,{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-${me.tipo}`,children:Xu[me.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-${me.estado}`,children:Yr[me.estado]})})]}),a.jsxs("div",{className:"mreq-detalle-info-item",children:[a.jsx("span",{children:"Origen:"}),a.jsx("strong",{children:me.sucursal_origen_nombre})]}),a.jsxs("div",{className:"mreq-detalle-info-item",children:[a.jsx("span",{children:"Destino:"}),a.jsx("strong",{children:me.sucursal_destino_nombre})]}),a.jsxs("div",{className:"mreq-detalle-info-item",children:[a.jsx("span",{children:"Fecha:"}),a.jsx("strong",{children:new Date(me.fecha+"T00:00:00").toLocaleDateString("es-MX")})]}),me.observaciones&&a.jsxs("div",{className:"mreq-detalle-info-item",children:[a.jsx("span",{children:"Observaciones:"}),a.jsx("strong",{children:me.observaciones})]})]}),(()=>{var ot;const k=me.sucursal_origen_nombre===u,ue=me.sucursal_destino_nombre===u,_e=me.tipo==="requisicion",Ae=me.estado==="aprobada"&&ue&&_e,Je=me.estado==="enviada"&&(_e&&k||!_e&&ue);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:(ot=me.items)==null?void 0:ot.map((yt,Nl)=>{var gi,Ns;return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx("span",{className:`req-item-tipo-badge ${yt.tipo_item==="producto"?"req-badge-producto":"req-badge-ingrediente"}`,children:yt.tipo_item==="producto"?"Producto":"Ingrediente"})}),a.jsx("td",{children:a.jsx("strong",{children:yt.item_nombre})}),a.jsxs("td",{children:[yt.cantidad_solicitada," ",yt.unidad]}),a.jsx("td",{children:Ae?a.jsx("input",{type:"number",className:"mreq-cant-input",value:((gi=qe[yt.id])==null?void 0:gi.enviada)??"",onChange:Qn=>De(yn=>({...yn,[yt.id]:{...yn[yt.id],enviada:Qn.target.value}})),min:"0",step:"0.01"}):yt.cantidad_enviada>0?`${yt.cantidad_enviada} ${yt.unidad}`:"-"}),a.jsx("td",{children:Je?a.jsx("input",{type:"number",className:"mreq-cant-input",value:((Ns=qe[yt.id])==null?void 0:Ns.recibida)??"",onChange:Qn=>De(yn=>({...yn,[yt.id]:{...yn[yt.id],recibida:Qn.target.value}})),min:"0",step:"0.01"}):yt.cantidad_recibida>0?`${yt.cantidad_recibida} ${yt.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(me.created_at).toLocaleString("es-MX")]})]}),me.fecha_aprobacion&&a.jsxs("div",{className:"mreq-timeline-item mreq-timeline-done",children:[a.jsx("div",{className:"mreq-timeline-dot"}),a.jsxs("span",{children:[me.estado==="rechazada"?"Rechazada":"Aprobada"," - ",new Date(me.fecha_aprobacion).toLocaleString("es-MX")]})]}),me.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(me.fecha_envio).toLocaleString("es-MX")]})]}),me.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(me.fecha_recepcion).toLocaleString("es-MX")]})]})]}),(()=>{const k=me.sucursal_origen_nombre===u,ue=me.sucursal_destino_nombre===u,_e=me.tipo==="requisicion",Ae=me.estado==="pendiente"&&ue&&_e,Je=me.estado==="aprobada"&&ue&&_e,ot=me.estado==="enviada"&&(_e&&k||!_e&&ue);return a.jsxs("div",{className:"mreq-detalle-actions",children:[Ae&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"mreq-btn-aprobar",onClick:()=>Ke("aprobarRequisicion",me.id),children:[a.jsx(Gn,{size:16})," Aprobar"]}),a.jsxs("button",{className:"mreq-btn-rechazar",onClick:()=>Ke("rechazarRequisicion",me.id),children:[a.jsx(vs,{size:16})," Rechazar"]})]}),Je&&a.jsxs("button",{className:"mreq-btn-enviar",onClick:B,children:[a.jsx(zx,{size:16})," Enviar"]}),ot&&a.jsxs("button",{className:"mreq-btn-recibir",onClick:ge,children:[a.jsx(Gt,{size:16})," Dar Entrada"]})]})})()]})]})}),document.body),ve&&Pt.createPortal(a.jsx("div",{className:"modal-overlay-req",onClick:()=>Ce(!1),children:a.jsxs("div",{className:"modal-req modal-req-sm",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"mreq-header",children:[a.jsx("h3",{children:ne?"Editar Sucursal":"Nueva Sucursal"}),a.jsx("button",{className:"mreq-btn-close",onClick:()=>Ce(!1),children:a.jsx(rt,{size:18})})]}),a.jsxs("form",{onSubmit:Te,children:[a.jsxs("div",{className:"mreq-field",children:[a.jsx("label",{children:"Nombre *"}),a.jsx("input",{type:"text",value:fe.nombre,onChange:k=>q(ue=>({...ue,nombre:k.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:fe.direccion,onChange:k=>q(ue=>({...ue,direccion:k.target.value})),placeholder:"Opcional"})]}),a.jsxs("div",{className:"mreq-field",children:[a.jsx("label",{children:"Teléfono"}),a.jsx("input",{type:"text",value:fe.telefono,onChange:k=>q(ue=>({...ue,telefono:k.target.value})),placeholder:"Opcional"})]}),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",children:ne?"Guardar Cambios":"Crear Sucursal"})]})]})]})}),document.body),a.jsx(Yt,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const HN=()=>Pe.getApiUrl();function VN(){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,x]=g.useState(!1),[h,p]=g.useState("todos"),[S,_]=g.useState("todos"),R=async()=>{x(!0);try{const T=await(await fetch(HN(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getRastreoInventario",fecha_inicio:i,fecha_fin:d,sucursal:Pe.getSucursal(),caja:Pe.getCaja()})})).json();T.success?m(T.data||[]):A.error(T.message||"Error al obtener datos")}catch{A.error("Error de conexion")}finally{x(!1)}},U=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):[],D=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(Yt,{position:"top-right",autoClose:3e3}),a.jsxs("div",{className:"ri-header",children:[a.jsxs("h2",{children:[a.jsx(Gt,{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:R,disabled:v,children:[v?a.jsx(ka,{size:16,className:"ri-spin"}):a.jsx(ba,{size:16}),v?"Buscando...":"Consultar"]})]})]}),c===null?a.jsxs("div",{className:"ri-empty",children:[a.jsx(Gt,{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:[D&&a.jsxs("div",{className:"ri-resumen",children:[a.jsxs("button",{className:`ri-card ${S==="todos"&&h==="todos"?"activo":""}`,onClick:()=>{_("todos"),p("todos")},children:[a.jsx("span",{className:"ri-card-num",children:D.totalProductos+D.totalIngredientes}),a.jsx("span",{className:"ri-card-label",children:"Todos"})]}),a.jsxs("button",{className:`ri-card ${S==="producto"?"activo":""}`,onClick:()=>{_("producto"),p("todos")},children:[a.jsx(Gt,{size:14}),a.jsx("span",{className:"ri-card-num",children:D.totalProductos}),a.jsx("span",{className:"ri-card-label",children:"Productos"})]}),a.jsxs("button",{className:`ri-card ${S==="ingrediente"?"activo":""}`,onClick:()=>{_("ingrediente"),p("todos")},children:[a.jsx(yl,{size:14}),a.jsx("span",{className:"ri-card-num",children:D.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"),_("todos")},children:[a.jsx(Mv,{size:14}),a.jsx("span",{className:"ri-card-num",children:D.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"),_("todos")},children:[a.jsx(mn,{size:14}),a.jsx("span",{className:"ri-card-num",children:D.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:U.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:"12",className:"ri-sin-datos",children:"Sin resultados para este filtro"})}):U.map(b=>{const T=b.discrepancia!==null&&Math.abs(b.discrepancia)>.01;return a.jsxs("tr",{className:T?"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 ${T?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),T&&(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=()=>Pe.getApiUrl();function BN(){const{user:i}=Ga(),[l,d]=g.useState("conteo"),[u,c]=g.useState([]),[m,v]=g.useState([]),[x,h]=g.useState(!1),[p,S]=g.useState(!1),[_,R]=g.useState(""),[U,D]=g.useState(""),[b,T]=g.useState(!0),[N,H]=g.useState({}),[z,j]=g.useState(null);g.useEffect(()=>{l==="conteo"?C():P()},[l]);const C=async()=>{h(!0);try{const re=await(await fetch(Xr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getIngredientesParaConteo"})})).json();if(re.success){c(re.data||[]);const xe={};(re.data||[]).forEach(je=>{xe[je.id]=""}),H(xe)}else A.error(re.message||"Error al cargar ingredientes")}catch{A.error("Error de conexion")}finally{h(!1)}},P=async()=>{h(!0);try{const re=await(await fetch(Xr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getConteosIngredientes",sucursal:Pe.getSucursal()})})).json();re.success&&v(re.data||[])}catch{A.error("Error de conexion")}finally{h(!1)}},w=(Y,re)=>{H(xe=>({...xe,[Y]:re}))},W=Object.entries(N).filter(([,Y])=>Y!==""&&Y!==null).length,de=async()=>{const Y=u.filter(re=>N[re.id]!==""&&N[re.id]!==null).map(re=>({ingrediente_id:re.id,nombre:re.nombre,unidad:re.unidad,stock_fisico:parseFloat(N[re.id])||0}));if(Y.length===0){A.warning("Ingresa al menos un conteo");return}S(!0);try{const xe=await(await fetch(Xr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"registrarConteoIngredientes",items:Y,notas:U,ajustar_stock:b,usuario_id:(i==null?void 0:i.id)||0,usuario_nombre:(i==null?void 0:i.nombre)||"",sucursal:Pe.getSucursal()})})).json();xe.success?(A.success("Conteo registrado correctamente"),D(""),C()):A.error(xe.message||"Error al registrar")}catch{A.error("Error de conexion")}finally{S(!1)}},J=async Y=>{try{const xe=await(await fetch(Xr(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tipo:"getConteoIngredienteDetalle",conteo_id:Y})})).json();xe.success&&j(xe.data)}catch{A.error("Error al cargar detalle")}},G=u.filter(Y=>Y.nombre.toLowerCase().includes(_.toLowerCase()));return a.jsxs("div",{className:"ii",children:[a.jsx(Yt,{position:"top-right",autoClose:3e3}),a.jsxs("div",{className:"ii-header",children:[a.jsxs("h2",{children:[a.jsx(yl,{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(bs,{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(ba,{size:16}),a.jsx("input",{type:"text",placeholder:"Buscar ingrediente...",value:_,onChange:Y=>R(Y.target.value)})]}),a.jsx("div",{className:"ii-toolbar-info",children:a.jsxs("span",{className:"ii-contados",children:[W," / ",u.length," contados"]})})]}),a.jsx("div",{className:"ii-tabla-wrap",children:x?a.jsxs("div",{className:"ii-loading",children:[a.jsx(ka,{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:G.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:"3",className:"ii-sin-datos",children:"Sin ingredientes"})}):G.map(Y=>{const re=N[Y.id]!==""&&N[Y.id]!==null&&N[Y.id]!==void 0;return a.jsxs("tr",{children:[a.jsx("td",{className:"ii-td-nombre",children:Y.nombre}),a.jsx("td",{className:"ii-td-center",children:Y.unidad}),a.jsx("td",{className:"ii-td-fisico",children:a.jsx("input",{type:"number",step:"0.01",min:"0",placeholder:"0.00",value:N[Y.id]??"",onChange:xe=>w(Y.id,xe.target.value),className:re?"ii-input-filled":""})})]},Y.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:U,onChange:Y=>D(Y.target.value)}),a.jsxs("label",{className:"ii-check-ajustar",children:[a.jsx("input",{type:"checkbox",checked:b,onChange:Y=>T(Y.target.checked)}),"Ajustar stock al fisico"]})]}),a.jsxs("button",{className:"ii-btn-guardar",onClick:de,disabled:p||W===0,children:[p?a.jsx(ka,{size:16,className:"ii-spin"}):a.jsx(ix,{size:16}),p?"Guardando...":"Guardar Conteo"]})]})]}):a.jsx("div",{className:"ii-tabla-wrap",children:x?a.jsxs("div",{className:"ii-loading",children:[a.jsx(ka,{size:24,className:"ii-spin"})," Cargando..."]}):m.length===0?a.jsxs("div",{className:"ii-empty",children:[a.jsx(bs,{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(Y=>a.jsxs("tr",{children:[a.jsx("td",{className:"ii-td-fecha",children:new Date(Y.fecha).toLocaleString("es-MX",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}),a.jsx("td",{children:Y.usuario_nombre}),a.jsx("td",{className:"ii-td-center",children:Y.total_items}),a.jsx("td",{className:"ii-td-notas",children:Y.notas||"-"}),a.jsx("td",{className:"ii-td-center",children:a.jsxs("button",{className:"ii-btn-ver",onClick:()=>J(Y.id),children:[a.jsx(ys,{size:14})," Ver"]})})]},Y.id))})]})}),z&&Pt.createPortal(a.jsx("div",{className:"ii-modal-overlay",onClick:()=>j(null),children:a.jsxs("div",{className:"ii-modal",onClick:Y=>Y.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(z.conteo.fecha).toLocaleString("es-MX")," - ",z.conteo.usuario_nombre]})]}),z.conteo.notas&&a.jsx("p",{className:"ii-modal-notas",children:z.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:z.items.map(Y=>a.jsxs("tr",{children:[a.jsx("td",{className:"ii-td-nombre",children:Y.nombre}),a.jsx("td",{className:"ii-td-center",children:Y.unidad}),a.jsx("td",{className:"ii-td-num",children:Y.stock_fisico.toFixed(2)})]},Y.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 $N(){const{login:i}=Ga(),[l,d]=g.useState({username:"",password:""}),[u,c]=g.useState(!1),[m,v]=g.useState(!1),x=p=>{const{name:S,value:_}=p.target;d(R=>({...R,[S]:_}))},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:x,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(Ly,{size:20}),a.jsx("input",{type:u?"text":"password",name:"password",value:l.password,onChange:x,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(ys,{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(Yt,{position:"top-right",autoClose:3e3,hideProgressBar:!1,newestOnTop:!0,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"})]})}const FN=[{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 PN(){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(ka,{size:14,className:l?"sync-global-spinning":""})})]})}function GN(){const{isAuthenticated:i,loading:l,tienePermiso:d}=Ga(),[u,c]=g.useState(!1),[m,v]=g.useState(null);g.useEffect(()=>{if(i&&!m){const h=FN.find(p=>d(p.permiso));v((h==null?void 0:h.id)||"ventas")}},[i,d,m]);const x=()=>{switch(m){case"ventas":return a.jsx(O1,{});case"productos":return a.jsx(xN,{});case"categorias":return a.jsx(jN,{});case"ingredientes":return a.jsx(CN,{});case"producciones":return a.jsx(_N,{});case"reporte_producciones":return a.jsx(TN,{});case"clientes":return a.jsx(ON,{});case"merma":return a.jsx(zN,{});case"compras":return a.jsx(MN,{});case"requisiciones":return a.jsx(qN,{});case"caja":return a.jsx(AN,{});case"reportes":return a.jsx(wN,{});case"rastreo_inventario":return a.jsx(VN,{});case"inventario_ingredientes":return a.jsx(BN,{});case"estadisticas":return a.jsx(kN,{});case"configuracion":return a.jsx(RN,{});case"usuarios":return a.jsx(UN,{});case"perfiles":return a.jsx(LN,{});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(Hx,{isOpen:u,setIsOpen:c,activeMenu:m,setActiveMenu:v}),a.jsx(Vx,{onClick:()=>c(!0)}),a.jsx(PN,{}),a.jsx("main",{className:"main-content",children:x()})]})}):a.jsx($N,{})}function YN(){return a.jsx(Ib,{children:a.jsx(GN,{})})}Xb.createRoot(document.getElementById("root")).render(a.jsx(ht.StrictMode,{children:a.jsx(YN,{})}));
