1var rB=Object.defineProperty;var g1=e=>{throw TypeError(e)};var nB=(e,t,r)=>t in e?rB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var cc=(e,t,r)=>nB(e,typeof t!="symbol"?t+"":t,r),Gv=(e,t,r)=>t.has(e)||g1("Cannot "+r);var U=(e,t,r)=>(Gv(e,t,"read from private field"),r?r.call(e):t.get(e)),qe=(e,t,r)=>t.has(e)?g1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Ee=(e,t,r,n)=>(Gv(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),rt=(e,t,r)=>(Gv(e,t,"access private method"),r);var Jd=(e,t,r,n)=>({set _(a){Ee(e,t,a,r)},get _(){return U(e,t,n)}});import{u as it,a as Xe,j as o,P as Me,c as ue,d as Go,b as Ka,e as Rh,f as Lr,V as _P,g as hn,h as $l,A as Lh,C as r0,S as NP,R as aB,i as n0,k as Qn,l as a0,O as Fh,m as Bh,n as EP,T as zh,D as qh,o as CP,p as OP,q as kl,r as iB,s as bd,t as oB,v as Uh,_ as Wh,w as Vh,x as Rt,y as Gh,z as Hh,B as Kh,E as Yh,F as Xh,G as Zh,H as Qh,I as sB,J as i0,K as o0,L as PP,M as lB,N as AP,Q as TP,U as cB,W as DP,X as uB,Y as $P,Z as kP,$ as dB,a0 as fB,a1 as MP,a2 as mB,a3 as hB,a4 as IP}from"./ui-BvxbG1jw.js";import{a as wd,r as h,b as Ho,R as $,$ as RP,d as pt,c as ef}from"./vendor-C7GLl8Yh.js";import{c as pB,_ as vB}from"./supabase-CWq0S8CO.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var LP,y1=wd;LP=y1.createRoot,y1.hydrateRoot;const gB=5,yB=1e6;let Hv=0;function xB(){return Hv=(Hv+1)%Number.MAX_VALUE,Hv.toString()}const bB=new Map,wB=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,gB)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?x1(r):e.toasts.forEach(n=>{x1(n.id)}),{...e,toasts:e.toasts.map(n=>
1n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}};function x1(e){const t=setTimeout(()=>{Uc({type:"REMOVE_TOAST",toastId:e})},yB);bB.set(e,t)}const Bf=[];let zf={toasts:[]};function Uc(e){zf=wB(zf,e),Bf.forEach(t=>{t(zf)})}function ao({...e}){const t=xB(),r=a=>Uc({type:"UPDATE_TOAST",toast:{...a,id:t}}),n=()=>Uc({type:"DISMISS_TOAST",toastId:t});return Uc({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||n()}}}),{id:t,dismiss:n,update:r}}function Rn(){const[e,t]=h.useState(zf);return h.useEffect(()=>(Bf.push(t),()=>{const r=Bf.indexOf(t);r>-1&&Bf.splice(r,1)}),[e]),{...e,toast:ao,dismiss:r=>Uc({type:"DISMISS_TOAST",toastId:r})}}function jB(e,t=globalThis==null?void 0:globalThis.document){const r=it(e);h.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var SB="DismissableLayer",xy="dismissableLayer.update",_B="dismissableLayer.pointerDownOutside",NB="dismissableLayer.focusOutside",b1,FP=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),BP=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...c}=e,u=h.useContext(FP),[d,f]=h.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=h.useState({}),y=Xe(t,N=>f(N)),v=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf(g),b=d?v.indexOf(d):-1,j=u.layersWithOutsidePointerEventsDisabled.size>0,w=b>=x,S=CB(N=>{const E=N.target,O=[...u.branches].some(P=>P.contains(E));!w||O||(a==null||a(N),s==null||s(N),N.defaultPrevented||l==null||l())},m),_=OB(N=>{const E=N.target;[...u.branches].some(P=>P.contains(E))||(i==null||i(N),s==null||s(N),N.defaultPrevented||l==null||l())},m);return jB(N=>{b===u.layers.size-1&&(n==null||n(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},m),h.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(b1=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),w1(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=b1)}},[d,m,r,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),w1())},[d,u]),h.useEffect(()=>{const N=()=>p({});return document.addEventListener(xy,N),()=>document.removeEventListener(xy,N)},[]),o.jsx(Me.div,{...c,ref:y,style:{pointerEvents:j?w?"auto":"none":void 0,...e.style},onFocusCapture:ue(e.onFocusCapture,_.onFocusCapture),onBlurCapture:ue(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:ue(e.onPointerDownCapture,S.onPointerDownCapture)})});BP.displayName=SB;var EB="DismissableLayerBranch",zP=h.forwardRef((e,t)=>{const r=h.useContext(FP),n=h.useRef(null),a=Xe(t,n);return h.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),o.jsx(Me.div,{...e,ref:a})});zP.displayName=EB;function CB(e,t=globalThis==null?void 0:globalThis.document){const r=it(e),n=h.useRef(!1),a=h.useRef(()=>{});return h.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){qP(_B,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function OB(e,t=globalThis==null?void 0:globalThis.document){const r=it(e),n=h.useRef(!1);return h.useEffect(()=>{const a=i=>{i.target&&!n.current&&qP(NB,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function w1(){const e=new CustomEvent(xy);document.dispatchEvent(e)}function qP(e,t,r,{discrete:n}){const a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?Go(a,i):a.dispatchEvent(i)}var PB=BP,AB=zP,TB="Portal",UP=h.forwardRef((e,t)=>
1{var l;const{container:r,...n}=e,[a,i]=h.useState(!1);Ka(()=>i(!0),[]);const s=r||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?Ho.createPortal(o.jsx(Me.div,{...n,ref:t}),s):null});UP.displayName=TB;function DB(e,t){return h.useReducer((r,n)=>t[r][n]??r,e)}var er=e=>{const{present:t,children:r}=e,n=$B(t),a=typeof r=="function"?r({present:n.isPresent}):h.Children.only(r),i=Xe(n.ref,kB(a));return typeof r=="function"||n.isPresent?h.cloneElement(a,{ref:i}):null};er.displayName="Presence";function $B(e){const[t,r]=h.useState(),n=h.useRef({}),a=h.useRef(e),i=h.useRef("none"),s=e?"mounted":"unmounted",[l,c]=DB(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=tf(n.current);i.current=l==="mounted"?u:"none"},[l]),Ka(()=>{const u=n.current,d=a.current;if(d!==e){const m=i.current,p=tf(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==p?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),Ka(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const v=tf(n.current).includes(p.animationName);if(p.target===t&&v&&(c("ANIMATION_END"),!a.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},m=p=>{p.target===t&&(i.current=tf(n.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function tf(e){return(e==null?void 0:e.animationName)||"none"}function kB(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var s0="ToastProvider",[l0,MB,IB]=Rh("Toast"),[WP,LPe]=Lr("Toast",[IB]),[RB,Jh]=WP(s0),VP=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:s}=e,[l,c]=h.useState(null),[u,d]=h.useState(0),f=h.useRef(!1),m=h.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${s0}\`. Expected non-empty \`string\`.`),o.jsx(l0.Provider,{scope:t,children:o.jsx(RB,{scope:t,label:r,duration:n,swipeDirection:a,swipeThreshold:i,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:h.useCallback(()=>d(p=>p+1),[]),onToastRemove:h.useCallback(()=>d(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:s})})};VP.displayName=s0;var GP="ToastViewport",LB=["F8"],by="toast.viewportPause",wy="toast.viewportResume",HP=h.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=LB,label:a="Notifications ({hotkey})",...i}=e,s=Jh(GP,r),l=MB(r),c=h.useRef(null),u=h.useRef(null),d=h.useRef(null),f=h.useRef(null),m=Xe(t,f,s.onViewportChange),p=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=s.toastCount>0;h.useEffect(()=>{const g=x=>{var j;n.length!==0&&n.every(w=>x[w]||x.code===w)&&((j=f.current)==null||j.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[n]),h.useEffect(()=>{const g=c.current,x=f.current;if(y&&g&&x){const b=()=>{if(!s.isClosePausedRef.current){const _=new CustomEvent(by);x.dispatchEvent(_),s.isClosePausedRef.current=!0}},j=()=>
1{if(s.isClosePausedRef.current){const _=new CustomEvent(wy);x.dispatchEvent(_),s.isClosePausedRef.current=!1}},w=_=>{!g.contains(_.relatedTarget)&&j()},S=()=>{g.contains(document.activeElement)||j()};return g.addEventListener("focusin",b),g.addEventListener("focusout",w),g.addEventListener("pointermove",b),g.addEventListener("pointerleave",S),window.addEventListener("blur",b),window.addEventListener("focus",j),()=>{g.removeEventListener("focusin",b),g.removeEventListener("focusout",w),g.removeEventListener("pointermove",b),g.removeEventListener("pointerleave",S),window.removeEventListener("blur",b),window.removeEventListener("focus",j)}}},[y,s.isClosePausedRef]);const v=h.useCallback(({tabbingDirection:g})=>{const b=l().map(j=>{const w=j.ref.current,S=[w,...ZB(w)];return g==="forwards"?S:S.reverse()});return(g==="forwards"?b.reverse():b).flat()},[l]);return h.useEffect(()=>{const g=f.current;if(g){const x=b=>{var S,_,N;const j=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!j){const E=document.activeElement,O=b.shiftKey;if(b.target===g&&O){(S=u.current)==null||S.focus();return}const A=v({tabbingDirection:O?"backwards":"forwards"}),T=A.findIndex(k=>k===E);Kv(A.slice(T+1))?b.preventDefault():O?(_=u.current)==null||_.focus():(N=d.current)==null||N.focus()}};return g.addEventListener("keydown",x),()=>g.removeEventListener("keydown",x)}},[l,v]),o.jsxs(AB,{ref:c,role:"region","aria-label":a.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&o.jsx(jy,{ref:u,onFocusFromOutsideViewport:()=>{const g=v({tabbingDirection:"forwards"});Kv(g)}}),o.jsx(l0.Slot,{scope:r,children:o.jsx(Me.ol,{tabIndex:-1,...i,ref:m})}),y&&o.jsx(jy,{ref:d,onFocusFromOutsideViewport:()=>{const g=v({tabbingDirection:"backwards"});Kv(g)}})]})});HP.displayName=GP;var KP="ToastFocusProxy",jy=h.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...a}=e,i=Jh(KP,r);return o.jsx(_P,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:s=>{var u;const l=s.relatedTarget;!((u=i.viewport)!=null&&u.contains(l))&&n()}})});jy.displayName=KP;var ep="Toast",FB="toast.swipeStart",BB="toast.swipeMove",zB="toast.swipeCancel",qB="toast.swipeEnd",YP=h.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:a,onOpenChange:i,...s}=e,[l=!0,c]=hn({prop:n,defaultProp:a,onChange:i});return o.jsx(er,{present:r||l,children:o.jsx(VB,{open:l,...s,ref:t,onClose:()=>c(!1),onPause:it(e.onPause),onResume:it(e.onResume),onSwipeStart:ue(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ue(e.onSwipeMove,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:ue(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ue(e.onSwipeEnd,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});YP.displayName=ep;var[UB,WB]=WP(ep,{onClose(){}}),VB=h.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:a,open:i,onClose:s,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:p,...y}=e,v=Jh(ep,r),[g,x]=h.useState(null),b=Xe(t,k=>x(k)),j=h.useRef(null),w=h.useRef(null),S=a||v.duration,_=h.useRef(0),N=h.useRef(S),E=h.useRef(0),{onToastAdd:O,onToastRemove:P}=v,C=it(()=>{var D;(g==null?void 0:g.contains(document.activeElement))&&((D=v.viewport)==null||D.focus()),s()}),A=h.useCallback(k=>
1{!k||k===1/0||(window.clearTimeout(E.current),_.current=new Date().getTime(),E.current=window.setTimeout(C,k))},[C]);h.useEffect(()=>{const k=v.viewport;if(k){const D=()=>{A(N.current),u==null||u()},M=()=>{const F=new Date().getTime()-_.current;N.current=N.current-F,window.clearTimeout(E.current),c==null||c()};return k.addEventListener(by,M),k.addEventListener(wy,D),()=>{k.removeEventListener(by,M),k.removeEventListener(wy,D)}}},[v.viewport,S,c,u,A]),h.useEffect(()=>{i&&!v.isClosePausedRef.current&&A(S)},[i,S,v.isClosePausedRef,A]),h.useEffect(()=>(O(),()=>P()),[O,P]);const T=h.useMemo(()=>g?rA(g):null,[g]);return v.viewport?o.jsxs(o.Fragment,{children:[T&&o.jsx(GB,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:T}),o.jsx(UB,{scope:r,onClose:C,children:wd.createPortal(o.jsx(l0.ItemSlot,{scope:r,children:o.jsx(PB,{asChild:!0,onEscapeKeyDown:ue(l,()=>{v.isFocusedToastEscapeKeyDownRef.current||C(),v.isFocusedToastEscapeKeyDownRef.current=!1}),children:o.jsx(Me.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":v.swipeDirection,...y,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ue(e.onKeyDown,k=>{k.key==="Escape"&&(l==null||l(k.nativeEvent),k.nativeEvent.defaultPrevented||(v.isFocusedToastEscapeKeyDownRef.current=!0,C()))}),onPointerDown:ue(e.onPointerDown,k=>{k.button===0&&(j.current={x:k.clientX,y:k.clientY})}),onPointerMove:ue(e.onPointerMove,k=>{if(!j.current)return;const D=k.clientX-j.current.x,M=k.clientY-j.current.y,F=!!w.current,q=["left","right"].includes(v.swipeDirection),I=["left","up"].includes(v.swipeDirection)?Math.min:Math.max,K=q?I(0,D):0,W=q?0:I(0,M),R=k.pointerType==="touch"?10:2,V={x:K,y:W},re={originalEvent:k,delta:V};F?(w.current=V,rf(BB,f,re,{discrete:!1})):j1(V,v.swipeDirection,R)?(w.current=V,rf(FB,d,re,{discrete:!1}),k.target.setPointerCapture(k.pointerId)):(Math.abs(D)>R||Math.abs(M)>R)&&(j.current=null)}),onPointerUp:ue(e.onPointerUp,k=>{const D=w.current,M=k.target;if(M.hasPointerCapture(k.pointerId)&&M.releasePointerCapture(k.pointerId),w.current=null,j.current=null,D){const F=k.currentTarget,q={originalEvent:k,delta:D};j1(D,v.swipeDirection,v.swipeThreshold)?rf(qB,p,q,{discrete:!0}):rf(zB,m,q,{discrete:!0}),F.addEventListener("click",I=>I.preventDefault(),{once:!0})}})})})}),v.viewport)})]}):null}),GB=e=>{const{__scopeToast:t,children:r,...n}=e,a=Jh(ep,t),[i,s]=h.useState(!1),[l,c]=h.useState(!1);return YB(()=>s(!0)),h.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:o.jsx(UP,{asChild:!0,children:o.jsx(_P,{...n,children:i&&o.jsxs(o.Fragment,{children:[a.label," ",r]})})})},HB="ToastTitle",XP=h.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return o.jsx(Me.div,{...n,ref:t})});XP.displayName=HB;var KB="ToastDescription",ZP=h.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return o.jsx(Me.div,{...n,ref:t})});ZP.displayName=KB;var QP="ToastAction",JP=h.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?o.jsx(tA,{altText:r,asChild:!0,children:o.jsx(c0,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${QP}\`. Expected non-empty \`string\`.`),null)});JP.displayName=QP;var eA="ToastClose",c0=h.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,a=WB(eA,r);return o.jsx(tA,{asChild:!0,children:o.jsx(Me.button,{type:"button",...n,ref:t,onClick:ue(e.onClick,a.onClose)})})});c0.displayName=eA;var tA=h.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...a}=e;return o.jsx(Me.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...a,ref:t})});function rA(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),XB(n)){const a=n.ariaHidden||n.hidden||n.style.display==="none",i=n.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const s=n.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...rA(n))}}),t}function rf(e,t,r,{discrete:n}){const a=r.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?Go(a,i):a.dispatchEvent(i)}var j1=(e,t,r=0)=>{const n=Math.abs(e.x),a=Math.abs(e.y),i=n>a;return t==="left"||t==="right"?i&&n>r:!i&&a>r};function YB(e=()=>{}){const t=it(e);Ka(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}
vendor: 9,626 bytes, lines 1-130
1function XB(e){return e.nodeType===e.ELEMENT_NODE}function ZB(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Kv(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var QB=VP,nA=HP,aA=YP,iA=XP,oA=ZP,sA=JP,lA=c0;function cA(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=cA(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Qe(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=cA(e))&&(n&&(n+=" "),n+=t);return n}const S1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,_1=Qe,Ml=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return _1(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:a,defaultVariants:i}=t,s=Object.keys(a).map(u=>{const d=r==null?void 0:r[u],f=i==null?void 0:i[u];if(d===null)return null;const m=S1(d)||S1(f);return a[u][m]}),l=r&&Object.entries(r).reduce((u,d)=>{let[f,m]=d;return m===void 0||(u[f]=m),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:f,className:m,...p}=d;return Object.entries(p).every(y=>{let[v,g]=y;return Array.isArray(g)?g.includes({...i,...l}[v]):{...i,...l}[v]===g})?[...u,f,m]:u},[]);return _1(e,s,c,r==null?void 0:r.class,r==null?void 0:r.className)};/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const JB=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),uA=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */var e3={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"};/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const t3=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:i,iconNode:s,...l},c)=>h.createElement("svg",{ref:c,...e3,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:uA("lucide",a),...l},[...s.map(([u,d])=>h.createElement(u,d)),...Array.isArray(i)?i:[i]]));/** 17 * @license lucide-react v0.462.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const xe=(e,t)=>{const r=h.forwardRef(({className:n,...a},i)=>h.createElement(t3,{ref:i,iconNode:t,className:uA(`lucide-${JB(e)}`,n),...a}));return r.displayName=`${e}`,r};/** 22 * @license lucide-react v0.462.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */const u0=xe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** 27 * @license lucide-react v0.462.0 - ISC 28 * 29 * This source code is licensed under the ISC license. 30 * See the LICENSE file in the root directory of this source tree. 31 */const N1=xe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** 32 * @license lucide-react v0.462.0 - ISC 33 * 34 * This source code is licensed under the ISC license. 35 * See the LICENSE file in the root directory of this source tree. 36 */const Yv=xe("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** 37 * @license lucide-react v0.462.0 - ISC 38 * 39 * This source code is licensed under the ISC license. 40 * See the LICENSE file in the root directory of this source tree. 41 */const nu=xe("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** 42 * @license lucide-react v0.462.0 - ISC 43 * 44 * This source code is licensed under the ISC license. 45 * See the LICENSE file in the root directory of this source tree. 46 */const r3=xe("Calendar",[["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"}]]);/** 47 * @license lucide-react v0.462.0 - ISC 48 * 49 * This source code is licensed under the ISC license. 50 * See the LICENSE file in the root directory of this source tree. 51 */const Wc=xe("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** 52 * @license lucide-react v0.462.0 - ISC 53 * 54 * This source code is licensed under the ISC license. 55 * See the LICENSE file in the root directory of this source tree. 56 */const au=xe("ChartColumn",[["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"}]]);/** 57 * @license lucide-react v0.462.0 - ISC 58 * 59 * This source code is licensed under the ISC license. 60 * See the LICENSE file in the root directory of this source tree. 61 */const iu=xe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** 62 * @license lucide-react v0.462.0 - ISC 63 * 64 * This source code is licensed under the ISC license. 65 * See the LICENSE file in the root directory of this source tree. 66 */const tp=xe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** 67 * @license lucide-react v0.462.0 - ISC 68 * 69 * This source code is licensed under the ISC license. 70 * See the LICENSE file in the root directory of this source tree. 71 */const Ao=xe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** 72 * @license lucide-react v0.462.0 - ISC 73 * 74 * This source code is licensed under the ISC license. 75 * See the LICENSE file in the root directory of this source tree. 76 */const Il=xe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** 77 * @license lucide-react v0.462.0 - ISC 78 * 79 * This source code is licensed under the ISC license. 80 * See the LICENSE file in the root directory of this source tree. 81 */const n3=xe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** 82 * @license lucide-react v0.462.0 - ISC 83 * 84 * This source code is licensed under the ISC license. 85 * See the LICENSE file in the root directory of this source tree. 86 */const a3=xe("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** 87 * @license lucide-react v0.462.0 - ISC 88 * 89 * This source code is licensed under the ISC license. 90 * See the LICENSE file in the root directory of this source tree. 91 */const i3=xe("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** 92 * @license lucide-react v0.462.0 - ISC 93 * 94 * This source code is licensed under the ISC license. 95 * See the LICENSE file in the root directory of this source tree. 96 */const o3=xe("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** 97 * @license lucide-react v0.462.0 - ISC 98 * 99 * This source code is licensed under the ISC license. 100 * See the LICENSE file in the root directory of this source tree. 101 */const d0=xe("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** 102 * @license lucide-react v0.462.0 - ISC 103 * 104 * This source code is licensed under the ISC license. 105 * See the LICENSE file in the root directory of this source tree. 106 */const To=xe("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** 107 * @license lucide-react v0.462.0 - ISC 108 * 109 * This source code is licensed under the ISC license. 110 * See the LICENSE file in the root directory of this source tree. 111 */const Do=xe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** 112 * @license lucide-react v0.462.0 - ISC 113 * 114 * This source code is licensed under the ISC license. 115 * See the LICENSE file in the root directory of this source tree. 116 */const s3=xe("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** 117 * @license lucide-react v0.462.0 - ISC 118 * 119 * This source code is licensed under the ISC license. 120 * See the LICENSE file in the root directory of this source tree. 121 */const Kf=xe("CircleX",[["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"}]]);/** 122 * @license lucide-react v0.462.0 - ISC 123 * 124 * This source code is licensed under the ISC license. 125 * See the LICENSE file in the root directory of this source tree. 126 */const f0=xe("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** 127 * @license lucide-react v0.462.0 - ISC 128 * 129 * This source code is licensed under the ISC license. 130 * See the LICENSE file in the root directory of this source tree.
131 */const m0=xe("ClipboardCheck",[["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:"m9 14 2 2 4-4",key:"df797q"}]]);/** 132 * @license lucide-react v0.462.0 - ISC 133 * 134 * This source code is licensed under the ISC license. 135 * See the LICENSE file in the root directory of this source tree. 136 */const l3=xe("ClipboardList",[["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"}]]);/** 137 * @license lucide-react v0.462.0 - ISC 138 * 139 * This source code is licensed under the ISC license. 140 * See the LICENSE file in the root directory of this source tree. 141 */const mn=xe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** 142 * @license lucide-react v0.462.0 - ISC 143 * 144 * This source code is licensed under the ISC license. 145 * See the LICENSE file in the root directory of this source tree. 146 */const c3=xe("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/** 147 * @license lucide-react v0.462.0 - ISC 148 * 149 * This source code is licensed under the ISC license. 150 * See the LICENSE file in the root directory of this source tree. 151 */const u3=xe("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** 152 * @license lucide-react v0.462.0 - ISC 153 * 154 * This source code is licensed under the ISC license. 155 * See the LICENSE file in the root directory of this source tree. 156 */const rp=xe("Database",[["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"}]]);/** 157 * @license lucide-react v0.462.0 - ISC 158 * 159 * This source code is licensed under the ISC license. 160 * See the LICENSE file in the root directory of this source tree. 161 */const dA=xe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** 162 * @license lucide-react v0.462.0 - ISC 163 * 164 * This source code is licensed under the ISC license. 165 * See the LICENSE file in the root directory of this source tree. 166 */const Yf=xe("EyeOff",[["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"}]]);/** 167 * @license lucide-react v0.462.0 - ISC 168 * 169 * This source code is licensed under the ISC license. 170 * See the LICENSE file in the root directory of this source tree. 171 */const Fi=xe("Eye",[["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"}]]);/** 172 * @license lucide-react v0.462.0 - ISC 173 * 174 * This source code is licensed under the ISC license. 175 * See the LICENSE file in the root directory of this source tree. 176 */const d3=xe("FileDown",[["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:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** 177 * @license lucide-react v0.462.0 - ISC 178 * 179 * This source code is licensed under the ISC license. 180 * See the LICENSE file in the root directory of this source tree. 181 */const Ya=xe("FileText",[["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"}]]);/** 182 * @license lucide-react v0.462.0 - ISC 183 * 184 * This source code is licensed under the ISC license. 185 * See the LICENSE file in the root directory of this source tree. 186 */const f3=xe("FileWarning",[["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:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** 187 * @license lucide-react v0.462.0 - ISC 188 * 189 * This source code is licensed under the ISC license. 190 * See the LICENSE file in the root directory of this source tree. 191 */const m3=xe("File",[["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"}]]);/** 192 * @license lucide-react v0.462.0 - ISC 193 * 194 * This source code is licensed under the ISC license. 195 * See the LICENSE file in the root directory of this source tree. 196 */const Xf=xe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** 197 * @license lucide-react v0.462.0 - ISC 198 * 199 * This source code is licensed under the ISC license. 200 * See the LICENSE file in the root directory of this source tree. 201 */const h3=xe("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** 202 * @license lucide-react v0.462.0 - ISC 203 * 204 * This source code is licensed under the ISC license. 205 * See the LICENSE file in the root directory of this source tree. 206 */const p3=xe("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}
206]]);/** 207 * @license lucide-react v0.462.0 - ISC 208 * 209 * This source code is licensed under the ISC license. 210 * See the LICENSE file in the root directory of this source tree. 211 */const Sy=xe("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** 212 * @license lucide-react v0.462.0 - ISC 213 * 214 * This source code is licensed under the ISC license. 215 * See the LICENSE file in the root directory of this source tree. 216 */const E1=xe("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** 217 * @license lucide-react v0.462.0 - ISC 218 * 219 * This source code is licensed under the ISC license. 220 * See the LICENSE file in the root directory of this source tree. 221 */const Zf=xe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** 222 * @license lucide-react v0.462.0 - ISC 223 * 224 * This source code is licensed under the ISC license. 225 * See the LICENSE file in the root directory of this source tree. 226 */const Qf=xe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** 227 * @license lucide-react v0.462.0 - ISC 228 * 229 * This source code is licensed under the ISC license. 230 * See the LICENSE file in the root directory of this source tree. 231 */const _y=xe("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** 232 * @license lucide-react v0.462.0 - ISC 233 * 234 * This source code is licensed under the ISC license. 235 * See the LICENSE file in the root directory of this source tree. 236 */const v3=xe("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** 237 * @license lucide-react v0.462.0 - ISC 238 * 239 * This source code is licensed under the ISC license. 240 * See the LICENSE file in the root directory of this source tree. 241 */const g3=xe("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** 242 * @license lucide-react v0.462.0 - ISC 243 * 244 * This source code is licensed under the ISC license. 245 * See the LICENSE file in the root directory of this source tree. 246 */const y3=xe("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/** 247 * @license lucide-react v0.462.0 - ISC 248 * 249 * This source code is licensed under the ISC license. 250 * See the LICENSE file in the root directory of this source tree. 251 */const x3=xe("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** 252 * @license lucide-react v0.462.0 - ISC 253 * 254 * This source code is licensed under the ISC license. 255 * See the LICENSE file in the root directory of this source tree. 256 */const fA=xe("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** 257 * @license lucide-react v0.462.0 - ISC 258 * 259 * This source code is licensed under the ISC license. 260 * See the LICENSE file in the root directory of this source tree. 261 */const ye=xe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** 262 * @license lucide-react v0.462.0 - ISC 263 * 264 * This source code is licensed under the ISC license. 265 * See the LICENSE file in the root directory of this source tree. 266 */const mA=xe("LogOut",[["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"}]]);/** 267 * @license lucide-react v0.462.0 - ISC 268 * 269 * This source code is licensed under the ISC license. 270 * See the LICENSE file in the root directory of this source tree. 271 */const b3=xe("Menu",[["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"}]]);/** 272 * @license lucide-react v0.462.0 - ISC 273 * 274 * This source code is licensed under the ISC license. 275 * See the LICENSE file in the root directory of this source tree. 276 */const h0=xe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** 277 * @license lucide-react v0.462.0 - ISC 278 * 279 * This source code is licensed under the ISC license. 280 * See the LICENSE file in the root directory of this source tree. 281 */const C1=xe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** 282 * @license lucide-react v0.462.0 - ISC 283 * 284 * This source code is licensed under the ISC license. 285 * See the LICENSE file in the root directory of this source tree. 286 */const wa=xe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** 287 * @license lucide-react v0.462.0 - ISC 288 * 289 * This source code is licensed under the ISC license. 290 * See the LICENSE file in the root directory of this source tree. 291 */const w3=xe("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/** 292 * @license lucide-react v0.462.0 - ISC 293 * 294 * This source code is licensed under the ISC license. 295 * See the LICENSE file in the root directory of this source tree. 296 */const $o=xe("RefreshCw",[["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"}]]);/** 297 * @license lucide-react v0.462.0 - ISC 298 * 299 * This source code is licensed under the ISC license. 300 * See the LICENSE file in the root directory of this source tree. 301 */const np=xe("Save",[["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"}]]);/** 302 * @license lucide-react v0.462.0 - ISC 303 * 304 * This source code is licensed under the ISC license. 305 * See the LICENSE file in the root directory of this source tree. 306 */const Ko=xe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** 307 * @license lucide-react v0.462.0 - ISC 308 * 309 * This source code is licensed under the ISC license. 310 * See the LICENSE file in the root directory of this source tree. 311 */const p0=xe("Send",[["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"}]]);/** 312 * @license lucide-react v0.462.0 - ISC 313 * 314 * This source code is licensed under the ISC license. 315 * See the LICENSE file in the root directory of this source tree. 316 */const No=xe("Settings",[["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"}]]);/** 317 * @license lucide-react v0.462.0 - ISC 318 * 319 * This source code is licensed under the ISC license. 320 * See the LICENSE file in the root directory of this source tree. 321 */const j3=xe("ShieldAlert",[["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",ke
321y:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** 322 * @license lucide-react v0.462.0 - ISC 323 * 324 * This source code is licensed under the ISC license. 325 * See the LICENSE file in the root directory of this source tree. 326 */const hA=xe("ShieldCheck",[["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"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** 327 * @license lucide-react v0.462.0 - ISC 328 * 329 * This source code is licensed under the ISC license. 330 * See the LICENSE file in the root directory of this source tree. 331 */const pA=xe("Shield",[["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"}]]);/** 332 * @license lucide-react v0.462.0 - ISC 333 * 334 * This source code is licensed under the ISC license. 335 * See the LICENSE file in the root directory of this source tree. 336 */const Ys=xe("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** 337 * @license lucide-react v0.462.0 - ISC 338 * 339 * This source code is licensed under the ISC license. 340 * See the LICENSE file in the root directory of this source tree. 341 */const Gi=xe("Trash2",[["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"}]]);/** 342 * @license lucide-react v0.462.0 - ISC 343 * 344 * This source code is licensed under the ISC license. 345 * See the LICENSE file in the root directory of this source tree. 346 */const Jf=xe("Trash",[["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"}]]);/** 347 * @license lucide-react v0.462.0 - ISC 348 * 349 * This source code is licensed under the ISC license. 350 * See the LICENSE file in the root directory of this source tree. 351 */const vA=xe("TrendingUp",[["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"}]]);/** 352 * @license lucide-react v0.462.0 - ISC 353 * 354 * This source code is licensed under the ISC license. 355 * See the LICENSE file in the root directory of this source tree. 356 */const Kr=xe("TriangleAlert",[["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"}]]);/** 357 * @license lucide-react v0.462.0 - ISC 358 * 359 * This source code is licensed under the ISC license. 360 * See the LICENSE file in the root directory of this source tree. 361 */const ou=xe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** 362 * @license lucide-react v0.462.0 - ISC 363 * 364 * This source code is licensed under the ISC license. 365 * See the LICENSE file in the root directory of this source tree. 366 */const S3=xe("UserCog",[["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"}]]);/** 367 * @license lucide-react v0.462.0 - ISC 368 * 369 * This source code is licensed under the ISC license. 370 * See the LICENSE file in the root directory of this source tree.
vendor: 13,843 bytes, lines 371-391
371 */const _3=xe("UserPlus",[["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"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** 372 * @license lucide-react v0.462.0 - ISC 373 * 374 * This source code is licensed under the ISC license. 375 * See the LICENSE file in the root directory of this source tree. 376 */const v0=xe("User",[["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"}]]);/** 377 * @license lucide-react v0.462.0 - ISC 378 * 379 * This source code is licensed under the ISC license. 380 * See the LICENSE file in the root directory of this source tree. 381 */const Rl=xe("Users",[["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"}]]);/** 382 * @license lucide-react v0.462.0 - ISC 383 * 384 * This source code is licensed under the ISC license. 385 * See the LICENSE file in the root directory of this source tree. 386 */const N3=xe("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** 387 * @license lucide-react v0.462.0 - ISC 388 * 389 * This source code is licensed under the ISC license. 390 * See the LICENSE file in the root directory of this source tree. 391 */const _r=xe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),g0="-",E3=e=>{const t=O3(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{const l=s.split(g0);return l[0]===""&&l.length!==1&&l.shift(),gA(l,t)||C3(s)},getConflictingClassGroupIds:(s,l)=>{const c=r[s]||[];return l&&n[s]?[...c,...n[s]]:c}}},gA=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?gA(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(g0);return(s=t.validators.find(({validator:l})=>l(i)))==null?void 0:s.classGroupId},O1=/^\[(.+)\]$/,C3=e=>{if(O1.test(e)){const t=O1.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},O3=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return A3(Object.entries(e.classGroups),r).forEach(([i,s])=>{Ny(s,n,i,t)}),n},Ny=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:P1(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(P3(a)){Ny(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,s])=>{Ny(s,P1(t,i),r,n)})})},P1=(e,t)=>{let r=e;return t.split(g0).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},P3=e=>e.isThemeGetter,A3=(e,t)=>t?e.map(([r,n])=>{const a=n.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,l])=>[t+s,l])):i);return[r,a]}):e,T3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(i,s)=>{r.set(i,s),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let s=r.get(i);if(s!==void 0)return s;if((s=n.get(i))!==void 0)return a(i,s),s},set(i,s){r.has(i)?r.set(i,s):a(i,s)}}},yA="!",D3=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,a=t[0],i=t.length,s=l=>{const c=[];let u=0,d=0,f;for(let g=0;g<l.length;g++){let x=l[g];if(u===0){if(x===a&&(n||l.slice(g,g+i)===t)){c.push(l.slice(d,g)),d=g+i;continue}if(x==="/"){f=g;continue}}x==="["?u++:x==="]"&&u--}const m=c.length===0?l:l.substring(d),p=m.startsWith(yA),y=p?m.substring(1):m,v=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:v}};return r?l=>r({className:l,parseClassName:s}):s},$3=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},k3=e=>({cache:T3(e.cacheSize),parseClassName:D3(e),...E3(e)}),M3=/\s+/,I3=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a}=t,i=[],s=e.trim().split(M3);let l="";for(let c=s.length-1;c>=0;c-=1){const u=s[c],{modifiers:d,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:p}=r(u);let y=!!p,v=n(y?m.substring(0,p):m);if(!v){if(!y){l=u+(l.length>0?" "+l:l);continue}if(v=n(m),!v){l=u+(l.length>0?" "+l:l);continue}y=!1}const g=$3(d).join(":"),x=f?g+yA:g,b=x+v;if(i.includes(b))continue;i.push(b);const j=a(v,y);for(let w=0;w<j.length;++w){const S=j[w];i.push(x+S)}l=u+(l.length>0?" "+l:l)}return l};function R3(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=xA(t))&&(n&&(n+=" "),n+=r);return n}const xA=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=xA(e[n]))&&(r&&(r+=" "),r+=t);return r};function L3(e,...t){let r,n,a,i=s;function s(c){const u=t.reduce((d,f)=>f(d),e());return r=k3(u),n=r.cache.get,a=r.cache.set,i=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=I3(c,r);return a(c,d),d}return function(){return i(R3.apply(null,arguments))}}const $t=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},bA=/^\[(?:([a-z-]+):)?(.+)\]$/i,F3=/^\d+\/\d+$/,B3=new Set(["px","full","screen"]),z3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,q3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,U3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,W3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,V3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ta=e=>Cs(e)||B3.has(e)||F3.test(e),li=e=>Ll(e,"length",J3),Cs=e=>!!e&&!Number.isNaN(Number(e)),Xv=e=>Ll(e,"number",Cs),uc=e=>!!e&&Number.isInteger(Number(e)),G3=e=>e.endsWith("%")&&Cs(e.slice(0,-1)),et=e=>bA.test(e),ci=e=>z3.test(e),H3=new Set(["length","size","percentage"]),K3=e=>Ll(e,H3,wA),Y3=e=>Ll(e,"position",wA),X3=new Set(["image","url"]),Z3=e=>Ll(e,X3,t5),Q3=e=>Ll(e,"",e5),dc=()=>!0,Ll=(e,t,r)=>{const n=bA.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},J3=e=>q3.test(e)&&!U3.test(e),wA=()=>!1,e5=e=>W3.test(e),t5=e=>V3.test(e),r5=()=>{const e=$t("colors"),t=$t("spacing"),r=$t("blur"),n=$t("brightness"),a=$t("borderColor"),i=$t("borderRadius"),s=$t("borderSpacing"),l=$t("borderWidth"),c=$t("contrast"),u=$t("grayscale"),d=$t("hueRotate"),f=$t("invert"),m=$t("gap"),p=$t("gradientColorStops"),y=$t("gradientColorStopPositions"),v=$t("inset"),g=$t("margin"),x=$t("opacity"),b=$t("padding"),j=$t("saturate"),w=$t("scale"),S=$t("sepia"),_=$t("skew"),N=$t("space"),E=$t("translate"),O=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto",et,t],A=()=>[et,t],T=()=>["",Ta,li],k=()=>["auto",Cs,et],D=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],M=()=>["solid","dashed","dotted","double","none"],F=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>["start","end","center","between","around","evenly","stretch"],I=()=>["","0",et],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[Cs,et];return{cacheSize:500,separator:":",theme:{colors:[dc],spacing:[Ta,li],blur:["none","",ci,et],brightness:W(),borderColor:[e],borderRadius:["none","","full",ci,et],borderSpacing:A(),borderWidth:T(),contrast:W(),grayscale:I(),hueRotate:W(),invert:I(),gap:A(),gradientColorStops:[e],gradientColorStopPositions:[G3,li],inset:C(),margin:C(),opacity:W(),padding:A(),saturate:W(),scale:W(),sepia:I(),skew:W(),space:A(),translate:A()},classGroups:{aspect:[{aspect:["auto","square","video",et]}],container:["container"],columns:[{columns:[ci]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...D(),et]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",uc,et]}],basis:[{basis:C()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",et]}],grow:[{grow:I()}],shrink:[{shrink:I()}],order:[{order:["first","last","none",uc,et]}],"grid-cols":[{"grid-cols":[dc]}],"col-start-end":[{col:["auto",{span:["full",uc,et]},et]}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":[dc]}],"row-start-end":[{row:["auto",{span:[uc,et]},et]}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",et]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",et]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",et,t]}],"min-w":[{"min-w":[et,t,"min","max","fit"]}],"max-w":[{"max-w":[et,t,"none","full","min","max","fit","prose",{screen:[ci]},ci]}],h:[{h:[et,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[et,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[et,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[et,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ci,li]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Xv]}],"font-family":[{font:[dc]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",et]}],"line-clamp":[{"line-clamp":["none",Cs,Xv]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ta,et]}],"list-image":[{"list-image":["none",et]}],"list-style-type":[{list:["none","disc","decimal",et]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...M(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ta,li]}],"underline-offset":[{"underline-offset":["auto",Ta,et]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...D(),Y3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",K3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Z3]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}
vendor: 5,180 bytes, line 391
391],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...M(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:M()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...M()]}],"outline-offset":[{"outline-offset":[Ta,et]}],"outline-w":[{outline:[Ta,li]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:T()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[Ta,li]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ci,Q3]}],"shadow-color":[{shadow:[dc]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...F(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":F()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",ci,et]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[j]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",et]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",et]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",et]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[uc,et]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",et]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",et]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}
391],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",et]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ta,li,Xv]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},n5=L3(r5);function oe(...e){return n5(Qe(e))}const a5=QB,jA=h.forwardRef(({className:e,...t},r)=>o.jsx(nA,{ref:r,className:oe("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));jA.displayName=nA.displayName;const i5=Ml("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),SA=h.forwardRef(({className:e,variant:t,...r},n)=>o.jsx(aA,{ref:n,className:oe(i5({variant:t}),e),...r}));SA.displayName=aA.displayName;const o5=h.forwardRef(({className:e,...t},r)=>o.jsx(sA,{ref:r,className:oe("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));o5.displayName=sA.displayName;const _A=h.forwardRef(({className:e,...t},r)=>o.jsx(lA,{ref:r,className:oe("absolute right-2 top-2 rounded-md p-1 text-foreground
391/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:o.jsx(_r,{className:"h-4 w-4"})}));_A.displayName=lA.displayName;const NA=h.forwardRef(({className:e,...t},r)=>o.jsx(iA,{ref:r,className:oe("text-sm font-semibold",e),...t}));NA.displayName=iA.displayName;const EA=h.forwardRef(({className:e,...t},r)=>o.jsx(oA,{ref:r,className:oe("text-sm opacity-90",e),...t}));EA.displayName=oA.displayName;function s5(){const{toasts:e}=Rn();return o.jsxs(a5,{children:[e.map(function({id:t,title:r,description:n,action:a,...i}){return o.jsxs(SA,{...i,children:[o.jsxs("div",{className:"grid gap-1",children:[r&&o.jsx(NA,{children:r}),n&&o.jsx(EA,{children:n})]}),a,o.jsx(_A,{})]},t)}),o.jsx(jA,{})]})}var A1=["light","dark"],l5="(prefers-color-scheme: dark)",c5=h.createContext(void 0),u5={setTheme:e=>{},themes:[]},d5=()=>{var e;return(e=h.useContext(c5))!=null?e:u5};h.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:a,defaultTheme:i,value:s,attrs:l,nonce:c})=>{let u=i==="system",d=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(y=>`'${y}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,f=a?A1.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",m=(y,v=!1,g=!0)=>{let x=s?s[y]:y,b=v?y+"|| ''":`'${x}'`,j="";return a&&g&&!v&&A1.includes(y)&&(j+=`d.style.colorScheme = '${y}';`),r==="class"?v||x?j+=`c.add(${b})`:j+="null":x&&(j+=`d[s](n,${b})`),j},p=e?`!function(){${d}${m(e)}}()`:n?`!function(){try{${d}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${l5}',m=window.matchMedia(t);if(m.media!==t||m.matches){${m("dark")}}else{${m("light")}}}else if(e){${s?`var x=${JSON.stringify(s)};`:""}${m(s?"x[e]":"e",!0)}}${u?"":"else{"+m(i,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${t}');if(e){${s?`var x=${JSON.stringify(s)};`:""}${m(s?"x[e]":"e",!0)}}else{${m(i,!1,!1)};}${f}}catch(t){}}();`;return h.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var f5=e=>{switch(e){case"success":return p5;case"info":return g5;case"warning":return v5;case"error":return y5;default:return null}},m5=Array(12).fill(0),h5=({visible:e})=>$.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},$.createElement("div",{className:"sonner-spinner"},m5.map((t,r)=>$.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),p5=$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},$.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),v5=$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},$.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),g5=$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},$.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),y5=$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},$.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),x5=()=>{let[e,t]=$.useState(document.hidden);return $.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},Ey=1,b5=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>
391{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...n}=e,a=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Ey++,i=this.toasts.find(l=>l.id===a),s=e.dismissible===void 0?!0:e.dismissible;return i?this.toasts=this.toasts.map(l=>l.id===a?(this.publish({...l,...e,id:a,title:r}),{...l,...e,id:a,dismissible:s,title:r}):l):this.addToast({title:r,...n,dismissible:s,id:a}),a},this.dismiss=e=>(e||this.toasts.forEach(t=>{this.subscribers.forEach(r=>r({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let n=e instanceof Promise?e:e(),a=r!==void 0;return n.then(async i=>{if(j5(i)&&!i.ok){a=!1;let s=typeof t.error=="function"?await t.error(`HTTP error! status: ${i.status}`):t.error,l=typeof t.description=="function"?await t.description(`HTTP error! status: ${i.status}`):t.description;this.create({id:r,type:"error",message:s,description:l})}else if(t.success!==void 0){a=!1;let s=typeof t.success=="function"?await t.success(i):t.success,l=typeof t.description=="function"?await t.description(i):t.description;this.create({id:r,type:"success",message:s,description:l})}}).catch(async i=>{if(t.error!==void 0){a=!1;let s=typeof t.error=="function"?await t.error(i):t.error,l=typeof t.description=="function"?await t.description(i):t.description;this.create({id:r,type:"error",message:s,description:l})}}).finally(()=>{var i;a&&(this.dismiss(r),r=void 0),(i=t.finally)==null||i.call(t)}),r},this.custom=(e,t)=>{let r=(t==null?void 0:t.id)||Ey++;return this.create({jsx:e(r),id:r,...t}),r},this.subscribers=[],this.toasts=[]}},rn=new b5,w5=(e,t)=>{let r=(t==null?void 0:t.id)||Ey++;return rn.addToast({title:e,...t,id:r}),r},j5=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",S5=w5,_5=()=>rn.toasts,Z=Object.assign(S5,{success:rn.success,info:rn.info,warning:rn.warning,error:rn.error,custom:rn.custom,message:rn.message,promise:rn.promise,dismiss:rn.dismiss,loading:rn.loading},{getHistory:_5});function N5(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}N5(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
391left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
391:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} 392`);function nf(e){return e.label!==void 0}var E5=3,C5="32px",O5=4e3,P5=356,A5=14,T5=20,D5=200;function $5(...e){return e.filter(Boolean).join(" ")}var k5=e=>{var t,r,n,a,i,s,l,c,u,d;let{invert:f,toast:m,unstyled:p,interacting:y,setHeights:v,visibleToasts:g,heights:x,index:b,toasts:j,expanded:w,removeToast:S,defaultRichColors:_,closeButton:N,style:E,cancelButtonStyle:O,actionButtonStyle:P,className:C="",descriptionClassName:A="",duration:T,position:k,gap:D,loadingIcon:M,expandByDefault:F,classNames:q,icons:I,closeButtonAriaLabel:K="Close toast",pauseWhenPageIsHidden:W,cn:R}=e,[V,re]=$.useState(!1),[H,te]=$.useState(!1),[ce,je]=$.useState(!1),[X,ae]=$.useState(!1),[_e,J]=$.useState(0),[Ke,Ne]=$.useState(0),Re=$.useRef(null),pe=$.useRef(null),De=b===0,L=b+1<=g,G=m.type,Y=m.dismissible!==!1,ie=m.className||"",se=m.descriptionClassName||"",ee=$.useMemo(()=>x.findIndex(Je=>Je.toastId===m.id)||0,[x,m.id]),ge=$.useMemo(()=>{var Je;return(Je=m.closeButton)!=null?Je:N},[m.closeButton,N]),He=$.useMemo(()=>m.duration||T||O5,[m.duration,T]),Tt=$.useRef(0),wt=$.useRef(0),wn=$.useRef(0),Zr=$.useRef(null),[Br,Se]=k.split("-"),vr=$.useMemo(()=>x.reduce((Je,Dt,Ct)=>Ct>=ee?Je:Je+Dt.height,0),[x,ee]),Er=x5(),qn=m.invert||f,Qr=G==="loading";wt.current=$.useMemo(()=>ee*D+vr,[ee,vr]),$.useEffect(()=>{re(!0)},[]),$.useLayoutEffect(()=>{if(!V)return;let Je=pe.current,Dt=Je.style.height;Je.style.height="auto";let Ct=Je.getBoundingClientRect().height;Je.style.height=Dt,Ne(Ct),v(ia=>ia.find(oa=>oa.toastId===m.id)?ia.map(oa=>oa.toastId===m.id?{...oa,height:Ct}:oa):[{toastId:m.id,height:Ct,position:m.position},...ia])},[V,m.title,m.description,v,m.id]);let zr=$.useCallback(()=>{te(!0),J(wt.current),v(Je=>Je.filter(Dt=>Dt.toastId!==m.id)),setTimeout(()=>{S(m)},D5)},[m,S,v,wt]);$.useEffect(()=>{if(m.promise&&G==="loading"||m.duration===1/0||m.type==="loading")return;let Je,Dt=He;return w||y||W&&Er?(()=>{if(wn.current<Tt.current){let Ct=new Date().getTime()-Tt.current;Dt=Dt-Ct}
392wn.current=new Date().getTime()})():Dt!==1/0&&(Tt.current=new Date().getTime(),Je=setTimeout(()=>{var Ct;(Ct=m.onAutoClose)==null||Ct.call(m,m),zr()},Dt)),()=>clearTimeout(Je)},[w,y,F,m,He,zr,m.promise,G,W,Er]),$.useEffect(()=>{let Je=pe.current;if(Je){let Dt=Je.getBoundingClientRect().height;return Ne(Dt),v(Ct=>[{toastId:m.id,height:Dt,position:m.position},...Ct]),()=>v(Ct=>Ct.filter(ia=>ia.toastId!==m.id))}},[v,m.id]),$.useEffect(()=>{m.delete&&zr()},[zr,m.delete]);function eB(){return I!=null&&I.loading?$.createElement("div",{className:"sonner-loader","data-visible":G==="loading"},I.loading):M?$.createElement("div",{className:"sonner-loader","data-visible":G==="loading"},M):$.createElement(h5,{visible:G==="loading"})}return $.createElement("li",{"aria-live":m.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:pe,className:R(C,ie,q==null?void 0:q.toast,(t=m==null?void 0:m.classNames)==null?void 0:t.toast,q==null?void 0:q.default,q==null?void 0:q[G],(r=m==null?void 0:m.classNames)==null?void 0:r[G]),"data-sonner-toast":"","data-rich-colors":(n=m.richColors)!=null?n:_,"data-styled":!(m.jsx||m.unstyled||p),"data-mounted":V,"data-promise":!!m.promise,"data-removed":H,"data-visible":L,"data-y-position":Br,"data-x-position":Se,"data-index":b,"data-front":De,"data-swiping":ce,"data-dismissible":Y,"data-type":G,"data-invert":qn,"data-swipe-out":X,"data-expanded":!!(w||F&&V),style:{"--index":b,"--toasts-before":b,"--z-index":j.length-b,"--offset":`${H?_e:wt.current}px`,"--initial-height":F?"auto":`${Ke}px`,...E,...m.style},onPointerDown:Je=>{Qr||!Y||(Re.current=new Date,J(wt.current),Je.target.setPointerCapture(Je.pointerId),Je.target.tagName!=="BUTTON"&&(je(!0),Zr.current={x:Je.clientX,y:Je.clientY}))},onPointerUp:()=>{var Je,Dt,Ct,ia;if(X||!Y)return;Zr.current=null;let oa=Number(((Je=pe.current)==null?void 0:Je.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Qd=new Date().getTime()-((Dt=Re.current)==null?void 0:Dt.getTime()),tB=Math.abs(oa)/Qd;if(Math.abs(oa)>=T5||tB>.11){J(wt.current),(Ct=m.onDismiss)==null||Ct.call(m,m),zr(),ae(!0);return}(ia=pe.current)==null||ia.style.setProperty("--swipe-amount","0px"),je(!1)},onPointerMove:Je=>{var Dt;if(!Zr.current||!Y)return;let Ct=Je.clientY-Zr.current.y,ia=Je.clientX-Zr.current.x,oa=(Br==="top"?Math.min:Math.max)(0,Ct),Qd=Je.pointerType==="touch"?10:2;Math.abs(oa)>Qd?(Dt=pe.current)==null||Dt.style.setProperty("--swipe-amount",`${Ct}px`):Math.abs(ia)>Qd&&(Zr.current=null)}},ge&&!m.jsx?$.createElement("button",{"aria-label":K,"data-disabled":Qr,"data-close-button":!0,onClick:Qr||!Y?()=>{}:()=>{var Je;zr(),(Je=m.onDismiss)==null||Je.call(m,m)},className:R(q==null?void 0:q.closeButton,(a=m==null?void 0:m.classNames)==null?void 0:a.closeButton)},$.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},$.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),$.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,m.jsx||$.isValidElement(m.title)?m.jsx||m.title:$.createElement($.Fragment,null,G||m.icon||m.promise?$.createElement("div",{"data-icon":"",className:R(q==null?void 0:q.icon,(i=m==null?void 0:m.classNames)==null?void 0:i.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||eB():null,m.type!=="loading"?m.
392icon||(I==null?void 0:I[G])||f5(G):null):null,$.createElement("div",{"data-content":"",className:R(q==null?void 0:q.content,(s=m==null?void 0:m.classNames)==null?void 0:s.content)},$.createElement("div",{"data-title":"",className:R(q==null?void 0:q.title,(l=m==null?void 0:m.classNames)==null?void 0:l.title)},m.title),m.description?$.createElement("div",{"data-description":"",className:R(A,se,q==null?void 0:q.description,(c=m==null?void 0:m.classNames)==null?void 0:c.description)},m.description):null),$.isValidElement(m.cancel)?m.cancel:m.cancel&&nf(m.cancel)?$.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||O,onClick:Je=>{var Dt,Ct;nf(m.cancel)&&Y&&((Ct=(Dt=m.cancel).onClick)==null||Ct.call(Dt,Je),zr())},className:R(q==null?void 0:q.cancelButton,(u=m==null?void 0:m.classNames)==null?void 0:u.cancelButton)},m.cancel.label):null,$.isValidElement(m.action)?m.action:m.action&&nf(m.action)?$.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||P,onClick:Je=>{var Dt,Ct;nf(m.action)&&(Je.defaultPrevented||((Ct=(Dt=m.action).onClick)==null||Ct.call(Dt,Je),zr()))},className:R(q==null?void 0:q.actionButton,(d=m==null?void 0:m.classNames)==null?void 0:d.actionButton)},m.action.label):null))};function T1(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var M5=e=>{let{invert:t,position:r="bottom-right",hotkey:n=["altKey","KeyT"],expand:a,closeButton:i,className:s,offset:l,theme:c="light",richColors:u,duration:d,style:f,visibleToasts:m=E5,toastOptions:p,dir:y=T1(),gap:v=A5,loadingIcon:g,icons:x,containerAriaLabel:b="Notifications",pauseWhenPageIsHidden:j,cn:w=$5}=e,[S,_]=$.useState([]),N=$.useMemo(()=>Array.from(new Set([r].concat(S.filter(W=>W.position).map(W=>W.position)))),[S,r]),[E,O]=$.useState([]),[P,C]=$.useState(!1),[A,T]=$.useState(!1),[k,D]=$.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),M=$.useRef(null),F=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),q=$.useRef(null),I=$.useRef(!1),K=$.useCallback(W=>{var R;(R=S.find(V=>V.id===W.id))!=null&&R.delete||rn.dismiss(W.id),_(V=>V.filter(({id:re})=>re!==W.id))},[S]);return $.useEffect(()=>rn.subscribe(W=>{if(W.dismiss){_(R=>R.map(V=>V.id===W.id?{...V,delete:!0}:V));return}setTimeout(()=>{Ho.flushSync(()=>{_(R=>{let V=R.findIndex(re=>re.id===W.id);return V!==-1?[...R.slice(0,V),{...R[V],...W},...R.slice(V+1)]:[W,...R]})})})}),[]),$.useEffect(()=>{if(c!=="system"){D(c);return}c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?D("dark"):D("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:W})=>{D(W?"dark":"light")})},[c]),$.useEffect(()=>{S.length<=1&&C(!1)},[S]),$.useEffect(()=>{let W=R=>{var V,re;n.every(H=>R[H]||R.code===H)&&(C(!0),(V=M.current)==null||V.focus()),R.code==="Escape"&&(document.activeElement===M.current||(re=M.current)!=null&&re.contains(document.activeElement))&&C(!1)};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[n]),$.useEffect(()=>{if(M.current)return()=>{q.current&&(q.current.focus({preventScroll:!0}),q.current=null,I.current=!1)}},[M.current]),S.length?$.createElement("section",{"aria-label":`${b} ${F}`,tabIndex:-1},N.map((W,R)=>{var V;let[re,H]=W.split("-");return $.createElement("ol",{key:W,dir:y==="auto"?T1():y,tabIndex:-1,ref:M,className:s,"data-sonner-toaster":!0,"data-theme":k,"data-y-position":re,"data-x-position":H,style:{"--front-toast-height":`${((V=E[0])==null?void 0:V.height)||0}px`,"--offset":typeof l=="number"?`${l}px`:l||C5,"--width":`${P5}px`,"--gap":`${v}px`,...f},onBlur:te=>{I.current&&!te.currentTarget.contains(te.relatedTarget)&&(I.current=!1,q.current&&(q.current.focus({preventScroll:!0}),q.current=null))},onFocus:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||I.current||(I.current=!0,q.current=te.relatedTarget)},onMouseEnter:()=>C(!0),onMouseMove:()=>C(!0),onMouseLeave:()=>{A||C(!1)},onPointerDown:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||T(!0)},onPointerUp:()=>T(!1)},S.filter(te=>!te.position&&R===0||te.position===W).map((te,ce)=>{var je,X;return $.createElement(k5,{key:te.id,icons:x,index:ce,toast:te,defaultRichColors:u,duration:(je=p==null?void 0:p.duration)!=null?je:d,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:t,visibleToasts:m,closeButton:(X=p==null?void 0:p.closeButton)!=null?X:i,interacting:A,position:W,style:p==null?void 0:p.style,unstyled:p==null?void 0:p.unstyled,classNames:p==null?void 0:p.classNames,cancelButtonStyle:p==null?void 0:p.cancelButtonStyle,actionButtonStyle:p==null?void 0:p.actionButtonStyle,removeToast:K,toasts:S.filter(ae=>ae.position==te.position),heights:E.filter(ae=>ae.position==te.position),setHeights:O,expandByDefault:a,gap:v,loadingIcon:g,expanded:P,pauseWhenPageIsHidden:j,cn:w})}))})):null};const I5=({...e})=>{const{theme:t="system"}=d5();return o.jsx(M5,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};function R5(e,t=globalThis==null?void 0:globalThis.document){const r=it(e);h.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var L5="DismissableLayer",Cy="dismissableLayer.update",F5="dismissableLayer.pointerDownOutside",B5="dismissableLayer.focusOutside",D1,CA=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),OA=h.forwardRef((e,t)=>
392{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...c}=e,u=h.useContext(CA),[d,f]=h.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=h.useState({}),y=Xe(t,N=>f(N)),v=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf(g),b=d?v.indexOf(d):-1,j=u.layersWithOutsidePointerEventsDisabled.size>0,w=b>=x,S=U5(N=>{const E=N.target,O=[...u.branches].some(P=>P.contains(E));!w||O||(a==null||a(N),s==null||s(N),N.defaultPrevented||l==null||l())},m),_=W5(N=>{const E=N.target;[...u.branches].some(P=>P.contains(E))||(i==null||i(N),s==null||s(N),N.defaultPrevented||l==null||l())},m);return R5(N=>{b===u.layers.size-1&&(n==null||n(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},m),h.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(D1=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),$1(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=D1)}},[d,m,r,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),$1())},[d,u]),h.useEffect(()=>{const N=()=>p({});return document.addEventListener(Cy,N),()=>document.removeEventListener(Cy,N)},[]),o.jsx(Me.div,{...c,ref:y,style:{pointerEvents:j?w?"auto":"none":void 0,...e.style},onFocusCapture:ue(e.onFocusCapture,_.onFocusCapture),onBlurCapture:ue(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:ue(e.onPointerDownCapture,S.onPointerDownCapture)})});OA.displayName=L5;var z5="DismissableLayerBranch",q5=h.forwardRef((e,t)=>{const r=h.useContext(CA),n=h.useRef(null),a=Xe(t,n);return h.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),o.jsx(Me.div,{...e,ref:a})});q5.displayName=z5;function U5(e,t=globalThis==null?void 0:globalThis.document){const r=it(e),n=h.useRef(!1),a=h.useRef(()=>{});return h.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){PA(F5,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function W5(e,t=globalThis==null?void 0:globalThis.document){const r=it(e),n=h.useRef(!1);return h.useEffect(()=>{const a=i=>{i.target&&!n.current&&PA(B5,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function $1(){const e=new CustomEvent(Cy);document.dispatchEvent(e)}function PA(e,t,r,{discrete:n}){const a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?Go(a,i):a.dispatchEvent(i)}var[ap,FPe]=Lr("Tooltip",[$l]),ip=$l(),AA="TooltipProvider",V5=700,Oy="tooltip.open",[G5,y0]=ap(AA),TA=e=>{const{__scopeTooltip:t,delayDuration:r=V5,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:i}=e,[s,l]=h.useState(!0),c=h.useRef(!1),u=h.useRef(0);return h.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),o.jsx(G5,{scope:t,isOpenDelayed:s,delayDuration:r,onOpen:h.useCallback(()=>{window.clearTimeout(u.current),l(!1)},[]),onClose:h.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l(!0),n)},[n]),isPointerInTransitRef:c,onPointerInTransitChange:h.useCallback(d=>{c.current=d},[]),disableHoverableContent:a,children:i})};TA.displayName=AA;var op="Tooltip",[H5,sp]=ap(op),DA=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:l}=e,c=y0(op,e.__scopeTooltip),u=ip(t),[d,f]=h.useState(null),m=Qn(),p=h.useRef(0),y=s??c.disableHoverableContent,v=l??c.delayDuration,g=h.useRef(!1),[x=!1,b]=hn({prop:n,defaultProp:a,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(Oy))):c.onClose(),i==null||i(N)}}),j=h.useMemo(()=>x?g.current?"delayed-open":"instant-open":"closed",[x]),w=h.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,b(!0)},[b]),S=h.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),_=h.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,b(!0),p.current=0},v)},[v,b]);return h.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),o.jsx(a0,{...u,children:o.jsx(H5,{scope:t,contentId:m,open:x,stateAttribute:j,trigger:d,onTriggerChange:f,onTriggerEnter:h.useCallback(()=>{c.isOpenDelayed?_():w()},[c.isOpenDelayed,_,w]),onTriggerLeave:h.useCallback(()=>{y?S():(window.clearTimeout(p.current),p.current=0)},[S,y]),onOpen:w,onClose:S,disableHoverableContent:y,children:r})})};DA.displayName=op;var Py="TooltipTrigger",$A=h.forwardRef((e,t)=>
vendor: 1,304 bytes, line 392
392{const{__scopeTooltip:r,...n}=e,a=sp(Py,r),i=y0(Py,r),s=ip(r),l=h.useRef(null),c=Xe(t,l,a.onTriggerChange),u=h.useRef(!1),d=h.useRef(!1),f=h.useCallback(()=>u.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),o.jsx(Lh,{asChild:!0,...s,children:o.jsx(Me.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:c,onPointerMove:ue(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:ue(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:ue(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ue(e.onFocus,()=>{u.current||a.onOpen()}),onBlur:ue(e.onBlur,a.onClose),onClick:ue(e.onClick,a.onClose)})})});$A.displayName=Py;var K5="TooltipPortal",[BPe,Y5]=ap(K5,{forceMount:void 0}),Xs="TooltipContent",kA=h.forwardRef((e,t)=>{const r=Y5(Xs,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...i}=e,s=sp(Xs,e.__scopeTooltip);return o.jsx(er,{present:n||s.open,children:s.disableHoverableContent?o.jsx(MA,{side:a,...i,ref:t}):o.jsx(X5,{side:a,...i,ref:t})})}),X5=h.forwardRef((e,t)=>{const r=sp(Xs,e.__scopeTooltip),n=y0(Xs,e.__scopeTooltip),a=h.useRef(null),i=Xe(t,a),[s,l]=
vendor: 4,274 bytes, line 392
392h.useState(null),{trigger:c,onClose:u}=r,d=a.current,{onPointerInTransitChange:f}=n,m=h.useCallback(()=>{l(null),f(!1)},[f]),p=h.useCallback((y,v)=>{const g=y.currentTarget,x={x:y.clientX,y:y.clientY},b=e6(x,g.getBoundingClientRect()),j=t6(x,b),w=r6(v.getBoundingClientRect()),S=a6([...j,...w]);l(S),f(!0)},[f]);return h.useEffect(()=>()=>m(),[m]),h.useEffect(()=>{if(c&&d){const y=g=>p(g,d),v=g=>p(g,c);return c.addEventListener("pointerleave",y),d.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",y),d.removeEventListener("pointerleave",v)}}},[c,d,p,m]),h.useEffect(()=>{if(s){const y=v=>{const g=v.target,x={x:v.clientX,y:v.clientY},b=(c==null?void 0:c.contains(g))||(d==null?void 0:d.contains(g)),j=!n6(x,s);b?m():j&&(m(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,d,s,u,m]),o.jsx(MA,{...e,ref:i})}),[Z5,Q5]=ap(op,{isInside:!1}),MA=h.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:s,...l}=e,c=sp(Xs,r),u=ip(r),{onClose:d}=c;return h.useEffect(()=>(document.addEventListener(Oy,d),()=>document.removeEventListener(Oy,d)),[d]),h.useEffect(()=>{if(c.trigger){const f=m=>{const p=m.target;p!=null&&p.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),o.jsx(OA,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:o.jsxs(r0,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(NP,{children:n}),o.jsx(Z5,{scope:r,isInside:!0,children:o.jsx(aB,{id:c.contentId,role:"tooltip",children:a||n})})]})})});kA.displayName=Xs;var IA="TooltipArrow",J5=h.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=ip(r);return Q5(IA,r).isInside?null:o.jsx(n0,{...a,...n,ref:t})});J5.displayName=IA;function e6(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(r,n,a,i)){case i:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function t6(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function r6(e){const{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function n6(e,t){const{x:r,y:n}=e;let a=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const l=t[i].x,c=t[i].y,u=t[s].x,d=t[s].y;c>n!=d>n&&r<(u-l)*(n-c)/(d-c)+l&&(a=!a)}return a}function a6(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),i6(t)}function i6(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const a=e[n];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))t.pop();else break}t.push(a)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;r.length>=2;){const i=r[r.length-1],s=r[r.length-2];if((i.x-s.x)*(a.y-s.y)>=(i.y-s.y)*(a.x-s.x))r.pop();else break}r.push(a)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var o6=TA,s6=DA,l6=$A,RA=kA;const x0=o6,LA=s6,FA=l6,b0=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>o.jsx(RA,{ref:n,sideOffset:t,className:oe("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
392de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));b0.displayName=RA.displayName;var Fl=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ko=typeof window>"u"||"Deno"in globalThis;function Cn(){}function c6(e,t){return typeof e=="function"?e(t):e}function Ay(e){return typeof e=="number"&&e>=0&&e!==1/0}function BA(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Os(e,t){return typeof e=="function"?e(t):e}function Hn(e,t){return typeof e=="function"?e(t):e}function k1(e,t){const{type:r="all",exact:n,fetchStatus:a,predicate:i,queryKey:s,stale:l}=e;if(s){if(n){if(t.queryHash!==w0(s,t.options))return!1}else if(!su(t.queryKey,s))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||a&&a!==t.state.fetchStatus||i&&!i(t))}function M1(e,t){const{exact:r,status:n,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(Mo(t.options.mutationKey)!==Mo(i))return!1}else if(!su(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||a&&!a(t))}function w0(e,t){return((t==null?void 0:t.queryKeyHashFn)||Mo)(e)}function Mo(e){return JSON.stringify(e,(t,r)=>Ty(r)?Object.keys(r).sort().reduce((n,a)=>(n[a]=r[a],n),{}):r)}function su(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(r=>!su(e[r],t[r])):!1}function zA(e,t){if(e===t)return e;const r=I1(e)&&I1(t);if(r||Ty(e)&&Ty(t)){const n=r?e:Object.keys(e),a=n.length,i=r?t:Object.keys(t),s=i.length,l=r?[]:{};let c=0;for(let u=0;u<s;u++){const d=r?u:i[u];(!r&&n.includes(d)||r)&&e[d]===void 0&&t[d]===void 0?(l[d]=void 0,c++):(l[d]=zA(e[d],t[d]),l[d]===e[d]&&e[d]!==void 0&&c++)}return a===s&&c===a?e:l}return t}function em(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function I1(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ty(e){if(!R1(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!R1(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function R1(e){return Object.prototype.toString.call(e)==="[object Object]"}function u6(e){return new Promise(t=>{setTimeout(t,e)})}function Dy(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?zA(e,t):t}function d6(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function f6(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var j0=Symbol();function qA(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===j0?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var yo,bi,Is,hP,m6=(hP=class extends Fl{constructor(){super();qe(this,yo);qe(this,bi);qe(this,Is);Ee(this,Is,t=>{if(!ko&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){U(this,bi)||this.setEventListener(U(this,Is))}onUnsubscribe(){var t;this.hasListeners()||((t=U(this,bi))==null||t.call(this),Ee(this,bi,void 0))}setEventListener(t){var r;Ee(this,Is,t),(r=U(this,bi))==null||r.call(this),Ee(this,bi,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){U(this,yo)!==t&&(Ee(this,yo,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof U(this,yo)=="boolean"?U(this,yo):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},yo=new WeakMap,bi=new WeakMap,Is=new WeakMap,hP),S0=new m6,Rs,wi,Ls,pP,h6=(pP=class extends Fl{constructor(){super();qe(this,Rs,!0);qe(this,wi);qe(this,Ls);Ee(this,Ls,t=>{if(!ko&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n
vendor: 31,743 bytes, line 392
392)}}})}onSubscribe(){U(this,wi)||this.setEventListener(U(this,Ls))}onUnsubscribe(){var t;this.hasListeners()||((t=U(this,wi))==null||t.call(this),Ee(this,wi,void 0))}setEventListener(t){var r;Ee(this,Ls,t),(r=U(this,wi))==null||r.call(this),Ee(this,wi,t(this.setOnline.bind(this)))}setOnline(t){U(this,Rs)!==t&&(Ee(this,Rs,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return U(this,Rs)}},Rs=new WeakMap,wi=new WeakMap,Ls=new WeakMap,pP),tm=new h6;function $y(){let e,t;const r=new Promise((a,i)=>{e=a,t=i});r.status="pending",r.catch(()=>{});function n(a){Object.assign(r,a),delete r.resolve,delete r.reject}return r.resolve=a=>{n({status:"fulfilled",value:a}),e(a)},r.reject=a=>{n({status:"rejected",reason:a}),t(a)},r}function p6(e){return Math.min(1e3*2**e,3e4)}function UA(e){return(e??"online")==="online"?tm.isOnline():!0}var WA=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Zv(e){return e instanceof WA}function VA(e){let t=!1,r=0,n=!1,a;const i=$y(),s=v=>{var g;n||(m(new WA(v)),(g=e.abort)==null||g.call(e))},l=()=>{t=!0},c=()=>{t=!1},u=()=>S0.isFocused()&&(e.networkMode==="always"||tm.isOnline())&&e.canRun(),d=()=>UA(e.networkMode)&&e.canRun(),f=v=>{var g;n||(n=!0,(g=e.onSuccess)==null||g.call(e,v),a==null||a(),i.resolve(v))},m=v=>{var g;n||(n=!0,(g=e.onError)==null||g.call(e,v),a==null||a(),i.reject(v))},p=()=>new Promise(v=>{var g;a=x=>{(n||u())&&v(x)},(g=e.onPause)==null||g.call(e)}).then(()=>{var v;a=void 0,n||(v=e.onContinue)==null||v.call(e)}),y=()=>{if(n)return;let v;const g=r===0?e.initialPromise:void 0;try{v=g??e.fn()}catch(x){v=Promise.reject(x)}Promise.resolve(v).then(f).catch(x=>{var _;if(n)return;const b=e.retry??(ko?0:3),j=e.retryDelay??p6,w=typeof j=="function"?j(r,x):j,S=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,x);if(t||!S){m(x);return}r++,(_=e.onFail)==null||_.call(e,r,x),u6(w).then(()=>u()?void 0:p()).then(()=>{t?m(x):y()})})};return{promise:i,cancel:s,continue:()=>(a==null||a(),i),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?y():p().then(y),i)}}function v6(){let e=[],t=0,r=l=>{l()},n=l=>{l()},a=l=>setTimeout(l,0);const i=l=>{t?e.push(l):a(()=>{r(l)})},s=()=>{const l=e;e=[],l.length&&a(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||s()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{a=l}}}var nr=v6(),xo,vP,GA=(vP=class{constructor(){qe(this,xo)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ay(this.gcTime)&&Ee(this,xo,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ko?1/0:5*60*1e3))}clearGcTimeout(){U(this,xo)&&(clearTimeout(U(this,xo)),Ee(this,xo,void 0))}},xo=new WeakMap,vP),Fs,Bs,En,wr,vd,bo,Wn,ka,gP,g6=(gP=class extends GA{constructor(t){super();qe(this,Wn);qe(this,Fs);qe(this,Bs);qe(this,En);qe(this,wr);qe(this,vd);qe(this,bo);Ee(this,bo,!1),Ee(this,vd,t.defaultOptions),this.setOptions(t.options),this.observers=[],Ee(this,En,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ee(this,Fs,y6(this.options)),this.state=t.state??U(this,Fs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=U(this,wr))==null?void 0:t.promise}setOptions(t){this.options={...U(this,vd),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&U(this,En).remove(this)}setData(t,r){const n=Dy(this.state.data,t,this.options);return rt(this,Wn,ka).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){rt(this,Wn,ka).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,a;const r=(n=U(this,wr))==null?void 0:n.promise;return(a=U(this,wr))==null||a.cancel(t),r?r.then(Cn).catch(Cn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(U(this,Fs))}isActive(){return this.observers.some(t=>Hn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===j0||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!BA(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=U(this,wr))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=U(this,wr))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),U(this,En).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(U(this,wr)&&(U(this,bo)?U(this,wr).cancel({revert:!0}):U(this,wr).cancelRetry()),this.scheduleGc()),U(this,En).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||rt(this,Wn,ka).call(this,{type:"invalidate"})}fetch(t,r){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(U(this,wr))return U(this,wr).continueRetry(),U(this,wr).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(m=>m.options.queryFn);f&&this.setOptions(f.options)}const n=new AbortController,a=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Ee(this,bo,!0),n.signal)})},i=()=>{const f=qA(this.options,r),m={queryKey:this.queryKey,meta:this.meta};return a(m),Ee(this,bo,!1),this.options.persister?this.options.persister(f,m,this):f(m)},s={fetchOptions:r,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};a(s),(c=this.options.behavior)==null||c.onFetch(s,this),Ee(this,Bs,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&rt(this,Wn,ka).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const l=f=>{var m,p,y,v;Zv(f)&&f.silent||rt(this,Wn,ka).call(this,{type:"error",error:f}),Zv(f)||((p=(m=U(this,En).config).onError)==null||p.call(m,f,this),(v=(y=U(this,En).config).onSettled)==null||v.call(y,this.state.data,f,this)),this.scheduleGc()};return Ee(this,wr,VA({initialPromise:r==null?void 0:r.initialPromise,fn:s.fetchFn,abort:n.abort.bind(n),onSuccess:f=>{var m,p,y,v;if(f===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(g){l(g);return}(p=(m=U(this,En).config).onSuccess)==null||p.call(m,f,this),(v=(y=U(this,En).config).onSettled)==null||v.call(y,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,m)=>{rt(this,Wn,ka).call(this,{type:"failed",failureCount:f,error:m})},onPause:()=>{rt(this,Wn,ka).call(this,{type:"pause"})},onContinue:()=>{rt(this,Wn,ka).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),U(this,wr).start()}},Fs=new WeakMap,Bs=new WeakMap,En=new WeakMap,wr=new WeakMap,vd=new WeakMap,bo=new WeakMap,Wn=new WeakSet,ka=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...HA(n.data,this.options),fetchMeta:t.meta??null};case"success":return{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=t.error;return Zv(a)&&a.revert&&U(this,Bs)?{...U(this,Bs),fetchStatus:"idle"}:{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),nr.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),U(this,En).notify({query:this,type:"updated",action:t})})},gP);function HA(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:UA(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function y6(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var sa,yP,x6=(yP=class extends Fl{constructor(t={}){super();qe(this,sa);this.config=t,Ee(this,sa,new Map)}build(t,r,n){const a=r.queryKey,i=r.queryHash??w0(a,r);let s=this.get(i);return s||(s=new g6({cache:this,queryKey:a,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(a)}),this.add(s)),s}add(t){U(this,sa).has(t.queryHash)||(U(this,sa).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=U(this,sa).get(t.queryHash);r&&(t.destroy(),r===t&&U(this,sa).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){nr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return U(this,sa).get(t)}getAll(){return[...U(this,sa).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>k1(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>k1(t,n)):r}notify(t){nr.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){nr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){nr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},sa=new WeakMap,yP),la,Pr,wo,ca,di,xP,b6=(xP=class extends GA{constructor(t){super();qe(this,ca);qe(this,la);qe(this,Pr);qe(this,wo);this.mutationId=t.mutationId,Ee(this,Pr,t.mutationCache),Ee(this,la,[]),this.state=t.state||KA(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){U(this,la).includes(t)||(U(this,la).push(t),this.clearGcTimeout(),U(this,Pr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ee(this,la,U(this,la).filter(r=>r!==t)),this.scheduleGc(),U(this,Pr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){U(this,la).length||(this.state.status==="pending"?this.scheduleGc():U(this,Pr).remove(this))}continue(){var t;return((t=U(this,wo))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var a,i,s,l,c,u,d,f,m,p,y,v,g,x,b,j,w,S,_,N;Ee(this,wo,VA({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(E,O)=>{rt(this,ca,di).call(this,{type:"failed",failureCount:E,error:O})},onPause:()=>{rt(this,ca,di).call(this,{type:"pause"})},onContinue:()=>{rt(this,ca,di).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>U(this,Pr).canRun(this)}));const r=this.state.status==="pending",n=!U(this,wo).canStart();try{if(!r){rt(this,ca,di).call(this,{type:"pending",variables:t,isPaused:n}),await((i=(a=U(this,Pr).config).onMutate)==null?void 0:i.call(a,t,this));const O=await((l=(s=this.options).onMutate)==null?void 0:l.call(s,t));O!==this.state.context&&rt(this,ca,di).call(this,{type:"pending",context:O,variables:t,isPaused:n})}const E=await U(this,wo).start();return await((u=(c=U(this,Pr).config).onSuccess)==null?void 0:u.call(c,E,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,E,t,this.state.context)),await((p=(m=U(this,Pr).config).onSettled)==null?void 0:p.call(m,E,null,this.state.variables,this.state.context,this)),await((v=(y=this.options).onSettled)==null?void 0:v.call(y,E,null,t,this.state.context)),rt(this,ca,di).call(this,{type:"success",data:E}),E}catch(E){try{throw await((x=(g=U(this,Pr).config).onError)==null?void 0:x.call(g,E,t,this.state.context,this)),await((j=(b=this.options).onError)==null?void 0:j.call(b,E,t,this.state.context)),await((S=(w=U(this,Pr).config).onSettled)==null?void 0:S.call(w,void 0,E,this.state.variables,this.state.context,this)),await((N=(_=this.options).onSettled)==null?void 0:N.call(_,void 0,E,t,this.state.context)),E}finally{rt(this,ca,di).call(this,{type:"error",error:E})}}finally{U(this,Pr).runNext(this)}}},la=new WeakMap,Pr=new WeakMap,wo=new WeakMap,ca=new WeakSet,di=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),nr.batch(()=>{U(this,la).forEach(n=>{n.onMutationUpdate(t)}),U(this,Pr).notify({mutation:this,type:"updated",action:t})})},xP);function KA(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var tn,gd,bP,w6=(bP=class extends Fl{constructor(t={}){super();qe(this,tn);qe(this,gd);this.config=t,Ee(this,tn,new Map),Ee(this,gd,Date.now())}build(t,r,n){const a=new b6({mutationCache:this,mutationId:++Jd(this,gd)._,options:t.defaultMutationOptions(r),state:n});return this.add(a),a}add(t){const r=af(t),n=U(this,tn).get(r)??[];n.push(t),U(this,tn).set(r,n),this.notify({type:"added",mutation:t})}remove(t){var n;const r=af(t);if(U(this,tn).has(r)){const a=(n=U(this,tn).get(r))==null?void 0:n.filter(i=>i!==t);a&&(a.length===0?U(this,tn).delete(r):U(this,tn).set(r,a))}this.notify({type:"removed",mutation:t})}canRun(t){var n;const r=(n=U(this,tn).get(af(t)))==null?void 0:n.find(a=>a.state.status==="pending");return!r||r===t}runNext(t){var n;const r=(n=U(this,tn).get(af(t)))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}clear(){nr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...U(this,tn).values()].flat()}find(t){const r={exact:!0,...t};return this.getAll().find(n=>M1(r,n))}findAll(t={}){return this.getAll().filter(r=>M1(t,r))}notify(t){nr.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return nr.batch(()=>Promise.all(t.map(r=>r.continue().catch(Cn))))}},tn=new WeakMap,gd=new WeakMap,bP);function af(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function L1(e){return{onFetch:(t,r)=>{var d,f,m,p,y;const n=t.options,a=(m=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],s=((y=t.state.data)==null?void 0:y.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let v=!1;const g=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(t.signal.aborted?v=!0:t.signal.addEventListener("abort",()=>{v=!0}),t.signal)})},x=qA(t.options,t.fetchOptions),b=async(j,w,S)=>{if(v)return Promise.reject();if(w==null&&j.pages.length)return Promise.resolve(j);const _={queryKey:t.queryKey,pageParam:w,direction:S?"backward":"forward",meta:t.options.meta};g(_);const N=await x(_),{maxPages:E}=t.options,O=S?f6:d6;return{pages:O(j.pages,N,E),pageParams:O(j.pageParams,w,E)}};if(a&&i.length){const j=a==="backward",w=j?j6:F1,S={pages:i,pageParams:s},_=w(n,S);l=await b(S,_,j)}else{const j=e??i.length;do{const w=c===0?s[0]??n.initialPageParam:F1(n,l);if(c>0&&w==null)break;l=await b(l,w),c++}while(c<j)}return l};t.options.persister?t.fetchFn=()=>{var v,g;return(g=(v=t.options).persister)==null?void 0:g.call(v,u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function F1(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function j6(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var Vt,ji,Si,zs,qs,_i,Us,Ws,wP,S6=(wP=class{constructor(e={}){qe(this,Vt);qe(this,ji);qe(this,Si);qe(this,zs);qe(this,qs);qe(this,_i);qe(this,Us);qe(this,Ws);Ee(this,Vt,e.queryCache||new x6),Ee(this,ji,e.mutationCache||new w6),Ee(this,Si,e.defaultOptions||{}),Ee(this,zs,new Map),Ee(this,qs,new Map),Ee(this,_i,0)}mount(){Jd(this,_i)._++,U(this,_i)===1&&(Ee(this,Us,S0.subscribe(async e=>{e&&(await this.resumePausedMutations(),U(this,Vt).onFocus())})),Ee(this,Ws,tm.subscribe(async e=>{e&&(await this.resumePausedMutations(),U(this,Vt).onOnline())})))}unmount(){var e,t;Jd(this,_i)._--,U(this,_i)===0&&((e=U(this,Us))==null||e.call(this),Ee(this,Us,void 0),(t=U(this,Ws))==null||t.call(this),Ee(this,Ws,void 0))}isFetching(e){return U(this,Vt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return U(this,ji).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=U(this,Vt).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(t===void 0)return this.fetchQuery(e);{const r=this.defaultQueryOptions(e),n=U(this,Vt).build(this,r);return e.revalidateIfStale&&n.isStaleByTime(Os(r.staleTime,n))&&this.prefetchQuery(r),Promise.resolve(t)}}getQueriesData(e){return U(this,Vt).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),a=U(this,Vt).get(n.queryHash),i=a==null?void 0:a.state.data,s=c6(t,i);if(s!==void 0)return U(this,Vt).build(this,n).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return nr.batch(()=>U(this,Vt).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=U(this,Vt).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=U(this,Vt);nr.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=U(this,Vt),n={type:"active",...e};return nr.batch(()=>(r.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries(n,t)))}cancelQueries(e={},t={}){const r={revert:!0,...t},n=nr.batch(()=>U(this,Vt).findAll(e).map(a=>a.cancel(r)));return Promise.all(n).then(Cn).catch(Cn)}invalidateQueries(e={},t={}){return nr.batch(()=>{if(U(this,Vt).findAll(e).forEach(n=>{n.invalidate()}),e.refetchType==="none")return Promise.resolve();const r={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(r,t)})}refetchQueries(e={},t){const r={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},n=nr.batch(()=>U(this,Vt).findAll(e).filter(a=>!a.isDisabled()).map(a=>{let i=a.fetch(void 0,r);return r.throwOnError||(i=i.catch(Cn)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Cn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=U(this,Vt).build(this,t);return r.isStaleByTime(Os(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Cn).catch(Cn)}fetchInfiniteQuery(e){return e.behavior=L1(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Cn).catch(Cn)}ensureInfiniteQueryData(e){return e.behavior=L1(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return tm.isOnline()?U(this,ji).resumePausedMutations():Promise.resolve()}getQueryCache(){return U(this,Vt)}getMutationCache(){return U(this,ji)}getDefaultOptions(){return U(this,Si)}setDefaultOptions(e){Ee(this,Si,e)}setQueryDefaults(e,t){U(this,zs).set(Mo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...U(this,zs).values()];let r={};return t.forEach(n=>{su(e,n.queryKey)&&(r={...r,...n.defaultOptions})}),r}setMutationDefaults(e,t){U(this,qs).set(Mo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...U(this,qs).values()];let r={};return t.forEach(n=>{su(e,n.mutationKey)&&(r={...r,...n.defaultOptions})}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...U(this,Si).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=w0(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.enabled!==!0&&t.queryFn===j0&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...U(this,Si).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){U(this,Vt).clear(),U(this,ji).clear()}},Vt=new WeakMap,ji=new WeakMap,Si=new WeakMap,zs=new WeakMap,qs=new WeakMap,_i=new WeakMap,Us=new WeakMap,Ws=new WeakMap,wP),Wr,at,yd,Ar,jo,Vs,Ni,ua,xd,Gs,Hs,So,_o,Ei,Ks,mt,$c,ky,My,Iy,Ry,Ly,Fy,By,YA,jP,_6=(jP=class extends Fl{constructor(t,r){super();qe(this,mt);qe(this,Wr);qe(this,at);qe(this,yd);qe(this,Ar);qe(this,jo);qe(this,Vs);qe(this,Ni);qe(this,ua);qe(this,xd);qe(this,Gs);qe(this,Hs);qe(this,So);qe(this,_o);qe(this,Ei);qe(this,Ks,new Set);this.options=r,Ee(this,Wr,t),Ee(this,ua,null),Ee(this,Ni,$y()),this.options.experimental_prefetchInRender||U(this,Ni).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(U(this,at).addObserver(this),B1(U(this,at),this.options)?rt(this,mt,$c).call(this):this.updateResult(),rt(this,mt,Ry).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return zy(U(this,at),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return zy(U(this,at),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,rt(this,mt,Ly).call(this),rt(this,mt,Fy).call(this),U(this,at).removeObserver(this)}setOptions(t,r){const n=this.options,a=U(this,at);if(this.options=U(this,Wr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Hn(this.options.enabled,U(this,at))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");rt(this,mt,By).call(this),U(this,at).setOptions(this.options),n._defaulted&&!em(this.options,n)&&U(this,Wr).getQueryCache().notify({type:"observerOptionsUpdated",query:U(this,at),observer:this});const i=this.hasListeners();i&&z1(U(this,at),a,this.options,n)&&rt(this,mt,$c).call(this),this.updateResult(r),i&&(U(this,at)!==a||Hn(this.options.enabled,U(this,at))!==Hn(n.enabled,U(this,at))||Os(this.options.staleTime,U(this,at))!==Os(n.staleTime,U(this,at)))&&rt(this,mt,ky).call(this);const s=rt(this,mt,My).call(this);i&&(U(this,at)!==a||Hn(this.options.enabled,U(this,at))!==Hn(n.enabled,U(this,at))||s!==U(this,Ei))&&rt(this,mt,Iy).call(this,s)}getOptimisticResult(t){const r=U(this,Wr).getQueryCache().build(U(this,Wr),t),n=this.createResult(r,t);return E6(this,n)&&(Ee(this,Ar,n),Ee(this,Vs,this.options),Ee(this,jo,U(this,at).state)),n}getCurrentResult(){return U(this,Ar)}trackResult(t,r){const n={};return Object.keys(t).forEach(a=>{Object.defineProperty(n,a,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(a),r==null||r(a),t[a])})}),n}trackProp(t){U(this,Ks).add(t)}getCurrentQuery(){return U(this,at)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=U(this,Wr).defaultQueryOptions(t),n=U(this,Wr).getQueryCache().build(U(this,Wr),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return rt(this,mt,$c).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),U(this,Ar)))}createResult(t,r){var E;const n=U(this,at),a=this.options,i=U(this,Ar),s=U(this,jo),l=U(this,Vs),u=t!==n?t.state:U(this,yd),{state:d}=t;let f={...d},m=!1,p;if(r._optimisticResults){const O=this.hasListeners(),P=!O&&B1(t,r),C=O&&z1(t,n,r,a);(P||C)&&(f={...f,...HA(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:v,status:g}=f;if(r.select&&f.data!==void 0)if(i&&f.data===(s==null?void 0:s.data)&&r.select===U(this,xd))p=U(this,Gs);else try{Ee(this,xd,r.select),p=r.select(f.data),p=Dy(i==null?void 0:i.data,p,r),Ee(this,Gs,p),Ee(this,ua,null)}catch(O){Ee(this,ua,O)}else p=f.data;if(r.placeholderData!==void 0&&p===void 0&&g==="pending"){let O;if(i!=null&&i.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData))O=i.data;else if(O=typeof r.placeholderData=="function"?r.placeholderData((E=U(this,Hs))==null?void 0:E.state.data,U(this,Hs)):r.placeholderData,r.select&&O!==void 0)try{O=r.select(O),Ee(this,ua,null)}catch(P){Ee(this,ua,P)}O!==void 0&&(g="success",p=Dy(i==null?void 0:i.data,O,r),m=!0)}U(this,ua)&&(y=U(this,ua),p=U(this,Gs),v=Date.now(),g="error");const x=f.fetchStatus==="fetching",b=g==="pending",j=g==="error",w=b&&x,S=p!==void 0,N={status:g,fetchStatus:f.fetchStatus,isPending:b,isSuccess:g==="success",isError:j,isInitialLoading:w,isLoading:w,data:p,dataUpdatedAt:f.dataUpdatedAt,error:y,errorUpdatedAt:v,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:x,isRefetching:x&&!b,isLoadingError:j&&!S,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:j&&S,isStale:_0(t,r),refetch:this.refetch,promise:U(this,Ni)};if(this.options.experimental_prefetchInRender){const O=A=>{N.status==="error"?A.reject(N.error):N.data!==void 0&&A.resolve(N.data)},P=()=>{const A=Ee(this,Ni,N.promise=$y());O(A)},C=U(this,Ni);switch(C.status){case"pending":t.queryHash===n.queryHash&&O(C);break;case"fulfilled":(N.status==="error"||N.data!==C.value)&&P();break;case"rejected":(N.status!=="error"||N.error!==C.reason)&&P();break}}return N}updateResult(t){const r=U(this,Ar),n=this.createResult(U(this,at),this.options);if(Ee(this,jo,U(this,at).state),Ee(this,Vs,this.options),U(this,jo).data!==void 0&&Ee(this,Hs,U(this,at)),em(n,r))return;Ee(this,Ar,n);const a={},i=()=>{if(!r)return!0;const{notifyOnChangeProps:s}=this.options,l=typeof s=="function"?s():s;if(l==="all"||!l&&!U(this,Ks).size)return!0;const c=new Set(l??U(this,Ks));return this.options.throwOnError&&c.add("error"),Object.keys(U(this,Ar)).some(u=>{const d=u;return U(this,Ar)[d]!==r[d]&&c.has(d)})};(t==null?void 0:t.listeners)!==!1&&i()&&(a.listeners=!0),rt(this,mt,YA).call(this,{...a,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&rt(this,mt,Ry).call(this)}},Wr=new WeakMap,at=new WeakMap,yd=new WeakMap,Ar=new WeakMap,jo=new WeakMap,Vs=new WeakMap,Ni=new WeakMap,ua=new WeakMap,xd=new WeakMap,Gs=new WeakMap,Hs=new WeakMap,So=new WeakMap,_o=new WeakMap,Ei=new WeakMap,Ks=new WeakMap,mt=new WeakSet,$c=function(t){rt(this,mt,By).call(this);let r=U(this,at).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Cn)),r},ky=function(){rt(this,mt,Ly).call(this);const t=Os(this.options.staleTime,U(this,at));if(ko||U(this,Ar).isStale||!Ay(t))return;const n=BA(U(this,Ar).dataUpdatedAt,t)+1;Ee(this,So,setTimeout(()=>{U(this,Ar).isStale||this.updateResult()},n))},My=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(U(this,at)):this.options.refetchInterval)??!1},Iy=function(t){rt(this,mt,Fy).call(this),Ee(this,Ei,t),!(ko||Hn(this.options.enabled,U(this,at))===!1||!Ay(U(this,Ei))||U(this,Ei)===0)&&Ee(this,_o,setInterval(()=>{(this.options.refetchIntervalInBackground||S0.isFocused())&&rt(this,mt,$c).call(this)},U(this,Ei)))},Ry=function(){rt(this,mt,ky).call(this),rt(this,mt,Iy).call(this,rt(this,mt,My).call(this))},Ly=function(){U(this,So)&&(clearTimeout(U(this,So)),Ee(this,So,void 0))},Fy=function(){U(this,_o)&&(clearInterval(U(this,_o)),Ee(this,_o,void 0))},By=function(){const t=U(this,Wr).getQueryCache().build(U(this,Wr),this.options);if(t===U(this,at))return;const r=U(this,at);Ee(this,at,t),Ee(this,yd,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},YA=function(t){nr.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(U(this,Ar))}),U(this,Wr).getQueryCache().notify({query:U(this,at),type:"observerResultsUpdated"})})},jP);function N6(e,t){return Hn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function B1(e,t){return N6(e,t)||e.state.data!==void 0&&zy(e,t,t.refetchOnMount)}function zy(e,t,r){if(Hn(t.enabled,e)!==!1){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&_0(e,t)}return!1}function z1(e,t,r,n){return(e!==t||Hn(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&_0(e,r)}function _0(e,t){return Hn(t.enabled,e)!==!1&&e.isStaleByTime(Os(t.staleTime,e))}function E6(e,t){return!em(e.getCurrentResult(),t)}var Ci,Oi,Vr,La,Ha,qf,qy,SP,C6=(SP=class extends Fl{constructor(r,n){super();qe(this,Ha);qe(this,Ci);qe(this,Oi);qe(this,Vr);qe(this,La);Ee(this,Ci,r),this.setOptions(n),this.bindMethods(),rt(this,Ha,qf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var a;const n=this.options;this.options=U(this,Ci).defaultMutationOptions(r),em(this.options,n)||U(this,Ci).getMutationCache().notify({type:"observerOptionsUpdated",mutation:U(this,Vr),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Mo(n.mutationKey)!==Mo(this.options.mutationKey)?this.reset():((a=U(this,Vr))==null?void 0:a.state.status)==="pending"&&U(this,Vr).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=U(this,Vr))==null||r.removeObserver(this)}onMutationUpdate(r){rt(this,Ha,qf).call(this),rt(this,Ha,qy).call(this,r)}getCurrentResult(){return U(this,Oi)}reset(){var r;(r=U(this,Vr))==null||r.removeObserver(this),Ee(this,Vr,void 0),rt(this,Ha,qf).call(this),rt(this,Ha,qy).call(this)}mutate(r,n){var a;return Ee(this,La,n),(a=U(this,Vr))==null||a.removeObserver(this),Ee(this,Vr,U(this,Ci).getMutationCache().build(U(this,Ci),this.options)),U(this,Vr).addObserver(this),U(this,Vr).execute(r)}},Ci=new WeakMap,Oi=new WeakMap,Vr=new WeakMap,La=new WeakMap,Ha=new WeakSet,qf=function(){var n;const r=((n=U(this,Vr))==null?void 0:n.state)??KA();Ee(this,Oi,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},qy=function(r){nr.batch(()=>{var n,a,i,s,l,c,u,d;if(U(this,La)&&this.hasListeners()){const f=U(this,Oi).variables,m=U(this,Oi).context;(r==null?void 0:r.type)==="success"?((a=(n=U(this,La)).onSuccess)==null||a.call(n,r.data,f,m),(s=(i=U(this,La)).onSettled)==null||s.call(i,r.data,null,f,m)):(r==null?void 0:r.type)==="error"&&((c=(l=U(this,La)).onError)==null||c.call(l,r.error,f,m),(d=(u=U(this,La)).onSettled)==null||d.call(u,void 0,r.error,f,m))}
392this.listeners.forEach(f=>{f(U(this,Oi))})})},SP),XA=h.createContext(void 0),pn=e=>{const t=h.useContext(XA);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},O6=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(XA.Provider,{value:e,children:t})),ZA=h.createContext(!1),P6=()=>h.useContext(ZA);ZA.Provider;function A6(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var T6=h.createContext(A6()),D6=()=>h.useContext(T6);function QA(e,t){return typeof e=="function"?e(...t):!!e}function JA(){}var $6=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},k6=e=>{h.useEffect(()=>{e.clearReset()},[e])},M6=({result:e,errorResetBoundary:t,throwOnError:r,query:n})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&QA(r,[e.error,n]),I6=e=>{e.suspense&&(e.staleTime===void 0&&(e.staleTime=1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},R6=(e,t)=>e.isLoading&&e.isFetching&&!t,L6=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,q1=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function F6(e,t,r){var d,f,m,p,y;const n=pn(),a=P6(),i=D6(),s=n.defaultQueryOptions(e);(f=(d=n.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||f.call(d,s),s._optimisticResults=a?"isRestoring":"optimistic",I6(s),$6(s,i),k6(i);const l=!n.getQueryCache().get(s.queryHash),[c]=h.useState(()=>new t(n,s)),u=c.getOptimisticResult(s);if(h.useSyncExternalStore(h.useCallback(v=>{const g=a?()=>{}:c.subscribe(nr.batchCalls(v));return c.updateResult(),g},[c,a]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),h.useEffect(()=>{c.setOptions(s,{listeners:!1})},[s,c]),L6(s,u))throw q1(s,c,i);if(M6({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:n.getQueryCache().get(s.queryHash)}))throw u.error;if((p=(m=n.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||p.call(m,s,u),s.experimental_prefetchInRender&&!ko&&R6(u,a)){const v=l?q1(s,c,i):(y=n.getQueryCache().get(s.queryHash))==null?void 0:y.promise;v==null||v.catch(JA).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?u:c.trackResult(u)}function lt(e,t){return F6(e,_6)}function Ir(e,t){const r=pn(),[n]=h.useState(()=>new C6(r,e));h.useEffect(()=>{n.setOptions(e)},[n,e]);const a=h.useSyncExternalStore(h.useCallback(s=>n.subscribe(nr.batchCalls(s)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=h.useCallback((s,l)=>{n.mutate(s,l).catch(JA)},[n]);if(a.error&&QA(n.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:i,mutateAsync:a.mutate}}/** 393 * @remix-run/router v1.20.0 394 * 395 * Copyright (c) Remix Software Inc. 396 * 397 * This source code is licensed under the MIT license found in the 398 * LICENSE.md file in the root directory of this source tree. 399 * 400 * @license MIT 401 */function lu(){return lu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},lu.apply(this,arguments)}var Pi;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Pi||(Pi={}));const U1="popstate";function B6(e){e===void 0&&(e={});function t(n,a){let{pathname:i,search:s,hash:l}=n.location;return Uy("",{pathname:i,search:s,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:rm(a)}return q6(t,r,null,e)}function qt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function eT(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function z6(){return Math.random().toString(36).substr(2,8)}function W1(e,t){return{usr:e.state,key:e.key,idx:t}}function Uy(e,t,r,n){return r===void 0&&(r=null),lu({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Bl(t):t,{state:r,key:t&&t.key||n||z6()})}function rm(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Bl(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function q6(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:i=!1}=n,s=a.history,l=Pi.Pop,c=null,u=d();u==null&&(u=0,s.replaceState(lu({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){l=Pi.Pop;let g=d(),x=g==null?null:g-u;u=g,c&&c({action:l,location:v.location,delta:x})}function m(g,x){l=Pi.Push;let b=Uy(v.location,g,x);u=d()+1;let j=W1(b,u),w=v.createHref(b);
vendor: 3,348 bytes, line 401
401try{s.pushState(j,"",w)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;a.location.assign(w)}i&&c&&c({action:l,location:v.location,delta:1})}function p(g,x){l=Pi.Replace;let b=Uy(v.location,g,x);u=d();let j=W1(b,u),w=v.createHref(b);s.replaceState(j,"",w),i&&c&&c({action:l,location:v.location,delta:0})}function y(g){let x=a.location.origin!=="null"?a.location.origin:a.location.href,b=typeof g=="string"?g:rm(g);return b=b.replace(/ $/,"%20"),qt(x,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,x)}let v={get action(){return l},get location(){return e(a,s)},listen(g){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(U1,f),c=g,()=>{a.removeEventListener(U1,f),c=null}},createHref(g){return t(a,g)},createURL:y,encodeLocation(g){let x=y(g);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:m,replace:p,go(g){return s.go(g)}};return v}var V1;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(V1||(V1={}));function U6(e,t,r){return r===void 0&&(r="/"),W6(e,t,r,!1)}function W6(e,t,r,n){let a=typeof t=="string"?Bl(t):t,i=Zs(a.pathname||"/",r);if(i==null)return null;let s=tT(e);V6(s);let l=null;for(let c=0;l==null&&c<s.length;++c){let u=rz(i);l=ez(s[c],u,n)}return l}function tT(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let a=(i,s,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};c.relativePath.startsWith("/")&&(qt(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let u=Ti([n,c.relativePath]),d=r.concat(c);i.children&&i.children.length>0&&(qt(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),tT(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:Q6(u,i.index),routesMeta:d})};return e.forEach((i,s)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))a(i,s);else for(let c of rT(i.path))a(i,s,c)}),t}function rT(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let s=rT(n.join("/")),l=[];return l.push(...s.map(c=>c===""?i:[i,c].join("/"))),a&&l.push(...s),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function V6(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:J6(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const G6=/^:[\w-]+$/,H6=3,K6=2,Y6=1,X6=10,Z6=-2,G1=e=>e==="*";function Q6(e,t){let r=e.split("/"),n=r.length;return r.some(G1)&&(n+=Z6),t&&(n+=K6),r.filter(a=>!G1(a)).reduce((a,i)=>a+(G6.test(i)?H6:i===""?Y6:X6),n)}function J6(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function ez(e,t,r){let{routesMeta:n}=e,a={},i="/",s=[];for(let l=0;l<n.length;++l){let c=n[l],u=l===n.length-1,d=i==="/"?t:t.slice(i.length)||"/",f=nm({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),m=c.route;if(!f&&u&&r&&!n[n.length-1].route.index&&(f=nm({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!f)return null;
vendor: 9,622 bytes, lines 401-410
401Object.assign(a,f.params),s.push({params:a,pathname:Ti([i,f.pathname]),pathnameBase:oz(Ti([i,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(i=Ti([i,f.pathnameBase]))}return s}function nm(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=tz(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let i=a[0],s=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:n.reduce((u,d,f)=>{let{paramName:m,isOptional:p}=d;if(m==="*"){let v=l[f]||"";s=i.slice(0,i.length-v.length).replace(/(.)\/+$/,"$1")}const y=l[f];return p&&!y?u[m]=void 0:u[m]=(y||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:s,pattern:e}}function tz(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),eT(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function rz(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return eT(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Zs(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function nz(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?Bl(e):e;return{pathname:r?r.startsWith("/")?r:az(r,t):t,search:sz(n),hash:lz(a)}}function az(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Qv(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function iz(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function N0(e,t){let r=iz(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function E0(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=Bl(e):(a=lu({},e),qt(!a.pathname||!a.pathname.includes("?"),Qv("?","pathname","search",a)),qt(!a.pathname||!a.pathname.includes("#"),Qv("#","pathname","hash",a)),qt(!a.search||!a.search.includes("#"),Qv("#","search","hash",a)));let i=e===""||a.pathname==="",s=i?"/":a.pathname,l;if(s==null)l=r;else{let f=t.length-1;if(!n&&s.startsWith("..")){let m=s.split("/");for(;m[0]==="..";)m.shift(),f-=1;a.pathname=m.join("/")}l=f>=0?t[f]:"/"}let c=nz(a,l),u=s&&s!=="/"&&s.endsWith("/"),d=(i||s===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Ti=e=>e.join("/").replace(/\/\/+/g,"/"),oz=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),sz=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,lz=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function cz(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const nT=["post","put","patch","delete"];new Set(nT);const uz=["get",...nT];new Set(uz);/** 402 * React Router v6.27.0 403 * 404 * Copyright (c) Remix Software Inc. 405 * 406 * This source code is licensed under the MIT license found in the 407 * LICENSE.md file in the root directory of this source tree. 408 * 409 * @license MIT 410 */function cu(){return cu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},cu.apply(this,arguments)}const lp=h.createContext(null),aT=h.createContext(null),ti=h.createContext(null),cp=h.createContext(null),Ca=h.createContext({outlet:null,matches:[],isDataRoute:!1}),iT=h.createContext(null);function dz(e,t){let{relative:r}=t===void 0?{}:t;zl()||qt(!1);let{basename:n,navigator:a}=h.useContext(ti),{hash:i,pathname:s,search:l}=dp(e,{relative:r}),c=s;return n!=="/"&&(c=s==="/"?n:Ti([n,s])),a.createHref({pathname:c,search:l,hash:i})}function zl(){return h.useContext(cp)!=null}function vn(){return zl()||qt(!1),h.useContext(cp).location}function oT(e){h.useContext(ti).static||h.useLayoutEffect(e)}function or(){let{isDataRoute:e}=h.useContext(Ca);return e?Ez():fz()}function fz(){zl()||qt(!1);let e=h.useContext(lp),{basename:t,future:r,navigator:n}=h.useContext(ti),{matches:a}=h.useContext(Ca),{pathname:i}=vn(),s=JSON.stringify(N0(a,r.v7_relativeSplatPath)),l=h.useRef(!1);return oT(()=>{l.current=!0}),h.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let f=E0(u,JSON.parse(s),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Ti([t,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[t,n,s,i,e])}const mz=h.createContext(null);function hz(e){let t=h.useContext(Ca).outlet;return t&&h.createElement(mz.Provider,{value:e},t)}function up(){let{matches:e}=h.useContext(Ca),t=e[e.length-1];return t?t.params:{}}function dp(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=h.useContext(ti),{matches:a}=h.useContext(Ca),{pathname:i}=vn(),s=JSON.stringify(N0(a,n.v7_relativeSplatPath));return h.useMemo(()=>E0(e,JSON.parse(s),i,r==="path"),[e,s,i,r])}function pz(e,t){return vz(e,t)}function vz(e,t,r,n){zl()||qt(!1);let{navigator:a}=h.useContext(ti),{matches:i}=h.useContext(Ca),s=i[i.length-1],l=s?s.params:{};s&&s.pathname;let c=s?s.pathnameBase:"/";s&&s.route;let u=vn(),d;if(t){var f;let g=typeof t=="string"?Bl(t):t;c==="/"||(f=g.pathname)!=null&&f.startsWith(c)||qt(!1),d=g}else d=u;let m=d.pathname||"/",p=m;if(c!=="/"){let g=c.replace(/^\//,"").split("/");p="/"+m.replace(/^\//,"").split("/").slice(g.length).join("/")}let y=U6(e,{pathname:p}),v=wz(y&&y.map(g=>Object.assign({},g,{params:Object.assign({},l,g.params),pathname:Ti([c,a.encodeLocation?a.encodeLocation(g.pathname).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?c:Ti([c,a.encodeLocation?a.encodeLocation(g.pathnameBase).pathname:g.pathnameBase])})),i,r,n);return t&&v?h.createElement(cp.Provider,{value:{location:cu({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Pi.Pop}},v):v}function gz(){let e=Nz(),t=cz(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),r?h.createElement("pre",{style:a},r):null,null)}const yz=h.createElement(gz,null);class xz extends h.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?h.createElement(Ca.Provider,{value:this.props.routeContext},h.createElement(iT.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function bz(e){let{routeContext:t,match:r,children:n}=e,a=h.useContext(lp);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),h.createElement(Ca.Provider,{value:t},n)}function wz(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,l=(a=r)==null?void 0:a.errors;if(l!=null){let d=s.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||qt(!1),s=s.slice(0,Math.min(s.length,d+1))}let c=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d<s.length;d++){let f=s[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:m,errors:p}=r,y=f.route.loader&&m[f.route.id]===void 0&&(!p||p[f.route.id]===void 0);if(f.route.lazy||y){c=!0,u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,f,m)=>{let p,y=!1,v=null,g=null;r&&(p=l&&f.route.id?l[f.route.id]:void 0,v=f.route.errorElement||yz,c&&(u<0&&m===0?(y=!0,g=null):u===m&&(y=!0,g=f.route.hydrateFallbackElement||null)));let x=t.concat(s.slice(0,m+1)),b=()=>{let j;return p?j=v:y?j=g:f.route.Component?j=h.createElement(f.route.Component,null):f.route.element?j=f.route.element:j=d,h.createElement(bz,{match:f,routeContext:{outlet:d,matches:x,isDataRoute:r!=null},children:j})};return r&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?h.createElement(xz,{location:r.location,revalidation:r.revalidation,component:v,error:p,children:b(),routeC
410ontext:{outlet:null,matches:x,isDataRoute:!0}}):b()},null)}var sT=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(sT||{}),am=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(am||{});function jz(e){let t=h.useContext(lp);return t||qt(!1),t}function Sz(e){let t=h.useContext(aT);return t||qt(!1),t}function _z(e){let t=h.useContext(Ca);return t||qt(!1),t}function lT(e){let t=_z(),r=t.matches[t.matches.length-1];return r.route.id||qt(!1),r.route.id}function Nz(){var e;let t=h.useContext(iT),r=Sz(am.UseRouteError),n=lT(am.UseRouteError);return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function Ez(){let{router:e}=jz(sT.UseNavigateStable),t=lT(am.UseNavigateStable),r=h.useRef(!1);return oT(()=>{r.current=!0}),h.useCallback(function(a,i){i===void 0&&(i={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,cu({fromRouteId:t},i)))},[e,t])}function fp(e){let{to:t,replace:r,state:n,relative:a}=e;zl()||qt(!1);let{future:i,static:s}=h.useContext(ti),{matches:l}=h.useContext(Ca),{pathname:c}=vn(),u=or(),d=E0(t,N0(l,i.v7_relativeSplatPath),c,a==="path"),f=JSON.stringify(d);return h.useEffect(()=>u(JSON.parse(f),{replace:r,state:n,relative:a}),[u,f,a,r,n]),null}function Cz(e){return hz(e.context)}function dt(e){qt(!1)}function Oz(e){let{basename:t="/",children:r=null,location:n,navigationType:a=Pi.Pop,navigator:i,static:s=!1,future:l}=e;zl()&&qt(!1);let c=t.replace(/^\/*/,"/"),u=h.useMemo(()=>({basename:c,navigator:i,static:s,future:cu({v7_relativeSplatPath:!1},l)}),[c,l,i,s]);typeof n=="string"&&(n=Bl(n));let{pathname:d="/",search:f="",hash:m="",state:p=null,key:y="default"}=n,v=h.useMemo(()=>{let g=Zs(d,c);return g==null?null:{location:{pathname:g,search:f,hash:m,state:p,key:y},navigationType:a}},[c,d,f,m,p,y,a]);return v==null?null:h.createElement(ti.Provider,{value:u},h.createElement(cp.Provider,{children:r,value:v}))}function Pz(e){let{children:t,location:r}=e;return pz(Wy(t),r)}new Promise(()=>{});function Wy(e,t){t===void 0&&(t=[]);let r=[];return h.Children.forEach(e,(n,a)=>{if(!h.isValidElement(n))return;let i=[...t,a];if(n.type===h.Fragment){r.push.apply(r,Wy(n.props.children,i));return}n.type!==dt&&qt(!1),!n.props.index||!n.props.children||qt(!1);let s={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=Wy(n.props.children,i)),r.push(s)}),r}/** 411 * React Router DOM v6.27.0 412 * 413 * Copyright (c) Remix Software Inc. 414 * 415 * This source code is licensed under the MIT license found in the 416 * LICENSE.md file in the root directory of this source tree. 417 * 418 * @license MIT 419 */function im(){return im=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},im.apply(this,arguments)}function cT(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,i;for(i=0;i<n.length;i++)a=n[i],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}function Az(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Tz(e,t){return e.button===0&&(!t||t==="_self")&&!Az(e)}function Vy(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function Dz(e,t){let r=Vy(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const $z=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],kz=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Mz="6";try{window.__reactRouterVersion=Mz}catch{}const Iz=h.createContext({isTransitioning:!1}),Rz="startTransition",H1=RP[Rz];function Lz(e){let{basename:t,children:r,future:n,window:a}=e,i=h.useRef();i.current==null&&(i.current=B6({window:a,v5Compat:!0}));let s=i.current,[l,c]=h.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},d=h.useCallback(f=>{u&&H1?H1(()=>c(f)):c(f)},[c,u]);return h.useLayoutEffect(()=>s.listen(d),[s,d]),h.createElement(Oz,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}const Fz=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Bz=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,zz=h.forwardRef(function(t,r){let{onClick:n,relative:a,reloadDocument:i,replace:s,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,m=cT(t,$z),{basename:p}=h.useContext(ti),y,v=!1;if(typeof u=="string"&&Bz.test(u)&&(y=u,Fz))try{let j=new URL(window.location.href),w=u.startsWith("//")?new URL(j.protocol+u):new URL(u),S=Zs(w.pathname,p);w.origin===j.origin&&S!=null?u=S+w.search+w.hash:v=!0}catch{}let g=dz(u,{relative:a}),x=Uz(u,{replace:s,state:l,target:c,preventScrollReset:d,relative:a,viewTransition:f});function b(j){n&&n(j),j.defaultPrevented||x(j)}return h.createElement("a",im({},m,{href:y||g,onClick:v||i?n:b,ref:r,target:c}))}),K1=h.forwardRef(function(t,r){let{"aria-current":n="page",caseSensitive:a=!1,className:i="",end:s=!1,style:l,to:c,viewTransition:u,children:d}=t,f=cT(t,kz),m=dp(c,{relative:f.relative}),p=vn(),y=h.useContext(aT),{navigator:v,basename:g}=h.useContext(ti),x=y!=null&&Wz(m)&&u===!0,b=v.encodeLocation?v.encodeLocation(m).pathname:m.pathname,j=p.pathname,w=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;a||(j=j.toLowerCase(),w=w?w.toLowerCase():null,b=b.toLowerCase()),w&&g&&(w=Zs(w,g)||w);const S=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let _=j===b||!s&&j.startsWith(b)&&j.charAt(S)==="/",N=w!=null&&(w===b||!s&&w.startsWith(b)&&w.charAt(b.length)==="/"),E={isActive:_,isPending:N,isTransitioning:x},O=_?n:void 0,P;typeof i=="function"?P=i(E):P=[i,_?"active":null,N?"pending":null,x?"transitioning":null].filter(
419Boolean).join(" ");let C=typeof l=="function"?l(E):l;return h.createElement(zz,im({},f,{"aria-current":O,className:P,ref:r,style:C,to:c,viewTransition:u}),typeof d=="function"?d(E):d)});var Gy;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Gy||(Gy={}));var Y1;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Y1||(Y1={}));function qz(e){let t=h.useContext(lp);return t||qt(!1),t}function Uz(e,t){let{target:r,replace:n,state:a,preventScrollReset:i,relative:s,viewTransition:l}=t===void 0?{}:t,c=or(),u=vn(),d=dp(e,{relative:s});return h.useCallback(f=>{if(Tz(f,r)){f.preventDefault();let m=n!==void 0?n:rm(u)===rm(d);c(e,{replace:m,state:a,preventScrollReset:i,relative:s,viewTransition:l})}},[u,c,d,n,a,r,e,i,s,l])}function uT(e){let t=h.useRef(Vy(e)),r=h.useRef(!1),n=vn(),a=h.useMemo(()=>Dz(n.search,r.current?null:t.current),[n.search]),i=or(),s=h.useCallback((l,c)=>{const u=Vy(typeof l=="function"?l(a):l);r.current=!0,i("?"+u,c)},[i,a]);return[a,s]}function Wz(e,t){t===void 0&&(t={});let r=h.useContext(Iz);r==null&&qt(!1);let{basename:n}=qz(Gy.useViewTransitionState),a=dp(e,{relative:t.relative});if(!r.isTransitioning)return!1;let i=Zs(r.currentLocation.pathname,n)||r.currentLocation.pathname,s=Zs(r.nextLocation.pathname,n)||r.nextLocation.pathname;return nm(a.pathname,s)!=null||nm(a.pathname,i)!=null}const X1={PRODUCTION:"https://produccion.unicoscomotu.com",ALLOWED_ORIGINS:["https://produccion.unicoscomotu.com","http://localhost:8080","http://localhost:3000"],SECURITY_HEADERS:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},Vz="https://hakrnctolecgwjmvkcvm.supabase.co",Gz="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imhha3JuY3RvbGVjZ3dqbXZrY3ZtIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDUzMzM1NzgsImV4cCI6MjA2MDkwOTU3OH0.NknESViMe4JVjQEdUKLQb402YuORBXalu3Sbz9hojM4",B=pB(Vz,Gz,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!1,flowType:"pkce"},global:{headers:{Origin:typeof window<"u"?window.location.origin:X1.PRODUCTION,Referer:typeof window<"u"?window.location.origin:X1.PRODUCTION}},db:{schema:"public"},realtime:{params:{eventsPerSecond:1}}}),dT=h.createContext(void 0),Hz=({children:e})=>{const[t,r]=h.useState(null),[n,a]=h.useState(null),[i,s]=h.useState(null),[l,c]=h.useState(!0),u=or(),d=h.useCallback(async v=>{try{const{data:g,error:x}=await B.from("profiles").select("id, role, identification, full_name, username, supervisor_turno").eq("id",v).single();s(!x&&g?g:null)}catch{s(null)}},[]);h.useEffect(()=>{const{data:{subscription:v}}=B.auth.onAuthStateChange((x,b)=>{r(b),a((b==null?void 0:b.user)??null),x==="SIGNED_IN"&&(b!=null&&b.user)?(setTimeout(()=>{d(b.user.id)},0),window.location.pathname==="/login"&&u("/dashboard")):x==="SIGNED_OUT"&&(s(null),u("/login"))});let g=!1;return g||B.auth.getSession().then(({data:{session:x}})=>{r(x),a((x==null?void 0:x.user)??null),x!=null&&x.user&&d(x.user.id),c(!1),g=!0}),()=>v.unsubscribe()},[u,d]);const f=h.useCallback(async(v,g)=>{try{const{data:x,error:b}=await B.auth.signInWithPassword({email:v,password:g});if(b){switch(console.error("ð¨ Detailed Login Error:",b),b.message){case"Invalid login credentials":Z.error("Credenciales inválidas. Verifica tu correo y contraseña.");break;case"Email not confirmed":Z.error("Por favor, confirma tu correo electrónico.");break;default:Z.error(b.message||"Error al iniciar sesión")}throw b}if(x.user){const{data:j,error:w}=await B.from("profiles").select("*").eq("id",x.user.id).maybeSingle();if(w&&w.code!=="PGRST116")console.error("Error checking profile:",w);else if(!j&&x.user){const{error:S}=await B.from("profiles").insert({id:x.user.id,username:x.user.email,full_name:x.user.user_metadata.full_name||x.user.email,identification:x.user.user_metadata.identification||"",role:"Operador"});S&&console.error("Error creating profile:",S)}}console.log("Login successful for:",v),Z.success("Inicio de sesión exitoso")}catch(x){throw console.error("ð¨ Login Catch Block Error:",x),x}},[]),m=h.useCallback(async(v,g,x,b)=>{try{const{data:j,error:w}=await B.auth.signUp({email:v,password:g,options:{emailRedirectTo:`${window.location.origin}/`,data:{full_name:x,identification:b,role:"Operador"}}});if(w){switch(w.message){case"User already exists":Z.error("Este usuario ya está registrado. Intenta iniciar sesión.");break;default:Z.error(w.message||"Error al registrarse")}throw w}if(j.user){const{error:S}=await B.from("profiles").insert({id:j.user.id,username:v,full_name:x,identification:b,role:"Operador"});
419S&&(console.error("Error creating profile during signup:",S),Z.warning("Usuario creado pero hubo un error al crear el perfil. Intenta iniciar sesión."))}Z.success("Registro exitoso. Verifica tu correo electrónico.")}catch(j){throw console.error("Signup Error:",j),j}},[]),p=h.useCallback(async()=>{try{await B.auth.signOut(),Z.success("Sesión cerrada exitosamente")}catch(v){throw Z.error(v.message||"Error al cerrar sesión"),v}},[]),y=h.useMemo(()=>({session:t,user:n,userProfile:i,loading:l,signIn:f,signUp:m,signOut:p}),[t,n,i,l,f,m,p]);return o.jsx(dT.Provider,{value:y,children:e})},Hi=()=>{const e=h.useContext(dT);if(e===void 0)throw new Error("useAuth debe ser usado dentro de un AuthProvider");return e};function C0(){const[e,t]=h.useState(new Set),[r,n]=h.useState(null),[a,i]=h.useState(!0);return h.useEffect(()=>{let s=!0;return(async()=>{try{const{data:{session:l}}=await B.auth.getSession();if(!l){s&&(t(new Set),n(null),i(!1));return}const{data:c}=await B.from("profiles").select("role").eq("id",l.user.id).maybeSingle(),u=(c==null?void 0:c.role)||null;if(s&&n(u),!u){s&&(t(new Set),i(!1));return}if(u==="Administrador"){s&&(t(new Set(["*"])),i(!1));return}const{data:d}=await B.from("app_role_permisos").select("modulo_id, puede_leer").eq("rol",u).eq("puede_leer",!0),f=new Set((d||[]).map(m=>m.modulo_id));s&&(t(f),i(!1))}catch(l){console.error("Error loading module permissions:",l),s&&i(!1)}})(),()=>{s=!1}},[]),{allowedModules:e,role:r,isLoading:a}}const Kz=({collapsed:e})=>{const{signOut:t}=Hi(),{allowedModules:r,role:n,isLoading:a}=C0(),[i,s]=h.useState(!1),[l,c]=h.useState(["tareas-turno","settings"]);h.useEffect(()=>{(async()=>{const{data:{session:p}}=await B.auth.getSession();if(!p)return;const{data:y}=await B.from("auditores").select("id").eq("user_id",p.user.id).eq("activo",!0).limit(1);s(((y==null?void 0:y.length)??0)>0)})()},[]);const u=p=>r.has("*")||r.has(p),d=[{title:"Dashboard",href:"/dashboard",icon:g3,moduleId:"dashboard"},{title:"Tareas de Turno",href:"/shifts",icon:mn,moduleId:"shifts",subItems:[{title:"Vista Administrativa",href:"/shifts",icon:au,moduleId:"shifts_admin"},{title:"Mi Turno",href:"/shifts/my-shift",icon:Rl,moduleId:"shifts_my"},{title:"Gestión de Tareas",href:"/shifts/management",icon:No,moduleId:"shifts_management"}]},{title:"Forms",href:"/forms",icon:fA,moduleId:"forms"},{title:"Reportes",href:"/reportes",icon:Ya,moduleId:"reportes"},{title:"Base de Conocimiento",href:"/base-conocimiento",icon:nu,moduleId:"base_conocimiento"},{title:"AuditorÃa",href:"/auditoria",icon:m0,moduleId:"auditoria"},{title:"Perfiles y Permisos",href:"/profiles",icon:hA,moduleId:"profiles"},{title:"Settings",href:"/settings",icon:No,moduleId:"settings",subItems:[{title:"Configuración General",href:"/settings",icon:c3,moduleId:"settings"},{title:"Máquinas",href:"/maquinas",icon:No,moduleId:"maquinas"},{title:"Generar Semanas",href:"/generar-semanas",icon:r3,moduleId:"generar_semanas"}]},{title:"Users",href:"/users",icon:S3,moduleId:"users"}],f=d.filter(p=>u(p.moduleId)||p.moduleId==="auditoria"&&i).map(p=>{var y;return{...p,subItems:(y=p.subItems)==null?void 0:y.filter(v=>u(v.moduleId))}}).filter(p=>{var y;return!p.subItems||p.subItems.length>0||!((y=d.find(v=>v.title===p.title))!=null&&y.subItems)}),m=p=>{c(y=>y.includes(p)?y.filter(v=>v!==p):[...y,p])};return a?o.jsx("div",{className:"flex flex-col h-full bg-gray-50 border-r py-4 items-center justify-center",children:o.jsx(ye,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):o.jsxs("div",{className:"flex flex-col h-full bg-gray-50 border-r py-4",children:[!e&&o.jsx("div",{className:"px-4 mb-4 flex justify-center",children:o.jsx("img",{src:"/lovable-uploads/487fc73a-aeac-4c0f-b546-1e5ecf9ea9da.png",alt:"Logo",className:"h-12 w-auto"})}),o.jsx("nav",{className:"flex-grow",children:o.jsx("ul",{children:f.map(p=>o.jsx("li",{children:p.subItems&&p.subItems.length>0?o.jsxs("div",{children:[o.jsxs("button",{onClick:()=>m(p.title.toLowerCase().replace(/\s+/g,"-")),className:"flex items-center justify-between w-full px-4 py-2 text-gray-700 hover:bg-gray-200",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx(p.icon,{className:"h-5 w-5 min-w-5 mr-2"}),(!e||window.innerWidth<768)&&p.title]}),(!e||window.innerWidth<768)&&(l.includes(p.title.toLowerCase().replace(/\s+/g,"-"))?o.jsx(tp,{className:"h-4 w-4"}):o.jsx(Il,{className:"h-4 w-4"}))]}),l.includes(p.title.toLowerCase().replace(/\s+/g,"-"))&&o.jsx("ul",{className:"ml-4",children:p.subItems.map(y=>o.jsx("li",{children:o.jsxs(K1,{to:y.href,className:({isActive:v})=>`flex items-center px-4 py-1 text-gray-600 hover:bg-gray-100 text-sm ${v?"font-semibold bg-gray-100":""}`,children:[o.jsx(y.icon,{className:"h-4 w-4 min-w-4 mr-2"}),(!e||window.innerWidth<768)&&y.title]})},y.href))})]}):o.jsxs(K1,{to:p.href,className:({isActive:y})=>`flex items-center px-4 py-2 text-gray-700 hover:bg-gray-200 ${y?"font-semibold bg-gray-200":""}`,children:[o.jsx(p.icon,{className:"h-5 w-5 min-w-5 mr-2"}),(!e||window.innerWidth<768)&&p.title]})},p.href))})}),o.jsx("div",{className:"p-4",children:o.jsxs("button",{onClick:t,className:"flex items-center w-full px-4 py-2 text-gray-700 hover:bg-gray-200",children:[o.jsx(mA,{className:"h-5 w-5 min-w-5 mr-2"}),(!e||window.innerWidth<768)&&"Logout"]})})]})},Jv=768;function ql(){const[e,t]=h.useState(void 0);return h.useEffect(()=>{const r=window.matchMedia(`(max-width: ${Jv-1}px)`),n=()=>{t(window.innerWidth<Jv)};return r.addEventListener("change",n),t(window.innerWidth<Jv),()=>r.removeEventListener("change",n)},[]),!!e}function Yz({collapsed:e,setCollapsed:t}){const r=ql(),[n,a]=h.useState(!1),i=vn();h.useEffect(()=>{r&&n&&(a(!1),t(!0))},[i.pathname,r,t]);const s=()=>{r?a(!n):t(!e)},l=()=>{a(!1),t(!0)};return o.jsxs(o.Fragment,{children:[r&&o.jsxs("div",{className:"fixed top-0 left-0 z-40 w-full flex items-center justify-between h-14 border-b bg-background px-3 shadow-sm",children:[o.jsx("button",{onClick:s,className:"flex items-center justify-center h-10 w-10 rounded-md hover:bg-gray-100 transition-colors","aria-label":"Toggle menu",children:n?o.jsx(_r,{className:"h-5 w-5"}):o.jsx(b3,{className:"h-5 w-5"})}),o.jsx("div",{className:"flex items-center",children:o.jsx("img",{src:"/lovable-uploads/487fc73a-aeac-4c0f-b546-1e5ecf9ea9da.png",alt:"Logo",className:"h-8 w-auto"})}),o.jsx("div",{className:"w-10"})]}),r&&n&&o.jsx("div",{className:"fixed inset-0 bg-black/50 z-30 transition-opacity",onClick:l}),o.jsxs("aside",{className:oe("relative z-40 h-full transition-all duration-300 ease-in-out border-r bg-background",r?`fixed ${n?"left-0":"-left-full"} top-14 bottom-0 w-64 shadow-lg`:e?"w-16":"w-64"),children:[!r&&o.jsx("button",{onClick:s,className:"absolute right-4 top-4 p-1.5 rounded-lg hover:bg-gray-100 transition-colors","aria-label":e?"Expandir menú":"Colapsar menú",children:o.jsx(Ao,{className:`h-5 w-5 transition-transform duration-200 ${e?"rotate-180":""}`})}),o.jsx(Kz,{collapsed:e})]})]})}function Xz(){const[e,t]=h.useState(!1);return[e,t]}const fT=OP,Zz=CP,mT=h.forwardRef(({className:e,...t},r)=>o.jsx(Fh,{className:oe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));mT.displayName=Fh.displayName;const Qz=Ml("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),O0=h.forwardRef(({side:e="right",className:t,children:r,...n},a)=>o.jsxs(Zz,{children:[o.jsx(mT,{}),o.jsxs(Bh,{ref:a,className:oe(Qz({side:e}),t),...n,children:[r,o.jsxs(EP,{className:"absolute right-4 top-4 roun
419ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[o.jsx(_r,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));O0.displayName=Bh.displayName;const P0=({className:e,...t})=>o.jsx("div",{className:oe("flex flex-col space-y-2 text-center sm:text-left",e),...t});P0.displayName="SheetHeader";const A0=h.forwardRef(({className:e,...t},r)=>o.jsx(zh,{ref:r,className:oe("text-lg font-semibold text-foreground",e),...t}));A0.displayName=zh.displayName;const hT=h.forwardRef(({className:e,...t},r)=>o.jsx(qh,{ref:r,className:oe("text-sm text-muted-foreground",e),...t}));hT.displayName=qh.displayName;const we=h.forwardRef(({className:e,type:t,...r},n)=>o.jsx("input",{type:t,className:oe("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));we.displayName="Input";const Jz=Ml("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ke({className:e,variant:t,...r}){return o.jsx("div",{className:oe(Jz({variant:t}),e),...r})}function eq(e,t){return h.useReducer((r,n)=>t[r][n]??r,e)}var T0="ScrollArea",[pT,qPe]=Lr(T0),[tq,Ln]=pT(T0),vT=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:i=600,...s}=e,[l,c]=h.useState(null),[u,d]=h.useState(null),[f,m]=h.useState(null),[p,y]=h.useState(null),[v,g]=h.useState(null),[x,b]=h.useState(0),[j,w]=h.useState(0),[S,_]=h.useState(!1),[N,E]=h.useState(!1),O=Xe(t,C=>c(C)),P=kl(a);return o.jsx(tq,{scope:r,type:n,dir:P,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:p,onScrollbarXChange:y,scrollbarXEnabled:S,onScrollbarXEnabledChange:_,scrollbarY:v,onScrollbarYChange:g,scrollbarYEnabled:N,onScrollbarYEnabledChange:E,onCornerWidthChange:b,onCornerHeightChange:w,children:o.jsx(Me.div,{dir:P,...s,ref:O,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});vT.displayName=T0;var gT="ScrollAreaViewport",yT=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,asChild:a,nonce:i,...s}=e,l=Ln(gT,r),c=h.useRef(null),u=Xe(t,c,l.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:` 420[data-radix-scroll-area-viewport] { 421 scrollbar-width: none; 422 -ms-overflow-style: none; 423 -webkit-overflow-scrolling: touch; 424} 425[data-radix-scroll-area-viewport]::-webkit-scrollbar {
426 display: none; 427} 428:where([data-radix-scroll-area-viewport]) { 429 display: flex; 430 flex-direction: column; 431 align-items: stretch; 432} 433:where([data-radix-scroll-area-content]) { 434 flex-grow: 1; 435} 436`},nonce:i}),o.jsx(Me.div,{"data-radix-scroll-area-viewport":"",...s,asChild:a,ref:u,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:dq({asChild:a,children:n},d=>o.jsx("div",{"data-radix-scroll-area-content":"",ref:l.onContentChange,style:{minWidth:l.scrollbarXEnabled?"fit-content":void 0},children:d}))})]})});yT.displayName=gT;var Oa="ScrollAreaScrollbar",D0=h.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Ln(Oa,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=a,l=e.orientation==="horizontal";return h.useEffect(()=>(l?i(!0):s(!0),()=>{l?i(!1):s(!1)}),[l,i,s]),a.type==="hover"?o.jsx(rq,{...n,ref:t,forceMount:r}):a.type==="scroll"?o.jsx(nq,{...n,ref:t,forceMount:r}):a.type==="auto"?o.jsx(xT,{...n,ref:t,forceMount:r}):a.type==="always"?o.jsx($0,{...n,ref:t}):null});D0.displayName=Oa;var rq=h.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Ln(Oa,e.__scopeScrollArea),[i,s]=h.useState(!1);return h.useEffect(()=>{const l=a.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),s(!0)},d=()=>{c=window.setTimeout(()=>s(!1),a.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[a.scrollArea,a.scrollHideDelay]),o.jsx(er,{present:r||i,children:o.jsx(xT,{"data-state":i?"visible":"hidden",...n,ref:t})})}),nq=h.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Ln(Oa,e.__scopeScrollArea),i=e.orientation==="horizontal",s=hp(()=>c("SCROLL_END"),100),[l,c]=eq("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return h.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,a.scrollHideDelay,c]),h.useEffect(()=>{const u=a.viewport,d=i?"scrollLeft":"scrollTop";if(u){let f=u[d];const m=()=>{const p=u[d];f!==p&&(c("SCROLL"),s()),f=p};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[a.viewport,i,c,s]),o.jsx(er,{present:r||l!=="hidden",children:o.jsx($0,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ue(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ue(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),xT=h.forwardRef((e,t)=>{const r=Ln(Oa,e.__scopeScrollArea),{forceMount:n,...a}=e,[i,s]=h.useState(!1),l=e.orientation==="horizontal",c=hp(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;s(l?u:d)}},10);return Qs(r.viewport,c),Qs(r.content,c),o.jsx(er,{present:n||i,children:o.jsx($0,{"data-state":i?"visible":"hidden",...a,ref:t})})}),$0=h.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,a=Ln(Oa,e.__scopeScrollArea),i=h.useRef(null),s=h.useRef(0),[l,c]=h.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=_T(l.viewport,l.content),d={...n,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:m=>i.current=m,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:m=>s.current=m};function f(m,p){return cq(m,s.current,l,p)}return r==="horizontal"?o.jsx(aq,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollLeft,p=Z1(m,l,a.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollLeft=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollLeft=f(m,a.dir))}}):r==="vertical"?o.jsx(iq,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollTop,p=Z1(m,l);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollTop=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollTop=f(m))}}):null}),aq=h.forwardRef((e,t)=>
vendor: 4,325 bytes, line 436
436{const{sizes:r,onSizesChange:n,...a}=e,i=Ln(Oa,e.__scopeScrollArea),[s,l]=h.useState(),c=h.useRef(null),u=Xe(t,c,i.onScrollbarXChange);return h.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(wT,{"data-orientation":"horizontal",...a,ref:u,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":mp(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(i.viewport){const m=i.viewport.scrollLeft+d.deltaX;e.onWheelScroll(m),ET(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&s&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:sm(s.paddingLeft),paddingEnd:sm(s.paddingRight)}})}})}),iq=h.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,i=Ln(Oa,e.__scopeScrollArea),[s,l]=h.useState(),c=h.useRef(null),u=Xe(t,c,i.onScrollbarYChange);return h.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(wT,{"data-orientation":"vertical",...a,ref:u,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":mp(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(i.viewport){const m=i.viewport.scrollTop+d.deltaY;e.onWheelScroll(m),ET(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&s&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:sm(s.paddingTop),paddingEnd:sm(s.paddingBottom)}})}})}),[oq,bT]=pT(Oa),wT=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...m}=e,p=Ln(Oa,r),[y,v]=h.useState(null),g=Xe(t,O=>v(O)),x=h.useRef(null),b=h.useRef(""),j=p.viewport,w=n.content-n.viewport,S=it(d),_=it(c),N=hp(f,10);function E(O){if(x.current){const P=O.clientX-x.current.left,C=O.clientY-x.current.top;u({x:P,y:C})}}return h.useEffect(()=>{const O=P=>{const C=P.target;(y==null?void 0:y.contains(C))&&S(P,w)};return document.addEventListener("wheel",O,{passive:!1}),()=>document.removeEventListener("wheel",O,{passive:!1})},[j,y,w,S]),h.useEffect(_,[n,_]),Qs(y,N),Qs(p.content,N),o.jsx(oq,{scope:r,scrollbar:y,hasThumb:a,onThumbChange:it(i),onThumbPointerUp:it(s),onThumbPositionChange:_,onThumbPointerDown:it(l),children:o.jsx(Me.div,{...m,ref:g,style:{position:"absolute",...m.style},onPointerDown:ue(e.onPointerDown,O=>{O.button===0&&(O.target.setPointerCapture(O.pointerId),x.current=y.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),E(O))}),onPointerMove:ue(e.onPointerMove,E),onPointerUp:ue(e.onPointerUp,O=>{const P=O.target;P.hasPointerCapture(O.pointerId)&&P.releasePointerCapture(O.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),x.current=null})})})}),om="ScrollAreaThumb",jT=h.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=bT(om,e.__scopeScrollArea);return o.jsx(er,{present:r||a.hasThumb,children:o.jsx(sq,{ref:t,...n})})}),sq=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,i=Ln(om,r),s=bT(om,r),{onThumbPositionChange:l}=s,c=Xe(t,f=>s.onThumbChange(f)),u=h.useRef(),d=hp(()=>{u.current&&(u.current(),u.current=void 0)},100);return h.useEffect(()=>{const f=i.viewport;if(f){const m=()=>{if(d(),!u.current){const p=uq(f,l);u.current=p,l()}};return l(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[i.viewport,d,l]),o.jsx(Me.div,{"data-state":s.hasThumb?"visible":"hidden",...a,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ue(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),y=f.clientX-p.left,v=f.clientY-p.top;s.onThumbPointerDown({x:y,y:v})}),onPointerUp:ue(e.onPointerUp,s.onThumbPointerUp)})});jT.displayName=om;var k0="ScrollAreaCorner",ST=h.forwardRef((e,t)=>
436{const r=Ln(k0,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?o.jsx(lq,{...e,ref:t}):null});ST.displayName=k0;var lq=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=Ln(k0,r),[i,s]=h.useState(0),[l,c]=h.useState(0),u=!!(i&&l);return Qs(a.scrollbarX,()=>{var f;const d=((f=a.scrollbarX)==null?void 0:f.offsetHeight)||0;a.onCornerHeightChange(d),c(d)}),Qs(a.scrollbarY,()=>{var f;const d=((f=a.scrollbarY)==null?void 0:f.offsetWidth)||0;a.onCornerWidthChange(d),s(d)}),u?o.jsx(Me.div,{...n,ref:t,style:{width:i,height:l,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function sm(e){return e?parseInt(e,10):0}function _T(e,t){const r=e/t;return isNaN(r)?0:r}function mp(e){const t=_T(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function cq(e,t,r,n="ltr"){const a=mp(r),i=a/2,s=t||i,l=a-s,c=r.scrollbar.paddingStart+s,u=r.scrollbar.size-r.scrollbar.paddingEnd-l,d=r.content-r.viewport,f=n==="ltr"?[0,d]:[d*-1,0];return NT([c,u],f)(e)}function Z1(e,t,r="ltr"){const n=mp(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,s=t.content-t.viewport,l=i-n,c=r==="ltr"?[0,s]:[s*-1,0],u=iB(e,c);return NT([0,s],[0,l])(u)}function NT(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function ET(e,t){return e>0&&e<t}var uq=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const i={left:e.scrollLeft,top:e.scrollTop},s=r.left!==i.left,l=r.top!==i.top;(s||l)&&t(),r=i,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function hp(e,t){const r=it(e),n=h.useRef(0);return h.useEffect(()=>()=>window.clearTimeout(n.current),[]),h.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Qs(e,t){const r=it(t);Ka(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,r])}function dq(e,t){const{asChild:r,children:n}=e;if(!r)return typeof t=="function"?t(n):t;const a=h.Children.only(n);return h.cloneElement(a,{children:typeof t=="function"?t(a.props.children):t})}var CT=vT,fq=yT,mq=ST;const Yo=h.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(CT,{ref:n,className:oe("relative overflow-hidden",e),...r,children:[o.jsx(fq,{className:"h-full w-full rounded-[inherit]",children:t}),o.jsx(OT,{}),o.jsx(mq,{})]}));Yo.displayName=CT.displayName;const OT=h.forwardRef(({className:e,orientation:t="vertical",...r},n)=>o.jsx(D0,{ref:n,orientation:t,className:oe("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:o.jsx(jT,{className:"relative flex-1 rounded-full bg-border"})}));OT.displayName=D0.displayName;const fc=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim();function hq(){const{data:e=[],isLoading:t}=lt({queryKey:["glosario-terminos-all"],queryFn:async()=>{const{data:a,error:i}=await B.from("glosario_terminos").select("id, termino, definicion, categoria").order("termino");if(i)throw i;return a||[]},staleTime:6e5}),r=h.useMemo(()=>{const a=new Set;return e.forEach(i=>i.categoria&&a.add(i.categoria)),Array.from(a).sort()},[e]);return{terms:e,categorias:r,search:(a,i,s)=>{const l=fc(a);return e.filter(c=>i&&c.categoria!==i||s&&fc(c.termino).charAt(0)!==fc(s)?!1:l?fc(c.termino).includes(l)||fc(c.definicion).includes(l):!0)},isLoading:t}}const pq="ABCDEFGHIJKLMNÃOPQRSTUVWXYZ".split("");function vq(){const[e,t]=h.useState(!1),[r,n]=h.useState(""),[a,i]=h.useState(null),[s,l]=h.useState(null),{terms:c,categorias:u,search:d,isLoading:f}=hq();h.useEffect(()=>{const y=g=>{(g.ctrlKey||g.metaKey)&&g.key.toLowerCase()==="k"&&(g.preventDefault(),t(!0))},v=g=>{const x=g.detail;x!=null&&x.termino&&n(x.termino),t(!0)};return window.addEventListener("keydown",y),window.addEventListener("open-glossary",v),()=>{window.removeEventListener("keydown",y),window.removeEventListener("open-glossary",v)}},[]);const m=h.useMemo(()=>d(r,a,s),[r,a,s,c]),p=()=>{n(""),i(null),l(null)};return o.jsxs(o.Fragment,{children:[o.jsx(x0,{children:o.jsxs(LA,{children:[o.jsx(FA,{asChild:!0,children:o.jsx("button",{type:"button",onClick:()=>t(!0),"aria-label":"Abrir glosario",className:oe("fixed z-50 bottom-6 right-6 h-14 w-14 roun
436ded-full shadow-lg","bg-primary text-primary-foreground hover:bg-primary/90","flex items-center justify-center transition-transform hover:scale-105","ring-4 ring-primary/15"),children:o.jsx(nu,{className:"h-6 w-6"})})}),o.jsxs(b0,{side:"left",children:["Glosario · ",o.jsx("kbd",{className:"text-xs",children:"Ctrl/Cmd + K"})]})]})}),o.jsx(fT,{open:e,onOpenChange:t,children:o.jsxs(O0,{side:"right",className:"w-full sm:max-w-md flex flex-col p-0",children:[o.jsxs(P0,{className:"p-4 border-b",children:[o.jsxs(A0,{className:"flex items-center gap-2",children:[o.jsx(nu,{className:"h-5 w-5"})," Glosario"]}),o.jsx(hT,{children:"Busca cualquier término que no conozcas mientras llenas el formulario."})]}),o.jsxs("div",{className:"p-4 space-y-3 border-b",children:[o.jsxs("div",{className:"relative",children:[o.jsx(Ko,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(we,{autoFocus:!0,value:r,onChange:y=>n(y.target.value),placeholder:"Buscar término o palabra...",className:"pl-9 pr-9"}),r&&o.jsx("button",{type:"button",onClick:()=>n(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground","aria-label":"Limpiar",children:o.jsx(_r,{className:"h-4 w-4"})})]}),u.length>0&&o.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[o.jsx(ke,{variant:a===null?"default":"outline",className:"cursor-pointer",onClick:()=>i(null),children:"Todas"}),u.map(y=>o.jsx(ke,{variant:a===y?"default":"outline",className:"cursor-pointer",onClick:()=>i(y===a?null:y),children:y},y))]}),o.jsxs("div",{className:"flex flex-wrap gap-1",children:[pq.map(y=>o.jsx("button",{type:"button",onClick:()=>l(s===y?null:y),className:oe("h-6 w-6 text-xs rounded transition-colors",s===y?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"),children:y},y)),(r||a||s)&&o.jsx("button",{type:"button",onClick:p,className:"h-6 px-2 text-xs rounded text-muted-foreground hover:bg-muted ml-1",children:"Limpiar"})]})]}),o.jsx(Yo,{className:"flex-1",children:o.jsxs("div",{className:"p-4 space-y-3",children:[f&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"Cargando glosario..."}),!f&&m.length===0&&o.jsxs("div",{className:"text-center py-8 space-y-3",children:[o.jsx(x3,{className:"h-10 w-10 mx-auto text-muted-foreground"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:['No encontramos "',o.jsx("span",{className:"font-medium",children:r}),'" en el glosario.']}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Pide a un administrador agregar este término en Base de Conocimiento."})]}),!f&&m.map(y=>o.jsxs("div",{className:"border rounded-md p-3 bg-card hover:bg-accent/30 transition-colors",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[o.jsx("h4",{className:"font-semibold text-sm text-foreground",children:y.termino}),y.categoria&&o.jsx(ke,{variant:"secondary",className:"text-[10px] shrink-0",children:y.categoria})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:y.definicion})]},y.id)),!f&&m.length>0&&o.jsxs("p",{className:"text-xs text-muted-foreground text-center pt-2",children:[m.length," resultado",m.length===1?"":"s"]})]})})]})})]})}function gq(){const[e,t]=Xz(),r=ql();return o.jsxs("div",{className:"flex h-screen w-full overflow-hidden",children:[o.jsx(Yz,{collapsed:e,setCollapsed:t}),o.jsx("main",{className:oe("flex-1 overflow-auto",r?"pt-14 p-2 sm:p-3":"p-2 sm:p-3 md:p-4 lg:p-6","container-fluid"),children:o.jsx("div",{className:"max-w-[1600px] mx-auto",children:o.jsx(Cz,{})})}),o.jsx(vq,{})]})}function yq({children:e}){const{user:t,loading:r}=Hi(),n=vn();return r?o.jsxs("div",{className:"h-screen w-full flex items-center justify-center",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("span",{className:"ml-2",children:"Cargando..."})]}):t?o.jsx(o.Fragment,{children:e}):o.jsx(fp,{to:"/login",state:{from:n},replace:!0})}const pp=Ml("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),z=h.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},i)=>{const s=n?bd:"button";return o.jsx(s,{className:oe(pp({variant:t,size:r,className:e})),ref:i,...a})});z.displayName="Button";var xq="Label",PT=h.forwardRef((e,t)=>
436o.jsx(Me.label,{...e,ref:t,onMouseDown:r=>{var a;r.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));PT.displayName=xq;var AT=PT;const bq=Ml("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ne=h.forwardRef(({className:e,...t},r)=>o.jsx(AT,{ref:r,className:oe(bq(),e),...t}));ne.displayName=AT.displayName;const de=h.forwardRef(({className:e,...t},r)=>o.jsx("div",{ref:r,className:oe("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));de.displayName="Card";const Le=h.forwardRef(({className:e,...t},r)=>o.jsx("div",{ref:r,className:oe("flex flex-col space-y-1.5 p-6",e),...t}));Le.displayName="CardHeader";const Ie=h.forwardRef(({className:e,...t},r)=>o.jsx("h3",{ref:r,className:oe("text-2xl font-semibold leading-none tracking-tight",e),...t}));Ie.displayName="CardTitle";const zt=h.forwardRef(({className:e,...t},r)=>o.jsx("p",{ref:r,className:oe("text-sm text-muted-foreground",e),...t}));zt.displayName="CardDescription";const fe=h.forwardRef(({className:e,...t},r)=>o.jsx("div",{ref:r,className:oe("p-6 pt-0",e),...t}));fe.displayName="CardContent";const jd=h.forwardRef(({className:e,...t},r)=>o.jsx("div",{ref:r,className:oe("flex items-center p-6 pt-0",e),...t}));jd.displayName="CardFooter";const Ft=OP,wq=oB,jq=CP,TT=h.forwardRef(({className:e,...t},r)=>o.jsx(Fh,{ref:r,className:oe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));TT.displayName=Fh.displayName;const It=h.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(jq,{children:[o.jsx(TT,{}),o.jsxs(Bh,{ref:n,className:oe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,o.jsxs(EP,{className:"absolute right-4 top-4 roun
436ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(_r,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));It.displayName=Bh.displayName;const Ut=({className:e,...t})=>o.jsx("div",{className:oe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ut.displayName="DialogHeader";const dr=({className:e,...t})=>o.jsx("div",{className:oe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});dr.displayName="DialogFooter";const Wt=h.forwardRef(({className:e,...t},r)=>o.jsx(zh,{ref:r,className:oe("text-lg font-semibold leading-none tracking-tight",e),...t}));Wt.displayName=zh.displayName;const Ul=h.forwardRef(({className:e,...t},r)=>o.jsx(qh,{ref:r,className:oe("text-sm text-muted-foreground",e),...t}));Ul.displayName=qh.displayName;function Sq({isOpen:e,onClose:t}){const[r,n]=h.useState(""),[a,i]=h.useState(!1),s=async l=>{l.preventDefault(),i(!0);try{const{error:c}=await B.auth.resetPasswordForEmail(r,{redirectTo:"https://form-forge-sql.lovable.app/login"});if(c)throw c;Z.success("Se ha enviado un correo para restablecer tu contraseña"),t()}catch(c){console.error("Error al enviar el correo de recuperación:",c),Z.error(c.message||"Error al enviar el correo de recuperación")}finally{i(!1)}};return o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsxs(It,{children:[o.jsxs(Ut,{children:[o.jsx(Wt,{children:"Recuperar contraseña"}),o.jsx(Ul,{children:"Ingresa tu correo electrónico y te enviaremos instrucciones para restablecer tu contraseña."})]}),o.jsxs("form",{onSubmit:s,children:[o.jsx("div",{className:"space-y-4 py-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"email",children:"Correo electrónico"}),o.jsx(we,{id:"email",type:"email",placeholder:"[email protected]",value:r,onChange:l=>n(l.target.value),required:!0})]})}),o.jsxs(dr,{children:[o.jsx(z,{type:"button",variant:"outline",onClick:t,children:"Cancelar"}),o.jsx(z,{type:"submit",disabled:a,children:a?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):"Enviar instrucciones"})]})]})]})})}function _q(){const[e,t]=h.useState(!1),[r,n]=h.useState(!1),[a,i]=h.useState({email:"",password:""}),{signIn:s}=Hi(),l=async c=>{c.preventDefault(),t(!0);try{await s(a.email,a.password)}catch(u){console.error("Error al iniciar sesión:",u),Z.error("Error al iniciar sesión")}finally{t(!1)}};return o.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8",children:[o.jsxs("div",{className:"max-w-md w-full space-y-8",children:[o.jsxs("div",{className:"flex flex-col items-center justify-center",children:[o.jsx("img",{src:"/lovable-uploads/487fc73a-aeac-4c0f-b546-1e5ecf9ea9da.png",alt:"Logo",className:"h-16 w-auto mb-4"}),o.jsx("p",{className:"mt-2 text-center text-sm text-gray-600",children:"Sistema de gestión de formularios y órdenes de trabajo"})]}),o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsx(Ie,{children:"Iniciar Sesión"}),o.jsx(zt,{children:"Ingrese sus credenciales para acceder al sistema"})]}),o.jsxs("form",{onSubmit:l,children:[o.jsxs(fe,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"login-email",children:"Correo electrónico"}),o.jsx(we,{id:"login-email",type:"email",placeholder:"[email protected]",required:!0,value:a.email,onChange:c=>i({...a,email:c.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"login-password",children:"Contraseña"}),o.jsx(we,{id:"login-password",type:"password",required:!0,value:a.password,onChange:c=>i({...a,password:c.target.value})})]})]}),o.jsxs(jd,{className:"flex flex-col gap-4",children:[o.jsx(z,{type:"submit",className:"w-full",disabled:e,children:e?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin"}),"Iniciando sesión..."]}):"Iniciar Sesión"}),o.jsx(z,{type:"button",variant:"link",className:"text-sm text-gray-600 hover:text-gray-900",onClick:()=>n(!0),children:"¿Olvidaste tu contraseña?"})]})]})]})]}),o.jsx(Sq,{isOpen:r,onClose:()=>n(!1)})]})}const DT=6048e5,Nq=864e5,of=43200,Q1=1440,J1=Symbol.for("constructDateFrom");function Xa(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&J1 in e?e[J1](t):e instanceof Date?new e.constructor(t):new Date(t)}function fr(e,t){return Xa(t||e,e)}let Eq={};function Sd(){return Eq}function uu(e,t){var l,c,u,d;const r=Sd(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,a=fr(e,t==null?void 0:t.in),i=a.getDay(),s=(i<n?7:0)+i-n;return a.setDate(a.getDate()-s),a.setHours(0,0,0,0),a}function lm(e,t){return uu(e,{...t,weekStartsOn:1}
vendor: 5,101 bytes, line 436
436)}function $T(e,t){const r=fr(e,t==null?void 0:t.in),n=r.getFullYear(),a=Xa(r,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const i=lm(a),s=Xa(r,0);s.setFullYear(n,0,4),s.setHours(0,0,0,0);const l=lm(s);return r.getTime()>=i.getTime()?n+1:r.getTime()>=l.getTime()?n:n-1}function cm(e){const t=fr(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function vp(e,...t){const r=Xa.bind(null,e||t.find(n=>typeof n=="object"));return t.map(r)}function eS(e,t){const r=fr(e,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function Cq(e,t,r){const[n,a]=vp(r==null?void 0:r.in,e,t),i=eS(n),s=eS(a),l=+i-cm(i),c=+s-cm(s);return Math.round((l-c)/Nq)}function Oq(e,t){const r=$T(e,t),n=Xa(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),lm(n)}function Uf(e,t){const r=+fr(e)-+fr(t);return r<0?-1:r>0?1:r}function Pq(e){return Xa(e,Date.now())}function Aq(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Tq(e){return!(!Aq(e)&&typeof e!="number"||isNaN(+fr(e)))}function Dq(e,t,r){const[n,a]=vp(r==null?void 0:r.in,e,t),i=n.getFullYear()-a.getFullYear(),s=n.getMonth()-a.getMonth();return i*12+s}function $q(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function kq(e,t){return+fr(e)-+fr(t)}function Mq(e,t){const r=fr(e,t==null?void 0:t.in);return r.setHours(23,59,59,999),r}function Iq(e,t){const r=fr(e,t==null?void 0:t.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}function Rq(e,t){const r=fr(e,t==null?void 0:t.in);return+Mq(r,t)==+Iq(r,t)}function Lq(e,t,r){const[n,a,i]=vp(r==null?void 0:r.in,e,e,t),s=Uf(a,i),l=Math.abs(Dq(a,i));if(l<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-s*l);let c=Uf(a,i)===-s;Rq(n)&&l===1&&Uf(n,i)===1&&(c=!1);const u=s*(l-+c);return u===0?0:u}function Fq(e,t,r){const n=kq(e,t)/1e3;return $q(r==null?void 0:r.roundingMethod)(n)}function Bq(e,t){const r=fr(e,t==null?void 0:t.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}const zq={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},qq=(e,t,r)=>{let n;const a=zq[e];return typeof a=="string"?n=a:t===1?n=a.one:n=a.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function Ps(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const Uq={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Wq={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Vq={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Gq={date:Ps({formats:Uq,defaultWidth:"full"}),time:Ps({formats:Wq,defaultWidth:"full"}),dateTime:Ps({formats:Vq,defaultWidth:"full"})},Hq={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Kq=(e,t,r,n)=>Hq[e];function da(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let a;if(n==="formatting"&&e.formattingValues){const s=e.defaultFormattingWidth||e.defaultWidth,l=r!=null&&r.width?String(r.width):s;a=e.formattingValues[l]||e.formattingValues[s]}else{const s=e.defaultWidth,l=r!=null&&r.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[s]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}const Yq={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Xq={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Zq={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Qq={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
436ay","Saturday"]},Jq={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},eU={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},tU=(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},rU={ordinalNumber:tU,era:da({values:Yq,defaultWidth:"wide"}),quarter:da({values:Xq,defaultWidth:"wide",argumentCallback:e=>e-1}),month:da({values:Zq,defaultWidth:"wide"}),day:da({values:Qq,defaultWidth:"wide"}),dayPeriod:da({values:Jq,defaultWidth:"wide",formattingValues:eU,defaultFormattingWidth:"wide"})};function fa(e){return(t,r={})=>{const n=r.width,a=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const s=i[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?aU(l,f=>f.test(s)):nU(l,f=>f.test(s));let u;u=e.valueCallback?e.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;const d=t.slice(s.length);return{value:u,rest:d}}}function nU(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function aU(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function kT(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const a=n[0],i=t.match(e.parsePattern);if(!i)return null;let s=e.valueCallback?e.valueCallback(i[0]):i[0];s=r.valueCallback?r.valueCallback(s):s;const l=t.slice(a.length);return{value:s,rest:l}}}const iU=/^(\d+)(th|st|nd|rd)?/i,oU=/\d+/i,sU={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},lU={any:[/^b/i,/^(a|c)/i]},cU={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},uU={any:[/1/i,/2/i,/3/i,/4/i]},dU={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},fU={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},mU={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},hU={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},pU={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},vU={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},gU={ordinalNumber:kT({matchPattern:iU,parsePattern:oU,valueCallback:e=>parseInt(e,10)}),era:fa({matchPatterns:sU,defaultMatchWidth:"wide",parsePatterns:lU,defaultParseWidth:"any"}),quarter:fa({matchPatterns:cU,defaultMatchWidth:"wide",parsePatterns:uU,defaultParseWidth:"any",valueCallback:e=>e+1}),month:fa({matchPatterns:dU,defaultMatchWidth:"wide",parsePatterns:fU,defaultParseWidth:"any"}),day:fa({matchPatterns:mU,defaultMatchWidth:"wide",parsePatterns:hU,defaultParseWidth:"any"}),dayPeriod:fa({matchPatterns:pU,defaultMatchWidth:"any",parsePatterns:vU,defaultParseWidth:"any"})},MT={code:"en-US",formatDistance:qq,formatLong:Gq,formatRelative:Kq,localize:rU,match:gU,options:{weekStartsOn:0,firstWeekContainsDate:1}};function yU(e,t){const r=fr(e,t==null?void 0:t.in);return Cq(r,Bq(r))+1}function xU(e,t){const r=fr(e,t==null?void 0:t.in),n=+lm(r)-+Oq(r);return Math.round(n/DT)+1}function IT(e,t){var d,f,m,p;const r=fr(e,t==null?void 0:t.in),n=r.getFullYear(),a=Sd(),i=(t==null?void 0:t.firstWeekContainsDate)??((f=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??a.firstWeekContainsDate??((p=(m=a.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??1,s=Xa((t==null?void 0:t.in)||e,0);s.setFullYear(n+1,0,i),s.setHours(0,0,0,0);const l=uu(s,t),c=Xa((t==null?void 0:t.in)||e,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const u=uu(c,t);return+r>=+l?n+1:+r>=+u?n:n-1}function bU(e,t){var l,c,u,d;const r=Sd(),n=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,a=IT(e,t),i=Xa((t==null?void 0:t.in)||e,0);return i.setFullYear(a,0,n),i.setHours(0,0,0,0),uu(i,t)}function wU(e,t){const r=fr(e,t==null?void 0:t.in),n=+uu(r,t)-+bU(r,t);return Math.round(n/DT)+1}function ht(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const ui={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return ht(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):ht(r+1,2)},d(e,t){return ht(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return ht(e.getHours()%12||12,t.length)},H(e,t){return ht(e.getHours(),t.length)},m(e,t){return ht(e.getMinutes(),t.length)},s(e,t){return ht(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),a=Math.trunc(n*Math.pow(10,r-3));return ht(a,t.length)}},is={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},tS={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return ui.y(e,t)},Y:function(e,t,r,n){const a=IT(e,n),i=a>0?a:1-a;if(t==="YY"){const s=i%100;return ht(s,2)}return t==="Yo"?r.ordinalNumber(i,{unit:"year"}):ht(i,t.length)},R:function(e,t){const r=$T(e);return ht(r,t.length)},u:function(e,t){const r=e.getFullYear();return ht(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return ht(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return ht(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return ui.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return ht(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const a=wU(e,n);return t==="wo"?r.ordinalNumber(a,{unit:"week"}):ht(a,t.length)},I:function(e,t,r){const n=xU(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):ht(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):ui.d(e,t)},D:function(e,t,r){const n=yU(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):ht(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const a=e.getDay(),i=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return ht(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});case"eeee":default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const a=e.getDay(),i=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return ht(i,t.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});case"cccc":default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),a=n===0?7:n;switch(t){case"i":return String(a);case"ii":return ht(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let a;switch(n===12?a=is.noon:n===0?a=is.midnight:a=n/12>
vendor: 4,607 bytes, line 436
436=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let a;switch(n>=17?a=is.evening:n>=12?a=is.afternoon:n>=4?a=is.morning:a=is.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return ui.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):ui.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):ht(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):ht(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):ui.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):ui.s(e,t)},S:function(e,t){return ui.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return nS(n);case"XXXX":case"XX":return io(n);case"XXXXX":case"XXX":default:return io(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return nS(n);case"xxxx":case"xx":return io(n);case"xxxxx":case"xxx":default:return io(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+rS(n,":");case"OOOO":default:return"GMT"+io(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+rS(n,":");case"zzzz":default:return"GMT"+io(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return ht(n,t.length)},T:function(e,t,r){return ht(+e,t.length)}};function rS(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),i=n%60;return i===0?r+String(a):r+String(a)+t+ht(i,2)}function nS(e,t){return e%60===0?(e>0?"-":"+")+ht(Math.abs(e)/60,2):io(e,t)}function io(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=ht(Math.trunc(n/60),2),i=ht(n%60,2);return r+a+t+i}const aS=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},RT=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},jU=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],a=r[2];if(!a)return aS(e,t);let i;switch(n){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",aS(n,t)).replace("{{time}}",RT(a,t))},SU={p:RT,P:jU},_U=/^D+$/,NU=/^Y+$/,EU=["D","DD","YY","YYYY"];function CU(e){return _U.test(e)}function OU(e){return NU.test(e)}function PU(e,t,r){const n=AU(e,t,r);if(console.warn(n),EU.includes(e))throw new RangeError(n)}function AU(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const TU=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,DU=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,$U=/^'([^]*?)'?$/,kU=/''/g,MU=/[a-zA-Z]/;function Dr(e,t,r){var d,f,m,p,y,v,g,x;const n=Sd(),a=(r==null?void 0:r.locale)??n.locale??MT,i=(r==null?void 0:r.firstWeekContainsDate)??((f=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??n.firstWeekContainsDate??((p=(m=n.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??1,s=(r==null?void 0:r.weekStartsOn)??((v=(y=r==null?void 0:r.locale)==null?void 0:y.options)==null?void 0:v.weekStartsOn)??n.weekStartsOn??((x=(g=n.locale)==null?void 0:g.options)==null?void 0:x.weekStartsOn)??0,l=fr(e,r==null?void 0:r.in);if(!Tq(l))throw new RangeError("Invalid time value");let c=t.match(DU).map(b=>{const j=b[0];if(j==="p"||j==="P"){const w=SU[j];return w(b,a.formatLong)}return b}).join("").match(TU).map(b=>{if(b==="''")return{isToken:!1,value:"'"};const j=b[0];
436if(j==="'")return{isToken:!1,value:IU(b)};if(tS[j])return{isToken:!0,value:b};if(j.match(MU))throw new RangeError("Format string contains an unescaped latin alphabet character `"+j+"`");return{isToken:!1,value:b}});a.localize.preprocessor&&(c=a.localize.preprocessor(l,c));const u={firstWeekContainsDate:i,weekStartsOn:s,locale:a};return c.map(b=>{if(!b.isToken)return b.value;const j=b.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&OU(j)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&CU(j))&&PU(j,t,String(e));const w=tS[j[0]];return w(l,j,a.localize,u)}).join("")}function IU(e){const t=e.match($U);return t?t[1].replace(kU,"'"):e}function RU(e,t,r){const n=Sd(),a=(r==null?void 0:r.locale)??n.locale??MT,i=2520,s=Uf(e,t);if(isNaN(s))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:s}),[c,u]=vp(r==null?void 0:r.in,...s>0?[t,e]:[e,t]),d=Fq(u,c),f=(cm(u)-cm(c))/1e3,m=Math.round((d-f)/60);let p;if(m<2)return r!=null&&r.includeSeconds?d<5?a.formatDistance("lessThanXSeconds",5,l):d<10?a.formatDistance("lessThanXSeconds",10,l):d<20?a.formatDistance("lessThanXSeconds",20,l):d<40?a.formatDistance("halfAMinute",0,l):d<60?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",1,l):m===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",m,l);if(m<45)return a.formatDistance("xMinutes",m,l);if(m<90)return a.formatDistance("aboutXHours",1,l);if(m<Q1){const y=Math.round(m/60);return a.formatDistance("aboutXHours",y,l)}else{if(m<i)return a.formatDistance("xDays",1,l);if(m<of){const y=Math.round(m/Q1);return a.formatDistance("xDays",y,l)}else if(m<of*2)return p=Math.round(m/of),a.formatDistance("aboutXMonths",p,l)}if(p=Lq(u,c),p<12){const y=Math.round(m/of);return a.formatDistance("xMonths",y,l)}else{const y=p%12,v=Math.trunc(p/12);return y<3?a.formatDistance("aboutXYears",v,l):y<9?a.formatDistance("overXYears",v,l):a.formatDistance("almostXYears",v+1,l)}}function LU(e,t){return RU(e,Pq(e),t)}function FU({form:e,onDelete:t}){const r=or();return o.jsxs(de,{className:"w-full",children:[o.jsxs(Le,{className:"pb-2",children:[o.jsx("div",{className:"flex items-start justify-between",children:o.jsxs("div",{className:"flex items-center",children:[o.jsx(Ya,{className:"h-5 w-5 mr-2 text-formforge-600"}),o.jsx(Ie,{children:e.name})]})}),o.jsxs(zt,{children:[e.fields.length," fields ⢠Updated ",LU(e.updatedAt,{addSuffix:!0})]})]}),o.jsxs(fe,{className:"pb-2",children:[o.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:e.description||"No description provided."}),e.connectionId&&e.tableName&&o.jsxs("div",{className:"flex items-center mt-2 text-xs text-muted-foreground",children:[o.jsx(rp,{className:"h-3.5 w-3.5 mr-1"}),o.jsxs("span",{children:["Connected to ",e.tableName]})]})]}),o.jsxs(jd,{className:"flex justify-between pt-2",children:[o.jsx(z,{variant:"outline",size:"sm",onClick:()=>r(`/preview/${e.id}`),children:"Preview"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>r(`/builder/${e.id}`),children:o.jsx(Ys,{className:"h-4 w-4"})}),o.jsx(z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive/90",onClick:()=>t(e.id),children:o.jsx(Jf,{className:"h-4 w-4"})})]})]})]})}function BU(e,t=globalThis==null?void 0:globalThis.document){const r=it(e);h.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var zU="DismissableLayer",Hy="dismissableLayer.update",qU="dismissableLayer.pointerDownOutside",UU="dismissableLayer.focusOutside",iS,LT=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),FT=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...c}=e,u=h.useContext(LT),[d,f]=h.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=h.useState({}),y=Xe(t,N=>
vendor: 17,832 bytes, lines 436-443
436f(N)),v=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf(g),b=d?v.indexOf(d):-1,j=u.layersWithOutsidePointerEventsDisabled.size>0,w=b>=x,S=GU(N=>{const E=N.target,O=[...u.branches].some(P=>P.contains(E));!w||O||(a==null||a(N),s==null||s(N),N.defaultPrevented||l==null||l())},m),_=HU(N=>{const E=N.target;[...u.branches].some(P=>P.contains(E))||(i==null||i(N),s==null||s(N),N.defaultPrevented||l==null||l())},m);return BU(N=>{b===u.layers.size-1&&(n==null||n(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},m),h.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(iS=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),oS(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=iS)}},[d,m,r,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),oS())},[d,u]),h.useEffect(()=>{const N=()=>p({});return document.addEventListener(Hy,N),()=>document.removeEventListener(Hy,N)},[]),o.jsx(Me.div,{...c,ref:y,style:{pointerEvents:j?w?"auto":"none":void 0,...e.style},onFocusCapture:ue(e.onFocusCapture,_.onFocusCapture),onBlurCapture:ue(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:ue(e.onPointerDownCapture,S.onPointerDownCapture)})});FT.displayName=zU;var WU="DismissableLayerBranch",VU=h.forwardRef((e,t)=>{const r=h.useContext(LT),n=h.useRef(null),a=Xe(t,n);return h.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),o.jsx(Me.div,{...e,ref:a})});VU.displayName=WU;function GU(e,t=globalThis==null?void 0:globalThis.document){const r=it(e),n=h.useRef(!1),a=h.useRef(()=>{});return h.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){BT(qU,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function HU(e,t=globalThis==null?void 0:globalThis.document){const r=it(e),n=h.useRef(!1);return h.useEffect(()=>{const a=i=>{i.target&&!n.current&&BT(UU,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function oS(){const e=new CustomEvent(Hy);document.dispatchEvent(e)}function BT(e,t,r,{discrete:n}){const a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?Go(a,i):a.dispatchEvent(i)}var eg="focusScope.autoFocusOnMount",tg="focusScope.autoFocusOnUnmount",sS={bubbles:!1,cancelable:!0},KU="FocusScope",zT=h.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...s}=e,[l,c]=h.useState(null),u=it(a),d=it(i),f=h.useRef(null),m=Xe(t,v=>c(v)),p=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(n){let v=function(j){if(p.paused||!l)return;const w=j.target;l.contains(w)?f.current=w:fi(f.current,{select:!0})},g=function(j){if(p.paused||!l)return;const w=j.relatedTarget;w!==null&&(l.contains(w)||fi(f.current,{select:!0}))},x=function(j){if(document.activeElement===document.body)for(const S of j)S.removedNodes.length>0&&fi(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",g);const b=new MutationObserver(x);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",g),b.disconnect()}}},[n,l,p.paused]),h.useEffect(()=>{if(l){cS.add(p);const v=document.activeElement;if(!l.contains(v)){const x=new CustomEvent(eg,sS);l.addEventListener(eg,u),l.dispatchEvent(x),x.defaultPrevented||(YU(e8(qT(l)),{select:!0}),document.activeElement===v&&fi(l))}return()=>{l.removeEventListener(eg,u),setTimeout(()=>{const x=new CustomEvent(tg,sS);l.addEventListener(tg,d),l.dispatchEvent(x),x.defaultPrevented||fi(v??document.body,{select:!0}),l.removeEventListener(tg,d),cS.remove(p)},0)}}},[l,u,d,p]);const y=h.useCallback(v=>{if(!r&&!n||p.paused)return;const g=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(g&&x){const b=v.currentTarget,[j,w]=XU(b);j&&w?!v.shiftKey&&x===w?(v.preventDefault(),r&&fi(j,{select:!0})):v.shiftKey&&x===j&&(v.preventDefault(),r&&fi(w,{select:!0})):x===b&&v.preventDefault()}},[r,n,p.paused]);return o.jsx(Me.div,{tabIndex:-1,...s,ref:m,onKeyDown:y})});zT.displayName=KU;function YU(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(fi(n,{select:t}),document.activeElement!==r)return}function XU(e){const t=qT(e),r=lS(t,e),n=lS(t.reverse(),e);return[r,n]}function qT(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function lS(e,t){for(const r of e)if(!ZU(r,{upTo:t}))return r}function ZU(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function QU(e){return e instanceof HTMLInputElement&&"select"in e}function fi(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&QU(e)&&t&&e.select()}}var cS=JU();function JU(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=uS(e,t),e.unshift(t)},remove(t){var r;e=uS(e,t),(r=e[0])==null||r.resume()}}}function uS(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function e8(e){return e.filter(t=>t.tagName!=="A")}var t8="Portal",UT=h.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[a,i]=h.useState(!1);Ka(()=>i(!0),[]);const s=r||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?Ho.createPortal(o.jsx(Me.div,{...n,ref:t}),s):null});UT.displayName=t8;var rg=0;function r8(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??dS()),document.body.insertAdjacentElement("beforeend",e[1]??dS()),rg++,()=>{rg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),rg--}},[])}function dS(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var WT=Uh(),ng=function(){},gp=h.forwardRef(function(e,t){var r=h.useRef(null),n=h.useState({onScrollCapture:ng,onWheelCapture:ng,onTouchMoveCapture:ng}),a=n[0],i=n[1],s=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,p=e.noIsolation,y=e.inert,v=e.allowPinchZoom,g=e.as,x=g===void 0?"div":g,b=e.gapMode,j=Wh(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=m,S=Vh([r,t]),_=Rt(Rt({},j),a);return h.createElement(h.Fragment,null,d&&h.createElement(w,{sideCar:WT,removeScrollBar:u,shards:f,noIsolation:p,inert:y,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:b}),s?h.cloneElement(h.Children.only(l),Rt(Rt({},_),{ref:S})):h.createElement(x,Rt({},_,{className:c,ref:S}),l))});gp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gp.classNames={fullWidth:Gh,zeroRight:Hh};var Ky=!1;if(typeof window<"u")try{var sf=Object.defineProperty({},"passive",{get:function(){return Ky=!0,!0}});window.addEventListener("test",sf,sf),window.removeEventListener("test",sf,sf)}catch{Ky=!1}var os=Ky?{passive:!1}:!1,n8=function(e){return e.tagName==="TEXTAREA"},VT=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!n8(e)&&r[t]==="visible")},a8=function(e){return VT(e,"overflowY")},i8=function(e){return VT(e,"overflowX")},fS=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=GT(e,n);if(a){var i=HT(e,n),s=i[1],l=i[2];if(s>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},o8=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},s8=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},GT=function(e,t){return e==="v"?a8(t):i8(t)},HT=function(e,t){return e==="v"?o8(t):s8(t)},l8=function(e,t){return e==="h"&&t==="rtl"?-1:1},c8=function(e,t,r,n,a){var i=l8(e,window.getComputedStyle(t).direction),s=i*n,l=r.target,c=t.contains(l),u=!1,d=s>0,f=0,m=0;do{var p=HT(e,l),y=p[0],v=p[1],g=p[2],x=v-g-i*y;(y||x)&>(e,l)&&(f+=x,m+=y),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(Math.abs(f)<1||!a)||!d&&(Math.abs(m)<1||!a))&&(u=!0),u},lf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},mS=function(e){return[e.deltaX,e.deltaY]},hS=function(e){return e&&"current"in e?e.current:e},u8=function(e,t){return e[0]===t[0]&&e[1]===t[1]},d8=function(e){return` 437 .block-interactivity-`.concat(e,` {pointer-events: none;} 438 .allow-interactivity-`).concat(e,` {pointer-events: all;} 439`)},f8=0,ss=[];function m8(e){var t=h.useRef([]),r=h.useRef([0,0]),n=h.useRef(),a=h.useState(f8++)[0],i=h.useState(Kh)[0],s=h.useRef(e);h.useEffect(function(){s.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var v=Yh([e.lockRef.current],(e.shards||[]).map(hS),!0).filter(Boolean);return v.forEach(function(g){return g.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),v.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(v,g){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var x=lf(v),b=r.current,j="deltaX"in v?v.deltaX:b[0]-x[0],w="deltaY"in v?v.deltaY:b[1]-x[1],S,_=v.target,N=Math.abs(j)>Math.abs(w)?"h":"v";if("touches"in v&&N==="h"&&_.type==="range")return!1;var E=fS(N,_);if(!E)return!0;if(E?S=N:(S=N==="v"?"h":"v",E=fS(N,_)),!E)return!1;if(!n.current&&"changedTouches"in v&&(j||w)&&(n.current=S),!S)return!0;var O=n.current||S;return c8(O,g,v,O==="h"?j:w,!0)},[]),c=h.useCallback(function(v){var g=v;if(!(!ss.length||ss[ss.length-1]!==i)){var x="deltaY"in g?mS(g):lf(g),b=t.current.filter(function(S){return S.name===g.type&&(S.target===g.target||g.target===S.shadowParent)&&u8(S.delta,x)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var j=(s.current.shards||[]).map(hS).filter(Boolean).filter(function(S){return S.contains(g.target)}),w=j.length>0?l(g,j[0]):!s.current.noIsolation;w&&g.cancelable&&g.preventDefault()}}},[]),u=h.useCallback(function(v,g,x,b){var j={name:v,delta:g,target:x,should:b,shadowParent:h8(x)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(w){return w!==j})},1)},[]),d=h.useCallback(function(v){r.current=lf(v),n.current=void 0},[]),f=h.useCallback(function(v){u(v.type,mS(v),v.target,l(v,e.lockRef.current))},[]),m=h.useCallback(function(v){u(v.type,lf(v),v.target,l(v,e.lockRef.current))},[]);h.useEffect(function(){return ss.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,os),document.addEventListener("touchmove",c,os),document.addEventListener("touchstart",d,os),function(){ss=ss.filter(function(v){return v!==i}),document.removeEventListener("wheel",c,os),document.removeEventListener("touchmove",c,os),document.removeEventListener("touchstart",d,os)}},[]);var p=e.removeScrollBar,y=e.inert;return h.createElement(h.Fragment,null,y?h.createElement(i,{styles:d8(a)}):null,p?h.createElement(Xh,{gapMode:e.gapMode}):null)}function h8(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const p8=Zh(WT,m8);var KT=h.forwardRef(function(e,t){return h.createElement(gp,Rt({},e,{ref:t,sideCar:p8}))});KT.classNames=gp.classNames;var M0="Dialog",[YT,XT]=Lr(M0),[v8,ra]=YT(M0),ZT=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:a,onOpenChange:i,modal:s=!0}=e,l=h.useRef(null),c=h.useRef(null),[u=!1,d]=hn({prop:n,defaultProp:a,onChange:i});return o.jsx(v8,{scope:t,triggerRef:l,contentRef:c,contentId:Qn(),titleId:Qn(),descriptionId:Qn(),open:u,onOpenChange:d,onOpenToggle:h.useCallback(()=>d(f=>!f),[d]),modal:s,children:r})};ZT.displayName=M0;var QT="DialogTrigger",JT=h.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=ra(QT,r),i=Xe(t,a.triggerRef);return o.jsx(Me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":L0(a.open),...n,ref:i,onClick:ue(e.onClick,a.onOpenToggle)})});JT.displayName=QT;var I0="DialogPortal",[g8,e2]=YT(I0,{forceMount:void 0}),t2=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:a}=e,i=ra(I0,t);return o.jsx(g8,{scope:t,forceMount:r,children:h.Children.map(n,s=>o.jsx(er,{present:r||i.open,children:o.jsx(UT,{asChild:!0,container:a,children:s})}))})};t2.displayName=I0;var um="DialogOverlay",r2=h.forwardRef((e,t)=>{const r=e2(um,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=ra(um,e.__scopeDialog);return i.modal?o.jsx(er,{present:n||i.open,children:o.jsx(y8,{...a,ref:t})}):null});r2.displayName=um;var y8=h.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=ra(um,r);return o.jsx(KT,{as:bd,allowPinchZoom:!0,shards:[a.contentRef],children:o.jsx(Me.div,{"data-state":L0(a.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Io="DialogContent",n2=h.forwardRef((e,t)=>{const r=e2(Io,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=ra(Io,e.__scopeDialog);return o.jsx(er,{present:n||i.open,children:i.modal?o.jsx(x8,{...a,ref:t}):o.jsx(b8,{...a,ref:t})})});n2.displayName=Io;var x8=h.forwardRef((e,t)=>{const r=ra(Io,e.__scopeDialog),n=h.useRef(null),a=Xe(t,r.contentRef,n);return h.useEffect(()=>{const i=n.current;if(i)return Qh(i)},[]),o.jsx(a2,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ue(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=r.triggerRef.current)==null||s.focus()}),onPointerDownOutside:ue(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&i.preventDefault()}),onFocusOutside:ue(e.onFocusOutside,i=>i.preventDefault())})}),b8=h.forwardRef((e,t)=>{const r=ra(Io,e.__scopeDialog),n=h.useRef(!1),a=h.useRef(!1);return o.jsx(a2,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,l;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),i.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;((u=r.triggerRef.current)==null?void 0:u.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),a2=h.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,...s}=e,l=ra(Io,r),c=h.useRef(null),u=Xe(t,c);return r8(),o.jsxs(o.Fragment,{children:[o.jsx(zT,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i,children:o.jsx(FT,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":L0(l.open),...s,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(j8,{titleId:l.titleId}),o.jsx(_8,{contentRef:c,descriptionId:l.descriptionId})]})]})}),R0="DialogTitle",i2=h.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=ra(R0,r);return o.jsx(Me.h2,{id:a.titleId,...n,ref:t})});i2.displayName=R0;var o2="DialogDescription",s2=h.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=ra(o2,r);return o.jsx(Me.p,{id:a.descriptionId,...n,ref:t})});s2.displayName=o2;var l2="DialogClose",c2=h.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=ra(l2,r);return o.jsx(Me.button,{type:"button",...n,ref:t,onClick:ue(e.onClick,()=>a.onOpenChange(!1))})});c2.displayName=l2;function L0(e){return e?"open":"closed"}var u2="DialogTitleWarning",[w8,d2]=sB(u2,{contentName:Io,titleName:R0,docsSlug:"dialog"}),j8=({titleId:e})=>{const t=d2(u2),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. 440 441If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. 442 443For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},S8="DialogDescriptionWarning",_8=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${d2(S8).contentName}}.`;return h.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},N8=ZT,E8=JT,C8=t2,O8=r2,P8=n2,A8=i2,T8=s2,f2=c2,m2="AlertDialog",[D8,UPe]=Lr(m2,[XT]),ri=XT(),h2=e=>{const{__scopeAlertDialog:t,...r}=e,n=ri(t);return o.jsx(N8,{...n,...r,modal:!0})};h2.displayName=m2;var $8="AlertDialogTrigger",k8=h.forwardRef((e,t)=>
443{const{__scopeAlertDialog:r,...n}=e,a=ri(r);return o.jsx(E8,{...a,...n,ref:t})});k8.displayName=$8;var M8="AlertDialogPortal",p2=e=>{const{__scopeAlertDialog:t,...r}=e,n=ri(t);return o.jsx(C8,{...n,...r})};p2.displayName=M8;var I8="AlertDialogOverlay",v2=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=ri(r);return o.jsx(O8,{...a,...n,ref:t})});v2.displayName=I8;var As="AlertDialogContent",[R8,L8]=D8(As),g2=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...a}=e,i=ri(r),s=h.useRef(null),l=Xe(t,s),c=h.useRef(null);return o.jsx(w8,{contentName:As,titleName:y2,docsSlug:"alert-dialog",children:o.jsx(R8,{scope:r,cancelRef:c,children:o.jsxs(P8,{role:"alertdialog",...i,...a,ref:l,onOpenAutoFocus:ue(a.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[o.jsx(NP,{children:n}),o.jsx(B8,{contentRef:s})]})})})});g2.displayName=As;var y2="AlertDialogTitle",x2=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=ri(r);return o.jsx(A8,{...a,...n,ref:t})});x2.displayName=y2;var b2="AlertDialogDescription",w2=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=ri(r);return o.jsx(T8,{...a,...n,ref:t})});w2.displayName=b2;var F8="AlertDialogAction",j2=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=ri(r);return o.jsx(f2,{...a,...n,ref:t})});j2.displayName=F8;var S2="AlertDialogCancel",_2=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:a}=L8(S2,r),i=ri(r),s=Xe(t,a);return o.jsx(f2,{...i,...n,ref:s})});_2.displayName=S2;var B8=({contentRef:e})=>{const t=`\`${As}\` requires a description for the component to be accessible for screen reader users. 444 445You can add a description to the \`${As}\` by passing a \`${b2}\` component as a child, which also benefits sighted users by adding visible context to the dialog. 446 447Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${As}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. 448 449For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return h.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},z8=h2,q8=p2,N2=v2,E2=g2,C2=j2,O2=_2,P2=x2,A2=w2;const T2=z8,U8=q8,D2=h.forwardRef(({className:e,...t},r)=>o.jsx(N2,{className:oe("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));D2.displayName=N2.displayName;const F0=h.forwardRef(({className:e,...t},r)=>o.jsxs(U8,{children:[o.jsx(D2,{}),o.jsx(E2,{ref:r,className:oe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));F0.displayName=E2.displayName;const B0=({className:e,...t})=>o.jsx("div",{className:oe("flex flex-col space-y-2 text-center sm:text-left",e),...t});B0.displayName="AlertDialogHeader";const z0=({className:e,...t})=>o.jsx("div",{className:oe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});z0.displayName="AlertDialogFooter";const q0=h.forwardRef(({className:e,...t},r)=>o.jsx(P2,{ref:r,className:oe("text-lg font-semibold",e),...t}));q0.displayName=P2.displayName;const U0=h.forwardRef(({className:e,...t},r)=>o.jsx(A2,{ref:r,className:oe("text-sm text-muted-foreground",e),...t}));U0.displayName=A2.displayName;const W0=h.forwardRef(({className:e,...t},r)=>o.jsx(C2,{ref:r,className:oe(pp(),e),...t}));W0.displayName=C2.displayName;const V0=h.forwardRef(({className:e,...t},r)=>o.jsx(O2,{ref:r,className:oe(pp({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));
449V0.displayName=O2.displayName;function W8({forms:e,isLoading:t,onDelete:r,refetch:n}){const[a,i]=h.useState(""),s=or(),[l,c]=h.useState(!1),[u,d]=h.useState(null),[f,m]=h.useState(!1),p=e.filter(g=>g.name.toLowerCase().includes(a.toLowerCase())||g.description&&g.description.toLowerCase().includes(a.toLowerCase())),y=g=>{d(g),c(!0)},v=async()=>{if(u)try{m(!0),await r(u),c(!1),d(null),n(),Z.success("Formulario eliminado correctamente")}catch(g){console.error("Error eliminando formulario:",g),Z.error(`Error eliminando formulario: ${g instanceof Error?g.message:String(g)}`)}finally{m(!1)}};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-center justify-between",children:[o.jsxs("div",{className:"relative w-full sm:w-96",children:[o.jsx(Ko,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(we,{placeholder:"Search forms...",className:"pl-9",value:a,onChange:g=>i(g.target.value)})]}),o.jsxs(z,{onClick:()=>s("/builder/new"),className:"w-full sm:w-auto",children:[o.jsx(wa,{className:"h-4 w-4 mr-2"}),"New Form"]})]}),t?o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsxs("div",{className:"text-center",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-primary"}),o.jsx("p",{className:"text-muted-foreground",children:"Cargando formularios..."})]})}):p.length===0?o.jsxs("div",{className:"text-center py-12",children:[o.jsx("div",{className:"mx-auto h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:o.jsx(Ya,{className:"h-6 w-6 text-muted-foreground"})}),o.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No forms found"}),o.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:a?"Try a different search term":"Get started by creating your first form"}),!a&&o.jsxs(z,{onClick:()=>s("/builder/new"),className:"mt-4",children:[o.jsx(wa,{className:"h-4 w-4 mr-2"}),"Create Form"]})]}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:p.map(g=>o.jsx(FU,{form:g,onDelete:()=>y(g.id)},g.id))}),o.jsx(T2,{open:l,onOpenChange:c,children:o.jsxs(F0,{children:[o.jsxs(B0,{children:[o.jsx(q0,{children:"¿Está seguro de eliminar este formulario?"}),o.jsx(U0,{children:"Esta acción no se puede deshacer. Se eliminará el formulario y todos sus datos asociados."})]}),o.jsxs(z0,{children:[o.jsx(V0,{disabled:f,children:"Cancelar"}),o.jsxs(W0,{onClick:g=>{g.preventDefault(),v()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:f,children:[f?o.jsx(ye,{className:"h-4 w-4 mr-2 animate-spin"}):null,f?"Eliminando...":"Eliminar"]})]})]})})]})}const V8=e=>{if(!e)return null;if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.warn("Error parsing options:",t),null}return Array.isArray(e)?e:null},G8=e=>{if(!e)return null;if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.warn("Error parsing validation:",t),null}return typeof e=="object"?e:null},$2=e=>({id:e.id,nombre:e.nombre,etiqueta:e.etiqueta,tipo:e.tipo,requerido:!!e.requerido,opciones:V8(e.opciones),placeholder:e.placeholder,orden:e.orden||0,validacion:G8(e.validacion),columna_db:e.columna_db}),pS=e=>{if(!e)return!1;const t=String(e.message||e);return console.log("Checking for RLS error in:",t),t.includes("permission denied")||t.includes("new row violates row-level security")||t.includes("new row violated row-level security policy")?(console.error("RLS policy issue detected:",t),Z.error("No tienes permisos suficientes para realizar esta acción. Contacta al administrador."),!0):!1},H8=async()=>{var e;console.log("Cargando formularios disponibles...");try{const{data:{session:t}}=await B.auth.getSession();if(!t)return console.error("No authenticated session found"),Z.error("Debes iniciar sesión para acceder a los formularios"),[];console.log("User is authenticated with ID:",t.user.id);let r=[],n=null;try{const{data:i,error:s}=await B.from("formularios").select("*, area_trabajo");r=i||[],n=s}catch(i){console.log("Area_trabajo column might not exist, trying without it"),n=i}if(n&&((e=n.message)!=null&&e.includes("area_trabajo"))){console.log("Falling back to query without area_trabajo column");const{data:i,error:s}=await B.from("formularios").select("*");if(s){if(console.error("Error cargando formularios (fallback):",s),pS(s))return Z.error("No tienes permisos suficientes para acceder a los formularios. Por favor contacta al administrador."),[];throw s}
449r=(i||[]).map(l=>({...l,area_trabajo:null}))}else if(n){if(console.error("Error cargando formularios:",n),pS(n))return Z.error("No tienes permisos suficientes para acceder a los formularios. Por favor contacta al administrador."),[];throw n}let a=[];if(r&&r.length>0){console.log("Datos encontrados directamente en formularios:",r.length);const i=r.map(u=>u.id),{data:s,error:l}=await B.from("formulario_campos").select("*").in("formulario_id",i).order("formulario_id",{ascending:!0}).order("orden",{ascending:!0}),c=(s||[]).reduce((u,d)=>(u[d.formulario_id]||(u[d.formulario_id]=[]),u[d.formulario_id].push(d),u),{});a=r.map(u=>{const d=c[u.id]||[];let f=[];return!l&&d&&d.length>0?(console.log(`Found ${d.length} campos for form ${u.id} (${u.nombre})`),f=d.map(m=>$2(m))):(console.log(`No campos found for form ${u.id} (${u.nombre})`),u.campos&&Array.isArray(u.campos)&&(f=u.campos.map(m=>({id:m.id||String(Math.random()),nombre:m.nombre||m.id||"campo",etiqueta:m.etiqueta||m.label||"Campo",tipo:m.tipo||m.type||"text",requerido:!!(m.requerido||m.required),opciones:Array.isArray(m.opciones)?m.opciones:Array.isArray(m.options)?m.options:null,placeholder:m.placeholder,orden:m.orden||0,validacion:m.validacion||m.validation,columna_db:m.columna_db||m.mappedColumn})))),{id:u.id,nombre:u.nombre,descripcion:u.descripcion,tipo:u.tipo||"general",campos:f,created_at:new Date(u.created_at),updated_at:new Date(u.updated_at),nombre_tabla:u.table_name,area_trabajo:u.area_trabajo||null}})}return console.log("Final transformed forms:",a.length),a.forEach(i=>{console.log(`Form: ${i.nombre}, ID: ${i.id}, Fields: ${i.campos.length}, Area: ${i.area_trabajo||"Sin área"}`)}),a}catch(t){return console.error("Error en fetchFormularios:",t),Z.error("Error al cargar los formularios"),[]}},K8=async e=>{const t=e.find(r=>r.nombre.toLowerCase().includes("galletas")||r.nombre.toLowerCase().includes("control de proceso"));if(t)if(console.log("Found potential Galletas form:",t.nombre,"with",t.campos.length,"fields"),!t.campos||t.campos.length===0){console.log("Galletas form has no campos, trying to load from formulario_campos table");try{const{data:r,error:n}=await B.from("formulario_campos").select("*").eq("formulario_id",t.id).order("orden",{ascending:!0});if(!n&&r&&r.length>0){console.log(`Found ${r.length} campos for Galletas form in formulario_campos table`);const a=r.map(i=>$2(i));t.campos=a,console.log("Updated Galletas form with",a.length,"campos")}else console.log("No campos found for Galletas form in formulario_campos table")}catch(r){console.error("Error processing Galletas form:",r)}}else console.log("Galletas form already has",t.campos.length,"campos");else console.log("No Galletas form found in the forms list");return e};function k2(){const{data:e,isLoading:t,error:r,refetch:n}=lt({queryKey:["formularios"],queryFn:async()=>{try{let a=await H8();return a=await K8(a),console.log("Formularios cargados:",a.length),a.forEach(i=>{console.log(`Form: ${i.nombre}, ID: ${i.id}, Fields: ${i.campos.length}`)}),a}catch(a){throw console.error("Error en useFormularios:",a),Z.error("Error al cargar los formularios"),a}},staleTime:6e5,gcTime:12e5,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1});return{formularios:e||[],isLoading:t,error:r?r.message:null,refetch:n}}function Y8(){const{formularios:e,isLoading:t,refetch:r}=k2(),n=e.map(s=>({id:s.id,name:s.nombre,description:s.descripcion||void 0,areaTrabajo:s.area_trabajo||void 0,fields:Array.isArray(s.campos)?s.campos.map(l=>{let c;return l.validacion!==null&&l.validacion!==void 0&&(c=typeof l.validacion=="object"?l.validacion:{}),{id:typeof l.id=="string"?l.id:String(l.id||""),type:a(l.tipo),label:l.etiqueta,required:!!l.requerido,options:Array.isArray(l.opciones)?l.opciones:void 0,placeholder:l.placeholder||void 0,mappedColumn:l.columna_db||void 0,validation:c}}):[],tableName:s.nombre_tabla,createdAt:s.created_at instanceof Date?s.created_at:new Date(s.created_at),updatedAt:s.updated_at instanceof Date?s.updated_at:new Date(s.updated_at)}));h.useEffect(()=>{n.forEach(l=>{console.log(`Form ${l.name} has ${l.fields.length} fields, Area: ${l.areaTrabajo||"Sin área"}`)});const s=n.find(l=>
449l.name==="CONTROL DE PROCESO GALLETAS"||l.id==="galletas");s&&(console.log("Galletas form:",s),console.log("Galletas form fields:",s.fields))},[n]);function a(s){return["text","textarea","select","checkbox","radio","email","password","number","date","time","file","camera","help"].includes(s)?s:"text"}const i=async s=>{try{const{data:{session:l}}=await B.auth.getSession();if(!l){Z.error("Debes iniciar sesión para eliminar formularios");return}const{error:c}=await B.from("formulario_campos").delete().eq("formulario_id",s);if(c){if(console.error("Error eliminando campos:",c),c.message.includes("permission denied for schema public")){Z.error("No tienes permisos suficientes para eliminar este formulario");return}throw c}const{error:u}=await B.from("form_responses").delete().eq("form_id",s);u&&!u.message.includes("no rows")&&(console.error("Error eliminando respuestas:",u),Z.warning("Algunas respuestas del formulario no pudieron ser eliminadas"));const{error:d}=await B.from("formularios").delete().eq("id",s);if(d){if(console.error("Error eliminando formulario:",d),d.message.includes("permission denied for schema public")){Z.error("No tienes permisos suficientes para eliminar este formulario");return}throw d}r(),Z.success("Formulario eliminado exitosamente")}catch(l){throw console.error("Error en el proceso de eliminación:",l),Z.error(`Error eliminando el formulario: ${l instanceof Error?l.message:String(l)}`),l}};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Tus Formularios"}),o.jsx("p",{className:"text-muted-foreground",children:"Crea, administra y despliega tus formularios personalizados"})]}),o.jsx(W8,{forms:n,isLoading:t,onDelete:i,refetch:r})]})}const yr=[];for(let e=0;e<256;++e)yr.push((e+256).toString(16).slice(1));function X8(e,t=0){return(yr[e[t+0]]+yr[e[t+1]]+yr[e[t+2]]+yr[e[t+3]]+"-"+yr[e[t+4]]+yr[e[t+5]]+"-"+yr[e[t+6]]+yr[e[t+7]]+"-"+yr[e[t+8]]+yr[e[t+9]]+"-"+yr[e[t+10]]+yr[e[t+11]]+yr[e[t+12]]+yr[e[t+13]]+yr[e[t+14]]+yr[e[t+15]]).toLowerCase()}let ag;const Z8=new Uint8Array(16);function Q8(){if(!ag){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ag=crypto.getRandomValues.bind(crypto)}return ag(Z8)}const J8=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),vS={randomUUID:J8};function Yy(e,t,r){var a;if(vS.randomUUID&&!t&&!e)return vS.randomUUID();e=e||{};const n=e.random??((a=e.rng)==null?void 0:a.call(e))??Q8();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,X8(n)}function Xy(e,t){return Xy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Xy(e,t)}function M2(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Xy(e,t)}function Ae(){return Ae=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ae.apply(null,arguments)}function du(e){"@babel/helpers - typeof";return du=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},du(e)}function eW(e,t){if(du(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(du(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tW(e){var t=eW(e,"string");return du(t)=="symbol"?t:t+""}function rW(e,t,r){return(t=tW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function gS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function yS(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};
449t%2?gS(Object(r),!0).forEach(function(n){rW(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gS(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qr(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var xS=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),ig=function(){return Math.random().toString(36).substring(7).split("").join(".")},bS={INIT:"@@redux/INIT"+ig(),REPLACE:"@@redux/REPLACE"+ig(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+ig()}};function nW(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function I2(e,t,r){var n;if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(qr(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(qr(1));return r(I2)(e,t)}if(typeof e!="function")throw new Error(qr(2));var a=e,i=t,s=[],l=s,c=!1;function u(){l===s&&(l=s.slice())}function d(){if(c)throw new Error(qr(3));return i}function f(v){if(typeof v!="function")throw new Error(qr(4));if(c)throw new Error(qr(5));var g=!0;return u(),l.push(v),function(){if(g){if(c)throw new Error(qr(6));g=!1,u();var b=l.indexOf(v);l.splice(b,1),s=null}}}function m(v){if(!nW(v))throw new Error(qr(7));if(typeof v.type>"u")throw new Error(qr(8));if(c)throw new Error(qr(9));try{c=!0,i=a(i,v)}finally{c=!1}for(var g=s=l,x=0;x<g.length;x++){var b=g[x];b()}return v}function p(v){if(typeof v!="function")throw new Error(qr(10));a=v,m({type:bS.REPLACE})}function y(){var v,g=f;return v={subscribe:function(b){if(typeof b!="object"||b===null)throw new Error(qr(11));function j(){b.next&&b.next(d())}j();var w=g(j);return{unsubscribe:w}}},v[xS]=function(){return this},v}return m({type:bS.INIT}),n={dispatch:m,subscribe:f,getState:d,replaceReducer:p},n[xS]=y,n}function wS(e,t){return function(){return t(e.apply(this,arguments))}}function jS(e,t){if(typeof e=="function")return wS(e,t);if(typeof e!="object"||e===null)throw new Error(qr(16));var r={};for(var n in e){var a=e[n];typeof a=="function"&&(r[n]=wS(a,t))}return r}function R2(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.length===0?function(n){return n}:t.length===1?t[0]:t.reduce(function(n,a){return function(){return n(a.apply(void 0,arguments))}})}function aW(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return function(){var a=n.apply(void 0,arguments),i=function(){throw new Error(qr(15))},s={getState:a.getState,dispatch:function(){return i.apply(void 0,arguments)}},l=t.map(function(c){return c(s)});return i=R2.apply(void 0,l)(a.dispatch),yS(yS({},a),{},{dispatch:i})}}}var L2={exports:{}},iW="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",oW=iW,sW=oW;function F2(){}function B2(){}B2.resetWarningCache=F2;var lW=function(){function e(n,a,i,s,l,c){if(c!==sW){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:B2,resetWarningCache:F2};return r.PropTypes=r,r};L2.exports=lW();var cW=L2.exports;const tt=pt(cW);var z2=$.createContext(null);function uW(e){e()}var q2=uW,dW=function(t){return q2=t},fW=function(){return q2};function mW(){var e=fW(),t=null,r=null;return{clear:function(){t=null,r=null},notify:function(){e(function(){for(var a=t;a;)a.callback(),a=a.next})},get:function(){for(var a=[],i=t;i;)a.push(i),i=i.next;return a},subscribe:function(a){var i=!0,s=r={callback:a,next:null,prev:r};return s.prev?s.prev.next=s:t=s,function(){!i||t===null||(i=!1,s.next?s.next.prev=s.prev:r=s.prev,s.prev?s.prev.next=s.next:t=s.next)}}}}var SS={notify:function(){},get:function(){return[]}};function U2(e,t){var r,n=SS;function a(f){return c(),n.subscribe(f)}function i(){n.notify()}function s(){d.onStateChange&&d.onStateChange()}function l(){return!!r}function c(){r||(r=t?t.addNestedSub(s):e.subscribe(s),n=mW())}function u(){r&&(r(),r=void 0,n.clear(),n=SS)}var d={addNestedSub:a,notifyNestedSubs:i,handleChangeWrapper:s,isSubscribed:l,trySubscribe:c,tryUnsubscribe:u,getListeners:function(){return n}};return d}var W2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?h.useLayoutEffect:h.useEffect;function hW(e){var t=e.store,r=e.context,n=e.children,a=h.useMemo(function(){var l=U2(t);return{store:t,subscription:l}},[t]),i=h.useMemo(function(){return t.getState()},[t]);W2(function(){var l=a.subscription;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),i!==t.getState()&&l.notifyNestedSubs(),function(){l.tryUnsubscribe(),l.onStateChange=null}},[a,i]);var s=r||z2;return $.createElement(s.Provider,{value:a},n)}function dm(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}var V2={exports:{}},vt={};/** @license React v16.13.1 450 * react-is.production.min.js 451 * 452 * Copyright (c) Facebook, Inc. and its affiliates. 453 * 454 * This source code is licensed under the MIT license found in the 455 * LICENSE file in the root directory of this source tree. 456 */var hr=typeof Symbol=="function"&&Symbol.for,G0=hr?Symbol.for("react.element"):60103,H0=hr?Symbol.for("react.portal"):60106,yp=hr?Symbol.for("react.fragment"):60107,xp=hr?Symbol.for("react.strict_mode"):60108,bp=hr?Symbol.for("react.profiler"):60114,
456wp=hr?Symbol.for("react.provider"):60109,jp=hr?Symbol.for("react.context"):60110,K0=hr?Symbol.for("react.async_mode"):60111,Sp=hr?Symbol.for("react.concurrent_mode"):60111,_p=hr?Symbol.for("react.forward_ref"):60112,Np=hr?Symbol.for("react.suspense"):60113,pW=hr?Symbol.for("react.suspense_list"):60120,Ep=hr?Symbol.for("react.memo"):60115,Cp=hr?Symbol.for("react.lazy"):60116,vW=hr?Symbol.for("react.block"):60121,gW=hr?Symbol.for("react.fundamental"):60117,yW=hr?Symbol.for("react.responder"):60118,xW=hr?Symbol.for("react.scope"):60119;function gn(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case G0:switch(e=e.type,e){case K0:case Sp:case yp:case bp:case xp:case Np:return e;default:switch(e=e&&e.$$typeof,e){case jp:case _p:case Cp:case Ep:case wp:return e;default:return t}}case H0:return t}}}function G2(e){return gn(e)===Sp}vt.AsyncMode=K0;vt.ConcurrentMode=Sp;vt.ContextConsumer=jp;vt.ContextProvider=wp;vt.Element=G0;vt.ForwardRef=_p;vt.Fragment=yp;vt.Lazy=Cp;vt.Memo=Ep;vt.Portal=H0;vt.Profiler=bp;vt.StrictMode=xp;vt.Suspense=Np;vt.isAsyncMode=function(e){return G2(e)||gn(e)===K0};vt.isConcurrentMode=G2;vt.isContextConsumer=function(e){return gn(e)===jp};vt.isContextProvider=function(e){return gn(e)===wp};vt.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===G0};vt.isForwardRef=function(e){return gn(e)===_p};vt.isFragment=function(e){return gn(e)===yp};vt.isLazy=function(e){return gn(e)===Cp};vt.isMemo=function(e){return gn(e)===Ep};vt.isPortal=function(e){return gn(e)===H0};vt.isProfiler=function(e){return gn(e)===bp};vt.isStrictMode=function(e){return gn(e)===xp};vt.isSuspense=function(e){return gn(e)===Np};vt.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===yp||e===Sp||e===bp||e===xp||e===Np||e===pW||typeof e=="object"&&e!==null&&(e.$$typeof===Cp||e.$$typeof===Ep||e.$$typeof===wp||e.$$typeof===jp||e.$$typeof===_p||e.$$typeof===gW||e.$$typeof===yW||e.$$typeof===xW||e.$$typeof===vW)};vt.typeOf=gn;V2.exports=vt;var bW=V2.exports,Y0=bW,wW={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},jW={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},SW={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},H2={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},X0={};X0[Y0.ForwardRef]=SW;X0[Y0.Memo]=H2;function _S(e){return Y0.isMemo(e)?H2:X0[e.$$typeof]||wW}var _W=Object.defineProperty,NW=Object.getOwnPropertyNames,NS=Object.getOwnPropertySymbols,EW=Object.getOwnPropertyDescriptor,CW=Object.getPrototypeOf,ES=Object.prototype;function K2(e,t,r){if(typeof t!="string"){if(ES){var n=CW(t);n&&n!==ES&&K2(e,n,r)}var a=NW(t);NS&&(a=a.concat(NS(t)));for(var i=_S(e),s=_S(t),l=0;l<a.length;++l){var c=a[l];if(!jW[c]&&!(r&&r[c])&&!(s&&s[c])&&!(i&&i[c])){var u=EW(t,c);try{_W(e,c,u)}catch{}}}}return e}var OW=K2;const CS=pt(OW);var Y2={exports:{}},Et={};/** @license React v17.0.2 457 * react-is.production.min.js 458 * 459 * Copyright (c) Facebook, Inc. and its affiliates. 460 * 461 * This source code is licensed under the MIT license found in the 462 * LICENSE file in the root directory of this source tree. 463 */var Op=60103,Pp=60106,_d=60107,Nd=60108,Ed=60114,Cd=60109,Od=60110,Pd=60112,Ad=60113,Z0=60120,Td=60115,Dd=60116,X2=60121,Z2=60122,Q2=60117,J2=60129,eD=60131;if(typeof Symbol=="function"&&Symbol.for){var gr=Symbol.for;Op=gr("react.element"),Pp=gr("react.portal"),_d=gr("react.fragment"),Nd=gr("react.strict_mode"),Ed=gr("react.profiler"),Cd=gr("react.provider"),Od=gr("react.context"),Pd=gr("react.forward_ref"),Ad=gr("react.suspense"),Z0=gr("react.suspense_list"),Td=gr("react.memo"),Dd=gr("react.lazy"),X2=gr("react.block"),Z2=gr("react.server.block"),Q2=gr("react.fundamental"),J2=gr("react.debug_trace_mode"),eD=gr("react.legacy_hidden")}function na(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Op:switch(e=e.type,e){case _d:case Ed:case Nd:case Ad:case Z0:return e;default:switch(e=e&&e.$$typeof,e){case Od:case Pd:case Dd:case Td:case Cd:return e;default:return t}}case Pp:return t}}}var PW=Cd,AW=Op,TW=Pd,DW=_d,$W=Dd,kW=Td,MW=Pp,IW=Ed,RW=Nd,LW=Ad;Et.ContextConsumer=Od;Et.ContextProvider=PW;Et.Element=AW;Et.ForwardRef=TW;Et.Fragment=DW;Et.Lazy=$W;Et.Memo=kW;Et.Portal=MW;Et.Profiler=IW;Et.StrictMode=RW;Et.Suspense=LW;Et.isAsyncMode=function(){return!1};Et.isConcurrentMode=function(){return!1};Et.isContextConsumer=function(e){return na(e)===Od};Et.isContextProvider=function(e){return na(e)===Cd};Et.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Op};Et.isForwardRef=function(e){return na(e)===Pd};Et.isFragment=function(e){return na(e)===_d};Et.isLazy=function(e){return na(e)===Dd};Et.isMemo=function(e){return na(e)===Td};Et.isPortal=function(e){return na(e)===Pp};Et.isProfiler=function(e){return na(e)===Ed};Et.isStrictMode=function(e){return na(e)===Nd};Et.isSuspense=function(e){return na(e)===Ad};Et.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===_d||e===Ed||e===J2||e===Nd||e===Ad||e===Z0||e===eD||typeof e=="object"&&e!==null&&(e.$$typeof===Dd||e.$$typeof===Td||e.$$typeof===Cd||e.$$typeof===Od||e.$$typeof===Pd||e.$$typeof===Q2||e.$$typeof===X2||e[0]===Z2)};Et.typeOf=na;Y2.exports=Et;var FW=Y2.exports,BW=["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"],zW=["reactReduxForwardedRef"],qW=[],UW=[null,null];function WW(e,t){var r=e[1];return[t.payload,r+1]}function OS(e,t,r){W2(function(){return e.apply(void 0,t)},r)}function VW(e,t,r,n,a,i,s){e.current=n,t.current=a,r.current=!1,i.current&&(i.current=null,s())}function GW(e,t,r,n,a,i,s,l,c,u){if(e){var d=!1,f=null,m=function(){if(!d){var v=t.getState(),g,x;try{g=n(v,a.current)}catch(b){x=b,f=b}x||(f=null),g===i.current?s.current||c():(i.current=g,l.current=g,s.current=!0,u({type:"STORE_UPDATED",payload:{error:x}}))}};r.onStateChange=m,r.trySubscribe(),m();var p=function(){if(d=!0,r.tryUnsubscribe(),r.onStateChange=null,f)throw f};return p}}var HW=function(){return[null,0]};function KW(e,t){t===void 0&&(t={});var r=t,n=r.getDisplayName,a=n===void 0?function(j){return"ConnectAdvanced("+j+")"}:n,i=r.methodName,s=i===void 0?"connectAdvanced":i,l=r.renderCountProp,c=l===void 0?void 0:l,u=r.shouldHandleStateChanges,d=u===void 0?!0:u,f=r.storeKey,m=f===void 0?"store":f;r.withRef;var p=r.forwardRef,y=p===void 0?!1:p,v=r.context,g=v===void 0?z2:v,x=dm(r,BW),b=g;return function(w){var S=w.displayName||w.name||"Component",_=a(S),N=Ae({},x,{getDisplayName:a,methodName:s,renderCountProp:c,shouldHandleStateChanges:d,storeKey:m,displayName:_,wrappedComponentName:S,WrappedComponent:w}),E=x.pure;function O(k){return e(k.dispatch,N)}var P=E?h.useMemo:function(k){return k()};function C(k){var D=h.useMemo(function(){var G=k.reactReduxForwardedRef,Y=dm(k,zW);return[k.context,G,Y]},[k]),M=D[0],F=D[1],q=D[2],I=h.useMemo(function(){return M&&M.Consumer&&FW.isContextConsumer($.createElement(M.Consumer,null))?M:b},[M,b]),K=h.useContext(I),W=!!k.store&&!!k.store.getState&&!!k.store.dispatch;K&&K.store;var R=W?k.store:K.store,V=h.useMemo(function(){return O(R)},[R]),re=h.useMemo(function(){if(!d)return UW;var G=U2(R,W?null:K.subscription),Y=G.notifyNestedSubs.bind(G);return[G,Y]},[R,W,K]),H=re[0],te=re[1],ce=h.useMemo(function(){return W?K:Ae
463({},K,{subscription:H})},[W,K,H]),je=h.useReducer(WW,qW,HW),X=je[0],ae=X[0],_e=je[1];if(ae&&ae.error)throw ae.error;var J=h.useRef(),Ke=h.useRef(q),Ne=h.useRef(),Re=h.useRef(!1),pe=P(function(){return Ne.current&&q===Ke.current?Ne.current:V(R.getState(),q)},[R,ae,q]);OS(VW,[Ke,J,Re,q,pe,Ne,te]),OS(GW,[d,R,H,V,Ke,J,Re,Ne,te,_e],[R,H,V]);var De=h.useMemo(function(){return $.createElement(w,Ae({},pe,{ref:F}))},[F,w,pe]),L=h.useMemo(function(){return d?$.createElement(I.Provider,{value:ce},De):De},[I,De,ce]);return L}var A=E?$.memo(C):C;if(A.WrappedComponent=w,A.displayName=C.displayName=_,y){var T=$.forwardRef(function(D,M){return $.createElement(A,Ae({},D,{reactReduxForwardedRef:M}))});return T.displayName=_,T.WrappedComponent=w,CS(T,w)}return CS(A,w)}}function PS(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function og(e,t){if(PS(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var a=0;a<r.length;a++)if(!Object.prototype.hasOwnProperty.call(t,r[a])||!PS(e[r[a]],t[r[a]]))return!1;return!0}function YW(e,t){var r={},n=function(s){var l=e[s];typeof l=="function"&&(r[s]=function(){return t(l.apply(void 0,arguments))})};for(var a in e)n(a);return r}function Q0(e){return function(r,n){var a=e(r,n);function i(){return a}return i.dependsOnOwnProps=!1,i}}function AS(e){return e.dependsOnOwnProps!==null&&e.dependsOnOwnProps!==void 0?!!e.dependsOnOwnProps:e.length!==1}function tD(e,t){return function(n,a){a.displayName;var i=function(l,c){return i.dependsOnOwnProps?i.mapToProps(l,c):i.mapToProps(l)};return i.dependsOnOwnProps=!0,i.mapToProps=function(l,c){i.mapToProps=e,i.dependsOnOwnProps=AS(e);var u=i(l,c);return typeof u=="function"&&(i.mapToProps=u,i.dependsOnOwnProps=AS(u),u=i(l,c)),u},i}}function XW(e){return typeof e=="function"?tD(e):void 0}function ZW(e){return e?void 0:Q0(function(t){return{dispatch:t}})}function QW(e){return e&&typeof e=="object"?Q0(function(t){return YW(e,t)}):void 0}const JW=[XW,ZW,QW];function eV(e){return typeof e=="function"?tD(e):void 0}function tV(e){return e?void 0:Q0(function(){return{}})}const rV=[eV,tV];function nV(e,t,r){return Ae({},r,e,t)}function aV(e){return function(r,n){n.displayName;var a=n.pure,i=n.areMergedPropsEqual,s=!1,l;return function(u,d,f){var m=e(u,d,f);return s?(!a||!i(m,l))&&(l=m):(s=!0,l=m),l}}}function iV(e){return typeof e=="function"?aV(e):void 0}function oV(e){return e?void 0:function(){return nV}}const sV=[iV,oV];var lV=["initMapStateToProps","initMapDispatchToProps","initMergeProps"];function cV(e,t,r,n){return function(i,s){return r(e(i,s),t(n,s),s)}}function uV(e,t,r,n,a){var i=a.areStatesEqual,s=a.areOwnPropsEqual,l=a.areStatePropsEqual,c=!1,u,d,f,m,p;function y(j,w){return u=j,d=w,f=e(u,d),m=t(n,d),p=r(f,m,d),c=!0,p}function v(){return f=e(u,d),t.dependsOnOwnProps&&(m=t(n,d)),p=r(f,m,d),p}function g(){return e.dependsOnOwnProps&&(f=e(u,d)),t.dependsOnOwnProps&&(m=t(n,d)),p=r(f,m,d),p}function x(){var j=e(u,d),w=!l(j,f);return f=j,w&&(p=r(f,m,d)),p}function b(j,w){var S=!s(w,d),_=!i(j,u,w,d);return u=j,d=w,S&&_?v():S?g():_?x():p}return function(w,S){return c?b(w,S):y(w,S)}}function dV(e,t){var r=t.initMapStateToProps,n=t.initMapDispatchToProps,a=t.initMergeProps,i=dm(t,lV),s=r(e,i),l=n(e,i),c=a(e,i),u=i.pure?uV:cV;return u(s,l,c,e,i)}var fV=["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"];function sg(e,t,r){for(var n=t.length-1;n>=0;n--){var a=t[n](e);if(a)return a}return function(i,s){throw new Error("Invalid value of type "+typeof e+" for "+r+" argument when connecting component "+s.wrappedComponentName+".")}}function mV(e,t){return e===t}function hV(e){var t=e===void 0?{}:e,r=t.connectHOC,n=r===void 0?KW:r,a=t.mapStateToPropsFactories,i=a===void 0?rV:a,s=t.mapDispatchToPropsFactories,l=s===void 0?JW:s,c=t.mergePropsFactories,u=c===void 0?sV:c,d=t.selectorFactory,f=d===void 0?dV:d;return function(p,y,v,g){g===void 0&&(g={});var x=g,b=x.pure,j=b===void 0?!0:b,w=x.areStatesEqual,S=w===void 0?mV:w,_=x.areOwnPropsEqual,N=_===void 0?og:_,E=x.areStatePropsEqual,O=E===void 0?og:E,P=x.areMergedPropsEqual,C=P===void 0?og:P,A=dm(x,fV),T=sg(p,i,"mapStateToProps"),k=sg(y,l,"mapDispatchToProps"),D=sg(v,u,"mergeProps");return n(f,Ae({methodName:"connect",getDisplayName:function(F){return"Connect("+F+")"},shouldHandleStateChanges:!!p,initMapStateToProps:T,initMapDispat
463chToProps:k,initMergeProps:D,pure:j,areStatesEqual:S,areOwnPropsEqual:N,areStatePropsEqual:O,areMergedPropsEqual:C},A))}}const rD=hV();dW(wd.unstable_batchedUpdates);function pV(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function nD(e,t){var r=h.useState(function(){return{inputs:t,result:e()}})[0],n=h.useRef(!0),a=h.useRef(r),i=n.current||!!(t&&a.current.inputs&&pV(t,a.current.inputs)),s=i?a.current:{inputs:t,result:e()};return h.useEffect(function(){n.current=!1,a.current=s},[s]),s.result}function vV(e,t){return nD(function(){return e},t)}var st=nD,Be=vV,gV="Invariant failed";function Bi(e,t){throw new Error(gV)}var Xn=function(t){var r=t.top,n=t.right,a=t.bottom,i=t.left,s=n-i,l=a-r,c={top:r,right:n,bottom:a,left:i,width:s,height:l,x:i,y:r,center:{x:(n+i)/2,y:(a+r)/2}};return c},J0=function(t,r){return{top:t.top-r.top,left:t.left-r.left,bottom:t.bottom+r.bottom,right:t.right+r.right}},TS=function(t,r){return{top:t.top+r.top,left:t.left+r.left,bottom:t.bottom-r.bottom,right:t.right-r.right}},yV=function(t,r){return{top:t.top+r.y,left:t.left+r.x,bottom:t.bottom+r.y,right:t.right+r.x}},lg={top:0,right:0,bottom:0,left:0},ew=function(t){var r=t.borderBox,n=t.margin,a=n===void 0?lg:n,i=t.border,s=i===void 0?lg:i,l=t.padding,c=l===void 0?lg:l,u=Xn(J0(r,a)),d=Xn(TS(r,s)),f=Xn(TS(d,c));return{marginBox:u,borderBox:Xn(r),paddingBox:d,contentBox:f,margin:a,border:s,padding:c}},jn=function(t){var r=t.slice(0,-2),n=t.slice(-2);if(n!=="px")return 0;var a=Number(r);return isNaN(a)&&Bi(),a},xV=function(){return{x:window.pageXOffset,y:window.pageYOffset}},fm=function(t,r){var n=t.borderBox,a=t.border,i=t.margin,s=t.padding,l=yV(n,r);return ew({borderBox:l,border:a,margin:i,padding:s})},mm=function(t,r){return r===void 0&&(r=xV()),fm(t,r)},aD=function(t,r){var n={top:jn(r.marginTop),right:jn(r.marginRight),bottom:jn(r.marginBottom),left:jn(r.marginLeft)},a={top:jn(r.paddingTop),right:jn(r.paddingRight),bottom:jn(r.paddingBottom),left:jn(r.paddingLeft)},i={top:jn(r.borderTopWidth),right:jn(r.borderRightWidth),bottom:jn(r.borderBottomWidth),left:jn(r.borderLeftWidth)};return ew({borderBox:t,margin:n,padding:a,border:i})},iD=function(t){var r=t.getBoundingClientRect(),n=window.getComputedStyle(t);return aD(r,n)},DS=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function bV(e,t){return!!(e===t||DS(e)&&DS(t))}function wV(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!bV(e[r],t[r]))return!1;return!0}function ur(e,t){t===void 0&&(t=wV);var r,n=[],a,i=!1;function s(){for(var l=[],c=0;c<arguments.length;c++)l[c]=arguments[c];return i&&r===this&&t(l,n)||(a=e.apply(this,l),i=!0,r=this,n=l),a}return s}var fu=function(t){var r=[],n=null,a=function(){for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];r=l,!n&&(n=requestAnimationFrame(function(){n=null,t.apply(void 0,r)}))};return a.cancel=function(){n&&(cancelAnimationFrame(n),n=null)},a};function oD(e,t){}oD.bind(null,"warn");oD.bind(null,"error");function Di(){}function jV(e,t){return Ae({},e,{},t)}function Dn(e,t,r){var n=t.map(function(a){var i=jV(r,a.options);return e.addEventListener(a.eventName,a.fn,i),function(){e.removeEventListener(a.eventName,a.fn,i)}});return function(){n.forEach(function(i){i()})}}var SV="Invariant failed";function hm(e){this.message=e}hm.prototype.toString=function(){return this.message};function me(e,t){throw new hm(SV)}var _V=function(e){M2(t,e);function t(){for(var n,a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return n=e.call.apply(e,[this].concat(i))||this,n.callbacks=null,n.unbind=Di,n.onWindowError=function(l){var c=n.getCallbacks();c.isDragging()&&c.tryAbort();var u=l.error;u instanceof hm&&l.preventDefault()},n.getCallbacks=function(){if(!n.callbacks)throw new Error("Unable to find AppCallbacks in <ErrorBoundary/>");return n.callbacks},n.setCallbacks=function(l){n.callbacks=l},n}var r=t.prototype;return r.componentDidMount=function(){this.unbind=Dn(window,[{eventName:"error",fn:this.onWindowError}])},r.componentDidCatch=function(a){if(a instanceof hm){this.setState({});return}throw a},r.componentWillUnmount=function(){this.unbind()},r.render=function(){return this.props.children(this.setCallbacks)},t}($.Component),NV=` 464 Press space bar to start a drag. 465 When dragging you can use the arrow keys to move the item around and escape to cancel. 466 Some screen readers may require you to be in focus mode or to use your pass through key 467`,pm=function(t){return t+1},EV=function(t){return` 468 You have lifted an item in position `+pm(t.source.index)+` 469`},sD=function(t,r){var n=t.droppableId===r.droppableId,a=pm(t.index),i=pm(r.index);return n?` 470 You have moved the item from position `+a+` 471 to position `+i+` 472 `:` 473 You have moved the item from position `+a+` 474 in list `+t.droppableId+` 475 to list `+r.droppableId+` 476 in position `+i+` 477 `},lD=function(t,r,n){var a=r.droppableId===n.droppableId;return a?` 478 The item `+t+` 479 has been combined with `+n.draggableId:` 480 The item `+t+` 481 in list `+r.droppableId+` 482 has been combined with `+n.draggableId+` 483 in list `+n.droppableId+` 484 `},CV=function(t){var r=t.destination;if(r)return sD(t.source,r);var n=t.combine;return n?lD(t.draggableId,t.source,n):"You are over an area that cannot be dropped on"},$S=function(t){return` 485 The item has returned to its starting position 486 of `+pm(t.index)+` 487`},OV=function(t){if(t.reason==="CANCEL")return` 488 Movement cancelled. 489 `+$S(t.source)+` 490 `;var r=t.destination,n=t.combine;return r?` 491 You have dropped the item. 492 `+sD(t.source,r)+` 493 `:n?` 494 You have dropped the item. 495 `+lD(t.draggableId,t.source,n)+` 496 `:` 497 The item has been dropped while not over a drop area. 498 `+$S(t.source)+` 499 `},Wf={dragHandleUsageInstructions:NV,onDragStart:EV,onDragUpdate:CV,onDragEnd:OV},mr={x:0,y:0},br=function(t,r){return{x:t.x+r.x,y:t.y+r.y}},sn=function(t,r){return{x:t.x-r.x,y:t.y-r.y}},$i=function(t,r){return t.x===r.x&&t.y===r.y},Wl=function(t){return{x:t.x!==0?-t.x:0,y:t.y!==0?-t.y:0}},Ro=function(t,r,n){var a;return n===void 0&&(n=0),a={},a[t]=r,a[t==="x"?"y":"x"]=n,a},mu=function(t,r){return Math.sqrt(Math.pow(r.x-t.x,2)+Math.pow(r.y-t.y,2))},kS=function(t,r){return Math.min.apply(Math,r.map(function(n){return mu(t,n)}))},cD=function(t){return function(r){return{x:t(r.x),y:t(r.y)}}},PV=function(e,t){var r=Xn({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return r.width<=0||r.height<=0?null:r},$d=function(t,r){return{top:t.top+r.y,left:t.left+r.x,bottom:t.bottom+r.y,right:t.right+r.x}},MS=function(t){return[{x:t.left,y:t.top},{x:t.right,y:t.top},{x:t.left,y:t.bottom},{x:t.right,y:t.bottom}]},AV={top:0,right:0,bottom:0,left:0},TV=function(t,r){return r?$d(t,r.scroll.diff.displacement):t},DV=function(t,r,n){if(n&&n.increasedBy){var a;return Ae({},t,(a={},a[r.end]=t[r.end]+n.increasedBy[r.line],a))}return t},$V=function(t,r){return r&&r.shouldClipSubject?PV(r.pageMarginBox,t):Xn(t)},Js=function(e){var t=e.page,r=e.withPlaceholder,n=e.axis,a=e.frame,i=TV(t.marginBox,a),s=DV(i,n,r),l=$V(s,a);return{page:t,withPlaceholder:r,active:l}},tw=function(e,t){e.frame||me();var r=e.frame,n=sn(t,r.scroll.initial),a=Wl(n),i=Ae({},r,{scroll:{initial:r.scroll.initial,current:t,diff:{value:n,displacement:a},max:r.scroll.max}}),s=Js({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i}),l=Ae({},e,{frame:i,subject:s});return l};function vm(e){return Object.values?Object.values(e):Object.keys(e).map(function(t){return e[t]})}function rw(e,t){if(e.findIndex)return e.findIndex(t);for(var r=0;r<e.length;r++)if(t(e[r]))return r;return-1}function Ki(e,t){if(e.find)return e.find(t);var r=rw(e,t);if(r!==-1)return e[r]}function uD(e){return Array.prototype.slice.call(e)}var dD=ur(function(e){return e.reduce(function(t,r){return t[r.descriptor.id]=r,t},{})}),fD=ur(function(e){return e.reduce(function(t,r){return t[r.descriptor.id]=r,t},{})}),Ap=ur(function(e){return vm(e)}
499),kV=ur(function(e){return vm(e)}),Vl=ur(function(e,t){var r=kV(t).filter(function(n){return e===n.descriptor.droppableId}).sort(function(n,a){return n.descriptor.index-a.descriptor.index});return r});function nw(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Tp(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Dp=ur(function(e,t){return t.filter(function(r){return r.descriptor.id!==e.descriptor.id})}),MV=function(e){var t=e.isMovingForward,r=e.draggable,n=e.destination,a=e.insideDestination,i=e.previousImpact;if(!n.isCombineEnabled)return null;var s=nw(i);if(!s)return null;function l(v){var g={type:"COMBINE",combine:{draggableId:v,droppableId:n.descriptor.id}};return Ae({},i,{at:g})}var c=i.displaced.all,u=c.length?c[0]:null;if(t)return u?l(u):null;var d=Dp(r,a);if(!u){if(!d.length)return null;var f=d[d.length-1];return l(f.descriptor.id)}var m=rw(d,function(v){return v.descriptor.id===u});m===-1&&me();var p=m-1;if(p<0)return null;var y=d[p];return l(y.descriptor.id)},Gl=function(e,t){return e.descriptor.droppableId===t.descriptor.id},mD={point:mr,value:0},hu={invisible:{},visible:{},all:[]},IV={displaced:hu,displacedBy:mD,at:null},kn=function(e,t){return function(r){return e<=r&&r<=t}},hD=function(e){var t=kn(e.top,e.bottom),r=kn(e.left,e.right);return function(n){var a=t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right);if(a)return!0;var i=t(n.top)||t(n.bottom),s=r(n.left)||r(n.right),l=i&&s;if(l)return!0;var c=n.top<e.top&&n.bottom>e.bottom,u=n.left<e.left&&n.right>e.right,d=c&&u;if(d)return!0;var f=c&&s||u&&i;return f}},RV=function(e){var t=kn(e.top,e.bottom),r=kn(e.left,e.right);return function(n){var a=t(n.top)&&t(n.bottom)&&r(n.left)&&r(n.right);return a}},aw={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},pD={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},LV=function(e){return function(t){var r=kn(t.top,t.bottom),n=kn(t.left,t.right);return function(a){return e===aw?r(a.top)&&r(a.bottom):n(a.left)&&n(a.right)}}},FV=function(t,r){var n=r.frame?r.frame.scroll.diff.displacement:mr;return $d(t,n)},BV=function(t,r,n){return r.subject.active?n(r.subject.active)(t):!1},zV=function(t,r,n){return n(r)(t)},iw=function(t){var r=t.target,n=t.destination,a=t.viewport,i=t.withDroppableDisplacement,s=t.isVisibleThroughFrameFn,l=i?FV(r,n):r;return BV(l,n,s)&&zV(l,a,s)},qV=function(t){return iw(Ae({},t,{isVisibleThroughFrameFn:hD}))},vD=function(t){return iw(Ae({},t,{isVisibleThroughFrameFn:RV}))},UV=function(t){return iw(Ae({},t,{isVisibleThroughFrameFn:LV(t.destination.axis)}))},WV=function(t,r,n){if(typeof n=="boolean")return n;if(!r)return!0;var a=r.invisible,i=r.visible;if(a[t])return!1;var s=i[t];return s?s.shouldAnimate:!0};function VV(e,t){var r=e.page.marginBox,n={top:t.point.y,right:0,bottom:0,left:t.point.x};return Xn(J0(r,n))}function pu(e){var t=e.afterDragging,r=e.destination,n=e.displacedBy,a=e.viewport,i=e.forceShouldAnimate,s=e.last;return t.reduce(function(c,u){var d=VV(u,n),f=u.descriptor.id;c.all.push(f);var m=qV({target:d,destination:r,viewport:a,withDroppableDisplacement:!0});if(!m)return c.invisible[u.descriptor.id]=!0,c;var p=WV(f,s,i),y={draggableId:f,shouldAnimate:p};return c.visible[f]=y,c},{all:[],visible:{},invisible:{}})}function GV(e,t){if(!e.length)return 0;var r=e[e.length-1].descriptor.index;return t.inHomeList?r:r+1}function IS(e){var t=e.insideDestination,r=e.inHomeList,n=e.displacedBy,a=e.destination,i=GV(t,{inHomeList:r});return{displaced:hu,displacedBy:n,at:{type:"REORDER",destination:{droppableId:a.descriptor.id,index:i}}}}function gm(e){var t=e.draggable,r=e.insideDestination,n=e.destination,a=e.viewport,i=e.displacedBy,s=e.last,l=e.index,c=e.forceShouldAnimate,u=Gl(t,n);if(l==null)return IS({insideDestination:r,inHomeList:u,displacedBy:i,destination:n});var d=Ki(r,function(v){return v.descriptor.index===l});if(!d)return IS({insideDestination:r,inHomeList:u,displacedBy:i,destination:n});var f=Dp(t,r),m=r.indexOf(d),p=f.slice(m),y=pu({afterDragging:p,destination:n,displacedBy:i,last:s,viewport:
499a.frame,forceShouldAnimate:c});return{displaced:y,displacedBy:i,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:l}}}}function zi(e,t){return!!t.effected[e]}var HV=function(e){var t=e.isMovingForward,r=e.destination,n=e.draggables,a=e.combine,i=e.afterCritical;if(!r.isCombineEnabled)return null;var s=a.draggableId,l=n[s],c=l.descriptor.index,u=zi(s,i);return u?t?c:c-1:t?c+1:c},KV=function(e){var t=e.isMovingForward,r=e.isInHomeList,n=e.insideDestination,a=e.location;if(!n.length)return null;var i=a.index,s=t?i+1:i-1,l=n[0].descriptor.index,c=n[n.length-1].descriptor.index,u=r?c:c+1;return s<l||s>u?null:s},YV=function(e){var t=e.isMovingForward,r=e.isInHomeList,n=e.draggable,a=e.draggables,i=e.destination,s=e.insideDestination,l=e.previousImpact,c=e.viewport,u=e.afterCritical,d=l.at;if(d||me(),d.type==="REORDER"){var f=KV({isMovingForward:t,isInHomeList:r,location:d.destination,insideDestination:s});return f==null?null:gm({draggable:n,insideDestination:s,destination:i,viewport:c,last:l.displaced,displacedBy:l.displacedBy,index:f})}var m=HV({isMovingForward:t,destination:i,displaced:l.displaced,draggables:a,combine:d.combine,afterCritical:u});return m==null?null:gm({draggable:n,insideDestination:s,destination:i,viewport:c,last:l.displaced,displacedBy:l.displacedBy,index:m})},XV=function(e){var t=e.displaced,r=e.afterCritical,n=e.combineWith,a=e.displacedBy,i=!!(t.visible[n]||t.invisible[n]);return zi(n,r)?i?mr:Wl(a.point):i?a.point:mr},ZV=function(e){var t=e.afterCritical,r=e.impact,n=e.draggables,a=Tp(r);a||me();var i=a.draggableId,s=n[i].page.borderBox.center,l=XV({displaced:r.displaced,afterCritical:t,combineWith:i,displacedBy:r.displacedBy});return br(s,l)},gD=function(t,r){return r.margin[t.start]+r.borderBox[t.size]/2},QV=function(t,r){return r.margin[t.end]+r.borderBox[t.size]/2},ow=function(t,r,n){return r[t.crossAxisStart]+n.margin[t.crossAxisStart]+n.borderBox[t.crossAxisSize]/2},RS=function(t){var r=t.axis,n=t.moveRelativeTo,a=t.isMoving;return Ro(r.line,n.marginBox[r.end]+gD(r,a),ow(r,n.marginBox,a))},LS=function(t){var r=t.axis,n=t.moveRelativeTo,a=t.isMoving;return Ro(r.line,n.marginBox[r.start]-QV(r,a),ow(r,n.marginBox,a))},JV=function(t){var r=t.axis,n=t.moveInto,a=t.isMoving;return Ro(r.line,n.contentBox[r.start]+gD(r,a),ow(r,n.contentBox,a))},eG=function(e){var t=e.impact,r=e.draggable,n=e.draggables,a=e.droppable,i=e.afterCritical,s=Vl(a.descriptor.id,n),l=r.page,c=a.axis;if(!s.length)return JV({axis:c,moveInto:a.page,isMoving:l});var u=t.displaced,d=t.displacedBy,f=u.all[0];if(f){var m=n[f];if(zi(f,i))return LS({axis:c,moveRelativeTo:m.page,isMoving:l});var p=fm(m.page,d.point);return LS({axis:c,moveRelativeTo:p,isMoving:l})}var y=s[s.length-1];if(y.descriptor.id===r.descriptor.id)return l.borderBox.center;if(zi(y.descriptor.id,i)){var v=fm(y.page,Wl(i.displacedBy.point));return RS({axis:c,moveRelativeTo:v,isMoving:l})}return RS({axis:c,moveRelativeTo:y.page,isMoving:l})},Zy=function(e,t){var r=e.frame;return r?br(t,r.scroll.diff.displacement):t},tG=function(t){var r=t.impact,n=t.draggable,a=t.droppable,i=t.draggables,s=t.afterCritical,l=n.page.borderBox.center,c=r.at;return!a||!c?l:c.type==="REORDER"?eG({impact:r,draggable:n,draggables:i,droppable:a,afterCritical:s}):ZV({impact:r,draggables:i,afterCritical:s})},$p=function(e){var t=tG(e),r=e.droppable,n=r?Zy(r,t):t;return n},yD=function(e,t){var r=sn(t,e.scroll.initial),n=Wl(r),a=Xn({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),i={frame:a,scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:r,displacement:n}}};return i};function FS(e,t){return e.map(function(r){return t[r]})}function rG(e,t){for(var r=0;r<t.length;r++){var n=t[r].visible[e];if(n)return n}return null}var nG=function(e){var t=e.impact,r=e.viewport,n=e.destination,a=e.draggables,i=e.maxScrollChange,s=yD(r,br(r.scroll.current,i)),l=n.frame?tw(n,br(n.frame.scroll.current,i)):n,c=t.displaced,u=pu({afterDragging:FS(c.all,a),destination:n,displacedBy:t.displacedBy,viewport:s.frame,last:c,forceShouldAnimate:!1}),d=pu({afterDragging:FS(c.all,a),destination:l,displacedBy:t.displacedBy,viewport:r.frame,last:c,forceShouldAnimate:!1}),f={},m={},p=[c,u,d];c.all.forEach(function(v){var g=rG(v,p);if(g){m[v]=g;return}f[v]=!0});var y=Ae({},t,{displaced:{all:c.all,invisible:f,visible:m}});return y},aG=function(e,t){return br(e.scroll.diff.displacement,t)},sw=function(e){var t=e.pageBorderBoxCenter,r=e.draggable,n=e.viewport,a=aG(n,t),i=sn(a,r.page.borderBox.center);return br(r.client.borderBox.center,i)},xD=function(e){var t=e.draggable,r=e.destination,n=e.newPageBorderBoxCenter,a=e.viewport,i=e.withDroppableDisplacement,s=e.onlyOnMainAxis,l=s===void 0?!1:s,c=sn(n,t.page.borderBox.center),u=$d(t.page.borderBox,c),d={target:u,destination:r,withDroppableDisplacement:i,viewport:
499a};return l?UV(d):vD(d)},iG=function(e){var t=e.isMovingForward,r=e.draggable,n=e.destination,a=e.draggables,i=e.previousImpact,s=e.viewport,l=e.previousPageBorderBoxCenter,c=e.previousClientSelection,u=e.afterCritical;if(!n.isEnabled)return null;var d=Vl(n.descriptor.id,a),f=Gl(r,n),m=MV({isMovingForward:t,draggable:r,destination:n,insideDestination:d,previousImpact:i})||YV({isMovingForward:t,isInHomeList:f,draggable:r,draggables:a,destination:n,insideDestination:d,previousImpact:i,viewport:s,afterCritical:u});if(!m)return null;var p=$p({impact:m,draggable:r,droppable:n,draggables:a,afterCritical:u}),y=xD({draggable:r,destination:n,newPageBorderBoxCenter:p,viewport:s.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0});if(y){var v=sw({pageBorderBoxCenter:p,draggable:r,viewport:s});return{clientSelection:v,impact:m,scrollJumpRequest:null}}var g=sn(p,l),x=nG({impact:m,viewport:s,destination:n,draggables:a,maxScrollChange:g});return{clientSelection:c,impact:x,scrollJumpRequest:g}},Cr=function(t){var r=t.subject.active;return r||me(),r},oG=function(e){var t=e.isMovingForward,r=e.pageBorderBoxCenter,n=e.source,a=e.droppables,i=e.viewport,s=n.subject.active;if(!s)return null;var l=n.axis,c=kn(s[l.start],s[l.end]),u=Ap(a).filter(function(f){return f!==n}).filter(function(f){return f.isEnabled}).filter(function(f){return!!f.subject.active}).filter(function(f){return hD(i.frame)(Cr(f))}).filter(function(f){var m=Cr(f);return t?s[l.crossAxisEnd]<m[l.crossAxisEnd]:m[l.crossAxisStart]<s[l.crossAxisStart]}).filter(function(f){var m=Cr(f),p=kn(m[l.start],m[l.end]);return c(m[l.start])||c(m[l.end])||p(s[l.start])||p(s[l.end])}).sort(function(f,m){var p=Cr(f)[l.crossAxisStart],y=Cr(m)[l.crossAxisStart];return t?p-y:y-p}).filter(function(f,m,p){return Cr(f)[l.crossAxisStart]===Cr(p[0])[l.crossAxisStart]});if(!u.length)return null;if(u.length===1)return u[0];var d=u.filter(function(f){var m=kn(Cr(f)[l.start],Cr(f)[l.end]);return m(r[l.line])});return d.length===1?d[0]:d.length>1?d.sort(function(f,m){return Cr(f)[l.start]-Cr(m)[l.start]})[0]:u.sort(function(f,m){var p=kS(r,MS(Cr(f))),y=kS(r,MS(Cr(m)));return p!==y?p-y:Cr(f)[l.start]-Cr(m)[l.start]})[0]},BS=function(t,r){var n=t.page.borderBox.center;return zi(t.descriptor.id,r)?sn(n,r.displacedBy.point):n},sG=function(t,r){var n=t.page.borderBox;return zi(t.descriptor.id,r)?$d(n,Wl(r.displacedBy.point)):n},lG=function(e){var t=e.pageBorderBoxCenter,r=e.viewport,n=e.destination,a=e.insideDestination,i=e.afterCritical,s=a.filter(function(l){return vD({target:sG(l,i),destination:n,viewport:r.frame,withDroppableDisplacement:!0})}).sort(function(l,c){var u=mu(t,Zy(n,BS(l,i))),d=mu(t,Zy(n,BS(c,i)));return u<d?-1:d<u?1:l.descriptor.index-c.descriptor.index});return s[0]||null},kd=ur(function(t,r){var n=r[t.line];return{value:n,point:Ro(t.line,n)}}),cG=function(t,r,n){var a=t.axis;if(t.descriptor.mode==="virtual")return Ro(a.line,r[a.line]);var i=t.subject.page.contentBox[a.size],s=Vl(t.descriptor.id,n),l=s.reduce(function(d,f){return d+f.client.marginBox[a.size]},0),c=l+r[a.line],u=c-i;return u<=0?null:Ro(a.line,u)},bD=function(t,r){return Ae({},t,{scroll:Ae({},t.scroll,{max:r})})},wD=function(t,r,n){var a=t.frame;Gl(r,t)&&me(),t.subject.withPlaceholder&&me();var i=kd(t.axis,r.displaceBy).point,s=cG(t,i,n),l={placeholderSize:i,increasedBy:s,oldFrameMaxScroll:t.frame?t.frame.scroll.max:null};if(!a){var c=Js({page:t.subject.page,withPlaceholder:l,axis:t.axis,frame:t.frame});return Ae({},t,{subject:c})}var u=s?br(a.scroll.max,s):a.scroll.max,d=bD(a,u),f=Js({page:t.subject.page,withPlaceholder:l,axis:t.axis,frame:d});return Ae({},t,{subject:f,frame:d})},uG=function(t){var r=t.subject.withPlaceholder;r||me();var n=t.frame;if(!n){var a=Js({page:t.subject.page,axis:t.axis,frame:null,withPlaceholder:null});return Ae({},t,{subject:a})}var i=r.oldFrameMaxScroll;i||me();var s=bD(n,i),l=Js({page:t.subject.page,axis:t.axis,frame:s,withPlaceholder:null});return Ae({},t,{subject:l,frame:s})},dG=function(e){var t=e.previousPageBorderBoxCenter,r=e.moveRelativeTo,n=e.insideDestination,a=e.draggable,i=e.draggables,s=e.destination,l=e.viewport,c=e.afterCritical;if(!r){if(n.length)return null;var u={displaced:hu,displacedBy:mD,at:{type:"REORDER",destination:{droppableId:s.descriptor.id,index:0}}},d=$p({impact:u,draggable:a,droppable:s,draggables:i,afterCritical:c}),f=Gl(a,s)?s:wD(s,a,i),m=xD({draggable:a,destination:f,newPageBorderBoxCenter:d,viewport:l.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0});return m?u:null}var p=t[s.axis.line]<=r.page.borderBox.center[s.axis.line],y=function(){var g=r.descriptor.index;return r.descriptor.id===a.descriptor.id||p?g:g+1}(),v=kd(s.axis,a.displaceBy);return gm({draggable:a,insideDestination:n,destination:s,viewport:l,displacedBy:v,last:hu,index:y})},fG=function(e){var t=e.isMovingForward,r=e.previousPageBorderBoxCenter,n=e.draggable,a=e.isOver,i=e.draggables,s=e.droppables,l=e.viewport,c=e.afterCritical,u=oG({isMovingForward:t,pageBorderBoxCenter:r,source:a,droppables:s,viewport:l});if(!u)return null;var d=Vl(u.descriptor.id,i),f=lG({pageBorderBoxCenter:r,viewport:l,destination:u,insideDestination:d,afterCritical:c}),m=dG({previousPageBorderBoxCenter:r,destination:u,draggable:n,draggables:i,moveRelativeTo:f,insideDestination:d,viewport:l,afterCritical:c});if(!m)return null;var p=$p({impact:m,draggable:n,droppable:u,draggables:i,afterCritical:c}),y=sw({pageBorderBoxCenter:p,draggable:n,viewport:l});return{clientSelection:y,impact:m,scrollJumpRequest:null}},ln=function(e){var t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null},mG=function(t,r){var n=ln(t);return n?r[n]:null},hG=function(e){var t=e.state,r=e.type,n=mG(t.impact,t.dimensions.droppables),a=!!n,i=t.dimensions.droppables[t.critical.droppable.
499id],s=n||i,l=s.axis.direction,c=l==="vertical"&&(r==="MOVE_UP"||r==="MOVE_DOWN")||l==="horizontal"&&(r==="MOVE_LEFT"||r==="MOVE_RIGHT");if(c&&!a)return null;var u=r==="MOVE_DOWN"||r==="MOVE_RIGHT",d=t.dimensions.draggables[t.critical.draggable.id],f=t.current.page.borderBoxCenter,m=t.dimensions,p=m.draggables,y=m.droppables;return c?iG({isMovingForward:u,previousPageBorderBoxCenter:f,draggable:d,destination:s,draggables:p,viewport:t.viewport,previousClientSelection:t.current.client.selection,previousImpact:t.impact,afterCritical:t.afterCritical}):fG({isMovingForward:u,previousPageBorderBoxCenter:f,draggable:d,isOver:s,draggables:p,droppables:y,viewport:t.viewport,afterCritical:t.afterCritical})};function oo(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function jD(e){var t=kn(e.top,e.bottom),r=kn(e.left,e.right);return function(a){return t(a.y)&&r(a.x)}}function pG(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function vG(e){var t=e.pageBorderBox,r=e.draggable,n=e.candidates,a=r.page.borderBox.center,i=n.map(function(s){var l=s.axis,c=Ro(s.axis.line,t.center[l.line],s.page.borderBox.center[l.crossAxisLine]);return{id:s.descriptor.id,distance:mu(a,c)}}).sort(function(s,l){return l.distance-s.distance});return i[0]?i[0].id:null}function gG(e){var t=e.pageBorderBox,r=e.draggable,n=e.droppables,a=Ap(n).filter(function(i){if(!i.isEnabled)return!1;var s=i.subject.active;if(!s||!pG(t,s))return!1;if(jD(s)(t.center))return!0;var l=i.axis,c=s.center[l.crossAxisLine],u=t[l.crossAxisStart],d=t[l.crossAxisEnd],f=kn(s[l.crossAxisStart],s[l.crossAxisEnd]),m=f(u),p=f(d);return!m&&!p?!0:m?u<c:d>c});return a.length?a.length===1?a[0].descriptor.id:vG({pageBorderBox:t,draggable:r,candidates:a}):null}var SD=function(t,r){return Xn($d(t,r))},yG=function(e,t){var r=e.frame;return r?SD(t,r.scroll.diff.value):t};function _D(e){var t=e.displaced,r=e.id;return!!(t.visible[r]||t.invisible[r])}function xG(e){var t=e.draggable,r=e.closest,n=e.inHomeList;return r?n&&r.descriptor.index>t.descriptor.index?r.descriptor.index-1:r.descriptor.index:null}var bG=function(e){var t=e.pageBorderBoxWithDroppableScroll,r=e.draggable,n=e.destination,a=e.insideDestination,i=e.last,s=e.viewport,l=e.afterCritical,c=n.axis,u=kd(n.axis,r.displaceBy),d=u.value,f=t[c.start],m=t[c.end],p=Dp(r,a),y=Ki(p,function(g){var x=g.descriptor.id,b=g.page.borderBox.center[c.line],j=zi(x,l),w=_D({displaced:i,id:x});return j?w?m<=b:f<b-d:w?m<=b+d:f<b}),v=xG({draggable:r,closest:y,inHomeList:Gl(r,n)});return gm({draggable:r,insideDestination:a,destination:n,viewport:s,last:i,displacedBy:u,index:v})},wG=4,jG=function(e){var t=e.draggable,r=e.pageBorderBoxWithDroppableScroll,n=e.previousImpact,a=e.destination,i=e.insideDestination,s=e.afterCritical;if(!a.isCombineEnabled)return null;var l=a.axis,c=kd(a.axis,t.displaceBy),u=c.value,d=r[l.start],f=r[l.end],m=Dp(t,i),p=Ki(m,function(v){var g=v.descriptor.id,x=v.page.borderBox,b=x[l.size],j=b/wG,w=zi(g,s),S=_D({displaced:n.displaced,id:g});return w?S?f>x[l.start]+j&&f<x[l.end]-j:d>x[l.start]-u+j&&d<x[l.end]-u-j:S?f>x[l.start]+u+j&&f<x[l.end]+u-j:d>x[l.start]+j&&d<x[l.end]-j});if(!p)return null;var y={displacedBy:c,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:p.descriptor.id,droppableId:a.descriptor.id}}};return y},ND=function(e){var t=e.pageOffset,r=e.draggable,n=e.draggables,a=e.droppables,i=e.previousImpact,s=e.viewport,l=e.afterCritical,c=SD(r.page.borderBox,t),u=gG({pageBorderBox:c,draggable:r,droppables:a});if(!u)return IV;var d=a[u],f=Vl(d.descriptor.id,n),m=yG(d,c);return jG({pageBorderBoxWithDroppableScroll:m,draggable:r,previousImpact:i,destination:d,insideDestination:f,afterCritical:l})||bG({pageBorderBoxWithDroppableScroll:m,draggable:r,destination:d,insideDestination:f,last:i.displaced,viewport:s,afterCritical:l})},lw=function(e,t){var r;return Ae({},e,(r={},r[t.descriptor.id]=t,r))},SG=function(t){var r=t.previousImpact,n=t.impact,a=t.droppables,i=ln(r),s=ln(n);if(!i||i===s)return a;var l=a[i];if(!l.subject.withPlaceholder)return a;var c=uG(l);return lw(a,c)},_G=function(e){var t=e.draggable,r=e.draggables,n=e.droppables,a=e.previousImpact,i=e.impact,s=SG({previousImpact:a,impact:i,droppables:n}),l=ln(i);if(!l)return s;var c=n[l];if(Gl(t,c)||c.subject.withPlaceholder)return s;var u=wD(c,t,r);return lw(s,u)},Vc=function(e){var t=e.state,r=e.clientSelection,n=e.dimensions,a=e.viewport,i=e.impact,s=e.scrollJumpRequest,l=a||t.viewport,c=n||t.dimensions,u=r||t.current.client.selection,d=sn(u,t.initial.client.selection),f={offset:d,selection:u,borderBoxCenter:br(t.initial.client.borderBoxCenter,d)},m={selection:br(f.selection,l.scroll.current),borderBoxCenter:br(f.borderBoxCenter,l.scroll.current),offset:br(f.offset,l.scroll.diff.value)},p={client:f,page:m};if(t.phase==="COLLECTING")return Ae({phase:"COLLECTING"},t,{dimensions:c,viewport:l,current:p});var y=c.draggables[t.critical.draggable.id],v=i||ND({pageOffset:m.offset,draggable:y,draggables:c.draggables,droppables:c.droppables,previousImpact:t.impact,viewport:l,afterCritical:t.afterCritical}),g=_G({draggable:y,impact:v,previousImpact:t.impact,draggables:c.draggables,droppables:c.droppables}),x=Ae({},t,{current:p,dimensions:{draggables:c.draggables,droppables:g},impact:v,viewport:l,scrollJumpRequest:s||null,forceShouldAnimate:s?!1:null});return x};function NG(e,t){return e.map(function(r){return t[r]})}var ED=function(e){var t=e.impact,r=e.viewport,n=e.draggables,a=e.destination,i=e.forceShouldAnimate,s=t.displaced,l=NG(s.all,n),c=pu({afterDragging:l,destination:a,displacedBy:t.displacedBy,viewport:r.frame,forceShouldAnimate:i,last:s});return Ae({},t,{displaced:c})},CD=function(e){var t=e.impact,r=e.draggable,n=e.droppable,a=e.draggables,i=e.viewport,s=e.afterCritical,l=$p({impact:t,draggable:r,draggables:a,droppable:n,afterCritical:s});return sw({pageBorderBoxCenter:l,draggable:r,viewport:i})},OD=function(e){var t=e.state,r=e.dimensions,n=e.viewport;t.movementMode!=="SNAP"&&me();var a=t.impact,i=n||t.viewport,s=r||t.dimensions,l=s.draggables,c=s.droppables,u=l[t.critical.draggable.id],d=ln(a);d||me();var f=c[d],m=ED({impact:a,viewport:i,destination:f,draggables:l}),p=CD({impact:m,draggable:u,droppable:f,draggables:l,viewport:i,afterCritical:t.afterCritical});return Vc({impact:m,clientSelection:p,state:t,dimensions:s,viewport:i})},EG=function(e){return{index:e.index,droppableId:e.droppableId}},PD=function(e){var t=e.draggable,r=e.home,n=e.draggables,a=e.viewport,i=kd(r.axis,t.displaceBy),s=Vl(r.descriptor.id,n),l=s.indexOf(t);l===-1&&me();var c=s.slice(l+1),u=c.reduce(function(p,y){return p[y.descriptor.id]=!0,p},{}),d={inVirtualList:r.descriptor.mode==="virtual",displacedBy:i,effected:u},f=pu({afterDragging:c,destination:r,displacedBy:i,last:null,viewport:
499a.frame,forceShouldAnimate:!1}),m={displaced:f,displacedBy:i,at:{type:"REORDER",destination:EG(t.descriptor)}};return{impact:m,afterCritical:d}},CG=function(e,t){return{draggables:e.draggables,droppables:lw(e.droppables,t)}},OG=function(e){var t=e.draggable,r=e.offset,n=e.initialWindowScroll,a=fm(t.client,r),i=mm(a,n),s=Ae({},t,{placeholder:Ae({},t.placeholder,{client:a}),client:a,page:i});return s},PG=function(e){var t=e.frame;return t||me(),t},AG=function(e){var t=e.additions,r=e.updatedDroppables,n=e.viewport,a=n.scroll.diff.value;return t.map(function(i){var s=i.descriptor.droppableId,l=r[s],c=PG(l),u=c.scroll.diff.value,d=br(a,u),f=OG({draggable:i,offset:d,initialWindowScroll:n.scroll.initial});return f})},TG=function(e){var t=e.state,r=e.published,n=r.modified.map(function(j){var w=t.dimensions.droppables[j.droppableId],S=tw(w,j.scroll);return S}),a=Ae({},t.dimensions.droppables,{},dD(n)),i=fD(AG({additions:r.additions,updatedDroppables:a,viewport:t.viewport})),s=Ae({},t.dimensions.draggables,{},i);r.removals.forEach(function(j){delete s[j]});var l={droppables:a,draggables:s},c=ln(t.impact),u=c?l.droppables[c]:null,d=l.draggables[t.critical.draggable.id],f=l.droppables[t.critical.droppable.id],m=PD({draggable:d,home:f,draggables:s,viewport:t.viewport}),p=m.impact,y=m.afterCritical,v=u&&u.isCombineEnabled?t.impact:p,g=ND({pageOffset:t.current.page.offset,draggable:l.draggables[t.critical.draggable.id],draggables:l.draggables,droppables:l.droppables,previousImpact:v,viewport:t.viewport,afterCritical:y}),x=Ae({phase:"DRAGGING"},t,{phase:"DRAGGING",impact:g,onLiftImpact:p,dimensions:l,afterCritical:y,forceShouldAnimate:!1});if(t.phase==="COLLECTING")return x;var b=Ae({phase:"DROP_PENDING"},x,{phase:"DROP_PENDING",reason:t.reason,isWaiting:!1});return b},Qy=function(t){return t.movementMode==="SNAP"},cg=function(t,r,n){var a=CG(t.dimensions,r);return!Qy(t)||n?Vc({state:t,dimensions:a}):OD({state:t,dimensions:a})};function ug(e){return e.isDragging&&e.movementMode==="SNAP"?Ae({phase:"DRAGGING"},e,{scrollJumpRequest:null}):e}var zS={phase:"IDLE",completed:null,shouldFlush:!1},DG=function(e,t){if(e===void 0&&(e=zS),t.type==="FLUSH")return Ae({},zS,{shouldFlush:!0});if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&me();var r=t.payload,n=r.critical,a=r.clientSelection,i=r.viewport,s=r.dimensions,l=r.movementMode,c=s.draggables[n.draggable.id],u=s.droppables[n.droppable.id],d={selection:a,borderBoxCenter:c.client.borderBox.center,offset:mr},f={client:d,page:{selection:br(d.selection,i.scroll.initial),borderBoxCenter:br(d.selection,i.scroll.initial),offset:br(d.selection,i.scroll.diff.value)}},m=Ap(s.droppables).every(function(_e){return!_e.isFixedOnPage}),p=PD({draggable:c,home:u,draggables:s.draggables,viewport:i}),y=p.impact,v=p.afterCritical,g={phase:"DRAGGING",isDragging:!0,critical:n,movementMode:l,dimensions:s,initial:f,current:f,isWindowScrollAllowed:m,impact:y,afterCritical:v,onLiftImpact:y,viewport:i,scrollJumpRequest:null,forceShouldAnimate:null};return g}if(t.type==="COLLECTION_STARTING"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase!=="DRAGGING"&&me();var x=Ae({phase:"COLLECTING"},e,{phase:"COLLECTING"});return x}if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||me(),TG({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;oo(e)||me();var b=t.payload.client;return $i(b,e.current.client.selection)?e:Vc({state:e,clientSelection:b,impact:Qy(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return ug(e);oo(e)||me();var j=t.payload,w=j.id,S=j.newScroll,_=e.dimensions.droppables[w];if(!_)return e;var N=tw(_,S);return cg(e,N,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;oo(e)||me();var E=t.payload,O=E.id,P=E.isEnabled,C=e.dimensions.droppables[O];C||me(),C.isEnabled===P&&me();var A=Ae({},C,{isEnabled:P});return cg(e,A,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;oo(e)||me();
499var T=t.payload,k=T.id,D=T.isCombineEnabled,M=e.dimensions.droppables[k];M||me(),M.isCombineEnabled===D&&me();var F=Ae({},M,{isCombineEnabled:D});return cg(e,F,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;oo(e)||me(),e.isWindowScrollAllowed||me();var q=t.payload.newScroll;if($i(e.viewport.scroll.current,q))return ug(e);var I=yD(e.viewport,q);return Qy(e)?OD({state:e,viewport:I}):Vc({state:e,viewport:I})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!oo(e))return e;var K=t.payload.maxScroll;if($i(K,e.viewport.scroll.max))return e;var W=Ae({},e.viewport,{scroll:Ae({},e.viewport.scroll,{max:K})});return Ae({phase:"DRAGGING"},e,{viewport:W})}if(t.type==="MOVE_UP"||t.type==="MOVE_DOWN"||t.type==="MOVE_LEFT"||t.type==="MOVE_RIGHT"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase!=="DRAGGING"&&me();var R=hG({state:e,type:t.type});return R?Vc({state:e,impact:R.impact,clientSelection:R.clientSelection,scrollJumpRequest:R.scrollJumpRequest}):e}if(t.type==="DROP_PENDING"){var V=t.payload.reason;e.phase!=="COLLECTING"&&me();var re=Ae({phase:"DROP_PENDING"},e,{phase:"DROP_PENDING",isWaiting:!0,reason:V});return re}if(t.type==="DROP_ANIMATE"){var H=t.payload,te=H.completed,ce=H.dropDuration,je=H.newHomeClientOffset;e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||me();var X={phase:"DROP_ANIMATING",completed:te,dropDuration:ce,newHomeClientOffset:je,dimensions:e.dimensions};return X}if(t.type==="DROP_COMPLETE"){var ae=t.payload.completed;return{phase:"IDLE",completed:ae,shouldFlush:!1}}return e},$G=function(t){return{type:"BEFORE_INITIAL_CAPTURE",payload:t}},kG=function(t){return{type:"LIFT",payload:t}},MG=function(t){return{type:"INITIAL_PUBLISH",payload:t}},IG=function(t){return{type:"PUBLISH_WHILE_DRAGGING",payload:t}},RG=function(){return{type:"COLLECTION_STARTING",payload:null}},LG=function(t){return{type:"UPDATE_DROPPABLE_SCROLL",payload:t}},FG=function(t){return{type:"UPDATE_DROPPABLE_IS_ENABLED",payload:t}},BG=function(t){return{type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:t}},AD=function(t){return{type:"MOVE",payload:t}},zG=function(t){return{type:"MOVE_BY_WINDOW_SCROLL",payload:t}},qG=function(t){return{type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:t}},UG=function(){return{type:"MOVE_UP",payload:null}},WG=function(){return{type:"MOVE_DOWN",payload:null}},VG=function(){return{type:"MOVE_RIGHT",payload:null}},GG=function(){return{type:"MOVE_LEFT",payload:null}},cw=function(){return{type:"FLUSH",payload:null}},HG=function(t){return{type:"DROP_ANIMATE",payload:t}},uw=function(t){return{type:"DROP_COMPLETE",payload:t}},TD=function(t){return{type:"DROP",payload:t}},KG=function(t){return{type:"DROP_PENDING",payload:t}},DD=function(){return{type:"DROP_ANIMATION_FINISHED",payload:null}},YG=function(e){return function(t){var r=t.getState,n=t.dispatch;return function(a){return function(i){if(i.type!=="LIFT"){a(i);return}var s=i.payload,l=s.id,c=s.clientSelection,u=s.movementMode,d=r();d.phase==="DROP_ANIMATING"&&n(uw({completed:d.completed})),r().phase!=="IDLE"&&me(),n(cw()),n($G({draggableId:l,movementMode:u}));var f={shouldPublishImmediately:u==="SNAP"},m={draggableId:l,scrollOptions:f},p=e.startPublishing(m),y=p.critical,v=p.dimensions,g=p.viewport;n(MG({critical:y,dimensions:v,clientSelection:c,movementMode:u,viewport:g}))}}}},XG=function(e){return function(){return function(t){return function(r){r.type==="INITIAL_PUBLISH"&&e.dragging(),r.type==="DROP_ANIMATE"&&e.dropping(r.payload.completed.result.reason),(r.type==="FLUSH"||r.type==="DROP_COMPLETE")&&e.resting(),t(r)}}}},dw={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},vu={opacity:{drop:0,combining:.7},scale:{drop:.75}},fw={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},eo=fw.outOfTheWay+"s "+dw.outOfTheWay,Gc={fluid:"opacity "+eo,snap:"transform "+eo+", opacity "+eo,drop:function(t){var r=t+"s "+dw.drop;return"transform "+r+", opacity "+r},outOfTheWay:"transform "+eo,placeholder:"height "+eo+", width "+eo+", margin "+eo},qS=function(t){return $i(t,mr)?null:"translate("+t.x+"px, "+t.y+"px)"},Jy={moveTo:qS,drop:function(t,r){var n=qS(t);return n?r?n+" scale("+vu.scale.drop+")":n:null}}
499,ex=fw.minDropTime,$D=fw.maxDropTime,ZG=$D-ex,US=1500,QG=.6,JG=function(e){var t=e.current,r=e.destination,n=e.reason,a=mu(t,r);if(a<=0)return ex;if(a>=US)return $D;var i=a/US,s=ex+ZG*i,l=n==="CANCEL"?s*QG:s;return Number(l.toFixed(2))},e7=function(e){var t=e.impact,r=e.draggable,n=e.dimensions,a=e.viewport,i=e.afterCritical,s=n.draggables,l=n.droppables,c=ln(t),u=c?l[c]:null,d=l[r.descriptor.droppableId],f=CD({impact:t,draggable:r,draggables:s,afterCritical:i,droppable:u||d,viewport:a}),m=sn(f,r.client.borderBox.center);return m},t7=function(e){var t=e.draggables,r=e.reason,n=e.lastImpact,a=e.home,i=e.viewport,s=e.onLiftImpact;if(!n.at||r!=="DROP"){var l=ED({draggables:t,impact:s,destination:a,viewport:i,forceShouldAnimate:!0});return{impact:l,didDropInsideDroppable:!1}}if(n.at.type==="REORDER")return{impact:n,didDropInsideDroppable:!0};var c=Ae({},n,{displaced:hu});return{impact:c,didDropInsideDroppable:!0}},r7=function(e){var t=e.getState,r=e.dispatch;return function(n){return function(a){if(a.type!=="DROP"){n(a);return}var i=t(),s=a.payload.reason;if(i.phase==="COLLECTING"){r(KG({reason:s}));return}if(i.phase!=="IDLE"){var l=i.phase==="DROP_PENDING"&&i.isWaiting;l&&me(),i.phase==="DRAGGING"||i.phase==="DROP_PENDING"||me();var c=i.critical,u=i.dimensions,d=u.draggables[i.critical.draggable.id],f=t7({reason:s,lastImpact:i.impact,afterCritical:i.afterCritical,onLiftImpact:i.onLiftImpact,home:i.dimensions.droppables[i.critical.droppable.id],viewport:i.viewport,draggables:i.dimensions.draggables}),m=f.impact,p=f.didDropInsideDroppable,y=p?nw(m):null,v=p?Tp(m):null,g={index:c.draggable.index,droppableId:c.droppable.id},x={draggableId:d.descriptor.id,type:d.descriptor.type,source:g,reason:s,mode:i.movementMode,destination:y,combine:v},b=e7({impact:m,draggable:d,dimensions:u,viewport:i.viewport,afterCritical:i.afterCritical}),j={critical:i.critical,afterCritical:i.afterCritical,result:x,impact:m},w=!$i(i.current.client.offset,b)||!!x.combine;if(!w){r(uw({completed:j}));return}var S=JG({current:i.current.client.offset,destination:b,reason:s}),_={newHomeClientOffset:b,dropDuration:S,completed:j};r(HG(_))}}}},kD=function(){return{x:window.pageXOffset,y:window.pageYOffset}};function n7(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(r){r.target!==window&&r.target!==window.document||e()}}}function a7(e){var t=e.onWindowScroll;function r(){t(kD())}var n=fu(r),a=n7(n),i=Di;function s(){return i!==Di}function l(){s()&&me(),i=Dn(window,[a])}function c(){s()||me(),n.cancel(),i(),i=Di}return{start:l,stop:c,isActive:s}}var i7=function(t){return t.type==="DROP_COMPLETE"||t.type==="DROP_ANIMATE"||t.type==="FLUSH"},o7=function(e){var t=a7({onWindowScroll:function(n){e.dispatch(zG({newScroll:n}))}});return function(r){return function(n){!t.isActive()&&n.type==="INITIAL_PUBLISH"&&t.start(),t.isActive()&&i7(n)&&t.stop(),r(n)}}},s7=function(e){var t=!1,r=!1,n=setTimeout(function(){r=!0}),a=function(s){t||r||(t=!0,e(s),clearTimeout(n))};return a.wasCalled=function(){return t},a},l7=function(){var e=[],t=function(i){var s=rw(e,function(u){return u.timerId===i});s===-1&&me();var l=e.splice(s,1),c=l[0];c.callback()},r=function(i){var s=setTimeout(function(){return t(s)}),l={timerId:s,callback:i};e.push(l)},n=function(){if(e.length){var i=[].concat(e);e.length=0,i.forEach(function(s){clearTimeout(s.timerId),s.callback()})}};return{add:r,flush:n}},c7=function(t,r){return t==null&&r==null?!0:t==null||r==null?!1:t.droppableId===r.droppableId&&t.index===r.index},u7=function(t,r){return t==null&&r==null?!0:t==null||r==null?!1:t.draggableId===r.draggableId&&t.droppableId===r.droppableId},d7=function(t,r){if(t===r)return!0;var n=t.draggable.id===r.draggable.id&&t.draggable.droppableId===r.draggable.droppableId&&t.draggable.type===r.draggable.type&&t.draggable.index===r.draggable.index,a=t.droppable.id===r.droppable.id&&t.droppable.type===r.droppable.type;return n&&a},mc=function(t,r){r()},cf=function(t,r){return{draggableId:t.draggable.id,type:t.droppable.type,source:{droppableId:t.droppable.id,index:t.draggable.index},mode:r}},dg=function(t,r,n,a){if(!t){n(a(r));return}var i=s7(n),s={announce:i};t(r,s),i.wasCalled()||n(a(r))},f7=function(e,t){var r=l7(),n=null,a=function(m,p){n&&me(),mc("onBeforeCapture",function(){var y=e().onBeforeCapture;if(y){var v={draggableId:m,mode:p};y(v)}})},i=function(m,p){n&&me(),mc("onBeforeDragStart",function(){var y=e().onBeforeDragStart;y&&y(cf(m,p))})},s=function(m,p){n&&me();var y=cf(m,p);n={mode:p,lastCritical:m,lastLocation:y.source,lastCombine:null},r.add(function(){mc("onDragStart",function(){return dg(e().onDragStart,y,t,Wf.onDragStart)})})},l=function(m,p){var y=nw(p),v=Tp(p);n||me();var g=!d7(m,n.lastCritical);g&&(n.lastCritical=m);var x=!c7(n.lastLocation,y);x&&(n.lastLocation=y);var b=!u7(n.lastCombine,v);if(b&&(n.lastCombine=v),!(!g&&!x&&!b)){var j=Ae({},cf(m,n.mode),{combine:v,destination:y});r.add(function(){mc("onDragUpdate",function(){return dg(e().onDragUpdate,j,t,Wf.onDragUpdate)})})}},c=function(){n||me(),r.flush()},u=function(m){n||me(),n=null,mc("onDragEnd",function(){return dg(e().onDragEnd,m,t,Wf.onDragEnd)})},d=function(){if(n){var m=Ae({},cf(n.lastCritical,n.mode),{combine:null,destination:null,reason:"CANCEL"});u(m)}};return{beforeCapture:a,beforeStart:i,start:s,update:l,flush:c,drop:u,abort:d}},m7=function(e,t){var r=f7(e,t);return function(n){return function(a){return function(i){if(i.type==="BEFORE_INITIAL_CAPTURE"){r.beforeCapture(i.payload.draggableId,i.payload.movementMode);return}if(i.type==="INITIAL_PUBLISH"){var s=i.payload.critical;r.beforeStart(s,i.payload.movementMode),a(i),r.start(s,i.payload.movementMode);return}if(i.type==="DROP_COMPLETE"){var l=i.payload.completed.result;r.flush(),a(i),r.drop(l);return}if(a(i),i.type==="FLUSH"){r.abort();return}var c=n.getState();c.phase==="DRAGGING"&&r.update(c.critical,c.impact)}}}}
499,h7=function(e){return function(t){return function(r){if(r.type!=="DROP_ANIMATION_FINISHED"){t(r);return}var n=e.getState();n.phase!=="DROP_ANIMATING"&&me(),e.dispatch(uw({completed:n.completed}))}}},p7=function(e){var t=null,r=null;function n(){r&&(cancelAnimationFrame(r),r=null),t&&(t(),t=null)}return function(a){return function(i){if((i.type==="FLUSH"||i.type==="DROP_COMPLETE"||i.type==="DROP_ANIMATION_FINISHED")&&n(),a(i),i.type==="DROP_ANIMATE"){var s={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){var c=e.getState();c.phase==="DROP_ANIMATING"&&e.dispatch(DD())}};r=requestAnimationFrame(function(){r=null,t=Dn(window,[s])})}}}},v7=function(e){return function(){return function(t){return function(r){(r.type==="DROP_COMPLETE"||r.type==="FLUSH"||r.type==="DROP_ANIMATE")&&e.stopPublishing(),t(r)}}}},g7=function(e){var t=!1;return function(){return function(r){return function(n){if(n.type==="INITIAL_PUBLISH"){t=!0,e.tryRecordFocus(n.payload.critical.draggable.id),r(n),e.tryRestoreFocusRecorded();return}if(r(n),!!t){if(n.type==="FLUSH"){t=!1,e.tryRestoreFocusRecorded();return}if(n.type==="DROP_COMPLETE"){t=!1;var a=n.payload.completed.result;a.combine&&e.tryShiftRecord(a.draggableId,a.combine.draggableId),e.tryRestoreFocusRecorded()}}}}}},y7=function(t){return t.type==="DROP_COMPLETE"||t.type==="DROP_ANIMATE"||t.type==="FLUSH"},x7=function(e){return function(t){return function(r){return function(n){if(y7(n)){e.stop(),r(n);return}if(n.type==="INITIAL_PUBLISH"){r(n);var a=t.getState();a.phase!=="DRAGGING"&&me(),e.start(a);return}r(n),e.scroll(t.getState())}}}},b7=function(e){return function(t){return function(r){if(t(r),r.type==="PUBLISH_WHILE_DRAGGING"){var n=e.getState();n.phase==="DROP_PENDING"&&(n.isWaiting||e.dispatch(TD({reason:n.reason})))}}}},w7=R2,j7=function(e){var t=e.dimensionMarshal,r=e.focusMarshal,n=e.styleMarshal,a=e.getResponders,i=e.announce,s=e.autoScroller;return I2(DG,w7(aW(XG(n),v7(t),YG(t),r7,h7,p7,b7,x7(s),o7,g7(r),m7(a,i))))},fg=function(){return{additions:{},removals:{},modified:{}}};function S7(e){var t=e.registry,r=e.callbacks,n=fg(),a=null,i=function(){a||(r.collectionStarting(),a=requestAnimationFrame(function(){a=null;var d=n,f=d.additions,m=d.removals,p=d.modified,y=Object.keys(f).map(function(x){return t.draggable.getById(x).getDimension(mr)}).sort(function(x,b){return x.descriptor.index-b.descriptor.index}),v=Object.keys(p).map(function(x){var b=t.droppable.getById(x),j=b.callbacks.getScrollWhileDragging();return{droppableId:x,scroll:j}}),g={additions:y,removals:Object.keys(m),modified:v};n=fg(),r.publish(g)}))},s=function(d){var f=d.descriptor.id;n.additions[f]=d,n.modified[d.descriptor.droppableId]=!0,n.removals[f]&&delete n.removals[f],i()},l=function(d){var f=d.descriptor;n.removals[f.id]=!0,n.modified[f.droppableId]=!0,n.additions[f.id]&&delete n.additions[f.id],i()},c=function(){a&&(cancelAnimationFrame(a),a=null,n=fg())};return{add:s,remove:l,stop:c}}var MD=function(e){var t=e.scrollHeight,r=e.scrollWidth,n=e.height,a=e.width,i=sn({x:r,y:t},{x:a,y:n}),s={x:Math.max(0,i.x),y:Math.max(0,i.y)};return s},ID=function(){var e=document.documentElement;return e||me(),e},RD=function(){var e=ID(),t=MD({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight});return t},_7=function(){var e=kD(),t=RD(),r=e.y,n=e.x,a=ID(),i=a.clientWidth,s=a.clientHeight,l=n+i,c=r+s,u=Xn({top:r,left:n,right:l,bottom:c}),d={frame:u,scroll:{initial:e,current:e,max:t,diff:{value:mr,displacement:mr}}};return d},N7=function(e){var t=e.critical,r=e.scrollOptions,n=e.registry,a=_7(),i=a.scroll.current,s=t.droppable,l=n.droppable.getAllByType(s.type).map(function(f){return f.callbacks.getDimensionAndWatchScroll(i,r)}),c=n.draggable.getAllByType(t.draggable.type).map(function(f){return f.getDimension(i)}),u={draggables:fD(c),droppables:dD(l)},d={dimensions:u,critical:t,viewport:a};return d};function WS(e,t,r){if(r.descriptor.id===t.id||r.descriptor.type!==t.type)return!1;var n=e.droppable.getById(r.descriptor.droppableId);return n.descriptor.mode==="virtual"}var E7=function(e,t){var r=null,n=S7({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),a=function(p,y){e.droppable.exists(p)||me(),r&&t.updateDroppableIsEnabled({id:p,isEnabled:y})},i=function(p,y){r&&(e.droppable.exists(p)||me(),t.updateDroppableIsCombine
499Enabled({id:p,isCombineEnabled:y}))},s=function(p,y){r&&(e.droppable.exists(p)||me(),t.updateDroppableScroll({id:p,newScroll:y}))},l=function(p,y){r&&e.droppable.getById(p).callbacks.scroll(y)},c=function(){if(r){n.stop();var p=r.critical.droppable;e.droppable.getAllByType(p.type).forEach(function(y){return y.callbacks.dragStopped()}),r.unsubscribe(),r=null}},u=function(p){r||me();var y=r.critical.draggable;p.type==="ADDITION"&&WS(e,y,p.value)&&n.add(p.value),p.type==="REMOVAL"&&WS(e,y,p.value)&&n.remove(p.value)},d=function(p){r&&me();var y=e.draggable.getById(p.draggableId),v=e.droppable.getById(y.descriptor.droppableId),g={draggable:y.descriptor,droppable:v.descriptor},x=e.subscribe(u);return r={critical:g,unsubscribe:x},N7({critical:g,registry:e,scrollOptions:p.scrollOptions})},f={updateDroppableIsEnabled:a,updateDroppableIsCombineEnabled:i,scrollDroppable:l,updateDroppableScroll:s,startPublishing:d,stopPublishing:c};return f},LD=function(e,t){return e.phase==="IDLE"?!0:e.phase!=="DROP_ANIMATING"||e.completed.result.draggableId===t?!1:e.completed.result.reason==="DROP"},C7=function(e){window.scrollBy(e.x,e.y)},O7=ur(function(e){return Ap(e).filter(function(t){return!(!t.isEnabled||!t.frame)})}),P7=function(t,r){var n=Ki(O7(r),function(a){return a.frame||me(),jD(a.frame.pageMarginBox)(t)});return n},A7=function(e){var t=e.center,r=e.destination,n=e.droppables;if(r){var a=n[r];return a.frame?a:null}var i=P7(t,n);return i},ki={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:function(t){return Math.pow(t,2)},durationDampening:{stopDampeningAt:1200,accelerateAt:360}},T7=function(e,t){var r=e[t.size]*ki.startFromPercentage,n=e[t.size]*ki.maxScrollAtPercentage,a={startScrollingFrom:r,maxScrollValueAt:n};return a},FD=function(e){var t=e.startOfRange,r=e.endOfRange,n=e.current,a=r-t;if(a===0)return 0;var i=n-t,s=i/a;return s},mw=1,D7=function(e,t){if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return ki.maxPixelScroll;if(e===t.startScrollingFrom)return mw;var r=FD({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),n=1-r,a=ki.maxPixelScroll*ki.ease(n);return Math.ceil(a)},VS=ki.durationDampening.accelerateAt,GS=ki.durationDampening.stopDampeningAt,$7=function(e,t){var r=t,n=GS,a=Date.now(),i=a-r;if(i>=GS)return e;if(i<VS)return mw;var s=FD({startOfRange:VS,endOfRange:n,current:i}),l=e*ki.ease(s);return Math.ceil(l)},HS=function(e){var t=e.distanceToEdge,r=e.thresholds,n=e.dragStartTime,a=e.shouldUseTimeDampening,i=D7(t,r);return i===0?0:a?Math.max($7(i,n),mw):i},KS=function(e){var t=e.container,r=e.distanceToEdges,n=e.dragStartTime,a=e.axis,i=e.shouldUseTimeDampening,s=T7(t,a),l=r[a.end]<r[a.start];return l?HS({distanceToEdge:r[a.end],thresholds:s,dragStartTime:n,shouldUseTimeDampening:i}):-1*HS({distanceToEdge:r[a.start],thresholds:s,dragStartTime:n,shouldUseTimeDampening:i})},k7=function(e){var t=e.container,r=e.subject,n=e.proposedScroll,a=r.height>t.height,i=r.width>t.width;return!i&&!a?n:i&&a?null:{x:i?0:n.x,y:a?0:n.y}},M7=cD(function(e){return e===0?0:e}),BD=function(e){var t=e.dragStartTime,r=e.container,n=e.subject,a=e.center,i=e.shouldUseTimeDampening,s={top:a.y-r.top,right:r.right-a.x,bottom:r.bottom-a.y,left:a.x-r.left},l=KS({container:r,distanceToEdges:s,dragStartTime:t,axis:aw,shouldUseTimeDampening:i}),c=KS({container:r,distanceToEdges:s,dragStartTime:t,axis:pD,shouldUseTimeDampening:i}),u=M7({x:c,y:l});if($i(u,mr))return null;var d=k7({container:r,subject:n,proposedScroll:u});return d?$i(d,mr)?null:d:null},I7=cD(function(e){return e===0?0:e>0?1:-1}),hw=function(){var e=function(r,n){return r<0?r:r>n?r-n:0};return function(t){var r=t.current,n=t.max,a=t.change,i=br(r,a),s={x:e(i.x,n.x),y:e(i.y,n.y)};return $i(s,mr)?null:s}}(),zD=function(t){var r=t.max,n=t.current,a=t.change,i={x:Math.max(n.x,r.x),y:Math.max(n.y,r.y)},s=I7(a),l=hw({max:i,current:n,change:s});return!l||s.x!==0&&l.x===0||s.y!==0&&l.y===0},pw=function(t,r){return zD({current:t.scroll.current,max:t.scroll.max,change:r})},R7=function(t,r){if(!pw(t,r))return null;var n=t.scroll.max,a=t.scroll.current;return hw({current:a,max:n,change:r})},vw=function(t,r){var n=t.frame;return n?zD({current:n.scroll.current,max:n.scroll.max,change:r}):!1},L7=function(t,r){var n=t.frame;return!n||!vw(t,r)?null:hw({current:n.scroll.current,max:n.scroll.max,change:r})},F7=function(e){var t=e.viewport,r=e.subject,n=e.center,a=e.dragStartTime,i=e.shouldUseTimeDampening,s=BD({dragStartTime:a,container:t.frame,subject:r,center:n,shouldUseTimeDampening:i});return s&&pw(t,s)?s:null},B7=function(e){var t=e.droppable,r=e.subject,n=e.center,a=e.dragStartTime,i=e.shouldUseTimeDampening,s=t.frame;if(!s)return null;var l=BD({dragStartTime:a,container:s.pageMarginBox,subject:r,center:n,shouldUseTimeDampening:i});return l&&vw(t,l)?l:null},YS=function(e){var t=e.state,r=e.dragStartTime,n=e.shouldUseTimeDampening,a=e.scrollWindow,i=e.scrollDroppable,s=t.current.page.borderBoxCenter,l=t.dimensions.draggables[t.critical.draggable.id],c=l.page.marginBox;if(t.isWindowScrollAllowed){var u=t.viewport,d=F7({dragStartTime:r,viewport:u,subject:c,center:s,shouldUseTimeDampening:n});if(d){a(d);return}}var f=A7({center:s,destination:ln(t.impact),droppables:t.dimensions.droppables});if(f){var m=B7({dragStartTime:r,droppable:f,subject:c,center:s,shouldUseTimeDampening:n});m&&i(f.descriptor.id,m)}},z7=function(e){var t=e.scrollWindow,r=e.scrollDroppable,n=fu(t),a=fu(r),i=null,s=function(d){i||me();var f=i,m=f.shouldUseTimeDampening,p=f.dragStartTime;YS({state:d,scrollWindow:n,scrollDroppable:a,dragStartTime:p,shouldUseTimeDampening:m})},l=function(d){i&&me();var f=Date.now(),m=!1,p=function(){m=!0};YS({state:d,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:p,scrollDroppable:p}),i={dragStartTime:f,shouldUseTimeDampening:m},m&&s(d)},c=function(){i&&(n.cancel(),a.cancel(),i=null)};return{start:l,stop:c,scroll:s}},q7=function(e){var t=e.move,r=e.scrollDroppable,n=e.scrollWindow,a=function(u,d){var f=br(u.current.client.selection,d);t({client:f})},i=function(u,d){if(!vw(u,d))return d;var f=L7(u,d);if(!f)return r(u.descriptor.id,d),null;var m=sn(d,f);r(u.descriptor.id,m);var p=sn(d,m);return p},s=function(u,d,f){if(!u||!pw(d,f))return f;var m=R7(d,f);if(!m)return n(f),null;var p=sn(f,m);n(p);var y=sn(f,p);return y},l=function(u){var d=u.scrollJumpRequest;if(d){var f=ln(u.impact);f||me();var m=i(u.dimensions.droppables[f],d);if(m){var p=u.viewport,y=s(u.isWindowScrollAllowed,p,m);y&&a(u,y)}}};return l},U7=function(e){var t=e.scrollDroppable,r=e.scrollWindow,n=e.move,a=z7({scrollWindow:r,scrollDroppable:t}),i=q7({move:n,scrollWindow:r,scrollDroppable:t}),s=function(u){if(u.phase==="DRAGGING"){if(u.movementMode==="FLUID"){a.scroll(u);return}u.scrollJumpRequest&&i(u)}},l={scroll:s,start:a.start,stop:a.stop};return l},el="data-rbd",tl=function(){var e=el+"-drag-handle";return{base:e,draggableId:e+"-draggable-id",contextId:e+"-context-id"}}(),tx=function(){var e=el+"-draggable";return{base:e,contextId:e+"-context-id",id:e+"-id"}}(),W7=function(){var e=el+"-droppable";return{base:e,contextId:e+"-context-id",id:e+"-id"}}(),XS={contextId:el+"-scroll-container-context-id"},V7=function(t){return function(r){return"["+r+'="'+t+'"]'}},hc=function(t,r){return t.map(function(n){var a=n.styles[r];return a?n.selector+" { "+a+" }":""}).join(" ")},G7="pointer-events: none;",H7=function(e){var t=V7(e),r=function(){var l=` 500 cursor: -webkit-grab; 501 cursor: grab; 502 `;return{selector:t(tl.contextId),styles:{always:` 503 -webkit-touch-callout: none; 504 -webkit-tap-highlight-color: rgba(0,0,0,0); 505 touch-action: manipulation; 506 `,resting:l,dragging:G7,dropAnimating:l}}}(),n=function(){var l=` 507 transition: `+Gc.outOfTheWay+`; 508 `;return{selector:t(tx.contextId),styles:{dragging:l,dropAnimating:l,userCancel:l}}}(),a={selector:t(W7.contextId),styles:{always:"overflow-anchor: n
508one;"}},i={selector:"body",styles:{dragging:` 509 cursor: grabbing; 510 cursor: -webkit-grabbing; 511 user-select: none; 512 -webkit-user-select: none; 513 -moz-user-select: none; 514 -ms-user-select: none; 515 overflow-anchor: none; 516 `}},s=[n,r,a,i];return{always:hc(s,"always"),resting:hc(s,"resting"),dragging:hc(s,"dragging"),dropAnimating:hc(s,"dropAnimating"),userCancel:hc(s,"userCancel")}},cn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?h.useLayoutEffect:h.useEffect,mg=function(){var t=document.querySelector("head");return t||me(),t},ZS=function(t){var r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.type="text/css",r};function K7(e,t){var r=st(function(){return H7(e)},[e]),n=h.useRef(null),a=h.useRef(null),i=Be(ur(function(f){var m=a.current;m||me(),m.textContent=f}),[]),s=Be(function(f){var m=n.current;m||me(),m.textContent=f},[]);cn(function(){!n.current&&!a.current||me();var f=ZS(t),m=ZS(t);return n.current=f,a.current=m,f.setAttribute(el+"-always",e),m.setAttribute(el+"-dynamic",e),mg().appendChild(f),mg().appendChild(m),s(r.always),i(r.resting),function(){var p=function(v){var g=v.current;g||me(),mg().removeChild(g),v.current=null};p(n),p(a)}},[t,s,i,r.always,r.resting,e]);var l=Be(function(){return i(r.dragging)},[i,r.dragging]),c=Be(function(f){if(f==="DROP"){i(r.dropAnimating);return}i(r.userCancel)},[i,r.dropAnimating,r.userCancel]),u=Be(function(){a.current&&i(r.resting)},[i,r.resting]),d=st(function(){return{dragging:l,dropping:c,resting:u}},[l,c,u]);return d}var qD=function(e){return e&&e.ownerDocument?e.ownerDocument.defaultView:window};function kp(e){return e instanceof qD(e).HTMLElement}function Y7(e,t){var r="["+tl.contextId+'="'+e+'"]',n=uD(document.querySelectorAll(r));if(!n.length)return null;var a=Ki(n,function(i){return i.getAttribute(tl.draggableId)===t});return!a||!kp(a)?null:a}function X7(e){var t=h.useRef({}),r=h.useRef(null),n=h.useRef(null),a=h.useRef(!1),i=Be(function(m,p){var y={id:m,focus:p};return t.current[m]=y,function(){var g=t.current,x=g[m];x!==y&&delete g[m]}},[]),s=Be(function(m){var p=Y7(e,m);p&&p!==document.activeElement&&p.focus()},[e]),l=Be(function(m,p){r.current===m&&(r.current=p)},[]),c=Be(function(){n.current||a.current&&(n.current=requestAnimationFrame(function(){n.current=null;var m=r.current;m&&s(m)}))},[s]),u=Be(function(m){r.current=null;var p=document.activeElement;p&&p.getAttribute(tl.draggableId)===m&&(r.current=m)},[]);cn(function(){return a.current=!0,function(){a.current=!1;var m=n.current;m&&cancelAnimationFrame(m)}},[]);var d=st(function(){return{register:i,tryRecordFocus:u,tryRestoreFocusRecorded:c,tryShiftRecord:l}},[i,u,c,l]);return d}function Z7(){var e={draggables:{},droppables:{}},t=[];function r(f){return t.push(f),function(){var p=t.indexOf(f);p!==-1&&t.splice(p,1)}}function n(f){t.length&&t.forEach(function(m){return m(f)})}function a(f){return e.draggables[f]||null}function i(f){var m=a(f);return m||me(),m}var s={register:function(m){e.draggables[m.descriptor.id]=m,n({type:"ADDITION",value:m})},update:function(m,p){var y=e.draggables[p.descriptor.id];y&&y.uniqueId===m.uniqueId&&(delete e.draggables[p.descriptor.id],e.draggables[m.descriptor.id]=m)},unregister:function(m){var p=m.descriptor.id,y=a(p);y&&m.uniqueId===y.uniqueId&&(delete e.draggables[p],n({type:"REMOVAL",value:m}))},getById:i,findById:a,exists:function(m){return!!a(m)},getAllByType:function(m){return vm(e.draggables).filter(function(p){return p.descriptor.type===m})}};function l(f){return e.droppables[f]||null}function c(f){var m=l(f);return m||me(),m}var u={register:function(m){e.droppables[m.descriptor.id]=m},unregister:function(m){var p=l(m.descriptor.id);p&&m.uniqueId===p.uniqueId&&delete e.droppables[m.descriptor.id]},getById:c,findById:l,exists:function(m){return!!l(m)},getAllByType:function(m){return vm(e.droppables).filter(function(p){return p.descriptor.type===m})}};function d(){e.draggables={},e.droppables={},t.length=0}return{draggable:s,droppable:u,subscribe:r,clean:d}}function Q7(){var e=st(Z7,[]);return h.useEffect(function(){return function(){requestAnimationFrame(e.clean)}},[e]),e}var gw=$.createContext(null),ym=function(){var e=document.body;return e||me(),e},J7={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},eH=function(t){return"rbd-announcement-"+t};function tH(e){var t=st(function(){return eH(e)},[e]),r=h.useRef(null);h.useEffect(function(){var i=document.createElement("div");return r.current=i,i.id=t,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),Ae(i.style,J7),ym().appendChild(i),function(){setTimeout(function(){var c=ym();c.contains(i)&&c.removeChild(i),i===r.current&&(r.current=null)})}},[t]);var n=Be(function(a){var i=r.current;if(i){i.textContent=a;return}},[]);return n}var rH=0,nH={separator:"::"};function yw(e,t){return t===void 0&&(t=nH),st(function(){return""+e+t.separator+rH++},[t.separator,e])}function aH(e){var t=e.contextId,r=e.uniqueId;return"rbd-hidden-text-"+t+"-"+r}function iH(e){var t=e.contextId,r=e.text,n=yw("hidden-text",{separator:"-"}),a=st(function(){return aH({contextId:t,uniqueId:n})},[n,t]);return h.useEffect(function(){var s=document.createElement("div");return s.id=a,s.textContent=r,s.style.display="none",ym().appendChild(s),function(){var c=ym();c.contains(s)&&c.removeChild(s)}},[a,r]),a}var Mp=$.createContext(null);function UD(e){var t=h.useRef(e);return h.useEffect(function(){t.current=e}),t}function oH(){var e=null;function t(){return!!e}function r(s){return s===e}function n(s){e&&me();var l={abandon:s};return e=l,l}function a(){e||me(),e=null}function i(){e&&(e.abandon(),a())}return{isClaimed:t,isActive:r,claim:n,release:a,tryAbandon:i}}var sH=9,lH=13,xw=27,WD=32,cH=33,uH=34,dH=35,fH=36,mH=37,hH=38,pH=39,vH=40,uf,gH=(uf={},uf[lH]=!0,uf[sH]=!0,uf),VD=function(e){gH[e.keyCode]&&e.preventDefault()},Ip=function(){var e="visibilitychange";if(typeof document>"u")return e;var t=[e,"ms"+e,"webkit"+e,"moz"+e,"o"+e],r=Ki(t,function(n){return"on"+n in document});return r||e}(),GD=0,QS=5;function yH(e,t){return Math.abs(t.x-e.x)>=QS||Math.abs(t.y-e.y)>=QS}var JS={type:"IDLE"};function xH(e){var t=e.cancel,r=e.completed,n=e.getPhase,a=e.setPhase;return[{eventName:"mousemove",fn:function(s){var l=s.button,c=s.clientX,u=s.clientY;if(l===GD){var d={x:c,y:u},f=n();if(f.type==="DRAGGING"){s.preventDefault(),f.actions.move(d);return}f.type!=="PENDING"&&me();var m=f.point;if(yH(m,d)){s.preventDefault();
516var p=f.actions.fluidLift(d);a({type:"DRAGGING",actions:p})}}}},{eventName:"mouseup",fn:function(s){var l=n();if(l.type!=="DRAGGING"){t();return}s.preventDefault(),l.actions.drop({shouldBlockNextClick:!0}),r()}},{eventName:"mousedown",fn:function(s){n().type==="DRAGGING"&&s.preventDefault(),t()}},{eventName:"keydown",fn:function(s){var l=n();if(l.type==="PENDING"){t();return}if(s.keyCode===xw){s.preventDefault(),t();return}VD(s)}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(){n().type==="PENDING"&&t()}},{eventName:"webkitmouseforcedown",fn:function(s){var l=n();if(l.type==="IDLE"&&me(),l.actions.shouldRespectForcePress()){t();return}s.preventDefault()}},{eventName:Ip,fn:t}]}function bH(e){var t=h.useRef(JS),r=h.useRef(Di),n=st(function(){return{eventName:"mousedown",fn:function(f){if(!f.defaultPrevented&&f.button===GD&&!(f.ctrlKey||f.metaKey||f.shiftKey||f.altKey)){var m=e.findClosestDraggableId(f);if(m){var p=e.tryGetLock(m,s,{sourceEvent:f});if(p){f.preventDefault();var y={x:f.clientX,y:f.clientY};r.current(),u(p,y)}}}}}},[e]),a=st(function(){return{eventName:"webkitmouseforcewillbegin",fn:function(f){if(!f.defaultPrevented){var m=e.findClosestDraggableId(f);if(m){var p=e.findOptionsForDraggable(m);p&&(p.shouldRespectForcePress||e.canGetLock(m)&&f.preventDefault())}}}}},[e]),i=Be(function(){var f={passive:!1,capture:!0};r.current=Dn(window,[a,n],f)},[a,n]),s=Be(function(){var d=t.current;d.type!=="IDLE"&&(t.current=JS,r.current(),i())},[i]),l=Be(function(){var d=t.current;s(),d.type==="DRAGGING"&&d.actions.cancel({shouldBlockNextClick:!0}),d.type==="PENDING"&&d.actions.abort()},[s]),c=Be(function(){var f={capture:!0,passive:!1},m=xH({cancel:l,completed:s,getPhase:function(){return t.current},setPhase:function(y){t.current=y}});r.current=Dn(window,m,f)},[l,s]),u=Be(function(f,m){t.current.type!=="IDLE"&&me(),t.current={type:"PENDING",point:m,actions:f},c()},[c]);cn(function(){return i(),function(){r.current()}},[i])}var ls;function wH(){}var jH=(ls={},ls[uH]=!0,ls[cH]=!0,ls[fH]=!0,ls[dH]=!0,ls);function SH(e,t){function r(){t(),e.cancel()}function n(){t(),e.drop()}return[{eventName:"keydown",fn:function(i){if(i.keyCode===xw){i.preventDefault(),r();return}if(i.keyCode===WD){i.preventDefault(),n();return}if(i.keyCode===vH){i.preventDefault(),e.moveDown();return}if(i.keyCode===hH){i.preventDefault(),e.moveUp();return}if(i.keyCode===pH){i.preventDefault(),e.moveRight();return}if(i.keyCode===mH){i.preventDefault(),e.moveLeft();return}if(jH[i.keyCode]){i.preventDefault();return}VD(i)}},{eventName:"mousedown",fn:r},{eventName:"mouseup",fn:r},{eventName:"click",fn:r},{eventName:"touchstart",fn:r},{eventName:"resize",fn:r},{eventName:"wheel",fn:r,options:{passive:!0}},{eventName:Ip,fn:r}]}function _H(e){var t=h.useRef(wH),r=st(function(){return{eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==WD)return;var s=e.findClosestDraggableId(i);if(!s)return;var l=e.tryGetLock(s,d,{sourceEvent:i});if(!l)return;i.preventDefault();var c=!0,u=l.snapLift();t.current();function d(){c||me(),c=!1,t.current(),n()}t.current=Dn(window,SH(u,d),{capture:!0,passive:!1})}}},[e]),n=Be(function(){var i={passive:!1,capture:!0};t.current=Dn(window,[r],i)},[r]);cn(function(){return n(),function(){t.current()}},[n])}var hg={type:"IDLE"},NH=120,EH=.15;function CH(e){var t=e.cancel,r=e.getPhase;return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:function(a){a.preventDefault()}},{eventName:"keydown",fn:function(a){if(r().type!=="DRAGGING"){t();return}a.keyCode===xw&&a.preventDefault(),t()}},{eventName:Ip,fn:t}]}function OH(e){var t=e.cancel,r=e.completed,n=e.getPhase;return[{eventName:"touchmove",options:{capture:!1},fn:function(i){var s=n();if(s.type!=="DRAGGING"){t();return}s.hasMoved=!0;var l=i.touches[0],c=l.clientX,u=l.clientY,d={x:c,y:u};i.preventDefault(),s.actions.move(d)}},{eventName:"touchend",fn:function(i){var s=n();if(s.type!=="DRAGGING"){t();return}i.preventDefault(),s.actions.drop({shouldBlockNextClick:!0}),r()}},{eventName:"touchcancel",fn:function(i){if(n().type!=="DRAGGING"){t();return}i.preventDefault(),t()}},{eventName:"touchforcechange",fn:function(i){var s=n();s.type==="IDLE"&&me();var l=i.touches[0];if(l){var c=l.force>=EH;if(c){var u=s.actions.shouldRespectForcePress();if(s.type==="PENDING"){u&&t();return}if(u){if(s.hasMoved){i.preventDefault();return}t();return}i.preventDefault()}}}},{eventName:Ip,fn:t}]}function PH(e){var t=h.useRef(hg),r=h.useRef(Di),n=Be(function(){return t.current},[]),a=Be(function(p){t.current=p},[]),i=st(function(){return{eventName:"touchstart",fn:function(p){if(!p.defaultPrevented){var y=e.findClosestDraggableId(p);if(y){var v=e.tryGetLock(y,l,{sourceEvent:p});if(v){var g=p.touches[0],x=g.clientX,b=g.clientY,j={x,y:b};r.current(),f(v,j)}}}}}},[e]),s=Be(function(){var p={capture:!0,passive:!1};r.current=Dn(window,[i],p)},[i]),l=Be(function(){var m=t.current;m.type!=="IDLE"&&(m.type==="PENDING"&&clearTimeout(m.longPressTimerId),a(hg),r.current(),s())},[s,a]),c=Be(function(){var m=t.current;l(),m.type==="DRAGGING"&&m.actions.cancel({shouldBlockNextClick:!0}),m.type==="PENDING"&&m.actions.abort()},[l]),u=Be(function(){var p={capture:!0,passive:!1},y={cancel:c,completed:l,getPhase:n}
516,v=Dn(window,OH(y),p),g=Dn(window,CH(y),p);r.current=function(){v(),g()}},[c,n,l]),d=Be(function(){var p=n();p.type!=="PENDING"&&me();var y=p.actions.fluidLift(p.point);a({type:"DRAGGING",actions:y,hasMoved:!1})},[n,a]),f=Be(function(p,y){n().type!=="IDLE"&&me();var v=setTimeout(d,NH);a({type:"PENDING",point:y,actions:p,longPressTimerId:v}),u()},[u,n,a,d]);cn(function(){return s(),function(){r.current();var y=n();y.type==="PENDING"&&(clearTimeout(y.longPressTimerId),a(hg))}},[n,s,a]),cn(function(){var p=Dn(window,[{eventName:"touchmove",fn:function(){},options:{capture:!1,passive:!1}}]);return p},[])}var AH={input:!0,button:!0,textarea:!0,select:!0,option:!0,optgroup:!0,video:!0,audio:!0};function HD(e,t){if(t==null)return!1;var r=!!AH[t.tagName.toLowerCase()];if(r)return!0;var n=t.getAttribute("contenteditable");return n==="true"||n===""?!0:t===e?!1:HD(e,t.parentElement)}function TH(e,t){var r=t.target;return kp(r)?HD(e,r):!1}var DH=function(e){return Xn(e.getBoundingClientRect()).center};function $H(e){return e instanceof qD(e).Element}var kH=function(){var e="matches";if(typeof document>"u")return e;var t=[e,"msMatchesSelector","webkitMatchesSelector"],r=Ki(t,function(n){return n in Element.prototype});return r||e}();function KD(e,t){return e==null?null:e[kH](t)?e:KD(e.parentElement,t)}function MH(e,t){return e.closest?e.closest(t):KD(e,t)}function IH(e){return"["+tl.contextId+'="'+e+'"]'}function RH(e,t){var r=t.target;if(!$H(r))return null;var n=IH(e),a=MH(r,n);return!a||!kp(a)?null:a}function LH(e,t){var r=RH(e,t);return r?r.getAttribute(tl.draggableId):null}function FH(e,t){var r="["+tx.contextId+'="'+e+'"]',n=uD(document.querySelectorAll(r)),a=Ki(n,function(i){return i.getAttribute(tx.id)===t});return!a||!kp(a)?null:a}function BH(e){e.preventDefault()}function df(e){var t=e.expected,r=e.phase,n=e.isLockActive;return e.shouldWarn,!(!n()||t!==r)}function YD(e){var t=e.lockAPI,r=e.store,n=e.registry,a=e.draggableId;if(t.isClaimed())return!1;var i=n.draggable.findById(a);return!(!i||!i.options.isEnabled||!LD(r.getState(),a))}function zH(e){var t=e.lockAPI,r=e.contextId,n=e.store,a=e.registry,i=e.draggableId,s=e.forceSensorStop,l=e.sourceEvent,c=YD({lockAPI:t,store:n,registry:a,draggableId:i});if(!c)return null;var u=a.draggable.getById(i),d=FH(r,u.descriptor.id);if(!d||l&&!u.options.canDragInteractiveElements&&TH(d,l))return null;var f=t.claim(s||Di),m="PRE_DRAG";function p(){return u.options.shouldRespectForcePress}function y(){return t.isActive(f)}function v(_,N){df({expected:_,phase:m,isLockActive:y,shouldWarn:!0})&&n.dispatch(N())}var g=v.bind(null,"DRAGGING");function x(_){function N(){t.release(),m="COMPLETED"}m!=="PRE_DRAG"&&(N(),m!=="PRE_DRAG"&&me()),n.dispatch(kG(_.liftActionArgs)),m="DRAGGING";function E(O,P){if(P===void 0&&(P={shouldBlockNextClick:!1}),_.cleanup(),P.shouldBlockNextClick){var C=Dn(window,[{eventName:"click",fn:BH,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(C)}N(),n.dispatch(TD({reason:O}))}return Ae({isActive:function(){return df({expected:"DRAGGING",phase:m,isLockActive:y,shouldWarn:!1})},shouldRespectForcePress:p,drop:function(P){return E("DROP",P)},cancel:function(P){return E("CANCEL",P)}},_.actions)}function b(_){var N=fu(function(O){g(function(){return AD({client:O})})}),E=x({liftActionArgs:{id:i,clientSelection:_,movementMode:"FLUID"},cleanup:function(){return N.cancel()},actions:{move:N}});return Ae({},E,{move:N})}function j(){var _={moveUp:function(){return g(UG)},moveRight:function(){return g(VG)},moveDown:function(){return g(WG)},moveLeft:function(){return g(GG)}};return x({liftActionArgs:{id:i,clientSelection:DH(d),movementMode:"SNAP"},cleanup:Di,actions:_})}function w(){var _=df({expected:"PRE_DRAG",phase:m,isLockActive:y,shouldWarn:!0});_&&t.release()}var S={isActive:function(){return df({expected:"PRE_DRAG",phase:m,isLockActive:y,shouldWarn:!1})},shouldRespectForcePress:p,fluidLift:b,snapLift:j,abort:w};return S}var qH=[bH,_H,PH];function UH(e){var t=e.contextId,r=e.store,n=e.registry,a=e.customSensors,i=e.enableDefaultSensors,s=[].concat(i?qH:[],a||[]),l=h.useState(function(){return oH()})[0],c=Be(function(b,j){b.isDragging&&!j.isDragging&&l.tryAbandon()},[l]);cn(function(){var b=r.getState(),j=r.subscribe(function(){var w=r.getState();c(b,w),b=w});return j},[l,r,c]),cn(function(){return l.tryAbandon},[l.tryAbandon]);for(var u=Be(function(x){return YD({lockAPI:l,registry:n,store:r,draggableId:x})},[l,n,r]),d=Be(function(x,b,j){return zH({lockAPI:l,registry:n,contextId:t,store:r,draggableId:x,forceSensorStop:b,sourceEvent:j&&j.sourceEvent?j.sourceEvent:null})},[t,l,n,r]),f=Be(function(x){return LH(t,x)},[t]),m=Be(function(x){var b=n.draggable.findById(x);return b?b.options:null},[n.draggable]),p=Be(function(){l.isClaimed()&&(l.tryAbandon(),r.getState().phase!=="IDLE"&&r.dispatch(cw()))},[l,r]),y=Be(l.isClaimed,[l]),v=st(function(){return{canGetLock:u,tryGetLock:d,findClosestDraggableId:f,findOptionsForDraggable:m,tryReleaseLock:p,isLockClaimed:y}},[u,d,f,m,p,y]),g=0;g<s.length;g++)s[g](v)}var WH=function(t){return{onBeforeCapture:t.onBeforeCapture,onBeforeDragStart:t.onBeforeDragStart,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd,onDragUpdate:t.onDragUpdate}};function pc(e){return e.current||me(),e.current}function VH(e){var t=e.contextId,r=e.setCallbacks,n=e.sensors,a=e.nonce,i=e.dragHandleUsageInstructions,s=h.useRef(null),l=UD(e),c=Be(function(){return WH(l.current)},[l]),u=tH(t),d=iH({contextId:t,text:i}),f=K7(t,a),m=Be(function(O){pc(s).dispatch(O)},[]),p=st(function(){return jS({publishWhileDragging:IG,updateDroppableScroll:LG,updateDroppableIsEnabled:FG,updateDroppableIsCombine
516Enabled:BG,collectionStarting:RG},m)},[m]),y=Q7(),v=st(function(){return E7(y,p)},[y,p]),g=st(function(){return U7(Ae({scrollWindow:C7,scrollDroppable:v.scrollDroppable},jS({move:AD},m)))},[v.scrollDroppable,m]),x=X7(t),b=st(function(){return j7({announce:u,autoScroller:g,dimensionMarshal:v,focusMarshal:x,getResponders:c,styleMarshal:f})},[u,g,v,x,c,f]);s.current=b;var j=Be(function(){var O=pc(s),P=O.getState();P.phase!=="IDLE"&&O.dispatch(cw())},[]),w=Be(function(){var O=pc(s).getState();return O.isDragging||O.phase==="DROP_ANIMATING"},[]),S=st(function(){return{isDragging:w,tryAbort:j}},[w,j]);r(S);var _=Be(function(O){return LD(pc(s).getState(),O)},[]),N=Be(function(){return oo(pc(s).getState())},[]),E=st(function(){return{marshal:v,focus:x,contextId:t,canLift:_,isMovementAllowed:N,dragHandleUsageInstructionsId:d,registry:y}},[t,v,d,x,_,N,y]);return UH({contextId:t,store:b,registry:y,customSensors:n,enableDefaultSensors:e.enableDefaultSensors!==!1}),h.useEffect(function(){return j},[j]),$.createElement(Mp.Provider,{value:E},$.createElement(hW,{context:gw,store:b},e.children))}var GH=0;function HH(){return st(function(){return""+GH++},[])}function KH(e){var t=HH(),r=e.dragHandleUsageInstructions||Wf.dragHandleUsageInstructions;return $.createElement(_V,null,function(n){return $.createElement(VH,{nonce:e.nonce,contextId:t,setCallbacks:n,dragHandleUsageInstructions:r,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd},e.children)})}var XD=function(t){return function(r){return t===r}},YH=XD("scroll"),XH=XD("auto"),e_=function(t,r){return r(t.overflowX)||r(t.overflowY)},ZH=function(t){var r=window.getComputedStyle(t),n={overflowX:r.overflowX,overflowY:r.overflowY};return e_(n,YH)||e_(n,XH)},QH=function(){return!1},JH=function e(t){return t==null?null:t===document.body?QH()?t:null:t===document.documentElement?null:ZH(t)?t:e(t.parentElement)},rx=function(e){return{x:e.scrollLeft,y:e.scrollTop}},e9=function e(t){if(!t)return!1;var r=window.getComputedStyle(t);return r.position==="fixed"?!0:e(t.parentElement)},t9=function(e){var t=JH(e),r=e9(e);return{closestScrollable:t,isFixedOnPage:r}},r9=function(e){var t=e.descriptor,r=e.isEnabled,n=e.isCombineEnabled,a=e.isFixedOnPage,i=e.direction,s=e.client,l=e.page,c=e.closest,u=function(){if(!c)return null;var p=c.scrollSize,y=c.client,v=MD({scrollHeight:p.scrollHeight,scrollWidth:p.scrollWidth,height:y.paddingBox.height,width:y.paddingBox.width});return{pageMarginBox:c.page.marginBox,frameClient:y,scrollSize:p,shouldClipSubject:c.shouldClipSubject,scroll:{initial:c.scroll,current:c.scroll,max:v,diff:{value:mr,displacement:mr}}}}(),d=i==="vertical"?aw:pD,f=Js({page:l,withPlaceholder:null,axis:d,frame:u}),m={descriptor:t,isCombineEnabled:n,isFixedOnPage:a,axis:d,isEnabled:r,client:s,page:l,frame:u,subject:f};return m},n9=function(t,r){var n=iD(t);if(!r||t!==r)return n;var a=n.paddingBox.top-r.scrollTop,i=n.paddingBox.left-r.scrollLeft,s=a+r.scrollHeight,l=i+r.scrollWidth,c={top:a,right:l,bottom:s,left:i},u=J0(c,n.border),d=ew({borderBox:u,margin:n.margin,border:n.border,padding:n.padding});return d},a9=function(e){var t=e.ref,r=e.descriptor,n=e.env,a=e.windowScroll,i=e.direction,s=e.isDropDisabled,l=e.isCombineEnabled,c=e.shouldClipSubject,u=n.closestScrollable,d=n9(t,u),f=mm(d,a),m=function(){if(!u)return null;var y=iD(u),v={scrollHeight:u.scrollHeight,scrollWidth:u.scrollWidth};return{client:y,page:mm(y,a),scroll:rx(u),scrollSize:v,shouldClipSubject:c}}(),p=r9({descriptor:r,isEnabled:!s,isCombineEnabled:l,isFixedOnPage:n.isFixedOnPage,direction:i,client:d,page:f,closest:m});return p},i9={passive:!1},o9={passive:!0},t_=function(e){return e.shouldPublishImmediately?i9:o9};function xm(e){var t=h.useContext(e);return t||me(),t}var ff=function(t){return t&&t.env.closestScrollable||null};function s9(e){var t=h.useRef(null),r=xm(Mp),n=yw("droppable"),a=r.registry,i=r.marshal,s=UD(e),l=st(function(){return{id:e.droppableId,type:e.type,mode:e.mode}},[e.droppableId,e.mode,e.type]),c=h.useRef(l),u=st(function(){return ur(function(w,S){t.current||me();var _={x:w,y:S};i.updateDroppableScroll(l.id,_)})},[l.id,i]),d=Be(function(){var w=t.current;return!w||!w.env.closestScrollable?mr:rx(w.env.closestScrollable)},[]),f=Be(function(){var w=d();u(w.x,w.y)},[d,u]),m=st(function(){return fu(f)},[f]),p=Be(function(){var w=t.current,S=ff(w);w&&S||me();var _=w.scrollOptions;if(_.shouldPublishImmediately){f();return}m()},[m,f]),y=Be(function(w,S){t.current&&me();var _=s.current,N=_.getDroppableRef();N||me();var E=t9(N),O={ref:N,descriptor:l,env:E,scrollOptions:S};t.current=O;var P=a9({ref:N,descriptor:l,env:E,windowScroll:w,direction:_.direction,isDropDisabled:_.isDropDisabled,isCombine
516Enabled:_.isCombineEnabled,shouldClipSubject:!_.ignoreContainerClipping}),C=E.closestScrollable;return C&&(C.setAttribute(XS.contextId,r.contextId),C.addEventListener("scroll",p,t_(O.scrollOptions))),P},[r.contextId,l,p,s]),v=Be(function(){var w=t.current,S=ff(w);return w&&S||me(),rx(S)},[]),g=Be(function(){var w=t.current;w||me();var S=ff(w);t.current=null,S&&(m.cancel(),S.removeAttribute(XS.contextId),S.removeEventListener("scroll",p,t_(w.scrollOptions)))},[p,m]),x=Be(function(w){var S=t.current;S||me();var _=ff(S);_||me(),_.scrollTop+=w.y,_.scrollLeft+=w.x},[]),b=st(function(){return{getDimensionAndWatchScroll:y,getScrollWhileDragging:v,dragStopped:g,scroll:x}},[g,y,v,x]),j=st(function(){return{uniqueId:n,descriptor:l,callbacks:b}},[b,l,n]);cn(function(){return c.current=j.descriptor,a.droppable.register(j),function(){t.current&&g(),a.droppable.unregister(j)}},[b,l,g,j,i,a.droppable]),cn(function(){t.current&&i.updateDroppableIsEnabled(c.current.id,!e.isDropDisabled)},[e.isDropDisabled,i]),cn(function(){t.current&&i.updateDroppableIsCombineEnabled(c.current.id,e.isCombineEnabled)},[e.isCombineEnabled,i])}function pg(){}var r_={width:0,height:0,margin:AV},l9=function(t){var r=t.isAnimatingOpenOnMount,n=t.placeholder,a=t.animate;return r||a==="close"?r_:{height:n.client.borderBox.height,width:n.client.borderBox.width,margin:n.client.margin}},c9=function(t){var r=t.isAnimatingOpenOnMount,n=t.placeholder,a=t.animate,i=l9({isAnimatingOpenOnMount:r,placeholder:n,animate:a});return{display:n.display,boxSizing:"border-box",width:i.width,height:i.height,marginTop:i.margin.top,marginRight:i.margin.right,marginBottom:i.margin.bottom,marginLeft:i.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:a!=="none"?Gc.placeholder:null}};function u9(e){var t=h.useRef(null),r=Be(function(){t.current&&(clearTimeout(t.current),t.current=null)},[]),n=e.animate,a=e.onTransitionEnd,i=e.onClose,s=e.contextId,l=h.useState(e.animate==="open"),c=l[0],u=l[1];h.useEffect(function(){return c?n!=="open"?(r(),u(!1),pg):t.current?pg:(t.current=setTimeout(function(){t.current=null,u(!1)}),r):pg},[n,c,r]);var d=Be(function(m){m.propertyName==="height"&&(a(),n==="close"&&i())},[n,i,a]),f=c9({isAnimatingOpenOnMount:c,animate:e.animate,placeholder:e.placeholder});return $.createElement(e.placeholder.tagName,{style:f,"data-rbd-placeholder-context-id":s,onTransitionEnd:d,ref:e.innerRef})}var d9=$.memo(u9),bw=$.createContext(null),f9=function(e){M2(t,e);function t(){for(var n,a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return n=e.call.apply(e,[this].concat(i))||this,n.state={isVisible:!!n.props.on,data:n.props.on,animate:n.props.shouldAnimate&&n.props.on?"open":"none"},n.onClose=function(){n.state.animate==="close"&&n.setState({isVisible:!1})},n}t.getDerivedStateFromProps=function(a,i){return a.shouldAnimate?a.on?{isVisible:!0,data:a.on,animate:"open"}:i.isVisible?{isVisible:!0,data:i.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!a.on,data:a.on,animate:"none"}};var r=t.prototype;return r.render=function(){if(!this.state.isVisible)return null;var a={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(a)},t}($.PureComponent),n_={dragging:5e3,dropAnimating:4500},m9=function(t,r){return r?Gc.drop(r.duration):t?Gc.snap:Gc.fluid},h9=function(t,r){return t?r?vu.opacity.drop:vu.opacity.combining:null},p9=function(t){return t.forceShouldAnimate!=null?t.forceShouldAnimate:t.mode==="SNAP"};function v9(e){var t=e.dimension,r=t.client,n=e.offset,a=e.combineWith,i=e.dropping,s=!!a,l=p9(e),c=!!i,u=c?Jy.drop(n,s):Jy.moveTo(n),d={position:"fixed",top:r.marginBox.top,left:r.marginBox.left,boxSizing:"border-box",width:r.borderBox.width,height:r.borderBox.height,transition:m9(l,i),transform:u,opacity:h9(s,c),zIndex:c?n_.dropAnimating:n_.dragging,pointerEvents:"none"};return d}function g9(e){return{transform:Jy.moveTo(e.offset),transition:e.shouldAnimateDisplacement?null:"none"}}function y9(e){return e.type==="DRAGGING"?v9(e):g9(e)}function x9(e,t,r){r===void 0&&(r=mr);var n=window.getComputedStyle(t),a=t.getBoundingClientRect(),i=aD(a,n),s=mm(i,r),l={client:i,tagName:t.tagName.toLowerCase(),display:n.display},c={x:i.marginBox.width,y:i.marginBox.height},u={descriptor:e,placeholder:l,displaceBy:c,client:i,page:s};return u}function b9(e){var t=yw("draggable"),r=e.descriptor,n=e.registry,a=e.getDraggableRef,i=e.canDragInteractiveElements,s=e.shouldRespectForcePress,l=e.isEnabled,c=st(function(){return{canDragInteractiveElements:i,shouldRespectForcePress:s,isEnabled:l}},[i,l,s]),u=Be(function(p){var y=a();return y||me(),x9(r,y,p)},[r,a]),d=st(function(){return{uniqueId:t,descriptor:r,options:c,getDimension:u}},[r,u,c,t]),f=h.useRef(d),m=h.useRef(!0);cn(function(){return n.draggable.register(f.current),function(){return n.draggable.unregister(f.current)}},[n.draggable]),cn(function(){if(m.current){m.current=!1;return}var p=f.current;f.current=d,n.draggable.update(d,p)},[d,n.draggable])}function w9(e){e.preventDefault()}function j9(e){var t=h.useRef(null),r=Be(function(O){t.current=O},[]),n=Be(function(){return t.current},[]),a=xm(Mp),i=a.contextId,s=a.dragHandleUsageInstructionsId,l=a.registry,c=xm(bw),u=c.type,d=c.droppableId,f=st(function(){return{id:e.draggableId,index:e.index,type:u,droppableId:d}},[e.draggableId,e.index,u,d]),m=e.children,p=e.draggableId,y=e.isEnabled,v=e.shouldRespectForcePress,g=e.canDragInteractiveElements,x=e.isClone,b=e.mapped,j=e.dropAnimationFinished;if(!x){var w=st(function(){return{descriptor:f,registry:l,getDraggableRef:n,canDragInteractiveElements:g,shouldRespectForcePress:v,isEnabled:y}},[f,l,n,g,v,y]);b9(w)}var S=st(function(){return y?{tabIndex:0,role:"button","aria-describedby":s,"data-rbd-drag-handle-draggable-id":p,"data-rbd-drag-handle-context-id":i,draggable:!1,onDragStart:w9}:null},[i,s,p,y]),_=Be(function(O){b.type==="DRAGGING"&&b.dropping&&O.propertyName==="transform"&&j()},[j,b]),N=st(function(){var O=y9(b),P=b.type==="DRAGGING"&&b.dropping?_:null,C={innerRef:r,draggableProps:{"data-rbd-draggable-context-id":i,"data-rbd-draggable-id":p,style:O,onTransitionEnd:P},dragHandleProps:S};return C},[i,S,p,b,_,r]),E=st(function(){return{draggableId:f.id,type:f.type,source:{index:f.index,droppableId:f.droppableId}}},[f.droppableId,f.id,f.index,f.type]);return m(N,b.snapshot,E)}var ZD=function(e,t){return e===t},QD=function(e){var t=e.combine,r=e.destination;return r?r.droppableId:t?t.droppableId:null},S9=function(t){return t.combine?t.combine.draggableId:null},_9=function(t){return t.at&&t.at.type==="COMBINE"?t.at.combine.draggableId:null};function N9(){var e=ur(function(a,i){return{x:a,y:i}}),t=ur(function(a,i,s,l,c){return{isDragging:!0,isClone:i,isDropAnimating:!!c,dropAnimation:c,mode:a,draggingOver:s,combineWith:l,combineTargetFor:null}}),r=ur(function(a,i,s,l,c,u,d){return{mapped:{type:"DRAGGING",dropping:null,draggingOver:c,combineWith:u,mode:i,offset:a,dimension:s,forceShouldAnimate:d,snapshot:t(i,l,c,u,null)}}}),n=function(i,s){if(i.isDragging){if(i.critical.draggable.id!==s.draggableId)return null;var l=i.current.client.offset,c=i.dimensions.draggables[s.draggableId],u=ln(i.impact),d=_9(i.impact),f=i.forceShouldAnimate;return r(e(l.x,l.y),i.movementMode,c,s.isClone,u,d,f)}if(i.phase==="DROP_ANIMATING"){var m=i.completed;if(m.result.draggableId!==s.draggableId)return null;var p=s.isClone,y=i.dimensions.draggables[s.draggableId],v=m.result,g=v.mode,x=QD(v),b=S9(v),j=i.dropDuration,w={duration:j,curve:dw.drop,moveTo:i.newHomeClientOffset,opacity:b?vu.opacity.drop:null,
516scale:b?vu.scale.drop:null};return{mapped:{type:"DRAGGING",offset:i.newHomeClientOffset,dimension:y,dropping:w,draggingOver:x,combineWith:b,mode:g,forceShouldAnimate:null,snapshot:t(g,p,x,b,w)}}}return null};return n}function JD(e){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}var E9={mapped:{type:"SECONDARY",offset:mr,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:JD(null)}};function C9(){var e=ur(function(s,l){return{x:s,y:l}}),t=ur(JD),r=ur(function(s,l,c){return l===void 0&&(l=null),{mapped:{type:"SECONDARY",offset:s,combineTargetFor:l,shouldAnimateDisplacement:c,snapshot:t(l)}}}),n=function(l){return l?r(mr,l,!0):null},a=function(l,c,u,d){var f=u.displaced.visible[l],m=!!(d.inVirtualList&&d.effected[l]),p=Tp(u),y=p&&p.draggableId===l?c:null;if(!f){if(!m)return n(y);if(u.displaced.invisible[l])return null;var v=Wl(d.displacedBy.point),g=e(v.x,v.y);return r(g,y,!0)}if(m)return n(y);var x=u.displacedBy.point,b=e(x.x,x.y);return r(b,y,f.shouldAnimate)},i=function(l,c){if(l.isDragging)return l.critical.draggable.id===c.draggableId?null:a(c.draggableId,l.critical.draggable.id,l.impact,l.afterCritical);if(l.phase==="DROP_ANIMATING"){var u=l.completed;return u.result.draggableId===c.draggableId?null:a(c.draggableId,u.result.draggableId,u.impact,u.afterCritical)}return null};return i}var O9=function(){var t=N9(),r=C9(),n=function(i,s){return t(i,s)||r(i,s)||E9};return n},P9={dropAnimationFinished:DD},A9=rD(O9,P9,null,{context:gw,pure:!0,areStatePropsEqual:ZD})(j9);function e$(e){var t=xm(bw),r=t.isUsingCloneFor;return r===e.draggableId&&!e.isClone?null:$.createElement(A9,e)}function T9(e){var t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,r=!!e.disableInteractiveElementBlocking,n=!!e.shouldRespectForcePress;return $.createElement(e$,Ae({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:r,shouldRespectForcePress:n}))}function D9(e){var t=h.useContext(Mp);t||me();var r=t.contextId,n=t.isMovementAllowed,a=h.useRef(null),i=h.useRef(null),s=e.children,l=e.droppableId,c=e.type,u=e.mode,d=e.direction,f=e.ignoreContainerClipping,m=e.isDropDisabled,p=e.isCombineEnabled,y=e.snapshot,v=e.useClone,g=e.updateViewportMaxScroll,x=e.getContainerForClone,b=Be(function(){return a.current},[]),j=Be(function(C){a.current=C},[]);Be(function(){return i.current},[]);var w=Be(function(C){i.current=C},[]),S=Be(function(){n()&&g({maxScroll:RD()})},[n,g]);s9({droppableId:l,type:c,mode:u,direction:d,isDropDisabled:m,isCombineEnabled:p,ignoreContainerClipping:f,getDroppableRef:b});var _=$.createElement(f9,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},function(C){var A=C.onClose,T=C.data,k=C.animate;return $.createElement(d9,{placeholder:T,onClose:A,innerRef:w,animate:k,contextId:r,onTransitionEnd:S})}),N=st(function(){return{innerRef:j,placeholder:_,droppableProps:{"data-rbd-droppable-id":l,"data-rbd-droppable-context-id":r}}},[r,l,_,j]),E=v?v.dragging.draggableId:null,O=st(function(){return{droppableId:l,type:c,isUsingCloneFor:E}},[l,E,c]);function P(){if(!v)return null;var C=v.dragging,A=v.render,T=$.createElement(e$,{draggableId:C.draggableId,index:C.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},function(k,D){return A(k,D,C)});return Ho.createPortal(T,x())}return $.createElement(bw.Provider,{value:O},s(N,y),P())}var vg=function(t,r){return t===r.droppable.type},a_=function(t,r){return r.draggables[t.draggable.id]},$9=function(){var t={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},r=Ae({},t,{shouldAnimatePlaceholder:!1}),n=ur(function(s){return{draggableId:s.id,type:s.type,source:{index:s.index,droppableId:s.droppableId}}}),a=ur(function(s,l,c,u,d,f){var m=d.descriptor.id,p=d.descriptor.droppableId===s;if(p){var y=f?{render:f,dragging:n(d.descriptor)}:null,v={isDraggingOver:c,draggingOverWith:c?m:null,draggingFromThisWith:m,isUsingPlaceholder:!0};return{placeholder:d.placeholder,shouldAnimatePlaceholder:!1,snapshot:v,useClone:y}}if(!l)return r;if(!u)return t;var g={isDraggingOver:c,draggingOverWith:m,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:d.placeholder,shouldAnimatePlaceholder:!0,snapshot:g,useClone:null}}),i=function(l,c){var u=c.droppableId,d=c.type,f=!c.isDropDisabled,m=c.renderClone;if(l.isDragging){var p=l.critical;if(!vg(d,p))return r;var y=a_(p,l.dimensions),v=ln(l.impact)===u;return a(u,f,v,v,y,m)}if(l.phase==="DROP_ANIMATING"){var g=l.completed;if(!vg(d,g.critical))return r;var x=a_(g.critical,l.dimensions);return a(u,f,QD(g.result)===u,ln(g.impact)===u,x,m)}if(l.phase==="IDLE"&&l.completed&&!l.shouldFlush){var b=l.completed;if(!vg(d,b.critical))return r;var j=ln(b.impact)===u,w=!!(b.impact.at&&b.impact.at.type==="COMBINE"),S=b.critical.droppable.
516id===u;return j?w?t:r:S?t:r}return r};return i},k9={updateViewportMaxScroll:qG};function M9(){return document.body||me(),document.body}var I9={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:M9},t$=rD($9,k9,null,{context:gw,pure:!0,areStatePropsEqual:ZD})(D9);t$.defaultProps=I9;function R9({field:e,onEdit:t,onDelete:r,dragHandleProps:n}){return o.jsxs(de,{className:"border border-dashed",children:[o.jsxs(Le,{className:"p-4 pb-2 flex flex-row items-center",children:[o.jsx("div",{...n,className:"cursor-grab mr-2",children:o.jsx(h3,{className:"h-5 w-5 text-muted-foreground"})}),o.jsx(Ie,{className:"text-sm font-medium flex-1",children:e.label}),o.jsxs("div",{className:"flex gap-1",children:[o.jsx(z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>t(e),children:o.jsx(No,{className:"h-4 w-4"})}),o.jsx(z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>r(e.id),children:o.jsx(Jf,{className:"h-4 w-4"})})]})]}),o.jsx(fe,{className:"p-4 pt-0",children:o.jsxs("div",{className:"text-xs text-muted-foreground",children:["Type: ",o.jsx("span",{className:"capitalize",children:e.type})," â¢",e.required?" Required":" Optional",e.mappedColumn&&o.jsxs(o.Fragment,{children:[" ⢠Mapped to: ",o.jsx("span",{className:"font-medium",children:e.mappedColumn})]})]})})]})}var ww="Switch",[L9,WPe]=Lr(ww),[F9,B9]=L9(ww),r$=h.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:i,required:s,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[m,p]=h.useState(null),y=Xe(t,j=>p(j)),v=h.useRef(!1),g=m?d||!!m.closest("form"):!0,[x=!1,b]=hn({prop:a,defaultProp:i,onChange:u});return o.jsxs(F9,{scope:r,checked:x,disabled:l,children:[o.jsx(Me.button,{type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":i$(x),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:y,onClick:ue(e.onClick,j=>{b(w=>!w),g&&(v.current=j.isPropagationStopped(),v.current||j.stopPropagation())})}),g&&o.jsx(z9,{control:m,bubbles:!v.current,name:n,value:c,checked:x,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});r$.displayName=ww;var n$="SwitchThumb",a$=h.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,a=B9(n$,r);return o.jsx(Me.span,{"data-state":i$(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});a$.displayName=n$;var z9=e=>{const{control:t,checked:r,bubbles:n=!0,...a}=e,i=h.useRef(null),s=i0(r),l=o0(t);return h.useEffect(()=>{const c=i.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==r&&f){const m=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(m)}},[s,r,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:i,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function i$(e){return e?"checked":"unchecked"}var o$=r$,q9=a$;const On=h.forwardRef(({className:e,...t},r)=>o.jsx(o$,{className:oe("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:o.jsx(q9,{className:oe("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));On.displayName=o$.displayName;function U9({field:e,open:t,onOpenChange:r,onUpdate:n}){var s;const[a,i]=h.useState(null);return h.useEffect(()=>{t&&e&&i({...e})},[t,e]),a?o.jsx(Ft,{open:t,onOpenChange:r,children:o.jsxs(It,{children:[o.jsx(Ut,{children:o.jsx(Wt,{children:"Field Settings"})}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"field-label",children:"Label"}),o.jsx(we,{id:"field-label",value:a.label,onChange:l=>i({...a,label:l.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"field-
516placeholder",children:"Placeholder (optional)"}),o.jsx(we,{id:"field-placeholder",value:a.placeholder||"",onChange:l=>i({...a,placeholder:l.target.value})})]}),(a.type==="select"||a.type==="radio"||a.type==="checkbox")&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Options"}),o.jsxs("div",{className:"space-y-2",children:[(s=a.options)==null?void 0:s.map((l,c)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{value:l,onChange:u=>{const d=[...a.options||[]];d[c]=u.target.value,i({...a,options:d})}}),o.jsx(z,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{const u=[...a.options||[]];u.splice(c,1),i({...a,options:u})},children:o.jsx(_r,{className:"h-4 w-4"})})]},c)),o.jsxs(z,{variant:"outline",size:"sm",className:"w-full",onClick:()=>{var c;const l=[...a.options||[],`Option ${(((c=a.options)==null?void 0:c.length)||0)+1}`];i({...a,options:l})},children:[o.jsx(wa,{className:"h-4 w-4 mr-2"}),"Add Option"]})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(On,{id:"field-required",checked:a.required,onCheckedChange:l=>i({...a,required:l})}),o.jsx(ne,{htmlFor:"field-required",children:"Required"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"field-mapping",children:"Database Column (optional)"}),o.jsx(we,{id:"field-mapping",value:a.mappedColumn||"",onChange:l=>i({...a,mappedColumn:l.target.value||void 0}),placeholder:"e.g. first_name, email, etc."})]})]}),o.jsxs("div",{className:"flex justify-end gap-4",children:[o.jsx(z,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),o.jsx(z,{onClick:()=>{a&&(n(a),r(!1))},children:"Update Field"})]})]})}):null}const Kt=h.forwardRef(({className:e,...t},r)=>o.jsx("textarea",{className:oe("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
516ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));Kt.displayName="Textarea";var jw="Checkbox",[W9,VPe]=Lr(jw),[V9,G9]=W9(jw),s$=h.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:a,defaultChecked:i,required:s,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[m,p]=h.useState(null),y=Xe(t,w=>p(w)),v=h.useRef(!1),g=m?d||!!m.closest("form"):!0,[x=!1,b]=hn({prop:a,defaultProp:i,onChange:u}),j=h.useRef(x);return h.useEffect(()=>{const w=m==null?void 0:m.form;if(w){const S=()=>b(j.current);return w.addEventListener("reset",S),()=>w.removeEventListener("reset",S)}},[m,b]),o.jsxs(V9,{scope:r,state:x,disabled:l,children:[o.jsx(Me.button,{type:"button",role:"checkbox","aria-checked":Mi(x)?"mixed":x,"aria-required":s,"data-state":u$(x),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:y,onKeyDown:ue(e.onKeyDown,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:ue(e.onClick,w=>{b(S=>Mi(S)?!0:!S),g&&(v.current=w.isPropagationStopped(),v.current||w.stopPropagation())})}),g&&o.jsx(H9,{control:m,bubbles:!v.current,name:n,value:c,checked:x,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Mi(i)?!1:i})]})});s$.displayName=jw;var l$="CheckboxIndicator",c$=h.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...a}=e,i=G9(l$,r);return o.jsx(er,{present:n||Mi(i.state)||i.state===!0,children:o.jsx(Me.span,{"data-state":u$(i.state),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});c$.displayName=l$;var H9=e=>{const{control:t,checked:r,bubbles:n=!0,defaultChecked:a,...i}=e,s=h.useRef(null),l=i0(r),c=o0(t);h.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==r&&p){const y=new Event("click",{bubbles:n});d.indeterminate=Mi(r),p.call(d,Mi(r)?!1:r),d.dispatchEvent(y)}},[l,r,n]);const u=h.useRef(Mi(r)?!1:r);return o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??u.current,...i,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Mi(e){return e==="indeterminate"}function u$(e){return Mi(e)?"indeterminate":e?"checked":"unchecked"}var d$=s$,K9=c$;const ja=h.forwardRef(({className:e,...t},r)=>o.jsx(d$,{ref:r,className:oe("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:o.jsx(K9,{className:oe("flex items-center justify-center text-current"),children:o.jsx(iu,{className:"h-4 w-4"})})}));ja.displayName=d$.displayName;function Sw(){const{data:e,isLoading:t,error:r}=lt({queryKey:["areas-trabajo"],queryFn:async()=>{const{data:n,error:a}=await B.from("TbAreadeTrabajo").select("areNombre, areCodigo, areabreviatura").order("areNombre");if(a)throw console.error("Error fetching areas de trabajo:",a),a;return n},staleTime:9e5,gcTime:18e5,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1});return{areas:e||[],isLoading:t,error:r?r.message:null}}function Y9({value:e=[],onValueChange:t,placeholder:r="Seleccionar áreas"}){const{areas:n,isLoading:a,error:i}=Sw();if(a)return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ye,{className:"h-4 w-4 animate-spin"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Cargando áreas..."})]});if(i)return o.jsxs("div",{className:"text-sm text-red-600",children:["Error al cargar áreas: ",i]});const s=(c,u)=>{t(u?[...e,c]:e.filter(d=>d!==c))},l=c=>{c&&t([])};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"area-trabajo",children:"Ãreas de Trabajo"}),o.jsxs("div",{className:"space-y-3 p-3 border rounded-md",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ja,{id:"sin-area",checked:e.length===0,onCheckedChange:l}),o.jsx(ne,{htmlFor:"sin-area",className:"text-sm font-normal",children:"Sin área especÃfica (todas las áreas)"})]}),o.jsx("div",{className:"border-t pt-3",children:o.jsx("div",{className:"grid grid-cols-2 gap-2 max-h-48 overflow-y-auto",children:n.map(c=>o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ja,{id:c.areNombre,checked:e.includes(c.areNombre),onCheckedChange:u=>s(c.areNombre,u)}
516),o.jsxs(ne,{htmlFor:c.areNombre,className:"text-sm font-normal",children:[c.areNombre," ",c.areabreviatura&&`(${c.areabreviatura})`]})]},c.areNombre))})}),e.length>0&&o.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t",children:[e.length," área",e.length>1?"s":""," seleccionada",e.length>1?"s":""]})]})]})}function X9({initialForm:e,onCancel:t}){const[r,n]=h.useState({id:(e==null?void 0:e.id)||Yy(),name:(e==null?void 0:e.name)||"",description:(e==null?void 0:e.description)||"",fields:(e==null?void 0:e.fields)||[],createdAt:(e==null?void 0:e.createdAt)||new Date,updatedAt:(e==null?void 0:e.updatedAt)||new Date,areaTrabajo:(e==null?void 0:e.areaTrabajo)||[]}),[a,i]=h.useState(!1),[s,l]=h.useState(null),{toast:c}=Rn(),u=or(),[d,f]=h.useState((e==null?void 0:e.areaTrabajo)||[]);h.useEffect(()=>{e&&(n({id:e.id,name:e.name||"",description:e.description||"",fields:e.fields||[],createdAt:e.createdAt||new Date,updatedAt:e.updatedAt||new Date,areaTrabajo:e.areaTrabajo||[]}),f(e.areaTrabajo||[]))},[e]);const m=x=>{n(b=>({...b,fields:b.fields.map(j=>j.id===x.id?x:j)})),l(null)},p=x=>{const b={id:Yy(),type:x,label:"Nuevo Campo",required:!1};n(j=>({...j,fields:[...j.fields,b]}))},y=x=>{n(b=>({...b,fields:b.fields.filter(j=>j.id!==x)}))},v=h.useCallback(x=>{if(!x.destination)return;const b=Array.from(r.fields),[j]=b.splice(x.source.index,1);b.splice(x.destination.index,0,j),n(w=>({...w,fields:b}))},[r.fields]),g=async()=>{if(!r.name.trim()){Z.error("El nombre del formulario es requerido");return}if(r.fields.length===0){Z.error("Debe agregar al menos un campo al formulario");return}i(!0);try{const{data:{session:x}}=await B.auth.getSession();if(!x){Z.error("Debe iniciar sesión para guardar formularios");return}const b={nombre:r.name,descripcion:r.description||null,tipo:"general",campos:r.fields,area_trabajo:d.length>0?d:null};if(e){const{error:j}=await B.from("formularios").update(b).eq("id",r.id);if(j){console.error("Error updating form:",j),Z.error(`Error al actualizar el formulario: ${j.message}`);return}const{error:w}=await B.from("formulario_campos").delete().eq("formulario_id",r.id);if(w){console.error("Error deleting existing fields:",w),Z.error(`Error al eliminar campos existentes: ${w.message}`);return}const S=r.fields.map((N,E)=>({id:N.id,formulario_id:r.id,nombre:N.label,tipo:N.type,etiqueta:N.label,requerido:N.required,opciones:N.options?JSON.stringify(N.options):null,placeholder:N.placeholder||null,orden:E,columna_db:N.mappedColumn||null,validacion:N.validation?JSON.stringify(N.validation):null})),{error:_}=await B.from("formulario_campos").insert(S);if(_){console.error("Error inserting new fields:",_),Z.error(`Error al insertar nuevos campos: ${_.message}`);return}c({title:"Formulario Actualizado",description:"El formulario ha sido actualizado exitosamente."})}else{const{data:j,error:w}=await B.from("formularios").insert([{id:r.id,...b}]).select();if(w){console.error("Error creating form:",w),Z.error(`Error al crear el formulario: ${w.message}`);return}const S=r.fields.map((N,E)=>({id:N.id,formulario_id:r.id,nombre:N.label,tipo:N.type,etiqueta:N.label,requerido:N.required,opciones:N.options?JSON.stringify(N.options):null,placeholder:N.placeholder||null,orden:E,columna_db:N.mappedColumn||null,validacion:N.validation?JSON.stringify(N.validation):null})),{error:_}=await B.from("formulario_campos").insert(S);if(_){console.error("Error inserting fields:",_),Z.error(`Error al insertar los campos: ${_.message}`);return}c({title:"Formulario Creado",description:"El formulario ha sido creado exitosamente."})}u("/forms")}catch(x){console.error("Error saving form:",x),Z.error(`Error al guardar el formulario: ${x instanceof Error?x.message:String(x)}`)}finally{i(!1)}};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-2xl font-bold",children:e?"Editar Formulario":"Nuevo Formulario"}),o.jsx("p",{className:"text-muted-foreground",children:e?"Modifica los campos y opciones de tu formulario.":"Crea un nuevo formulario personalizado."})]}),o.jsx(z,{variant:"destructive",onClick:t,children:"Cancelar"})]}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"name",children:"Nombre del Formulario"}),o.jsx(we,{id:"name",placeholder:"Nombre descriptivo del formulario",value:r.name,onChange:x=>n({...r,name:x.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"description",children:"Descripción (opcional)"}),o.jsx(Kt,{id:"description",placeholder:"Descripción breve del formulario",value:r.description||"",onChange:x=>n({...r,description:x.target.value})})]}),o.jsx(Y9,{value:d,onValueChange:f,placeholder:"Seleccionar áreas de trabajo"}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-xl font-semibold",children:"Campos del Formulario"}),o.jsx("p",{className:"text-muted-foreground",children:"Arrastra y suelta para reordenar los campos."}),o.jsx(KH,{onDragEnd:v,children:o.jsx(t$,{droppableId:"form-fields",children:x=>o.jsxs("div",{...x.droppableProps,ref:x.innerRef,className:"space-y-3",children:[r.fields.map((b,j)=>o.jsx(T9,{draggableId:b.id,index:j,children:w=>o.jsx("div",{ref:w.innerRef,...w.draggableProps,children:o.jsx(R9,{field:b,onEdit:l,onDelete:()=>y(b.id),dragHandleProps:w.dragHandleProps})})},b.id)),x.placeholder]})})})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(z,{type:"button",variant:"outline",onClick:()=>p("text"),children:"Agregar Campo de Texto"}),o.jsx(z,{type:"button",variant:"outline",onClick:()=>
516p("textarea"),children:"Agregar Ãrea de Texto"}),o.jsx(z,{type:"button",variant:"outline",onClick:()=>p("select"),children:"Agregar Selección"}),o.jsx(z,{type:"button",variant:"outline",onClick:()=>p("checkbox"),children:"Agregar Checkbox"})]})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-xl font-semibold",children:"Vista Previa"}),o.jsx("p",{className:"text-muted-foreground",children:"Asà se verá tu formulario."}),o.jsx("div",{className:"border rounded-md p-4",children:o.jsx("div",{className:"space-y-4",children:r.fields.map(x=>{var b;switch(x.type){case"text":return o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:x.id,children:x.label}),o.jsx(we,{type:"text",id:x.id,placeholder:x.placeholder,required:x.required,disabled:!0})]},x.id);case"textarea":return o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:x.id,children:x.label}),o.jsx(Kt,{id:x.id,placeholder:x.placeholder,required:x.required,disabled:!0})]},x.id);case"select":return o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:x.id,children:x.label}),o.jsxs("select",{id:x.id,disabled:!0,className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
516ing-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",children:[o.jsx("option",{value:"",children:x.placeholder||"Selecciona"}),(b=x.options)==null?void 0:b.map(j=>o.jsx("option",{value:j,children:j},j))]})]},x.id);case"checkbox":return o.jsx("div",{className:"space-y-2",children:o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ja,{id:x.id,disabled:!0}),o.jsx(ne,{htmlFor:x.id,children:x.label})]})},x.id);default:return null}})})})]})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(z,{type:"button",variant:"secondary",onClick:t,children:"Cancelar"}),o.jsx(z,{type:"button",onClick:g,disabled:a,children:a?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin"}),"Guardando..."]}):"Guardar Formulario"})]}),o.jsx(U9,{field:s,open:!!s,onOpenChange:x=>!x&&l(null),onUpdate:m})]})}const Z9=Ml("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),pa=h.forwardRef(({className:e,variant:t,...r},n)=>o.jsx("div",{ref:n,role:"alert",className:oe(Z9({variant:t}),e),...r}));pa.displayName="Alert";const Ii=h.forwardRef(({className:e,...t},r)=>o.jsx("h5",{ref:r,className:oe("mb-1 font-medium leading-none tracking-tight",e),...t}));Ii.displayName="AlertTitle";const va=h.forwardRef(({className:e,...t},r)=>o.jsx("div",{ref:r,className:oe("text-sm [&_p]:leading-relaxed",e),...t}));va.displayName="AlertDescription";function Q9(){var u;const{id:e}=up(),t=or(),r=e==="new",[n,a]=h.useState(null);h.useEffect(()=>{async function d(){const{data:{session:f}}=await B.auth.getSession();if(!f){console.error("No session found");return}const{data:m,error:p}=await B.from("profiles").select("role").eq("id",f.user.id).single();if(p){console.error("Error fetching user role:",p);return}m&&(console.log("FormBuilderPage - Direct DB role check:",m.role),a(m.role))}d()},[]);const{data:i,isLoading:s,error:l}=lt({queryKey:["form",e],queryFn:async()=>{if(r)return null;try{console.log(`Cargando formulario con ID: ${e}`);const{data:{session:d},error:f}=await B.auth.getSession();if(f||!d)throw console.error("Error de autenticación:",f),new Error("Debe iniciar sesión para acceder a los formularios");let m=null,p=null;try{const{data:b,error:j}=await B.from("formularios").select("*, area_trabajo").eq("id",e).single();m=b,p=j}catch{console.log("Trying fallback query without area_trabajo");const{data:j,error:w}=await B.from("formularios").select("*").eq("id",e).single();m=j?{...j,area_trabajo:null}:null,p=w}if(p)throw console.error("Error cargando formulario:",p),p.code==="42501"||p.message.includes("permission")?(Z.error("Error de permisos: No tienes acceso para ver este formulario."),new Error("No tienes permisos para ver este formulario")):p;if(!m)throw console.error("Formulario no encontrado"),new Error("Formulario no encontrado");console.log("Datos de formulario cargados:",m);const{data:y,error:v}=await B.from("formulario_campos").select("*").eq("formulario_id",e).order("orden",{ascending:!0});if(v)throw console.error("Error cargando campos:",v),(v.code==="42501"||v.message.includes("permission"))&&Z.error("Error de permisos: No tienes acceso para ver los campos de este formulario."),v;console.log("Campos cargados desde formulario_campos:",(y==null?void 0:y.length)||0,"campos");let g=[];Array.isArray(y)&&y.length>0?(console.log("Transformando campos de formulario_campos..."),g=y.map((b,j)=>{console.log(`Campo ${j+1}:`,b);let w;if(b.opciones)if(typeof b.opciones=="string")try{const _=JSON.parse(b.opciones);w=Array.isArray(_)?_.map(String):void 0}catch(_){console.warn("Error parsing field options:",_),w=void 0}else Array.isArray(b.opciones)&&(w=b.opciones.map(_=>String(_)));let S;
516if(b.validacion)if(typeof b.validacion=="string")try{S=JSON.parse(b.validacion)}catch(_){console.warn("Error parsing field validation:",_),S=void 0}else typeof b.validacion=="object"&&(S=b.validacion);return{id:b.id,type:b.tipo,label:b.etiqueta,required:!!b.requerido,placeholder:b.placeholder||void 0,options:w,validation:S,mappedColumn:b.columna_db||void 0}})):m.campos&&(console.log("No se encontraron campos en formulario_campos, usando campos del formulario..."),g=(Array.isArray(m.campos)?m.campos:m.campos?[m.campos]:[]).map((j,w)=>(console.log(`Campo fallback ${w+1}:`,j),{id:j.id||Yy(),type:j.tipo||j.type||"text",label:j.etiqueta||j.label||`Campo ${w+1}`,required:j.requerido||j.required||!1,placeholder:j.placeholder,options:Array.isArray(j.opciones)?j.opciones.map(String):Array.isArray(j.options)?j.options.map(String):void 0,validation:j.validacion||j.validation,mappedColumn:j.columna_db||j.mappedColumn}))),console.log(`Total de campos transformados: ${g.length}`),g.forEach((b,j)=>{console.log(`Campo final ${j+1}: ID=${b.id}, Type=${b.type}, Label=${b.label}`)});const x={id:m.id,name:m.nombre,description:m.descripcion||void 0,fields:g,createdAt:new Date(m.created_at),updatedAt:new Date(m.updated_at),tableName:m.table_name||void 0,connectionId:m.connection_id||void 0,areaTrabajo:m.area_trabajo||void 0};return console.log("Formulario construido completamente:",x),console.log("Cantidad final de campos:",x.fields.length),x}catch(d){throw console.error("Error en la consulta del formulario:",d),Z.error(`Error cargando el formulario: ${d instanceof Error?d.message:String(d)}`),d}},enabled:!r}),c=()=>{t("/forms")};if(h.useEffect(()=>{(async()=>{const{data:{session:f}}=await B.auth.getSession();f||(Z.error("Debes iniciar sesión para acceder a esta página"),t("/login"))})()},[t]),!r&&s)return o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsxs("div",{className:"text-center",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-primary"}),o.jsx("p",{className:"text-muted-foreground",children:"Cargando formulario..."})]})});if(!r&&l){const d=l instanceof Error&&(l.message.includes("permisos")||l.message.includes("permission"));return o.jsxs("div",{className:"space-y-6",children:[o.jsxs(pa,{variant:"destructive",children:[o.jsx(Kr,{className:"h-4 w-4"}),o.jsx(Ii,{children:"Error cargando el formulario"}),o.jsx(va,{children:d?"No tienes permisos para acceder a este formulario. Se requiere rol de Administrador o Supervisor.":"No se pudo cargar el formulario. Por favor, intenta nuevamente."})]}),n&&o.jsxs(pa,{variant:"default",children:[o.jsx(Qf,{className:"h-4 w-4"}),o.jsx(Ii,{children:"Información de depuración"}),o.jsxs(va,{children:["Tu rol (directo de base de datos): ",n]})]}),o.jsx(z,{onClick:()=>t("/forms"),variant:"outline",className:"mt-4",children:"Volver a la lista de formularios"})]})}return o.jsxs("div",{className:"space-y-6",children:[n&&o.jsxs(pa,{variant:"default",children:[o.jsx(Qf,{className:"h-4 w-4"}),o.jsx(Ii,{children:"Información de depuración"}),o.jsxs(va,{children:["Tu rol (directo de base de datos): ",n,o.jsx("br",{}),i&&`Campos cargados: ${((u=i.fields)==null?void 0:u.length)??0}`]})]}),o.jsx(X9,{initialForm:i,onCancel:c})]})}function Xo(){const e=pn(),{data:t,isLoading:r,error:n,refetch:a}=lt({queryKey:["batch-ot-data"],queryFn:async()=>{const i=new Date;i.setHours(i.getHours()-24);const{data:s,error:l}=await B.from("v_ot_samples_summary").select("*").gte("fecha",i.toISOString()).order("ot_number",{ascending:!1}).limit(300);if(l)throw console.error("Error fetching v_ot_samples_summary:",l),l;const c={};return(s||[]).forEach(u=>{var f;const d=(f=u.ot_number??u.OTnum_orden)==null?void 0:f.toString();d&&(c[d]={otNumber:d,otData:{ot_number:u.ot_number??u.OTnum_orden??null,fecha:u.fecha??u.OTfecha??null,premezcla:u.premezcla??u.OTpremezcla??null,producto_resultante:u.producto_resultante??u.OTprod_resultante??null,area:u.area_trabajo??u.OTarea??u.area??null,supervisor:u.supervisor??u.OTdoc_supervisor??null,jefe_turno:u.jefe_turno??u.OTjefedeturno??null,cant_programada:u.cant_programada??u.OTcant_programada??null,cant_producida:u.cant_producida??u.OTcant_producida??null,muestras_programadas:u.muestras_programadas??null,tiempo_proceso:u.tiempo_proceso??null,cantidad:u.cantidad??null,estado:u.estado??null,exento_muestreo:u.exento_muestreo??!1},procesoOtId:u.proceso_ot_id??null,validacion:null,muestras:[],muestras_count:u.muestras_completadas??0},d==="43610"&&console.log("ð DEBUG: OT 43610 found in v_ot_samples_summary:",{otNumber:d,fecha:u.OTfecha??u.fecha,area:u.OTarea??u.area??u.area_trabajo}))}),c},staleTime:0,gcTime:0,refetchOnWindowFocus:!0,refetchOnMount:!0,refetchOnReconnect:!0,retry:1});return{allOtData:t||{},isLoading:r,error:n,refetch:a,getOtData:i=>
516!i||!t?null:t[i]||null,invalidateCache:()=>{e.invalidateQueries({queryKey:["batch-ot-data"]})}}}function f$({otNumber:e,formId:t,setMuestrasProgramadas:r,toast:n}){const{allOtData:a,isLoading:i,getOtData:s}=Xo(),l=h.useMemo(()=>(e==null?void 0:e.trim())||"",[e]),c=h.useMemo(()=>{var b;if(!l)return null;const m=s(l);if(!(m!=null&&m.otData))return null;const p=m.otData,y=Number(p.cant_programada)||0,v=p.area||"";let g;if(v.includes("BATIDOS"))g=1;else{const j=y*2e-4;j<=1?g=2:g=Math.ceil(j)}const x={ot_numero:((b=p.ot_number)==null?void 0:b.toString())||l,lider_proceso:p.jefe_turno,producto_resultante:p.producto_resultante||p.premezcla,premezcla:p.premezcla,area:p.area,fecha:p.fecha,unidades_programadas:y,unidades_completadas:Number(p.cant_producida)||0,muestras_programadas:g,muestras_completadas:0,turno:"No especificado",supervisor:p.supervisor||p.jefe_turno,estado:p.estado};return x.muestras_programadas&&r&&r(x.muestras_programadas),x},[l,a,r]),u=h.useMemo(()=>{if(!l)return null;const m=s(l);return(m==null?void 0:m.procesoOtId)||null},[l,a]),d=h.useMemo(()=>{if(!l)return[];const m=s(l);if(!(m!=null&&m.muestras))return[];const p=t?m.muestras.filter(y=>y.formulario_id===t):m.muestras;return console.log("ð FILTERED SAMPLES:",{otNumber:l,formId:t,totalSamples:m.muestras.length,filteredSamples:p.length,filteredByFormId:!!t}),p.map(y=>({id:y.id,values:{},date:new Date(y.created_at).toLocaleString(),num_muestra:y.num_muestra||"N/A"}))},[l,t,a]),f=h.useMemo(()=>{if(!l)return 0;const m=s(l);return(m==null?void 0:m.muestras_count)??0},[l,a]);return{otData:c,procesoOtId:u,muestras:d,muestrasCount:f,setMuestras:m=>{console.log("â ï¸ GALLETAS OT: setMuestras called but batch data is read-only:",m)},setProcesoOtId:m=>{console.log("â ï¸ GALLETAS OT: setProcesoOtId called but batch data is read-only:",m)},isLoading:i}}function nx({open:e,onOpenChange:t,children:r,title:n,description:a,hasUnsavedChanges:i=!1,onConfirmClose:s,preventCloseOnEscape:l=!0,preventCloseOnOverlayClick:c=!0}){const[u,d]=h.useState(!1),f=y=>{!y&&i?d(!0):(t(y),s&&!y&&s())},m=()=>{d(!1),t(!1),s&&s()},p=()=>{d(!1)};return h.useEffect(()=>{const y=v=>{v.key==="Escape"&&e&&i&&l&&(v.preventDefault(),d(!0))};return e&&document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}},[e,i,l]),o.jsxs(o.Fragment,{children:[o.jsx(Ft,{open:e,onOpenChange:f,children:o.jsxs(It,{className:"sm:max-w-[600px]",onPointerDownOutside:y=>{i&&c&&(y.preventDefault(),d(!0))},onEscapeKeyDown:y=>{i&&l&&(y.preventDefault(),d(!0))},children:[(n||a)&&o.jsxs(Ut,{children:[n&&o.jsx(Wt,{children:n}),a&&o.jsx(Ul,{children:a})]}),r]})}),o.jsx(T2,{open:u,onOpenChange:d,children:o.jsxs(F0,{children:[o.jsxs(B0,{children:[o.jsxs(q0,{className:"flex items-center gap-2",children:[o.jsx(Kr,{className:"h-5 w-5 text-yellow-500"}),"¿Cerrar sin guardar?"]}),o.jsx(U0,{children:"Tienes cambios no guardados que se perderán si cierras este formulario. ¿Estás seguro de que quieres continuar?"})]}),o.jsxs(z0,{children:[o.jsx(V0,{onClick:p,children:"Continuar editando"}),o.jsx(W0,{onClick:m,className:"bg-red-600 hover:bg-red-700",children:"Cerrar sin guardar"})]})]})})]})}function J9(e){const[t,r]=h.useState(""),{data:n,isLoading:a}=lt({queryKey:["form",e],queryFn:async()=>{if(!e)return null;console.log("Loading form data for ID:",e);const{data:s,error:l}=await B.from("formularios").select("*").eq("id",e).maybeSingle();let c=null;if(l)if(console.error("Error loading form from formularios table:",l),e==="galletas")console.log("Trying hardcoded galletas form data"),c={id:"galletas",nombre:"Control de Proceso Galletas",descripcion:"Formulario para el control de proceso de galletas",tipo:"technical",campos:[]};else{console.log("Trying to find form through its fields in formulario_campos table");const{data:f,error:m}=await B.from("formulario_campos").select("formulario_id").eq("formulario_id",e).limit(1);if(m||!f||f.length===0)throw console.error("Form not found in formulario_campos either:",m||"No fields found"),l;const{data:p,error:y}=await B.from("formularios").select("*").eq("id",e).maybeSingle();y||!p?(console.error("Error loading form from ID found in fields:",y||"No form found"),c={id:e,nombre:"Form "+e,descripcion:"Form details not found",tipo:"unknown",campos:[]}):c=p}else c=s;console.log("Form found in database:",c),c&&r(c.nombre||"Formulario");const{data:u,error:d}=await B.from("formulario_campos").select("*").eq("formulario_id",e).order("orden",{ascending:!0});if(d)console.error("Error loading form fields:",d);else if(u&&u.length>0){console.log("Field data found for form:",u.length,"fields"),console.log("Raw field data:",u);const f=u.map(m=>{let p=m.opciones;if(typeof p=="string")try{p=JSON.parse(p)}catch(v){console.warn("Error parsing field options:",v),p=null}let y=m.validacion;if(typeof y=="string")try{y=JSON.parse(y)}catch(v){console.warn("Error parsing field validation:",v),y=null}return{id:m.id,nombre:m.nombre,tipo:m.tipo,etiqueta:m.etiqueta,requerido:!!m.requerido,placeholder:m.placeholder,opciones:p,orden:m.orden||0,validacion:y,columna_db:m.columna_db}});if(console.log("Formatted fields:",f),c.campos){let m=[];
516if(Array.isArray(c.campos))m=c.campos;else if(typeof c.campos=="object")m=[c.campos];else if(typeof c.campos=="string")try{const y=JSON.parse(c.campos);m=Array.isArray(y)?y:[y]}catch(y){console.warn("Error parsing campos string:",y),m=[]}console.log("Merging existing campos with fields from formulario_campos");const p=new Map;[...m,...f].forEach(y=>{p.set(y.id,y)}),c.campos=Array.from(p.values())}else console.log("Using fields from formulario_campos table"),c.campos=f;console.log("Final form campos:",c.campos)}else console.log("No fields found in formulario_campos table for form:",e);return c.campos?Array.isArray(c.campos)||(console.log("Converting campos to array"),c.campos=typeof c.campos=="object"?[c.campos]:[]):c.campos=[],c},enabled:!!e,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1});return{formData:n,formLoading:a,formName:t,setFormName:r,mapFieldsForRenderer:()=>!n||!n.campos||!Array.isArray(n.campos)?(console.log("No form fields to map"),[]):n.campos.map(s=>(console.log("Mapping field:",s),{id:s.id||String(Math.random()),field_type:s.tipo,label:s.etiqueta||s.nombre||"Campo sin etiqueta",required:!!s.requerido,placeholder:s.placeholder||"",options:Array.isArray(s.opciones)?s.opciones:[]}))}}function eK({formId:e,otNumber:t,formName:r,otData:n,procesoOtId:a,setProcesoOtId:i,muestraNumero:s,muestras:l,setMuestras:c,muestrasProgramadas:u,setFormValues:d,setMuestraNumero:f}){const[m,p]=h.useState(!1),y=or();return{isSubmitting:m,handleSubmit:async g=>{if(!e){Z.error("Faltan datos para enviar el formulario");return}p(!0),console.log("Valores del formulario a enviar:",g);try{if(console.log("Enviando datos:",{formId:e,values:g,muestraNumero:s,otNumber:t}),!t){console.log("Valores del formulario:",g),Z.success("Formulario enviado en modo prueba"),p(!1);return}let x=a;if(x)await B.from("proceso_ot").update({validacion:{...n,formulario_id:e,formulario_nombre:r}}).eq("id",x);else{const{data:N,error:E}=await B.from("proceso_ot").insert({ot_number:t,validacion:{...n,formulario_id:e,formulario_nombre:r}}).select("id").single();if(E)throw console.error("Error creating proceso_ot:",E),E;x=N.id,i(x)}const{data:b,error:j}=await B.from("proceso_ot_muestra").insert({proceso_ot_id:x,num_muestra:s,formulario_id:e}).select("*").single();if(j)throw console.error("Error saving muestra:",j),j;const w=Object.entries(g).map(([N,E])=>({muestra_id:b.id,field_id:N,field_label:N,field_value:typeof E=="string"&&!E.includes("/")?E:null,image_storage_path:typeof E=="string"&&E.includes("/")?E:null,numeric_value:typeof E=="number"?E:null})),{error:S}=await B.from("form_field_responses").insert(w);if(S)throw console.error("Error saving field responses:",S),S;const _={id:b.id,values:g,date:new Date(b.created_at).toLocaleDateString(),num_muestra:s};c([...l,_]),d({}),l.length+1>=u?(Z.success("¡Has completado todas las muestras programadas!"),setTimeout(()=>{y("/dashboard")},2e3)):(Z.success(`Muestra #${s} guardada correctamente. Siguiente muestra: #${s+1}`),f(s+1))}catch(x){console.error("Error submitting form:",x),Z.error("Error al enviar el formulario: "+x.message)}finally{p(!1)}}}}const _w=({staticFase1Data:e,muestrasProgramadas:t,muestrasCount:r,showTitle:n=!1,formId:a,formName:i})=>{if(!e||Object.keys(e).length===0)return o.jsxs("div",{className:"flex justify-center items-center p-4",children:[o.jsx(ye,{className:"w-6 h-6 animate-spin mr-2"}),o.jsx("span",{children:"Cargando datos..."})]});const s=r>=t,l=o.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold",children:"Número de OT:"})," ",o.jsx("span",{children:e["num-ot"]||e.ot_numero||e.OTnum_orden})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold",children:"Turno de trabajo:"})," ",o.jsx("span",{children:e.turno||"No especificado"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold",children:"LÃder proceso:"})," ",o.jsx("span",{children:e.lider||e.lider_proceso||e.OTjefedeturno||"No especificado"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold",children:"Producto:"})," ",o.jsx("span",{children:e.producto||e.producto_resultante||e.OTprod_resultante||"No especificado"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold",children:"UND programadas:"})," ",o.jsx("span",{children:e["und-prog"]||e.unidades_programadas||e.OTcant_programada||0})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold",children:"UND realizadas:"})," ",o.jsx("span",{children:e["und-real"]||e.unidades_completadas||e.OTcant_producida||0})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold",children:"Supervisor:"})," ",o.jsx("span",{children:e.supervisor||"No especificado"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold",children:"Muestras programadas:"})," ",o.jsx("span",{children:t})]}),o.jsxs("div",{children:[o.jsx("span",{className:"font-semibold",children:"Muestras llenadas:"})," ",o.jsxs("span",{className:`${s?"text-green-700 font-bold":""}`,children:[r," / ",t]})]}),a&&i&&o.jsxs("div",{className:"col-span-2 mt-1",children:[o.jsx("span",{className:"font-semibold",children:"Formulario:"})," ",o.jsxs("span",{children:[i," ",o.jsxs("span",{className:"text-gray-500 text-xs",children:["(",a,")"]})]})]}),o.jsxs("div",{className:"col-span-2 mt-2",children:[o.jsx("span",{className:"font-semibold",children:"Estado:"})," ",o.jsx("span",{className:`${s?"text-green-700 font-bold":"text-amber-600"}`,children:s?"Completado":"En Proceso"})]})]});return n?o.jsxs(de,{className:"mb-4",children:[o.jsx(Le,{className:"py-3 px-4",children:o.jsx(Ie,{className:"text-sm font-medium",children:"Fase 1: Información de OT"})}),o.jsx(fe,{className:"py-3 px-4",children:l})]}):l};function tK({otNumber:e,otDataLoading:t,otData:r,muestrasProgramadas:n,muestras:a,formId:i,formName:s,onConfirmPhase1:l}){return o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{children:"Fase 1: Información de OT"})}),o.jsx(fe,{children:t?o.jsxs("div",{className:"flex items-center justify-center h-40",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin mr-2"}),o.jsx("span",{children:"Cargando datos de OT..."})]}):r?o.jsxs("div",{className:"space-y-4",children:[o.jsx(_w,{staticFase1Data:r,muestrasProgramadas:n,muestrasCount:a.length,showTitle:!1,formId:i,formName:s}),o.jsx("div",{className:"flex justify-end",children:o.jsxs(z,{onClick:l,disabled:!r||t,children:["Confirmar y Continuar",o.jsx(Il,{className:"h-4 w-4 ml-1"})]})})]}):o.jsx("div",{className:"text-center p-6 border rounded-md",children:o.jsxs("p",{className:"text-muted-foreground",children:["No se encontraron datos para la OT ",e,". Por favor, verifique el número de OT."]})})})]})}async function m$(e,t={}){const{maxWidth:r=1280,quality:n=.75,format:a="webp"}=t;return e.type.startsWith("image/")?new Promise((i,s)=>{const l=new Image,c=URL.createObjectURL(e);l.onload=()=>{URL.revokeObjectURL(c);let{width:u,height:d}=l;u>r&&(d=Math.round(d*r/u),u=r);const f=document.createElement("canvas");f.width=u,f.height=d;const m=f.getContext("2d");if(!m){s(new Error("Could not get canvas context"));return}m.drawImage(l,0,0,u,d);const p=(g,x,b)=>{f.toBlob(j=>
516{if(!j){if(g==="image/webp"){p("image/jpeg",.8,"jpg");return}s(new Error("Failed to compress image"));return}const w=e.name.replace(/\.[^.]+$/,""),S=new File([j],`${w}.${b}`,{type:g});console.log(`Image compressed: ${(e.size/1024).toFixed(0)}KB â ${(S.size/1024).toFixed(0)}KB (${u}x${d}, ${g}, q=${x})`),i(S)},g,x)};p(a==="webp"?"image/webp":"image/jpeg",n,a==="webp"?"webp":"jpg")},l.onerror=()=>{URL.revokeObjectURL(c),console.warn("Could not load image for compression, returning original"),i(e)},l.src=c}):e}function rK({open:e,onClose:t,onCapture:r}){const n=h.useRef(null),a=h.useRef(null),i=h.useRef(null),[s,l]=h.useState(!1),[c,u]=h.useState(null),[d,f]=h.useState("environment"),m=h.useCallback(async()=>{u(null);try{i.current&&i.current.getTracks().forEach(b=>b.stop());const x=await navigator.mediaDevices.getUserMedia({video:{facingMode:d,width:{ideal:1920},height:{ideal:1080}},audio:!1});i.current=x,n.current&&(n.current.srcObject=x,await n.current.play(),l(!0))}catch(x){console.error("Error accessing camera:",x),u("No se pudo acceder a la cámara. Verifica los permisos del navegador."),l(!1)}},[d]),p=h.useCallback(()=>{i.current&&(i.current.getTracks().forEach(x=>x.stop()),i.current=null),n.current&&(n.current.srcObject=null),l(!1)},[]),y=h.useCallback(()=>{if(!n.current||!a.current)return;const x=n.current,b=a.current,j=1280;let w=x.videoWidth,S=x.videoHeight;w>j&&(S=Math.round(S*j/w),w=j),b.width=w,b.height=S;const _=b.getContext("2d");if(!_)return;_.drawImage(x,0,0,w,S);const N=(E,O,P)=>{b.toBlob(C=>{if(!C&&E==="image/webp"){N("image/jpeg","jpg",.8);return}if(C){const A=new File([C],`webcam_${Date.now()}.${O}`,{type:E});r(A),p(),t()}},E,P)};N("image/webp","webp",.75)},[r,t,p]),v=h.useCallback(()=>{f(x=>x==="user"?"environment":"user")},[]);h.useEffect(()=>(e?m():p(),()=>{p()}),[e,m,p]),h.useEffect(()=>{e&&s&&m()},[d]);const g=()=>{p(),t()};return o.jsx(Ft,{open:e,onOpenChange:x=>!x&&g(),children:o.jsxs(It,{className:"sm:max-w-lg p-0 overflow-hidden",children:[o.jsx(Ut,{className:"p-4 pb-0",children:o.jsx(Wt,{className:"flex items-center justify-between",children:o.jsx("span",{children:"Capturar foto"})})}),o.jsxs("div",{className:"relative bg-black aspect-video",children:[c?o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-white p-4 text-center",children:[o.jsx(Wc,{className:"h-12 w-12 mb-4 opacity-50"}),o.jsx("p",{className:"text-sm",children:c}),o.jsx(z,{variant:"outline",className:"mt-4",onClick:m,children:"Reintentar"})]}):o.jsx("video",{ref:n,autoPlay:!0,playsInline:!0,muted:!0,className:"w-full h-full object-cover"}),o.jsx("canvas",{ref:a,className:"hidden"})]}),o.jsxs("div",{className:"p-4 flex justify-center gap-3",children:[o.jsx(z,{variant:"outline",size:"icon",onClick:v,disabled:!s,title:"Cambiar cámara",children:o.jsx($o,{className:"h-5 w-5"})}),o.jsxs(z,{size:"lg",onClick:y,disabled:!s,className:"px-8",children:[o.jsx(Wc,{className:"h-5 w-5 mr-2"}),"Capturar"]}),o.jsx(z,{variant:"outline",onClick:g,children:"Cancelar"})]})]})})}function h$({field:e,value:t,onChange:r}){const[n,a]=h.useState(null),[i,s]=h.useState(!1),[l,c]=h.useState(!1),u=h.useRef(null),d=h.useRef(null),f=ql();h.useEffect(()=>{if(t&&!t.startsWith("data:")){const{data:w}=B.storage.from("form-images").getPublicUrl(t);a(w.publicUrl)}else t!=null&&t.startsWith("data:")?a(t):a(null)},[t]);const m=async w=>{if(!w.type.startsWith("image/")){ao({title:"Error",description:"Por favor seleccione un archivo de imagen válido.",variant:"destructive"});return}if(w.size>10*1024*1024){ao({title:"Error",description:"La imagen es demasiado grande. Máximo 10MB.",variant:"destructive"});return}s(!0);try{const S=await m$(w),_=new Date().toISOString().replace(/[:.]/g,"-"),N=`upload_${_}_${S.name.replace(/[^a-zA-Z0-9.-]/g,"_")}`,E=`${_}/${N}`,{data:O,error:P}=await B.storage.from("form-images").upload(E,S,{contentType:S.type,cacheControl:"3600",upsert:!1});if(P)throw P;r(O.path),ao({title:"Imagen guardada",description:"La imagen ha sido guardada correctamente."})}catch(S){console.error("Error uploading file:",S),ao({title:"Error",description:"No se pudo subir la imagen.",variant:"destructive"})}finally{s(!1)}},p=async w=>{var _;const S=(_=w.target.files)==null?void 0:_[0];S&&await m(S),w.target.value=""},y=async w=>{var _;const S=(_=w.target.files)==null?void 0:_[0];S&&await m(S),w.target.value=""},v=async w=>{await m(w)},g=()=>{var w;(w=u.current)==null||w.click()},x=()=>{var w;f?(w=d.current)==null||w.click():c(!0)},b=()=>{if(n)try{const w=document.createElement("a");
516w.href=n,w.download=`${e.label}_${new Date().toISOString().slice(0,19).replace(/:/g,"-")}.jpg`,w.target="_blank",document.body.appendChild(w),w.click(),document.body.removeChild(w),ao({title:"Descarga iniciada",description:"La imagen se está descargando."})}catch{ao({title:"Error",description:"No se pudo descargar la imagen.",variant:"destructive"})}},j=()=>{r(null),a(null)};return o.jsxs("div",{className:"space-y-3",children:[o.jsx(ne,{htmlFor:e.id,className:oe(e.required&&"after:content-['*'] after:ml-0.5 after:text-destructive"),children:e.label}),o.jsxs("div",{className:"space-y-3",children:[t&&n?o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"relative border-2 border-dashed border-border rounded-lg overflow-hidden bg-muted/30 p-2",children:[o.jsx("img",{src:n,alt:e.label,className:"max-w-full h-auto mx-auto rounded-md shadow-sm"}),o.jsxs("div",{className:"absolute top-2 right-2 flex gap-1",children:[o.jsx(z,{variant:"outline",size:"icon",className:"bg-background/90 hover:bg-background h-8 w-8",onClick:b,title:"Descargar imagen",type:"button",children:o.jsx(dA,{className:"h-4 w-4"})}),o.jsx(z,{variant:"outline",size:"icon",className:"bg-background/90 hover:bg-background h-8 w-8",onClick:j,title:"Eliminar imagen",type:"button",children:o.jsx(_r,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2 justify-center",children:[o.jsxs(z,{variant:"default",type:"button",onClick:x,disabled:i,children:[o.jsx(Wc,{className:"h-4 w-4 mr-2"}),i?"Guardando...":"Tomar otra foto"]}),!f&&o.jsxs(z,{variant:"outline",type:"button",onClick:g,disabled:i,children:[o.jsx(E1,{className:"h-4 w-4 mr-2"}),"Subir desde galerÃa"]})]})]}):o.jsx("div",{className:"border-2 border-dashed border-border rounded-lg p-6 text-center bg-muted/20",children:o.jsxs("div",{className:"flex flex-col items-center gap-4",children:[o.jsx("div",{className:"p-3 rounded-full bg-muted",children:o.jsx(Wc,{className:"h-8 w-8 text-muted-foreground"})}),o.jsx("p",{className:"text-muted-foreground text-sm",children:f?"Toma una foto con la cámara":"Captura o selecciona una imagen"}),o.jsxs("div",{className:"flex flex-wrap gap-2 justify-center",children:[o.jsxs(z,{variant:"default",type:"button",onClick:x,disabled:i,className:"min-w-[140px]",children:[o.jsx(Wc,{className:"h-4 w-4 mr-2"}),i?"Guardando...":"Abrir cámara"]}),!f&&o.jsxs(z,{variant:"outline",type:"button",onClick:g,disabled:i,className:"min-w-[140px]",children:[o.jsx(E1,{className:"h-4 w-4 mr-2"}),"Subir imagen"]})]})]})}),o.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:p,className:"hidden"}),f&&o.jsx("input",{ref:d,type:"file",accept:"image/*",capture:"environment",onChange:y,className:"hidden"}),o.jsx(rK,{open:l,onClose:()=>c(!1),onCapture:v})]})]})}function nK(e,t=globalThis==null?void 0:globalThis.document){const r=it(e);h.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var aK="DismissableLayer",ax="dismissableLayer.update",iK="dismissableLayer.pointerDownOutside",oK="dism
516issableLayer.focusOutside",i_,p$=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),v$=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...c}=e,u=h.useContext(p$),[d,f]=h.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=h.useState({}),y=Xe(t,N=>f(N)),v=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf(g),b=d?v.indexOf(d):-1,j=u.layersWithOutsidePointerEventsDisabled.size>0,w=b>=x,S=cK(N=>{const E=N.target,O=[...u.branches].some(P=>P.contains(E));!w||O||(a==null||a(N),s==null||s(N),N.defaultPrevented||l==null||l())},m),_=uK(N=>{const E=N.target;[...u.branches].some(P=>P.contains(E))||(i==null||i(N),s==null||s(N),N.defaultPrevented||l==null||l())},m);return nK(N=>{b===u.layers.size-1&&(n==null||n(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},m),h.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(i_=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),o_(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=i_)}},[d,m,r,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),o_())},[d,u]),h.useEffect(()=>{const N=()=>p({});return document.addEventListener(ax,N),()=>document.removeEventListener(ax,N)},[]),o.jsx(Me.div,{...c,ref:y,style:{pointerEvents:j?w?"auto":"none":void 0,...e.style},onFocusCapture:ue(e.onFocusCapture,_.onFocusCapture),onBlurCapture:ue(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:ue(e.onPointerDownCapture,S.onPointerDownCapture)})});v$.displayName=aK;var sK="DismissableLayerBranch",lK=h.forwardRef((e,t)=>{const r=h.useContext(p$),n=h.useRef(null),a=Xe(t,n);return h.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),o.jsx(Me.div,{...e,ref:a})});lK.displayName=sK;function cK(e,t=globalThis==null?void 0:globalThis.document){const r=it(e),n=h.useRef(!1),a=h.useRef(()=>{});return h.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){g$(iK,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function uK(e,t=globalThis==null?void 0:globalThis.document){const r=it(e),n=h.useRef(!1);return h.useEffect(()=>{const a=i=>{i.target&&!n.current&&g$(oK,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function o_(){const e=new CustomEvent(ax);document.dispatchEvent(e)}function g$(e,t,r,{discrete:n}){const a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?Go(a,i):a.dispatchEvent(i)}var gg=0;function dK(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??s_()),document.body.insertAdjacentElement("beforeend",e[1]??s_()),gg++,()=>{gg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),gg--}},[])}function s_(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var yg="focusScope.autoFocusOnMount",xg="focusScope.autoFocusOnUnmount",l_={bubbles:!1,cancelable:!0},fK="FocusScope",y$=h.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...s}=e,[l,c]=h.useState(null),u=it(a),d=it(i),f=h.useRef(null),m=Xe(t,v=>c(v)),p=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(n){let v=function(j){if(p.paused||!l)return;const w=j.target;l.contains(w)?f.current=w:mi(f.current,{select:!0})},g=function(j){if(p.paused||!l)return;const w=j.relatedTarget;w!==null&&(l.contains(w)||mi(f.current,{select:!0}))},x=function(j){if(document.activeElement===document.body)for(const S of j)S.removedNodes.length>0&&mi(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",g);const b=new MutationObserver(x);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",g),b.disconnect()}}},[n,l,p.paused]),h.useEffect(()=>{if(l){u_.add(p);const v=document.activeElement;if(!l.contains(v)){const x=new CustomEvent(yg,l_);l.addEventListener(yg,u),l.dispatchEvent(x),x.defaultPrevented||(mK(yK(x$(l)),{select:!0}),document.activeElement===v&&mi(l))}return()=>{l.removeEventListener(yg,u),setTimeout(()=>{const x=new CustomEvent(xg,l_);l.addEventListener(xg,d),l.dispatchEvent(x),x.defaultPrevented||mi(v??document.body,{select:!0}),l.removeEventListener(xg,d),u_.remove(p)}
vendor: 4,258 bytes, line 516
516,0)}}},[l,u,d,p]);const y=h.useCallback(v=>{if(!r&&!n||p.paused)return;const g=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(g&&x){const b=v.currentTarget,[j,w]=hK(b);j&&w?!v.shiftKey&&x===w?(v.preventDefault(),r&&mi(j,{select:!0})):v.shiftKey&&x===j&&(v.preventDefault(),r&&mi(w,{select:!0})):x===b&&v.preventDefault()}},[r,n,p.paused]);return o.jsx(Me.div,{tabIndex:-1,...s,ref:m,onKeyDown:y})});y$.displayName=fK;function mK(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(mi(n,{select:t}),document.activeElement!==r)return}function hK(e){const t=x$(e),r=c_(t,e),n=c_(t.reverse(),e);return[r,n]}function x$(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function c_(e,t){for(const r of e)if(!pK(r,{upTo:t}))return r}function pK(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function vK(e){return e instanceof HTMLInputElement&&"select"in e}function mi(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&vK(e)&&t&&e.select()}}var u_=gK();function gK(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=d_(e,t),e.unshift(t)},remove(t){var r;e=d_(e,t),(r=e[0])==null||r.resume()}}}function d_(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function yK(e){return e.filter(t=>t.tagName!=="A")}var xK="Portal",b$=h.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[a,i]=h.useState(!1);Ka(()=>i(!0),[]);const s=r||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?Ho.createPortal(o.jsx(Me.div,{...n,ref:t}),s):null});b$.displayName=xK;var w$=Uh(),bg=function(){},Rp=h.forwardRef(function(e,t){var r=h.useRef(null),n=h.useState({onScrollCapture:bg,onWheelCapture:bg,onTouchMoveCapture:bg}),a=n[0],i=n[1],s=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,p=e.noIsolation,y=e.inert,v=e.allowPinchZoom,g=e.as,x=g===void 0?"div":g,b=e.gapMode,j=Wh(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=m,S=Vh([r,t]),_=Rt(Rt({},j),a);return h.createElement(h.Fragment,null,d&&h.createElement(w,{sideCar:w$,removeScrollBar:u,shards:f,noIsolation:p,inert:y,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:b}),s?h.cloneElement(h.Children.only(l),Rt(Rt({},_),{ref:S})):h.createElement(x,Rt({},_,{className:c,ref:S}),l))});Rp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Rp.classNames={fullWidth:Gh,zeroRight:Hh};var ix=!1;if(typeof window<"u")try{var mf=Object.defineProperty({},"passive",{get:function(){return ix=!0,!0}});window.addEventListener("test",mf,mf),window.removeEventListener("test",mf,mf)}catch{ix=!1}var cs=ix?{passive:!1}:!1,bK=function(e){return e.tagName==="TEXTAREA"},j$=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!bK(e)&&r[t]==="visible")},wK=function(e){return j$(e,"overflowY")},jK=function(e){return j$(e,"overflowX")},f_=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=S$(e,n);if(a){var i=_$(e,n),s=i[1],l=i[2];if(s>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},SK=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},_K=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},S$=function(e,t){return e==="v"?wK(t):jK(t)},_$=function(e,t){return e==="v"?SK(t):_K(t)},NK=function(e,t){return e==="h"&&t==="rtl"?-1:1},EK=function(e,t,r,n,a){var i=NK(e,window.getComputedStyle(t).direction),s=i*n,l=r.target,c=t.contains(l),u=!1,d=s>0,f=0,m=0;do{var p=_$(e,l),y=p[0],v=p[1],g=p[2],x=v-g-i*y;(y||x)&&S$(e,l)&&(f+=x,m+=y),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));
vendor: 1,915 bytes, lines 516-519
516return(d&&(Math.abs(f)<1||!a)||!d&&(Math.abs(m)<1||!a))&&(u=!0),u},hf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},m_=function(e){return[e.deltaX,e.deltaY]},h_=function(e){return e&&"current"in e?e.current:e},CK=function(e,t){return e[0]===t[0]&&e[1]===t[1]},OK=function(e){return` 517 .block-interactivity-`.concat(e,` {pointer-events: none;} 518 .allow-interactivity-`).concat(e,` {pointer-events: all;} 519`)},PK=0,us=[];function AK(e){var t=h.useRef([]),r=h.useRef([0,0]),n=h.useRef(),a=h.useState(PK++)[0],i=h.useState(Kh)[0],s=h.useRef(e);h.useEffect(function(){s.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var v=Yh([e.lockRef.current],(e.shards||[]).map(h_),!0).filter(Boolean);return v.forEach(function(g){return g.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),v.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(v,g){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var x=hf(v),b=r.current,j="deltaX"in v?v.deltaX:b[0]-x[0],w="deltaY"in v?v.deltaY:b[1]-x[1],S,_=v.target,N=Math.abs(j)>Math.abs(w)?"h":"v";if("touches"in v&&N==="h"&&_.type==="range")return!1;var E=f_(N,_);if(!E)return!0;if(E?S=N:(S=N==="v"?"h":"v",E=f_(N,_)),!E)return!1;if(!n.current&&"changedTouches"in v&&(j||w)&&(n.current=S),!S)return!0;var O=n.current||S;return EK(O,g,v,O==="h"?j:w,!0)},[]),c=h.useCallback(function(v){var g=v;if(!(!us.length||us[us.length-1]!==i)){var x="deltaY"in g?m_(g):hf(g),b=t.current.filter(function(S){return S.name===g.type&&(S.target===g.target||g.target===S.shadowParent)&&CK(S.delta,x)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}
vendor: 4,570 bytes, line 519
519if(!b){var j=(s.current.shards||[]).map(h_).filter(Boolean).filter(function(S){return S.contains(g.target)}),w=j.length>0?l(g,j[0]):!s.current.noIsolation;w&&g.cancelable&&g.preventDefault()}}},[]),u=h.useCallback(function(v,g,x,b){var j={name:v,delta:g,target:x,should:b,shadowParent:TK(x)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(w){return w!==j})},1)},[]),d=h.useCallback(function(v){r.current=hf(v),n.current=void 0},[]),f=h.useCallback(function(v){u(v.type,m_(v),v.target,l(v,e.lockRef.current))},[]),m=h.useCallback(function(v){u(v.type,hf(v),v.target,l(v,e.lockRef.current))},[]);h.useEffect(function(){return us.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,cs),document.addEventListener("touchmove",c,cs),document.addEventListener("touchstart",d,cs),function(){us=us.filter(function(v){return v!==i}),document.removeEventListener("wheel",c,cs),document.removeEventListener("touchmove",c,cs),document.removeEventListener("touchstart",d,cs)}},[]);var p=e.removeScrollBar,y=e.inert;return h.createElement(h.Fragment,null,y?h.createElement(i,{styles:OK(a)}):null,p?h.createElement(Xh,{gapMode:e.gapMode}):null)}function TK(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const DK=Zh(w$,AK);var N$=h.forwardRef(function(e,t){return h.createElement(Rp,Rt({},e,{ref:t,sideCar:DK}))});N$.classNames=Rp.classNames;var Nw="Popover",[E$,GPe]=Lr(Nw,[$l]),Md=$l(),[$K,Yi]=E$(Nw),C$=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:a,onOpenChange:i,modal:s=!1}=e,l=Md(t),c=h.useRef(null),[u,d]=h.useState(!1),[f=!1,m]=hn({prop:n,defaultProp:a,onChange:i});return o.jsx(a0,{...l,children:o.jsx($K,{scope:t,contentId:Qn(),triggerRef:c,open:f,onOpenChange:m,onOpenToggle:h.useCallback(()=>m(p=>!p),[m]),hasCustomAnchor:u,onCustomAnchorAdd:h.useCallback(()=>d(!0),[]),onCustomAnchorRemove:h.useCallback(()=>d(!1),[]),modal:s,children:r})})};C$.displayName=Nw;var O$="PopoverAnchor",kK=h.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Yi(O$,r),i=Md(r),{onCustomAnchorAdd:s,onCustomAnchorRemove:l}=a;return h.useEffect(()=>(s(),()=>l()),[s,l]),o.jsx(Lh,{...i,...n,ref:t})});kK.displayName=O$;var P$="PopoverTrigger",A$=h.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Yi(P$,r),i=Md(r),s=Xe(t,a.triggerRef),l=o.jsx(Me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":M$(a.open),...n,ref:s,onClick:ue(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:o.jsx(Lh,{asChild:!0,...i,children:l})});A$.displayName=P$;var Ew="PopoverPortal",[MK,IK]=E$(Ew,{forceMount:void 0}),T$=e=>{const{__scopePopover:t,forceMount:r,children:n,container:a}=e,i=Yi(Ew,t);return o.jsx(MK,{scope:t,forceMount:r,children:o.jsx(er,{present:r||i.open,children:o.jsx(b$,{asChild:!0,container:a,children:n})})})};T$.displayName=Ew;var rl="PopoverContent",D$=h.forwardRef((e,t)=>{const r=IK(rl,e.__scopePopover),{forceMount:n=r.forceMount,...a}=e,i=Yi(rl,e.__scopePopover);return o.jsx(er,{present:n||i.open,children:i.modal?o.jsx(RK,{...a,ref:t}):o.jsx(LK,{...a,ref:t})})});D$.displayName=rl;var RK=h.forwardRef((e,t)=>{const r=Yi(rl,e.__scopePopover),n=h.useRef(null),a=Xe(t,n),i=h.useRef(!1);return h.useEffect(()=>{const s=n.current;if(s)return Qh(s)},[]),o.jsx(N$,{as:bd,allowPinchZoom:!0,children:o.jsx($$,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ue(e.onCloseAutoFocus,s=>{var l;s.preventDefault(),i.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ue(e.onPointerDownOutside,s=>{const l=s.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:ue(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),LK=h.forwardRef((e,t)=>{const r=Yi(rl,e.__scopePopover),n=h.useRef(!1),a=h.useRef(!1);return o.jsx($$,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,l;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),i.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const s=i.target;((u=r.triggerRef.current)==null?void 0:u.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),$$=h.forwardRef((e,t)=>
519{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=e,m=Yi(rl,r),p=Md(r);return dK(),o.jsx(y$,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i,children:o.jsx(v$,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),children:o.jsx(r0,{"data-state":M$(m.open),role:"dialog",id:m.contentId,...p,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),k$="PopoverClose",FK=h.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Yi(k$,r);return o.jsx(Me.button,{type:"button",...n,ref:t,onClick:ue(e.onClick,()=>a.onOpenChange(!1))})});FK.displayName=k$;var BK="PopoverArrow",zK=h.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Md(r);return o.jsx(n0,{...a,...n,ref:t})});zK.displayName=BK;function M$(e){return e?"open":"closed"}var qK=C$,UK=A$,WK=T$,I$=D$;const R$=qK,L$=UK,Cw=h.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},a)=>o.jsx(WK,{children:o.jsx(I$,{ref:a,align:t,sideOffset:r,className:oe("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Cw.displayName=I$.displayName;var VK="Separator",p_="horizontal",GK=["horizontal","vertical"],F$=h.forwardRef((e,t)=>{const{decorative:r,orientation:n=p_,...a}=e,i=HK(n)?n:p_,l=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return o.jsx(Me.div,{"data-orientation":i,...l,...a,ref:t})});F$.displayName=VK;function HK(e){return GK.includes(e)}var B$=F$;const Ow=h.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},a)=>o.jsx(B$,{ref:a,decorative:r,orientation:t,className:oe("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Ow.displayName=B$.displayName;function z$({guide:e,glossaryMatches:t=[]}){const[r,n]=h.useState(!1),a=(e==null?void 0:e.valor_min)!=null||(e==null?void 0:e.valor_normal)!=null||(e==null?void 0:e.valor_max)!=null,i=!!(e!=null&&e.no_aplica),s=(e==null?void 0:e.unidad)||"";return!!(e!=null&&e.instrucciones)||!!(e!=null&&e.valor_referencia)||!!(e!=null&&e.imagen_referencia_url)||a||i||t.length>0?o.jsxs(o.Fragment,{children:[o.jsxs(R$,{children:[o.jsx(L$,{asChild:!0,children:o.jsx("button",{type:"button",className:"inline-flex items-center justify-center h-5 w-5 rounded-full text-primary hover:bg-primary/10 transition-colors ml-1","aria-label":"Ayuda del campo",children:o.jsx(Qf,{className:"h-3.5 w-3.5"})})}),o.jsx(Cw,{className:"w-[calc(100vw-1.5rem)] max-w-sm sm:w-80 text-sm max-h-[70vh] overflow-y-auto",side:"bottom",align:"end",sideOffset:8,collisionPadding:12,children:o.jsxs("div",{className:"space-y-3",children:[i&&(e==null?void 0:e.imagen_referencia_url)&&o.jsxs("div",{children:[o.jsx("p",{className:"font-medium text-xs text-muted-foreground uppercase mb-1",children:"Imagen de referencia"}),o.jsx("button",{type:"button",onClick:()=>n(!0),className:"block w-full rounded-md overflow-hidden border hover:opacity-90",children:o.jsx("img",{src:e.imagen_referencia_url,alt:"Referencia",className:"w-full h-32 object-cover"})})]}),i&&!(e!=null&&e.imagen_referencia_url)&&o.jsx("div",{children:o.jsx(ke,{variant:"secondary",children:"N/A â No aplica valor numérico"})}),!i&&a&&o.jsxs("div",{children:[o.jsxs("p",{className:"font-medium text-xs text-muted-foreground uppercase mb-1",children:["Valor de referencia ",s&&o.jsxs("span",{children:["(",s,")"]})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[o.jsxs("div",{className:"rounded-md border p-2",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:"MÃn"}),o.jsx("p",{className:"font-semibold",children:(e==null?void 0:e.valor_min)??"â"})]}),o.jsxs("div",{className:"rounded-md border p-2 bg-primary/5",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:"Normal"}),o.jsx("p",{className:"font-semibold text-primary",children:(e==null?void 0:e.valor_normal)??"â"})]}),o.jsxs("div",{className:"rounded-md border p-2",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:"Máx"}),o.jsx("p",{className:"font-semibold",children:(e==null?void 0:e.valor_max)??"â"})]})]})]}),!i&&!a&&(e==null?void 0:e.valor_referencia)&&o.jsxs("div",{children:[o.jsx("p",{className:"font-medium text-xs text-muted-foreground uppercase mb-1",children:"Valor de referencia"}),o.jsx("p",{className:"font-semibold text-primary",children:e.valor_referencia})]}),(e==null?void 0:e.instrucciones)&&o.jsxs("div",{children:[o.jsx("p",{className:"font-medium text-xs text-muted-foreground uppercase mb-1",children:"Instrucciones"}),o.jsx("p",{children:e.instrucciones})]}),t.length>0&&o.jsxs("div",{children:[o.jsx("p",{className:"font-medium text-xs text-muted-foreground uppercase mb-1",children:"Glosario"}),o.jsx("div",{className:"space-y-1.5",children:t.map(c=>o.jsxs("div",{children:[o.jsx("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("open-glossary",{detail:{termino:c.termino}})),className:"inline-block mr-1 align-middle",title:"Ver en el glosario",children:o.jsx(ke,{variant:"outline",className:"text-xs cursor-pointer hover:bg-accent",children:c.termino})}),o.jsx("span",{className:"text-muted-foreground",children:c.definicion})]},c.termino))})]}),o.jsx(Ow,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"¿Desconoces algún término? Consúltalo."}),o.jsxs(z,{type:"button",variant:"outline",size:"sm",className:"w-full",onClick:()=>window.dispatchEvent(new CustomEvent("open-glossary")),children:[o.jsx(nu,{className:"h-3.5 w-3.5"}),"Ver Glosario"]})]})]})})]}),(e==null?void 0:e.imagen_referencia_url)&&o.jsx(Ft,{open:r,onOpenChange:n,children:o.jsx(It,{className:"max-w-3xl",children:o.jsx("img",{src:e.imagen_referencia_url,alt:"Imagen de referencia",className:"w-full h-auto rounded"})})})]}):null}function q$(e,t,r){const{data:n=[],isLoading:a}
519=lt({queryKey:["guias-producto",e,r],queryFn:async()=>{if(!e)return[];let f=B.from("guias_producto").select("*").eq("producto",e);r&&(f=f.eq("formulario_id",r));const{data:m,error:p}=await f;if(p)throw p;return m},enabled:!!e,staleTime:6e5}),{data:i=[],isLoading:s}=lt({queryKey:["glosario-terminos"],queryFn:async()=>{const{data:f,error:m}=await B.from("glosario_terminos").select("*").order("termino");if(m)throw m;return f},staleTime:10*60*1e3}),{data:l=[],isLoading:c}=lt({queryKey:["manuales-area",t],queryFn:async()=>[],enabled:!!t,staleTime:10*60*1e3});return{guias:n,glosario:i,manuales:l,getFieldGuide:f=>n.find(m=>m.campo_id===f)||null,getGlossaryMatches:f=>{if(!f)return[];const m=f.toLowerCase();return i.filter(p=>m.includes(p.termino.toLowerCase()))},isLoading:a||s||c}}function bm({values:e,onFieldChange:t,formId:r,disabled:n=!1,otNumber:a,producto:i,syncedValues:s,onSyncFieldChange:l,lastUpdatedField:c,activeEditors:u=0}){const[d,f]=h.useState({}),[m,p]=h.useState(e),{getFieldGuide:y,getGlossaryMatches:v}=q$(i,null,r),g=h.useRef(!1);h.useEffect(()=>{!s||Object.keys(s).length===0||p(w=>{let S=!1;const _={...w};for(const[N,E]of Object.entries(s))_[N]!==E&&(_[N]=E,S=!0);return S?_:w})},[s]),h.useEffect(()=>{g.current||(g.current=!0,e&&Object.keys(e).length>0&&p(e))},[e]);const{data:x=[],isLoading:b}=lt({queryKey:["galletasFormFields",r],queryFn:async()=>{const{data:w,error:S}=await B.from("formulario_campos").select("*").eq("formulario_id",r).order("orden",{ascending:!0});return S||!w||w.length===0?(console.log("No fields found for formId:",r,S),[]):w.map(_=>({id:_.id,label:_.etiqueta,field_type:_.tipo,required:!!_.requerido,placeholder:_.placeholder,options:_.opciones}))}}),j=(w,S)=>{if(p(_=>({..._,[w]:S})),t(w,S),l&&l(w,S),d[w]){const _={...d};delete _[w],f(_)}};return h.useEffect(()=>{const w=new Date,S=w.toISOString().split("T")[0],_=w.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});m.fecha||j("fecha",S),m.hora||j("hora",_)},[]),b?o.jsx("div",{children:"Cargando campos del formulario..."}):x.length===0?o.jsx("div",{className:"p-4 bg-yellow-50 border border-yellow-200 rounded-md text-yellow-800",children:"No se encontraron campos definidos para este formulario. Por favor verifique la configuración del formulario en la base de datos."}):o.jsxs("div",{className:"space-y-4",children:[u>0&&o.jsx("div",{className:"flex justify-end",children:o.jsxs(ke,{variant:"outline",className:"flex items-center gap-1",children:[o.jsx(Rl,{className:"h-3 w-3"}),u," editando"]})}),x.map(w=>{const S=(c==null?void 0:c.fieldId)===w.id;return o.jsxs("div",{className:oe("space-y-2 relative transition-all duration-300 p-2 rounded-md",S&&"ring-2 ring-primary/50 bg-primary/5"),children:[o.jsxs(ne,{htmlFor:w.id,className:"flex items-center",children:[w.label,w.required&&o.jsx("span",{className:"text-red-500 ml-1",children:"*"}),o.jsx(z$,{guide:y(w.id),glossaryMatches:v(w.label)}),S&&o.jsx(ke,{variant:"secondary",className:"ml-2 text-xs animate-pulse",children:c.updatedBy})]}),w.field_type==="textarea"?o.jsx(Kt,{id:w.id,value:m[w.id]||"",onChange:_=>j(w.id,_.target.value),placeholder:w.placeholder,className:d[w.id]?"border-red-500":"",disabled:n}):w.field_type==="number"?o.jsx(we,{id:w.id,type:"number",value:m[w.id]||"",onChange:_=>j(w.id,_.target.value?Number(_.target.value):""),placeholder:w.placeholder,className:d[w.id]?"border-red-500":"",disabled:n}):w.field_type==="camera"?o.jsx(h$,{field:{id:w.id,field_type:"camera",label:w.label,required:w.required,placeholder:w.placeholder,options:w.options},value:m[w.id]||null,onChange:_=>j(w.id,_)}):o.jsx(we,{id:w.id,type:w.field_type,value:m[w.id]||"",onChange:_=>j(w.id,_.target.value),placeholder:w.placeholder,className:d[w.id]?"border-red-500":"",disabled:n}),d[w.id]&&o.jsx("p",{className:"text-sm text-red-500",children:d[w.id]})]},w.id)})]})}function v_({field:e,value:t,onChange:r}){const n=e.field_type==="textarea",a=e.field_type==="email"?"email":e.field_type==="date"?"date":e.field_type==="number"?"number":"text",i=t!=null?String(t):"";return o.jsx("div",{className:"space-y-1",children:n?o.jsx(Kt,{id:e.id,name:e.id,placeholder:e.placeholder,value:i,onChange:s=>
519r(s.target.value),required:e.required,className:"w-full"}):o.jsx(we,{id:e.id,name:e.id,type:a,placeholder:e.placeholder,value:i,onChange:s=>r(s.target.value),required:e.required,className:"w-full"})})}function KK({field:e,value:t,onChange:r}){const n=t==null?"":typeof t=="number"||typeof t=="string"&&!isNaN(Number(t))?String(t):(typeof t=="string"&&t.includes("-")&&t.length>30,"");return o.jsx("div",{className:"space-y-1 w-full",children:o.jsx(we,{id:e.id,type:"number",placeholder:e.placeholder||"",value:n,onChange:a=>r(a.target.value),required:e.required,className:"w-full md:max-w-sm",min:e.options&&Array.isArray(e.options)&&e.options[0]?e.options[0]:void 0,max:e.options&&Array.isArray(e.options)&&e.options[1]?e.options[1]:void 0})})}const jt=mB,St=hB,xt=h.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(PP,{ref:n,className:oe("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,o.jsx(lB,{asChild:!0,children:o.jsx(tp,{className:"h-4 w-4 opacity-50"})})]}));xt.displayName=PP.displayName;const U$=h.forwardRef(({className:e,...t},r)=>o.jsx(AP,{ref:r,className:oe("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(n3,{className:"h-4 w-4"})}));U$.displayName=AP.displayName;const W$=h.forwardRef(({className:e,...t},r)=>o.jsx(TP,{ref:r,className:oe("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(tp,{className:"h-4 w-4"})}));W$.displayName=TP.displayName;const bt=h.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>o.jsx(cB,{children:o.jsxs(DP,{ref:a,className:oe("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[o.jsx(U$,{}),o.jsx(uB,{className:oe("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(W$,{})]})}));bt.displayName=DP.displayName;const YK=h.forwardRef(({className:e,...t},r)=>o.jsx($P,{ref:r,className:oe("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));YK.displayName=$P.displayName;const $e=h.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(kP,{ref:n,className:oe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(dB,{children:o.jsx(iu,{className:"h-4 w-4"})})}),o.jsx(fB,{children:t})]}));$e.displayName=kP.displayName;const XK=h.forwardRef(({className:e,...t},r)=>o.jsx(MP,{ref:r,className:oe("-mx-1 my-1 h-px bg-muted",e),...t}));XK.displayName=MP.displayName;function ZK({field:e,value:t,onChange:r}){const n=Array.isArray(e.options)?e.options:[];return o.jsx("div",{className:"space-y-1",children:o.jsxs(jt,{value:t||"",onValueChange:a=>r(a),children:[o.jsx(xt,{id:e.id,className:"w-full bg-white",children:o.jsx(St,{placeholder:e.placeholder||"Seleccione una opción"})}),o.jsx(bt,{children:n.map((a,i)=>o.jsx($e,{value:a,children:a},i))})]})})}function QK({field:e,value:t,onChange:r}){var l;const n=e.id,a=e.required,i=Array.isArray(t)?t:[],s=(c,u)=>{const d=i,f=u?[...d,c]:d.filter(m=>m!==c);r(n,f)};return o.jsx("div",{className:"space-y-2",children:(l=e.options)==null?void 0:l.map((c,u)=>o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ja,{id:`${n}-${u}`,checked:(i==null?void 0:i.includes(c))||!1,onCheckedChange:d=>s(c,!!d),required:a}),o.jsx(ne,{htmlFor:`${n}-${u}`,children:c})]},u))})}function JK(e,t=[]){let r=[];function n(i,s){const l=h.createContext(s),c=r.length;r=[...r,s];function u(f){const{scope:m,children:p,...y}=f,v=(m==null?void 0:m[e][c])||l,g=h.useMemo(()=>y,Object.values(y));return o.jsx(v.Provider,{value:g,children:p})}function d(f,m){const p=(m==null?void 0:m[e][c])||l,y=h.useContext(p);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const a=()=>{const i=r.map(s=>h.createContext(s));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[n,eY(a,...t)]}function eY(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));
vendor: 4,222 bytes, line 519
519return function(i){const s=n.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var wg="rovingFocusGroup.onEntryFocus",tY={bubbles:!1,cancelable:!0},Lp="RovingFocusGroup",[ox,V$,rY]=Rh(Lp),[nY,Hl]=JK(Lp,[rY]),[aY,iY]=nY(Lp),G$=h.forwardRef((e,t)=>o.jsx(ox.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(ox.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(oY,{...e,ref:t})})}));G$.displayName=Lp;var oY=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,m=h.useRef(null),p=Xe(t,m),y=kl(i),[v=null,g]=hn({prop:s,defaultProp:l,onChange:c}),[x,b]=h.useState(!1),j=it(u),w=V$(r),S=h.useRef(!1),[_,N]=h.useState(0);return h.useEffect(()=>{const E=m.current;if(E)return E.addEventListener(wg,j),()=>E.removeEventListener(wg,j)},[j]),o.jsx(aY,{scope:r,orientation:n,dir:y,loop:a,currentTabStopId:v,onItemFocus:h.useCallback(E=>g(E),[g]),onItemShiftTab:h.useCallback(()=>b(!0),[]),onFocusableItemAdd:h.useCallback(()=>N(E=>E+1),[]),onFocusableItemRemove:h.useCallback(()=>N(E=>E-1),[]),children:o.jsx(Me.div,{tabIndex:x||_===0?-1:0,"data-orientation":n,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:ue(e.onMouseDown,()=>{S.current=!0}),onFocus:ue(e.onFocus,E=>{const O=!S.current;if(E.target===E.currentTarget&&O&&!x){const P=new CustomEvent(wg,tY);if(E.currentTarget.dispatchEvent(P),!P.defaultPrevented){const C=w().filter(M=>M.focusable),A=C.find(M=>M.active),T=C.find(M=>M.id===v),D=[A,T,...C].filter(Boolean).map(M=>M.ref.current);Y$(D,d)}}S.current=!1}),onBlur:ue(e.onBlur,()=>b(!1))})})}),H$="RovingFocusGroupItem",K$=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:i,...s}=e,l=Qn(),c=i||l,u=iY(H$,r),d=u.currentTabStopId===c,f=V$(r),{onFocusableItemAdd:m,onFocusableItemRemove:p}=u;return h.useEffect(()=>{if(n)return m(),()=>p()},[n,m,p]),o.jsx(ox.ItemSlot,{scope:r,id:c,focusable:n,active:a,children:o.jsx(Me.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:ue(e.onMouseDown,y=>{n?u.onItemFocus(c):y.preventDefault()}),onFocus:ue(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:ue(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=cY(y,u.orientation,u.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let x=f().filter(b=>b.focusable).map(b=>b.ref.current);if(v==="last")x.reverse();else if(v==="prev"||v==="next"){v==="prev"&&x.reverse();const b=x.indexOf(y.currentTarget);x=u.loop?uY(x,b+1):x.slice(b+1)}setTimeout(()=>Y$(x))}})})})});K$.displayName=H$;var sY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function lY(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function cY(e,t,r){const n=lY(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return sY[n]}function Y$(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function uY(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Pw=G$,Aw=K$,Tw="Radio",[dY,X$]=Lr(Tw),[fY,mY]=dY(Tw),Z$=h.forwardRef((e,t)=>{const{__scopeRadio:r,name:n,checked:a=!1,required:i,disabled:s,value:l="on",onCheck:c,form:u,...d}=e,[f,m]=h.useState(null),p=Xe(t,g=>m(g)),y=h.useRef(!1),v=f?u||!!f.closest("form"):!0;return o.jsxs(fY,{scope:r,checked:a,disabled:s,children:[o.jsx(Me.button,{type:"button",role:"radio","aria-checked":a,"data-state":ek(a),"data-disabled":s?"":void 0,disabled:s,value:l,...d,ref:p,onClick:ue(e.onClick,g=>{a||c==null||c(),v&&(y.current=g.isPropagationStopped(),y.current||g.stopPropagation())})}),v&&o.jsx(hY,{control:f,bubbles:!y.current,name:n,value:l,checked:a,required:i,disabled:s,form:u,style:{transform:"translateX(-100%)"}})]})});Z$.displayName=Tw;var Q$="RadioIndicator",J$=h.forwardRef((e,t)=>
vendor: 1,950 bytes, line 519
519{const{__scopeRadio:r,forceMount:n,...a}=e,i=mY(Q$,r);return o.jsx(er,{present:n||i.checked,children:o.jsx(Me.span,{"data-state":ek(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t})})});J$.displayName=Q$;var hY=e=>{const{control:t,checked:r,bubbles:n=!0,...a}=e,i=h.useRef(null),s=i0(r),l=o0(t);return h.useEffect(()=>{const c=i.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==r&&f){const m=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(m)}},[s,r,n]),o.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:i,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function ek(e){return e?"checked":"unchecked"}var pY=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Dw="RadioGroup",[vY,HPe]=Lr(Dw,[Hl,X$]),tk=Hl(),rk=X$(),[gY,yY]=vY(Dw),nk=h.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:n,defaultValue:a,value:i,required:s=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...m}=e,p=tk(r),y=kl(u),[v,g]=hn({prop:i,defaultProp:a,onChange:f});return o.jsx(gY,{scope:r,name:n,required:s,disabled:l,value:v,onValueChange:g,children:o.jsx(Pw,{asChild:!0,...p,orientation:c,dir:y,loop:d,children:o.jsx(Me.div,{role:"radiogroup","aria-required":s,"aria-orientation":c,"data-disabled":l?"":void 0,dir:y,...m,ref:t})})})});nk.displayName=Dw;var ak="RadioGroupItem",ik=h.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...a}=e,i=yY(ak,r),s=i.disabled||n,l=tk(r),c=rk(r),u=h.useRef(null),d=Xe(t,u),f=i.value===a.value,m=h.useRef(!1);return h.useEffect(()=>{const p=v=>{pY.includes(v.key)&&(m.current=!0)},y=()=>m.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",y),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",y)}},[]),o.jsx(Aw,{asChild:!0,...l,focusable:!s,active:f,children:o.jsx(Z$,{disabled:s,required:i.required,
519checked:f,...c,...a,name:i.name,ref:d,onCheck:()=>i.onValueChange(a.value),onKeyDown:ue(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:ue(a.onFocus,()=>{var p;m.current&&((p=u.current)==null||p.click())})})})});ik.displayName=ak;var xY="RadioGroupIndicator",ok=h.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,a=rk(r);return o.jsx(J$,{...a,...n,ref:t})});ok.displayName=xY;var sk=nk,lk=ik,bY=ok;const ck=h.forwardRef(({className:e,...t},r)=>o.jsx(sk,{className:oe("grid gap-2",e),...t,ref:r}));ck.displayName=sk.displayName;const uk=h.forwardRef(({className:e,...t},r)=>o.jsx(lk,{ref:r,className:oe("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:o.jsx(bY,{className:"flex items-center justify-center",children:o.jsx(f0,{className:"h-2.5 w-2.5 fill-current text-current"})})}));uk.displayName=lk.displayName;function wY({field:e,value:t,onChange:r}){var i;const n=e.id,a=e.required;return o.jsx("div",{className:"space-y-1",children:o.jsx(ck,{value:t||"",onValueChange:s=>r(n,s),required:a,children:(i=e.options)==null?void 0:i.map((s,l)=>o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(uk,{value:s,id:`${n}-${l}`}),o.jsx(ne,{htmlFor:`${n}-${l}`,children:s})]},l))})})}function sx({fields:e,onSubmit:t,initialValues:r={},isSubmitting:n=!1,title:a,description:i,formId:s,syncedValues:l,onSyncFieldChange:c,lastUpdatedField:u,activeEditors:d=0,producto:f}){const[m,p]=h.useState(r),{getFieldGuide:y,getGlossaryMatches:v}=q$(f,null,s),g=h.useRef(!1);h.useEffect(()=>{!l||Object.keys(l).length===0||p(w=>{let S=!1;const _={...w};for(const[N,E]of Object.entries(l))_[N]!==E&&(_[N]=E,S=!0);return S?_:w})},[l]),h.useEffect(()=>{g.current||(g.current=!0,r&&Object.keys(r).length>0&&p(r))},[r]);const x=(w,S)=>{p(_=>({..._,[w]:S})),c&&c(w,S)},b=w=>{w.preventDefault(),t(m)},j=w=>{const S=m[w.id]||"",_=(u==null?void 0:u.fieldId)===w.id,N=E=>o.jsxs("div",{className:oe("relative transition-all duration-300",_&&"ring-2 ring-primary/50 rounded-md"),children:[E,_&&o.jsx(ke,{variant:"secondary",className:"absolute -top-2 -right-2 text-xs animate-pulse",children:u.updatedBy})]});switch(w.field_type){case"text":case"email":case"date":case"textarea":return N(o.jsx(v_,{field:w,value:S,onChange:E=>x(w.id,E)},w.id));case"number":return N(o.jsx(KK,{field:w,value:S,onChange:E=>x(w.id,E)},w.id));case"select":return N(o.jsx(ZK,{field:w,value:S,onChange:E=>x(w.id,E)},w.id));case"checkbox":return N(o.jsx(QK,{field:w,value:S,onChange:x},w.id));case"radio":return N(o.jsx(wY,{field:w,value:S,onChange:x},w.id));case"camera":return N(o.jsx(h$,{field:w,value:S,onChange:E=>x(w.id,E)},w.id));default:return N(o.jsx(v_,{field:w,value:S,onChange:E=>x(w.id,E)},w.id))}};return o.jsxs(de,{className:"w-full",children:[(a||i||d>0)&&o.jsx(Le,{className:"p-3 sm:p-6",children:o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0",children:[a&&o.jsx(Ie,{className:"text-base sm:text-lg",children:a}),i&&o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:i})]}),d>0&&o.jsxs(ke,{variant:"outline",className:"flex items-center gap-1 shrink-0",children:[o.jsx(Rl,{className:"h-3 w-3"}),d," editando"]})]})}),o.jsx(fe,{className:"p-3 sm:p-6 pt-0 sm:pt-0",children:o.jsxs("form",{onSubmit:b,className:"space-y-4 sm:space-y-6",children:[e.map(w=>o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center mb-1",children:[o.jsx(ne,{className:"text-sm font-medium",children:w.label}),w.required&&o.jsx("span",{className:"text-destructive ml-1",children:"*"}),o.jsx(z$,{guide:y(w.id),glossaryMatches:v(w.label)})]}),j(w)]},w.id)),o.jsx("div",{className:"pt-4",children:o.jsx(z,{type:"submit",disabled:n,className:"w-full",children:n?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):o.jsxs(o.Fragment,{children:[o.jsx(p0,{className:"mr-2 h-4 w-4"}),"Enviar Formulario"]})})})]})})]})}function jY({muestraNumero:e,muestrasProgramadas:t,otNumber:r,formData:n,formValues:a,onFieldChange:i,formId:s,isGalletasForm:l,hasFormFields:c,formFields:u,isSubmitting:d,onSubmit:f,onBack:m,producto:p}){const y=or();return o.jsxs("div",{className:"space-y-4",children:[e&&r&&o.jsx("div",{className:"bg-muted p-3 rounded-md mb-4",children:o.jsxs("p",{className:"font-medium",children:["Muestra #",e," de ",t]})}),o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{children:r?"Fase 2: Llenado de Formulario":"Vista previa del formulario"})}),o.jsxs(fe,{children:[l?o.jsx(bm,{values:a,onFieldChange:i,formId:s,otNumber:r,producto:p}):o.jsx(o.Fragment,{children:c?o.jsx(sx,{fields:u,onSubmit:f,initialValues:a,isSubmitting:d,title:n==null?void 0:n.nombre,description:n==null?void 0:n.descripcion,formId:s,producto:p}):o.jsxs("div",{className:"text-center p-6 border rounded-md",children:[o.jsx("p",{className:"text-muted-foreground",children:"Este formulario no tiene campos definidos. Por favor, edite el formulario para agregar campos."}),o.jsx(z,{variant:"outline",className:"mt-4",onClick:()=>y(`/forms/edit/${s}`),children:"Editar Formulario"})]})}),l&&r&&o.jsxs("div",{className:"mt-6 flex gap-2",children:[o.jsx(z,{onClick:()=>f(a),disabled:d,className:"flex-1",children:d?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):o.jsxs(o.Fragment,{children:[o.jsx(p0,{className:"mr-2 h-4 w-4"}),"Enviar Muestra #",e]})}),o.jsxs(z,{variant:"outline",onClick:m,children:[o.jsx(_r,{className:"mr-2 h-4 w-4"}),"Cancelar"]})]}),l&&!r&&o.jsx("div",{className:"mt-6",children:o.jsx(z,{onClick:()=>y(-1),variant:"outline",className:"w-full",children:"Volver"})})]})]})]})}function SY(){const{id:e}=up(),[t]=uT(),r=t.get("ot"),n=e,a=or(),[i,s]=h.useState(r?"phase1":"phase2"),[l,c]=h.useState(5),[u,d]=h.useState({}),[f,m]=h.useState(null),[p,y]=h.useState(!1),{otData:v,procesoOtId:g,muestras:x,setMuestras:b,setProcesoOtId:j,isLoading:w}=f$({otNumber:r||"",setMuestrasProgramadas:c,toast:Z}),{formData:S,formLoading:_,formName:N,setFormName:E,mapFieldsForRenderer:O}=J9(n),{isSubmitting:P,handleSubmit:C}=eK({formId:n,otNumber:r,formName:N,otData:v,procesoOtId:g,setProcesoOtId:j,muestraNumero:f,muestras:x,setMuestras:b,muestrasProgramadas:l,setFormValues:d,setMuestraNumero:m}),A=Object.keys(u).some(V=>{const re=u[V];return re!==void 0&&re!==""&&re!==null}),T=(V,re)=>{console.log(`Field ${V} changed to:`,re),d(H=>({...H,[V]:re}))},k=()=>
519{if(!r){Z.error("No se ha seleccionado una OT");return}if(!v){Z.error("No se ha podido cargar la información de la OT");return}s("phase2");const V=x.length+1;m(V),Z.success(`Muestra #${V} - OT: ${r}`)},D=()=>{i==="phase2"&&r?A?y(!0):s("phase1"):A?y(!0):a("/dashboard")},M=()=>{A?y(!0):a("/dashboard")},F=()=>{y(!1),i==="phase2"&&r?s("phase1"):a("/dashboard")};if(h.useEffect(()=>{const V=re=>{A&&(re.preventDefault(),re.returnValue="Tienes cambios no guardados que se perderán")};return window.addEventListener("beforeunload",V),()=>{window.removeEventListener("beforeunload",V)}},[A]),h.useEffect(()=>{n&&n==="galletas"&&r?document.title=`Control de Proceso Galletas - OT: ${r}`:S&&(document.title=`${S.nombre} - ${r?`OT: ${r}`:"Vista previa"}`)},[n,r,S]),h.useEffect(()=>{S&&(console.log("Current form data:",S),console.log("Form fields count:",S.campos?Array.isArray(S.campos)?S.campos.length:"not an array":"no campos"))},[S]),!n)return o.jsx("div",{className:"flex items-center justify-center h-screen",children:o.jsxs("div",{className:"text-center",children:[o.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Formulario no encontrado"}),o.jsx("p",{className:"mb-4",children:"No se ha especificado un ID de formulario válido."}),o.jsx(z,{onClick:()=>a("/dashboard"),children:"Volver al Dashboard"})]})});const q=n==="galletas",I=n==="validation",K=n==="technical";if(h.useEffect(()=>{I?a(`/preview/validation${r?`?ot=${r}`:""}`):K&&a(`/preview/technical${r?`?ot=${r}`:""}`)},[I,K,r,a]),_)return o.jsxs("div",{className:"flex flex-col items-center justify-center h-screen",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin mb-4"}),o.jsx("p",{children:"Cargando formulario..."})]});const W=O(),R=W.length>0;return console.log("Mapped form fields:",W),q&&(!R||!(S!=null&&S.campos)||S.campos.length===0)&&console.warn("Galletas form has no fields defined in database."),o.jsx("div",{className:"min-h-screen bg-background",children:o.jsxs("div",{className:"container mx-auto py-6 space-y-6",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(z,{variant:"ghost",size:"sm",onClick:D,children:[o.jsx(Ao,{className:"h-4 w-4 mr-1"}),i==="phase2"&&r?"Volver a Fase 1":"Volver"]}),o.jsxs("h1",{className:"text-2xl font-bold",children:[(S==null?void 0:S.nombre)||"Formulario de Control de Proceso",r&&o.jsxs("span",{className:"ml-2 text-muted-foreground",children:["OT: ",r]})]})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsxs(z,{variant:"outline",onClick:M,children:[o.jsx(Sy,{className:"h-4 w-4 mr-2"}),"Ir a Dashboard"]})})]}),i==="phase1"&&r?o.jsx(tK,{otNumber:r,otDataLoading:w,otData:v,muestrasProgramadas:l,muestras:x,formId:n,formName:N,onConfirmPhase1:k}):o.jsx(jY,{muestraNumero:f,muestrasProgramadas:l,otNumber:r,formData:S,formValues:u,onFieldChange:T,formId:n,isGalletasForm:q,hasFormFields:R,formFields:W,isSubmitting:P,onSubmit:C,onBack:D}),o.jsx(nx,{open:p,onOpenChange:y,title:"¿Salir sin guardar?",description:"Tienes cambios no guardados que se perderán si sales del formulario.",hasUnsavedChanges:!0,onConfirmClose:F,children:o.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[o.jsx(z,{variant:"outline",onClick:()=>y(!1),children:"Continuar editando"}),o.jsxs(z,{variant:"destructive",onClick:F,children:[o.jsx(_r,{className:"mr-2 h-4 w-4"}),"Salir sin guardar"]})]})})]})})}function _Y({title:e,otNumber:t,phase:r,onBackClick:n,onDashboardClick:a,onContinueToPhase2:i,canContinueToPhase2:s=!1}){return o.jsx("div",{className:"bg-background border-b border-border p-3 md:p-4 lg:p-6",children:o.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[o.jsxs("div",{className:"flex flex-col gap-2 md:hidden",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs(z,{variant:"ghost",size:"sm",onClick:n,className:"h-8 px-2",children:[o.jsx(Ao,{className:"h-4 w-4 mr-1"}),o.jsx("span",{className:"text-xs",children:r==="phase2"&&t?"Fase 1":"Atrás"})]}),o.jsxs(z,{variant:"outline",size:"sm",onClick:a,className:"h-8 px-2",children:[o.jsx(Sy,{className:"h-4 w-4 mr-1"}),o.jsx("span",{className:"text-xs",children:"Dashboard"})]})]}),o.jsxs("div",{className:"text-center",children:[o.jsx("h1",{className:"text-lg font-bold leading-tight",children:e}),t&&o.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["OT: ",t]})]}),r==="phase1"&&t&&i&&o.jsx("div",{className:"flex justify-center",children:o.jsx(z,{onClick:i,disabled:!s,size:"sm",className:"w-full max-w-xs",children:"Continuar a Fase 2"})})]}),o.jsxs("div",{className:"hidden md:flex md:justify-between md:items-center",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(z,{variant:"ghost",size:"sm",onClick:n,children:[o.jsx(Ao,{className:"h-4 w-4 mr-1"}),r==="phase2"&&t?"Volver a Fase 1":"Atrás"]}),o.jsxs("h1",{className:"text-2xl font-bold",children:[e,t&&o.jsxs("span",{className:"ml-2 text-muted-foreground",children:["OT: ",t]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[r==="phase1"&&t&&i&&o.jsx(z,{onClick:i,disabled:!s,children:"Continuar a Fase 2"}),o.jsxs(z,{variant:"outline",onClick:a,children:[o.jsx(Sy,{className:"h-4 w-4 mr-2"}),"Ir a Dashboard"]})]})]})]})})}function NY({otNumber:e,formId:t,muestraNumero:r,enabled:n=!0}){const{user:a,userProfile:i}
519=Hi(),[s,l]=h.useState({}),[c,u]=h.useState(!0),[d,f]=h.useState(null),[m,p]=h.useState(0),y=h.useRef(null),v=h.useRef({}),g=e&&t&&r?`${e}_${t}_${r}`:null,x=h.useCallback(async()=>{if(!g||!n){console.log("ð´ loadDrafts skipped:",{sessionKey:g,enabled:n}),u(!1);return}console.log("ð¥ Loading drafts for session:",g);try{const{data:S,error:_}=await B.from("form_draft_values").select("field_id, field_value, updated_by_name").eq("session_key",g);if(_)throw _;console.log("ð¥ Loaded draft data:",S);const N={};S==null||S.forEach(O=>{try{N[O.field_id]=O.field_value?JSON.parse(O.field_value):null}catch{N[O.field_id]=O.field_value}}),console.log("ð¥ Parsed values:",N),l(N);const E=new Set(S==null?void 0:S.map(O=>O.updated_by_name).filter(Boolean));p(E.size)}catch(S){console.error("â Error loading draft values:",S)}finally{u(!1)}},[g,n]),b=h.useCallback(async(S,_)=>{if(!g||!a)return;const N=typeof _=="object"?JSON.stringify(_):String(_??"");try{const{error:E}=await B.from("form_draft_values").upsert({session_key:g,field_id:S,field_value:N,updated_by:a.id,updated_by_name:(i==null?void 0:i.full_name)||a.email||"Usuario"},{onConflict:"session_key,field_id"});if(E)throw E}catch(E){console.error("Error saving draft field:",E)}},[g,a,i]),j=h.useCallback(async(S,_)=>{l(N=>N[S]===_?N:{...N,[S]:_}),v.current[S]&&clearTimeout(v.current[S]),v.current[S]=setTimeout(()=>{b(S,_)},300)},[b]),w=h.useCallback(async()=>{if(g)try{const{error:S}=await B.from("form_draft_values").delete().eq("session_key",g);if(S)throw S;l({})}catch(S){console.error("Error clearing drafts:",S)}},[g]);return h.useEffect(()=>{if(!g||!n){console.log("ð´ Realtime sync disabled:",{sessionKey:g,enabled:n});return}console.log("ð¢ Setting up realtime sync for session:",g),x();const S=B.channel(`form-drafts-${g}`).on("postgres_changes",{event:"*",schema:"public",table:"form_draft_values",filter:`session_key=eq.${g}`},_=>{if(console.log("ð¡ Realtime update received:",_),_.eventType==="INSERT"||_.eventType==="UPDATE"){const N=_.new;if(N.updated_by===(a==null?void 0:a.id))return;const E=(()=>{try{return N.field_value?JSON.parse(N.field_value):null}catch{return N.field_value}})();l(O=>O[N.field_id]===E?O:{...O,[N.field_id]:E}),f({fieldId:N.field_id,updatedBy:N.updated_by_name||"Otro usuario"}),setTimeout(()=>f(null),2e3)}else if(_.eventType==="DELETE"){const N=_.old;l(E=>{if(!(N.field_id in E))return E;const O={...E};return delete O[N.field_id],O})}}).subscribe(_=>{console.log("ð¡ Realtime subscription status:",_),_==="SUBSCRIBED"?console.log("â
Successfully subscribed to realtime updates for:",g):_
519==="CHANNEL_ERROR"&&console.error("â Channel error for:",g)});return y.current=S,()=>{console.log("ð´ Cleaning up realtime subscription for:",g),Object.values(v.current).forEach(_=>clearTimeout(_)),v.current={},y.current&&(B.removeChannel(y.current),y.current=null)}},[g,n,a==null?void 0:a.id,x]),{syncedValues:s,updateField:j,clearDrafts:w,isLoading:c,lastUpdatedField:d,activeEditors:m}}function EY(){const{id:e}=up(),[t]=uT(),r=t.get("ot"),n=e,a=or(),[i,s]=h.useState(r?"phase1":"phase2"),[l,c]=h.useState(2),[u,d]=h.useState({}),[f,m]=h.useState(!1),[p,y]=h.useState(null),[v,g]=h.useState(""),[x,b]=h.useState(!1),[j,w]=h.useState(!1),{invalidateCache:S}=Xo(),{otData:_,procesoOtId:N,muestras:E,muestrasCount:O,setMuestras:P,setProcesoOtId:C,isLoading:A}=f$({otNumber:r||"",formId:n,setMuestrasProgramadas:c,toast:Z}),{syncedValues:T,updateField:k,clearDrafts:D,isLoading:M,lastUpdatedField:F,activeEditors:q}=NY({otNumber:r,formId:n||null,muestraNumero:p,enabled:i==="phase2"&&!!r&&!!p}),{data:I,isLoading:K}=lt({queryKey:["form",n],queryFn:async()=>{if(!n)return null;console.log("Loading form data for ID:",n);const{data:Re,error:pe}=await B.from("formularios").select("*").eq("id",n).single();let De=null;pe?(console.error("Error loading form from formularios table:",pe),n==="galletas"?(console.log("Using hardcoded galletas form data"),De={id:"galletas",nombre:"Control de Proceso Galletas",descripcion:"Formulario para el control de proceso de galletas",tipo:"technical",campos:[]}):De={id:n,nombre:"Formulario "+n,descripcion:"Formulario de proceso",tipo:"unknown",campos:[]}):De=Re,De&&g(De.nombre||"Formulario");const{data:L,error:G}=await B.from("formulario_campos").select("*").eq("formulario_id",n).order("orden",{ascending:!0});if(G)console.error("Error loading form fields:",G);else if(L&&L.length>0){console.log("Field data found for form:",L.length,"fields");const Y=L.map(ie=>{let se=ie.opciones;if(typeof se=="string")try{se=JSON.parse(se)}catch(ge){console.warn("Error parsing field options:",ge),se=null}let ee=ie.validacion;if(typeof ee=="string")try{ee=JSON.parse(ee)}catch(ge){console.warn("Error parsing field validation:",ge),ee=null}return{id:ie.id,nombre:ie.nombre,tipo:ie.tipo,etiqueta:ie.etiqueta,requerido:!!ie.requerido,placeholder:ie.placeholder,opciones:se,orden:ie.orden||0,validacion:ee,columna_db:ie.columna_db}});if(De.campos){let ie=[];if(Array.isArray(De.campos))ie=De.campos;else if(typeof De.campos=="object")ie=[De.campos];else if(typeof De.campos=="string")try{const ee=JSON.parse(De.campos);ie=Array.isArray(ee)?ee:[ee]}catch(ee){console.warn("Error parsing campos string:",ee),ie=[]}const se=new Map;[...ie,...Y].forEach(ee=>{se.set(ee.id,ee)}),De.campos=Array.from(se.values())}else De.campos=Y}return De.campos?Array.isArray(De.campos)||(De.campos=typeof De.campos=="object"?[De.campos]:[]):De.campos=[],De},enabled:!!n}),W=Object.keys(u).some(Re=>{const pe=u[Re];return pe!==void 0&&pe!==""&&pe!==null}),R=(Re,pe)=>{console.log(`Field ${Re} changed to:`,pe),d(De=>({...De,[Re]:pe}))},V=(Re,pe)=>{k(Re,pe)},re=()=>{if(!r){Z.error("No se ha seleccionado una OT");return}if(!_){Z.error("No se ha podido cargar la información de la OT");return}if(O>=l){Z.error(`Ya se han completado todas las muestras programadas (${O} de ${l})`);return}S(),s("phase2");const Re=O+1;y(Re),Z.success(`Muestra #${Re} - OT: ${r}`)},H=async Re=>{if(!n){Z.error("Faltan datos para enviar el formulario");return}if(O>=l){Z.error(`Ya se han completado todas las muestras programadas (${O} de ${l})`);return}m(!0),console.log("Valores del formulario a enviar:",Re);try{if(!r){console.log("Valores del formulario:",Re),Z.success("Formulario enviado en modo prueba"),m(!1);return}let pe=N;if(pe)await B.from("proceso_ot").update({validacion:{..._,formulario_id:n,formulario_nombre:v}}).eq("id",pe);else{const{data:ee,error:ge}=await B.from("proceso_ot").insert({ot_number:r,validacion:{..._,formulario_id:n,formulario_nombre:v}}).select("id").single();if(ge)throw console.error("Error creating proceso_ot:",ge),ge;pe=ee.id,C(pe)}const{data:De,error:L}=await B.from("proceso_ot_muestra").insert({proceso_ot_id:pe,num_muestra:p,formulario_id:n}).select("*").single();if(L)throw console.error("Error saving muestra:",L),L;const G=Object.entries(Re).map(([ee,ge])=>({muestra_id:De.id,field_id:ee,field_label:ee,field_value:typeof ge=="string"&&!ge.includes("/")?ge:null,image_storage_path:typeof ge=="string"&&ge.includes("/")?ge:null,numeric_value:typeof ge=="number"?ge:null})),{error:Y}=await B.from("form_field_responses").insert(G);if(Y)throw console.error("Error saving field responses:",Y),Y;const ie={id:De.id,values:Re,date:new Date(De.created_at).toLocaleDateString(),num_muestra:p};d({}),await D(),console.log("ð Refrescando datos después de guardar muestra..."),S();const se=p+1;y(se),se>l?(console.log(`ð COMPLETED: ${se} > ${l}`),S(),Z.success("¡Has completado todas las muestras programadas!"),w(!0)):(console.log(`ð CONTINUE: Current: ${p}, Next: ${se}, Total: ${l}`),Z.success(`Muestra #${p} guardada correctamente. Siguiente muestra: #${se}`))}catch(pe){console.error("Error submitting form:",pe),Z.error("Error al enviar el formulario: "+pe.message)}finally{m(!1)}},te=()=>{i==="phase2"&&r?W?b(!0):(S(),s("phase1")):W?b(!0):a("/dashboard")},ce=()=>{W?b(!0):a("/dashboard")},je=()=>{b(!1),i==="phase2"&&r?(S(),s("phase1")):a("/dashboard")},X=()=>{w(!1),s("phase1")},ae=()=>{w(!1),a("/dashboard")};if(h.useEffect(()=>{n&&n==="galletas"&&r?document.title=`Control de Proceso Galletas - OT: ${r}`:I&&(document.title=`${I.nombre} - ${r?`OT: ${r}`:"Formulario"}`)},[n,r,I]),!n)return o.jsx("div",{className:"flex items-center justify-center h-screen",children:o.jsxs("div",{className:"text-center",children:[o.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Formulario no encontrado"}),o.jsx("p",{className:"mb-4",children:"No se ha especificado un ID de formulario válido."}),o.jsx(z,{onClick:()=>
519a("/dashboard"),children:"Volver al Dashboard"})]})});const _e=n==="galletas";if(K)return o.jsxs("div",{className:"flex flex-col items-center justify-center h-screen",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin mb-4"}),o.jsx("p",{children:"Cargando formulario..."})]});const Ke=!I||!I.campos||!Array.isArray(I.campos)?[]:I.campos.map(Re=>({id:Re.id||String(Math.random()),field_type:Re.tipo,label:Re.etiqueta||Re.nombre||"Campo sin etiqueta",required:!!Re.requerido,placeholder:Re.placeholder||"",options:Array.isArray(Re.opciones)?Re.opciones:[]})),Ne=Ke.length>0;return o.jsx("div",{className:"min-h-screen bg-background",children:o.jsxs("div",{className:"container mx-auto px-0 sm:px-4 space-y-3 md:space-y-6",children:[o.jsx(_Y,{title:(I==null?void 0:I.nombre)||"Formulario de Control de Proceso",otNumber:r||void 0,phase:i,onBackClick:te,onDashboardClick:ce,onContinueToPhase2:re,canContinueToPhase2:!!(_&&!A)}),i==="phase1"&&r?o.jsx("div",{className:"px-0 sm:px-3 md:px-4 lg:px-6",children:o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{children:"Fase 1: Información de OT"})}),o.jsx(fe,{children:r?A?o.jsxs("div",{className:"flex items-center justify-center h-40",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin mr-2"}),o.jsx("span",{children:"Cargando datos de OT..."})]}):_?o.jsx(_w,{staticFase1Data:_,muestrasProgramadas:l,muestrasCount:E.length,showTitle:!1,formId:n,formName:v}):o.jsx("div",{className:"text-center p-6 border rounded-md",children:o.jsxs("p",{className:"text-muted-foreground",children:["No se encontraron datos para la OT ",r,". Por favor, verifique el número de OT."]})}):null})]})}):o.jsxs("div",{className:"space-y-3 md:space-y-6 px-0 sm:px-3 md:px-4 lg:px-6",children:[p&&o.jsx("div",{className:"bg-muted p-3 rounded-md mb-4",children:E.length>=l?o.jsxs("p",{className:"font-medium text-sm md:text-base text-green-600",children:["â Se han completado todas las muestras programadas (",E.length," de ",l,")"]}):o.jsxs("p",{className:"font-medium text-sm md:text-base",children:["Muestra #",p," de ",l]})}),(console.log(`ð PHASE 2 RENDER: muestraNumero=${p}, muestrasProgramadas=${l}, shouldShow=${!p||p<=l}`),null),(!p||p<=l)&&o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{className:"text-lg md:text-xl",children:r?"Fase 2: Llenado de Formulario":"Formulario"})}),o.jsxs(fe,{children:[_e?o.jsx(bm,{values:u,onFieldChange:R,formId:n,otNumber:r||void 0,producto:(_==null?void 0:_.producto_resultante)||null,syncedValues:T,onSyncFieldChange:V,lastUpdatedField:F,activeEditors:q}):o.jsx(o.Fragment,{children:Ne?o.jsx(sx,{fields:Ke,onSubmit:H,initialValues:u,isSubmitting:f,title:I==null?void 0:I.nombre,description:I==null?void 0:I.descripcion,formId:n,producto:(_==null?void 0:_.producto_resultante)||null,syncedValues:T,onSyncFieldChange:V,lastUpdatedField:F,activeEditors:q}):o.jsx("div",{className:"text-center p-6 border rounded-md",children:o.jsx("p",{className:"text-muted-foreground",children:"Este formulario no tiene campos definidos."})})}),_e&&r&&o.jsxs("div",{className:"mt-6 flex flex-col gap-2 md:flex-row",children:[o.jsx(z,{onClick:()=>H(u),disabled:f||E.length>=l,className:"flex-1",children:f?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):E.length>=l?o.jsx(o.Fragment,{children:"â Muestras Completadas"}):o.jsxs(o.Fragment,{children:[o.jsx(p0,{className:"mr-2 h-4 w-4"}),"Enviar Muestra #",p]})}),o.jsxs(z,{variant:"outline",onClick:te,className:"md:flex-none",children:[o.jsx(_r,{className:"mr-2 h-4 w-4"}),"Cancelar"]})]})]})]}),E.length>=l&&o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{className:"text-lg md:text-xl text-green-600",children:"â Proceso Completado"})}),o.jsx(fe,{children:o.jsxs("div",{className:"text-center py-6",children:[o.jsx("p",{className:"text-lg mb-4",children:"Se han completado todas las muestras programadas para esta OT."}),o.jsx(z,{onClick:()=>{a("/dashboard"),window.location.reload()},children:"Volver al Dashboard"})]})})]}),!r&&o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{children:"Formulario"})}),o.jsx(fe,{children:_e?o.jsx(bm,{values:u,onFieldChange:R,formId:n,producto:(_==null?void 0:_.producto_resultante)||null}):o.jsx(o.Fragment,{children:Ne?o.jsx(sx,{fields:Ke,onSubmit:H,initialValues:u,isSubmitting:f,title:I==null?void 0:I.nombre,description:I==null?void 0:I.descripcion,formId:n,producto:(_==null?void 0:_.producto_resultante)||null}):o.jsx("div",{className:"text-center p-6 border rounded-md",children:o.jsx("p",{className:"text-muted-foreground",children:"Este formulario no tiene campos definidos."})})})})]})]}),o.jsx(nx,{open:j,onOpenChange:()=>{},title:"¡Muestras Completadas!",description:`Has completado todas las muestras programadas (${E.length} de ${l}) para la OT ${r}.`,hasUnsavedChanges:!1,children:o.jsxs("div",{className:"flex flex-col gap-2 md:flex-row justify-end mt-4",children:[o.jsx(z,{variant:"outline",onClick:X,className:"order-2 md:order-1",children:"Ver Resumen (Fase 1)"}),o.jsx(z,{onClick:ae,className:"order-1 md:order-2",children:"Ir al Dashboard"})]})}),o.jsx(nx,{open:x,onOpenChange:b,title:"¿Salir sin guardar?",description:"Tienes cambios no guardados que se perderán si sales del formulario.",hasUnsavedChanges:!0,onConfirmClose:je,children:o.jsxs("div",{className:"flex flex-col gap-2 md:flex-row justify-end mt-4",children:[o.jsx(z,{variant:"outline",onClick:()=>b(!1),className:"order-2 md:order-1",children:"Continuar editando"}),o.jsxs(z,{variant:"destructive",onClick:je,className:"order-1 md:order-2",children:[o.jsx(_r,{className:"mr-2 h-4 w-4"}),"Salir sin guardar"]})]})})]})})}var $w="Tabs",[CY,KPe]=Lr($w,[Hl]),dk=Hl(),[OY,kw]=CY($w),fk=h.forwardRef((e,t)=>
519{const{__scopeTabs:r,value:n,onValueChange:a,defaultValue:i,orientation:s="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=kl(l),[f,m]=hn({prop:n,onChange:a,defaultProp:i});return o.jsx(OY,{scope:r,baseId:Qn(),value:f,onValueChange:m,orientation:s,dir:d,activationMode:c,children:o.jsx(Me.div,{dir:d,"data-orientation":s,...u,ref:t})})});fk.displayName=$w;var mk="TabsList",hk=h.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...a}=e,i=kw(mk,r),s=dk(r);return o.jsx(Pw,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:n,children:o.jsx(Me.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:t})})});hk.displayName=mk;var pk="TabsTrigger",vk=h.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:a=!1,...i}=e,s=kw(pk,r),l=dk(r),c=xk(s.baseId,n),u=bk(s.baseId,n),d=n===s.value;return o.jsx(Aw,{asChild:!0,...l,focusable:!a,active:d,children:o.jsx(Me.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...i,ref:t,onMouseDown:ue(e.onMouseDown,f=>{!a&&f.button===0&&f.ctrlKey===!1?s.onValueChange(n):f.preventDefault()}),onKeyDown:ue(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(n)}),onFocus:ue(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!a&&f&&s.onValueChange(n)})})})});vk.displayName=pk;var gk="TabsContent",yk=h.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:a,children:i,...s}=e,l=kw(gk,r),c=xk(l.baseId,n),u=bk(l.baseId,n),d=n===l.value,f=h.useRef(d);return h.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),o.jsx(er,{present:a||d,children:({present:m})=>o.jsx(Me.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&i})})});yk.displayName=gk;function xk(e,t){return`${e}-trigger-${t}`}function bk(e,t){return`${e}-content-${t}`}var PY=fk,wk=hk,jk=vk,Sk=yk;const Kl=PY,Zo=h.forwardRef(({className:e,...t},r)=>o.jsx(wk,{ref:r,className:oe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Zo.displayName=wk.displayName;const Yt=h.forwardRef(({className:e,...t},r)=>o.jsx(jk,{ref:r,className:oe("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Yt.displayName=jk.displayName;const Qt=h.forwardRef(({className:e,...t},r)=>o.jsx(Sk,{ref:r,className:oe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Qt.displayName=Sk.displayName;function AY(){const{toast:e}=Rn(),[t,r]=h.useState(!1),n=()=>{r(!0),setTimeout(()=>{r(!1),e({title:"Settings updated",description:"Your settings have been saved successfully."})},1500)};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Settings"}),o.jsx("p",{className:"text-muted-foreground",children:"Manage your application preferences and configurations"})]}),o.jsxs(Kl,{defaultValue:"general",children:[o.jsxs(Zo,{className:"grid grid-cols-3 w-full max-w-md",children:[o.jsx(Yt,{value:"general",children:"General"}),o.jsx(Yt,{value:"database",children:"Database"}),o.jsx(Yt,{value:"security",children:"Security"})]}),o.jsx(Qt,{value:"general",className:"space-y-4",children:o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsxs(Ie,{className:"flex items-center",children:[o.jsx(No,{className:"h-5 w-5 mr-2 text-formforge-600"}),"General Settings"]}),o.jsx(zt,{children:"Configure application preferences and behavior"})]}),o.jsxs(fe,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"app-name",children:"Application Name"}),o.jsx(we,{id:"app-name",defaultValue:"FormForge SQL"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ne,{htmlFor:"dark-mode",children:"Dark Mode"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable dark mode for the application interface"})]}),o.jsx(On,{id:"dark-mode"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ne,{htmlFor:"save-drafts",children:"Save Form Drafts"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Automatically save form drafts while editing"})]}),o.jsx(On,{id:"save-drafts",defaultChecked:!0})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ne,{htmlFor:"notifications",children:"Email Notifications"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Receive notifications for form submissions"})]}),o.jsx(On,{id:"notifications"})]})]})]})]})}),o.jsx(Qt,{value:"database",className:"space-y-4",children:o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsxs(Ie,{className:"flex items-center",children:[o.jsx(rp,{className:"h-5 w-5 mr-2 text-formforge-600"}),"Database Configuration"]}),o.jsx(zt,{children:"Configure database settings and preferences"})]}),o.jsxs(fe,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ne,{htmlFor:"auto-create-tables",children:"Auto-create Tables"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Automatically create tables if they don't exist"})]}),o.jsx(On,{id:"auto-create-tables",defaultChecked:!0})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ne,{htmlFor:"connection-pooling",children:"Connection Pooling"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable database connection pooling"})]}),o.jsx(On,{id:"connection-pooling",defaultChecked:!0})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"timeout",children:"Connection Timeout (seconds)"}),o.jsx(we,{id:"timeout",type:"number",defaultValue:"30"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"retry-attempts",children:"Retry Attempts"}),o.jsx(we,{id:"retry-attempts",type:"number",defaultValue:"3"})]}),o.jsx("div",{className:"pt-2",children:o.jsxs(z,{variant:"outline",className:"w-full",children:[o.jsx($o,{className:"h-4 w-4 mr-2"}),"Test All Connections"]})})]})]})}),o.jsx(Qt,{value:"security",className:"space-y-4",children:o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsxs(Ie,{className:"flex items-center",children:[o.jsx(pA,{className:"h-5 w-5 mr-2 text-formforge-600"}),"Security Settings"]}),o.jsx(zt,{children:"Configure security options for your forms and data"})]}),o.jsxs(fe,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ne,{htmlFor:"encrypt-data",children:"Encrypt Sensitive Data"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Encrypt sensitive form data before storage"})]}),o.jsx(On,{id:"encrypt-data",defaultChecked:!0})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ne,{htmlFor:"secure-connections",children:"Require Secure Connections"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Only allow encrypted database connections"})]}),o.jsx(On,{id:"secure-connections",defaultChecked:!0})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(ne,{htmlFor:"captcha",children:"Enable CAPTCHA"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Add CAPTCHA verification to public forms"})]}),o.jsx(On,{id:"captcha"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"password-mask",children:"Password Display in Settings"}),o.jsxs("select",{id:"password-mask",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
519ing-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",children:[o.jsx("option",{value:"always-mask",children:"Always Mask Passwords"}),o.jsx("option",{value:"unmask-click",children:"Unmask on Click"}),o.jsx("option",{value:"never-mask",children:"Never Mask (Not Recommended)"})]})]})]})]})})]}),o.jsx("div",{className:"flex justify-end",children:o.jsxs(z,{onClick:n,disabled:t,children:[o.jsx(np,{className:"h-4 w-4 mr-2"}),t?"Saving...":"Save Settings"]})})]})}const TY=()=>{const e=vn(),t=or();h.useEffect(()=>{if(console.error("404 Error: Usuario intentó acceder a una ruta inexistente:",e.pathname),e.pathname==="/"&&window.location.hostname==="produccion.unicoscomotu.com"){t("/login",{replace:!0});return}},[e.pathname,t]);const r=()=>{t(-1)},n=()=>{t("/login",{replace:!0})};return o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:o.jsxs("div",{className:"text-center max-w-md p-6 bg-white rounded-lg shadow-md",children:[o.jsx("img",{src:"/lovable-uploads/487fc73a-aeac-4c0f-b546-1e5ecf9ea9da.png",alt:"Del Cerro Logo",className:"mx-auto w-40 h-auto mb-4"}),o.jsx("h1",{className:"text-4xl font-bold mb-4",children:"404"}),o.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Página no encontrada"}),o.jsxs("p",{className:"text-gray-500 mb-6",children:["Lo sentimos, no pudimos encontrar la ruta:",o.jsx("span",{className:"font-mono text-sm block mt-2 p-2 bg-gray-100 rounded",children:e.pathname})]}),o.jsxs("div",{className:"flex flex-col md:flex-row gap-3 justify-center",children:[o.jsxs(z,{variant:"outline",onClick:r,className:"flex items-center justify-center",children:[o.jsx(u0,{className:"h-4 w-4 mr-2"}),"Volver"]}),o.jsx(z,{onClick:n,className:"flex items-center justify-center",children:"Ir a Iniciar Sesión"})]})]})})};function vc({label:e,value:t,onChange:r,options:n,isLoading:a=!1,className:i=""}){return n?o.jsxs("div",{className:oe("flex flex-col",i),children:[o.jsx("span",{className:"text-sm font-medium mb-1 r-text-sm",children:e}),o.jsxs(jt,{value:t,onValueChange:r,children:[o.jsx(xt,{className:"w-full sm:w-[150px] md:w-[150px] text-sm",children:o.jsx(St,{placeholder:`Seleccione ${e}`})}),o.jsx(bt,{children:a?o.jsx("div",{className:"flex items-center justify-center py-2",children:o.jsx(ye,{className:"h-4 w-4 animate-spin text-primary"})}):n.map(s=>o.jsx($e,{value:s.value,children:s.label},s.value))})]})]}):o.jsxs("div",{className:oe("flex flex-col",i),children:[o.jsx("label",{className:"text-sm font-medium mb-1 r-text-sm",children:e}),o.jsx(we,{type:"text",value:t,onChange:s=>r(s.target.value),className:"w-full sm:w-[150px] md:w-[150px]",placeholder:`Buscar por ${e}`})]})}function DY({filters:e,setFilters:t,workOrders:r}){const n=ql(),[a,i]=h.useState(!n),{areas:s}=Sw();h.useEffect(()=>{i(!n)},[n]);const l=h.useMemo(()=>[{value:"all",label:"Todas"},...s.map(f=>({value:f.areNombre,label:f.areNombre}))],[s]),c=h.useMemo(()=>{const d=new Set;return r.forEach(m=>{m.processLeader&&m.processLeader!=="-"&&m.processLeader!=="No asignado"&&d.add(m.processLeader)}),[{value:"all",label:"Todos"},...Array.from(d).sort().map(m=>({value:m,label:m}))]},[r]),u=()=>{t({otNumber:"",status:"",area:"",resultingProduct:"",supervisor:""})};return o.jsxs("div",{className:"mb-6",children:[n&&o.jsxs("div",{className:"flex justify-between items-center mb-2",children:[o.jsxs(z,{variant:"outline",size:"sm",onClick:()=>i(!a),className:"flex items-center gap-1 text-sm",children:[o.jsx(Xf,{className:"h-4 w-4"}),a?"Ocultar filtros":"Mostrar filtros"]}),a&&o.jsxs(z,{variant:"ghost",size:"sm",onClick:u,className:"text-gray-500 text-sm",children:[o.jsx(_r,{className:"h-4 w-4 mr-1"}),"Limpiar"]})]}),a&&o.jsxs("div",{className:"flex flex-wrap gap-2 md:gap-4 bg-gray-50 p-3 rounded-lg",children:[o.jsx(vc,{label:"Número OT",value:e.otNumber,onChange:d=>t({...e,otNumber:d}),className:"w-full sm:w-auto"}),o.jsx(vc,{label:"Estado",value:e.status,onChange:d=>t({...e,status:d}),options:[{value:"all",label:"Todos"},{value:"Pendiente",label:"Pendiente"},{value:"Incompleto",label:"Incompleto"},{value:"Completado",label:"Completado"}],className:"w-full sm:w-auto"}),o.jsx(vc,{label:"Ãrea",value:e.area,onChange:d=>t({...e,area:d}),options:l,className:"w-full sm:w-auto"}),o.jsx(vc,{label:"Producto Resultante",value:e.resultingProduct,onChange:d=>t({...e,resultingProduct:d}),className:"w-full sm:w-auto"}),o.jsx(vc,{label:"Supervisor de Turno",value:e.supervisor,onChange:d=>t({...e,supervisor:d}),options:c,className:"w-full sm:w-auto"}),!n&&o.jsx("div",{className:"flex items-end",children:o.jsxs(z,{variant:"ghost",size:"sm",onClick:u,className:"text-gray-500 text-sm",children:[o.jsx(_r,{className:"h-4 w-4 mr-1"}),"Limpiar"]})})]})]})}function $Y(e){const{data:t,isLoading:r,error:n}=lt({queryKey:["samples-by-form-ot",e],queryFn:async()=>{try{const{data:a,error:i}=await B.from("proceso_ot").select("id").eq("ot_number",e).single();if(i||!a)return console.log("No proceso_ot found for OT:",e),{};const{data:s,error:l}=await B.from("proceso_ot_muestra").select(` 520 id, 521 formulario_id 522 `).eq("proceso_ot_id",a.id);if(l)throw console.error("Error fetching samples by form:",l),l;const c={};for(const u of s||[]){if(!u.formulario_id)continue;const{count:d}=await B.from("form_field_responses").select("*",{count:"exact",head:!0}).eq("muestra_id",u.id);d&&d>0&&(c[u.formulario_id]=(c[u.formulario_id]||0)+1)}return console.log("Samples by form for OT",e,":",c),c}catch(a){throw console.error("Error in useSamplesByFormAndOT:",a),a}},enabled:!!e,staleTime:0,gcTime:0,refetchOnWindowFocus:!0,refetchOnMount:!0,refetchOnReconnect:!0});return{samplesByForm:t||{},isLoading:r,error:n?n.message:null}}function kY({open:e,onOpenChange:t,otNumber:r,otArea:n}){const a=or(),[i,s]=h.useState(""),{samplesByForm:l,isLoading:c}=$Y(r),{data:u=[],isLoading:d,error:f}=lt({queryKey:["forms-for-selection",n],queryFn:async()=>{var y,v;try{let g=B.from("formularios").select("id, nombre, descripcion, tipo, area_trabajo").order("nombre");const{data:x,error:b}=await g;if(b){if(console.error("Error fetching forms with area_trabajo:",b),(y=b.message)!=null&&y.includes("area_trabajo")&&((v=b.message)!=null&&v.includes("does not exist"))){console.log("Falling back to basic forms query without area_trabajo");const{data:j,error:w}=await B.from("formularios").select("id, nombre, descripcion, tipo").order("nombre");if(w)throw console.error("Error in fallback query:",w),w;return(j||[]).map(S=>({...S,area_trabajo:null}))}throw b}return n&&x?x.filter(j=>j.area_trabajo?Array.isArray(j.area_trabajo)?j.area_trabajo.includes(n):j.area_trabajo===n:!0):x||[]}catch(g){throw console.error("Error in forms query:",g),g}}}),m=()=>
522{i&&(a(`/fill/${i}?ot=${r}`),t(!1))},p=y=>{let v=y.descripcion||"";return y.area_trabajo&&(Array.isArray(y.area_trabajo)?v+=v?` ⢠Ãreas: ${y.area_trabajo.join(", ")}`:`Ãreas: ${y.area_trabajo.join(", ")}`:v+=v?` ⢠Ãrea: ${y.area_trabajo}`:`Ãrea: ${y.area_trabajo}`),v};return f&&console.error("Forms loading error:",f),o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsxs(It,{className:"sm:max-w-[500px] max-h-[80vh] flex flex-col",children:[o.jsxs(Ut,{children:[o.jsx(Wt,{children:"Seleccionar Formulario"}),o.jsxs(Ul,{children:["Selecciona el formulario que deseas usar para la OT ",r,n&&o.jsxs("span",{className:"block text-sm text-muted-foreground mt-1",children:["Ãrea: ",n]})]})]}),o.jsx("div",{className:"flex-1 min-h-0",children:d||c?o.jsxs("div",{className:"flex items-center justify-center h-32",children:[o.jsx(ye,{className:"h-6 w-6 animate-spin"}),o.jsx("span",{className:"ml-2",children:"Cargando formularios..."})]}):f?o.jsx("div",{className:"flex items-center justify-center h-32 text-red-600",children:o.jsx("p",{children:"Error al cargar formularios. Por favor intenta de nuevo."})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:o.jsx("p",{children:n?`No hay formularios disponibles para el área "${n}". Crea uno primero en la sección de Formularios.`:"No hay formularios disponibles. Crea uno primero en la sección de Formularios."})}):o.jsx(Yo,{className:"h-[300px] pr-4",children:o.jsx("div",{className:"space-y-2",children:u.map(y=>{const v=l[y.id]||0;return o.jsxs("div",{className:`p-3 border rounded-lg cursor-pointer transition-colors ${i===y.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"}`,onClick:()=>s(y.id),children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"font-medium text-sm",children:y.nombre}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(ke,{variant:v>0?"default":"secondary",className:"text-xs",children:[v," muestras"]}),v>0?o.jsx(To,{className:"h-4 w-4 text-green-600"}):o.jsx(f0,{className:"h-4 w-4 text-gray-400"})]})]}),p(y)&&o.jsx("div",{className:"text-xs text-gray-600 mt-1",children:p(y)}),o.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:["Tipo: ",y.tipo]})]},y.id)})})})}),o.jsxs(dr,{className:"mt-4",children:[o.jsx(z,{variant:"outline",onClick:()=>t(!1),children:"Cancelar"}),o.jsx(z,{onClick:m,disabled:!i||d||u.length===0,children:"Continuar con Formulario"})]})]})})}function _k(e){if(!e||!Array.isArray(e))return{totalOrders:0,pendingOrders:0,completedOrders:0,incompleteOrders:0};const t=e.length,r=e.filter(i=>i.status==="Pendiente").length,n=e.filter(i=>i.status==="Completado").length,a=e.filter(i=>i.status==="Incompleto").length;return{totalOrders:t,pendingOrders:r,completedOrders:n,incompleteOrders:a}}function Nk(){const{data:e,isLoading:t,error:r}=lt({queryKey:["forms-by-area"],queryFn:async()=>{try{const{data:n,error:a}=await B.from("formularios").select("area_trabajo").not("area_trabajo","is",null);if(a)throw console.error("Error fetching forms by area:",a),a;const i={};return n==null||n.forEach(s=>{s.area_trabajo&&Array.isArray(s.area_trabajo)&&s.area_trabajo.forEach(l=>{i[l]=(i[l]||0)+1})}),console.log("Forms by area:",i),console.log("BAÃADO L2 forms count:",i["BAÃADO L2"]||0),console.log("All area keys:",Object.keys(i)),i}catch(n){throw console.error("Error in useFormsByArea:",n),n}},staleTime:9e5,gcTime:18e5,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1});return{formsByArea:e||{},isLoading:t,error:r?r.message:null}}const MY={STATIC_DATA:{staleTime:30*60*1e3,gcTime:60*60*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,retry:1,retryDelay:5e3},OT_DATA:{staleTime:30*60*1e3,gcTime:60*60*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,retry:1,retryDelay:5e3},DYNAMIC_DATA:{staleTime:15*60*1e3,gcTime:30*60*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!0,retry:1,retryDelay:3e3},CRITICAL_DATA:{staleTime:10*60*1e3,gcTime:20*60*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!0,retry:2,retryDelay:2e3}},Ek=(e,t,r)=>{const n=[...e];return t&&n.push(`user:${t}`),r&&Object.entries(r).forEach(([a,i])=>{i!=null&&n.push(`${a}:${i}`)}),n},pf=25,jg=e=>{const t=(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").trim().toUpperCase();return t&&t!=="SIN ASIGNAR"?t:null};function IY(){const{user:e,userProfile:t}=Hi(),[r,n]=h.useState(1),[a,i]=h.useState({otNumber:"",status:"",area:"",supervisor:""}),{allOtData:s,isLoading:l,error:c,refetch:u}=Xo(),{formsByArea:d}=Nk(),{data:f,isLoading:m,error:p,refetch:y}=lt({queryKey:Ek(["all-workOrders"],e==null?void 0:e.id,{role:t==null?void 0:t.role,identification:t==null?void 0:t.identification,supervisorTurno:t==null?void 0:t.supervisor_turno,dataCount:Object.keys(s).length}),queryFn:async()=>{const P=Object.values(s);if(P.length===0)return[];let C=P;const A=(t==null?void 0:t.role)==="Operador",T=jg(t==null?void 0:t.supervisor_turno);if(C=C.filter(D=>{var M,F;return((M=D.otData)==null?void 0:M.area)!=="SUPERVISOR BODEGA"&&!((F=D.otData)!=null&&F.exento_muestreo)}),A&&T){const D=C.length,M=new Set(C.map(F=>{var q;return jg((q=F.otData)==null?void 0:q.jefe_turno)}
522).filter(Boolean));C=C.filter(F=>{var q;return jg((q=F.otData)==null?void 0:q.jefe_turno)===T}),console.log("ð Filtro Operador:",{supervisorAsignado:T,otsAntes:D,otsDespues:C.length,jefesDisponibles:Array.from(M)})}return C.map(D=>{const M=D.otData,F=D.otNumber,q=Number(M.cant_programada)||0,I=Number(M.cant_producida)||0,K=Number(M.cant_programada)||0,W=M.area||"",R=d[W]||0;W==="BAÃADO L2"&&console.log("DEBUG - BAÃADO L2 (paginated):",{area:W,formsAssigned:R,formsByArea:d});const V=Number(M.muestras_programadas);let re;if(Number.isFinite(V)&&V>0)re=V;else if(W.toUpperCase().startsWith("BATIDOS"))re=1;else{const je=K*2e-4;re=je<=1?2:Math.ceil(je)}const H=Number(D.muestras_count??0),te=re*R;let ce;return H===0?ce="Pendiente":H>=te?ce="Completado":ce="Incompleto",{id:D.procesoOtId||`ot-${F}`,otNumber:F,premix:M.premezcla||"-",area:M.area||"-",processLeader:M.jefe_turno||"-",status:ce,date:M.fecha||"N/A",formsCompleted:H,formsRequired:te,formsAssigned:R,shift:"No especificado",unitsScheduled:q,unitsCompleted:I,supervisor:M.supervisor||"No asignado",samplesScheduled:re,samplesCompleted:H,tiempoProceso:Number(M.tiempo_proceso)||null,cantidad:Number(M.cantidad)||null,samples:[],realSamples:D.muestras||[]}}).sort((D,M)=>M.otNumber.localeCompare(D.otNumber))},enabled:!!e&&!!t&&!l,...MY.DYNAMIC_DATA}),v=h.useMemo(()=>f?f.filter(P=>{const C=!a.otNumber||P.otNumber.toLowerCase().includes(a.otNumber.toLowerCase()),A=!a.status||a.status==="all"||P.status===a.status,T=!a.area||P.area.toLowerCase().includes(a.area.toLowerCase()),k=!a.supervisor||a.supervisor==="all"||P.processLeader===a.supervisor;return C&&A&&T&&k}):[],[f,a]),g=h.useMemo(()=>_k(v),[v]),x=h.useMemo(()=>{const P=v.length,C=Math.ceil(P/pf),A=(r-1)*pf,T=A+pf;return{data:v.slice(A,T),totalItems:P,totalPages:C,hasNextPage:r<C,hasPreviousPage:r>1}},[v,r]),b=h.useCallback(P=>{i(P),n(1)},[]),j=h.useCallback(P=>{P>=1&&P<=x.totalPages&&n(P)},[x.totalPages]),w=h.useCallback(()=>{x.hasNextPage&&n(P=>P+1)},[x.hasNextPage]),S=h.useCallback(()=>{x.hasPreviousPage&&n(P=>P-1)},[x.hasPreviousPage]),_=h.useCallback(async()=>{console.log("â ï¸ PAGINATED: Actualizando datos..."),await u(),await y()},[y,u]);h.useEffect(()=>{r>x.totalPages&&x.totalPages>0&&n(1)},[r,x.totalPages]);const N={currentPage:r,totalPages:x.totalPages,totalItems:x.totalItems,itemsPerPage:pf,hasNextPage:x.hasNextPage,hasPreviousPage:x.hasPreviousPage},E=l||m,O=c||p;return{workOrders:x.data,allWorkOrders:f||[],filteredSummaryStats:g,paginationInfo:N,isLoading:E,error:O?O.message:null,goToPage:j,nextPage:w,previousPage:S,refreshData:_,applyFilters:b}}const yn=h.forwardRef(({className:e,...t},r)=>o.jsx("div",{className:"relative w-full overflow-auto",children:o.jsx("table",{ref:r,className:oe("w-full caption-bottom text-sm responsive-table",e),...t})}));yn.displayName="Table";const xn=h.forwardRef(({className:e,...t},r)=>o.jsx("thead",{ref:r,className:oe("[&_tr]:border-b",e),...t}));xn.displayName="TableHeader";const bn=h.forwardRef(({className:e,...t},r)=>o.jsx("tbody",{ref:r,className:oe("[&_tr:last-child]:border-0",e),...t}));bn.displayName="TableBody";const RY=h.forwardRef(({className:e,...t},r)=>o.jsx("tfoot",{ref:r,className:oe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));RY.displayName="TableFooter";const Nt=h.forwardRef(({className:e,...t},r)=>o.jsx("tr",{ref:r,className:oe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Nt.displayName="TableRow";const Pe=h.forwardRef(({className:e,sticky:t,...r},n)=>o.jsx("th",{ref:n,className:oe("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t&&"sticky bg-background z-10 shadow-sm",t&&"first:left-0 nth-child-2:left-[140px]",e),...r}));Pe.displayName="TableHead";const Oe=h.forwardRef(({className:e,dataLabel:t,sticky:r,children:n,...a},i)=>{const s=t||a["data-label"];return o.jsx("td",{ref:i,className:oe("p-4 align-middle [&:has([role=checkbox])]:pr-0",r&&"sticky bg-background z-10 shadow-sm",r&&"first:left-0 nth-child-2:left-[140px]",e),"data-label":s,...a,children:n})});Oe.displayName="TableCell";const LY=h.forwardRef(({className:e,...t},r)=>o.jsx("caption",{ref:r,className:oe("mt-4 text-sm text-muted-foreground",e),...t}));LY.displayName="TableCaption";function FY(e,t){const r=h.useRef();return h.useCallback((...n)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...n)},t)},[e,t])}function BY(e){const{getOtData:t,isLoading:r}=Xo(),n=h.useRef({ordersHash:"",result:[]}),a=FY(s=>{console.log("â ï¸ SYNC EXECUTION: useSyncWorkOrderSamples ejecutado para",s,"órdenes")},300);return h.useMemo(()=>
522{if(r||!e||e.length===0)return e;const s=JSON.stringify(e.map(l=>({id:l.id,otNumber:l.otNumber,samplesCompleted:l.samplesCompleted})));if(n.current.ordersHash===s)return n.current.result;a(e.length);try{const l=e.map(c=>{const u=t(c.otNumber);let d=[];return u&&u.muestras&&(d=u.muestras.map(f=>({id:f.id,values:{},date:new Date(f.created_at).toLocaleDateString()}))),{...c,realSamples:d}});return console.log("â ï¸ SYNC: Updated",l.length,"orders with batch data"),n.current={ordersHash:s,result:l},typeof window<"u"&&(window.mockData=l),l}catch(l){return console.error("Error syncing work order samples:",l),e.map(u=>({...u,realSamples:[],syncError:!0}))}},[e,t,r])}function Ck({startDate:e,tiempoProceso:t,cantidad:r}){const[n,a]=h.useState(null),[i,s]=h.useState("green");if(h.useEffect(()=>{if(!e||!t||!r){a(null);return}const f=()=>{const y=t*r*60*1e3,v=new Date(e).getTime(),x=Date.now()-v,b=y-x;if(b<=0){a(0),s("red");return}const j=b/(60*60*1e3);j>3?s("green"):j>2?s("yellow"):s("red"),a(b)};f();const m=setInterval(f,1e3);return()=>clearInterval(m)},[e,t,r]),n===null||!t||!r)return o.jsx("span",{className:"text-muted-foreground",children:"-"});const c=t*r/60,u=f=>{if(f<=0)return"00:00:00";const m=Math.floor(f/1e3),p=Math.floor(m/3600),y=Math.floor(m%3600/60),v=m%60;return`${p.toString().padStart(2,"0")}:${y.toString().padStart(2,"0")}:${v.toString().padStart(2,"0")}`},d={green:"bg-green-500",yellow:"bg-yellow-500",red:"bg-red-500"};return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:`w-3 h-3 rounded-full ${d[i]}`}),o.jsxs("div",{className:"flex flex-col",children:[o.jsxs("div",{className:"flex items-center gap-1 text-sm font-medium",children:[o.jsx(mn,{className:"h-3 w-3"}),o.jsx("span",{children:u(n)})]}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["/ ",c.toFixed(1),"h"]})]})]})}function zY({order:e,onViewSamples:t,onFormClick:r}){var c,u;const n=e.date||"N/A",a=((c=e.area)==null?void 0:c.toUpperCase().startsWith("EMPAQUE"))||((u=e.area)==null?void 0:u.toUpperCase().startsWith("EMBALAJE"))||!1,i=e.status==="Completado",s=h.useMemo(()=>{if(!a||!e.date||!e.tiempoProceso||!e.cantidad)return!1;const d=e.tiempoProceso*e.cantidad*60*1e3,f=new Date(e.date).getTime(),m=Date.now()-f;return d-m<=0},[a,e.date,e.tiempoProceso,e.cantidad]),l=i?"bg-green-50 dark:bg-green-900/20":s?"bg-red-100 dark:bg-red-900/50":"";return o.jsxs(Nt,{className:l,children:[o.jsx(Oe,{className:"font-medium",children:e.otNumber||"-"}),o.jsx(Oe,{children:e.productoResultante||e.premix||"-"}),o.jsx(Oe,{children:e.area||"-"}),o.jsx(Oe,{children:e.processLeader||"-"}),o.jsx(Oe,{children:n}),o.jsx(Oe,{children:o.jsx(ke,{className:`${e.status==="Completado"?"bg-green-100 text-green-800 hover:bg-green-200":e.status==="Incompleto"?"bg-yellow-100 text-yellow-800 hover:bg-yellow-200":"bg-red-100 text-red-800 hover:bg-red-200"}`,children:e.status||"Pendiente"})}),o.jsx(Oe,{children:a?o.jsx(Ck,{startDate:e.date,tiempoProceso:e.tiempoProceso,cantidad:e.cantidad}):o.jsx("span",{className:"text-muted-foreground",children:"-"})}),o.jsx(Oe,{children:o.jsxs("div",{className:"flex items-center space-x-1",children:[o.jsxs("span",{className:"text-sm",children:[e.samplesCompleted||0," / ",e.samplesScheduled||0]}),(e.samplesCompleted||0)>0&&o.jsx(z,{variant:"ghost",size:"sm",className:"p-1 h-auto",onClick:()=>t(e.samples,e.realSamples),children:o.jsx(Fi,{className:"h-4 w-4"})})]})}),o.jsx(Oe,{children:o.jsxs(z,{variant:"outline",size:"sm",onClick:()=>r(e.otNumber),children:[o.jsx(Ya,{className:"h-4 w-4 mr-2"}),"Llenar Form"]})})]})}const qY={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dÃa",other:"{{count}} dÃas"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},UY=(e,t,r)=>{let n;const a=qY[e];
522return typeof a=="string"?n=a:t===1?n=a.one:n=a.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"en "+n:"hace "+n:n},WY={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},VY={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},GY={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},HY={date:Ps({formats:WY,defaultWidth:"full"}),time:Ps({formats:VY,defaultWidth:"full"}),dateTime:Ps({formats:GY,defaultWidth:"full"})},KY={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},YY={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},XY=(e,t,r,n)=>t.getHours()!==1?YY[e]:KY[e],ZY={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},QY={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},JY={narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},eX={narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},tX={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},rX={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},nX=(e,t)=>Number(e)+"º",aX={ordinalNumber:nX,era:da({values:ZY,defaultWidth:"wide"}),quarter:da({values:QY,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:da({values:JY,defaultWidth:"wide"}),day:da({values:eX,defaultWidth:"wide"}),dayPeriod:da({values:tX,defaultWidth:"wide",formattingValues:rX,defaultFormattingWidth:"wide"})},iX=/^(\d+)(º)?/i,oX=/\d+/i,sX={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},lX={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},cX={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},uX={any:[/1/i,/2/i,/3/i,/4/i]},dX={narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},fX={narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},mX={narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},hX={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},pX={narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},vX={any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},gX={ordinalNumber:kT({matchPattern:iX,parsePattern:oX,valueCallback:function(e){return parseInt(e,10)}}),era:fa({matchPatterns:sX,defaultMatchWidth:"wide",parsePatterns:lX,defaultParseWidth:"any"}),quarter:fa({matchPatterns:cX,defaultMatchWidth:"wide",parsePatterns:uX,defaultParseWidth:"any",valueCallback:e=>e+1}),month:fa({matchPatterns:dX,defaultMatchWidth:"wide",parsePatterns:fX,defaultParseWidth:"any"}),day:fa({matchPatterns:mX,defaultMatchWidth:"wide",parsePatterns:hX,defaultParseWidth:"any"}),dayPeriod:fa({matchPatterns:pX,defaultMatchWidth:"any",parsePatterns:vX,defaultParseWidth:"any"})},Ua={code:"es",formatDistance:UY,formatLong:HY,formatRelative:XY,localize:aX,match:gX,options:{weekStartsOn:1,firstWeekContainsDate:1}},yX=async e=>{try{console.log("Fetching field responses for muestra:",e);const{data:t,error:r}=await B.from("form_field_responses").select("*").eq("muestra_id",e).order("field_label",{ascending:!0});return r?(console.error("Error fetching field responses:",r),[]):(console.log("Field responses found:",(t==null?void 0:t.length)||0,t),t||[])}catch(t){return console.error("Exception in getFieldResponsesForMuestra:",t),[]}},xX=async e=>{if(!e||e.length===0)return console.log("No muestra IDs provided"),{};try{console.log("Fetching field responses for multiple muestras:",e);const{data:t,error:r}=await B.from("form_field_responses").select("*").in("muestra_id",e).order("field_label",{ascending:!0});if(r)return console.error("Error fetching field responses for multiple muestras:",r),{};
522const n=[...new Set((t||[]).map(l=>l.field_id).filter(Boolean))];let a={};if(n.length>0){const{data:l}=await B.from("formulario_campos").select("id, etiqueta").in("id",n);l&&(a=Object.fromEntries(l.map(c=>[c.id,c.etiqueta])))}const i=(t||[]).map(l=>({...l,formulario_campos:a[l.field_id]?{etiqueta:a[l.field_id]}:null}));console.log("Raw field responses data:",i);const s={};return i.forEach(l=>{s[l.muestra_id]||(s[l.muestra_id]=[]),s[l.muestra_id].push(l)}),console.log("Grouped field responses:",s),s}catch(t){return console.error("Exception in getFieldResponsesForMultipleMuestras:",t),{}}},Ok=async e=>{try{console.log("Fetching muestras with form data for OT:",e);const{data:t,error:r}=await B.from("proceso_ot_muestra").select(` 523 *, 524 proceso_ot!inner( 525 ot_number 526 ) 527 `).eq("proceso_ot.ot_number",e).order("num_muestra",{ascending:!0});if(r)return console.error("Error fetching muestras:",r),[];if(console.log("Muestras found:",(t==null?void 0:t.length)||0,t),!t||t.length===0)return[];const n=t.map(s=>s.id),a=await xX(n),i=t.map(s=>({...s,form_responses:a[s.id]||[],created_at:s.created_at,date:new Date(s.created_at).toLocaleDateString()}));return console.log("Final muestras with form data:",i),i}catch(t){return console.error("Exception in getMuestrasWithFormDataForOT:",t),[]}};function bX({src:e,alt:t}){const[r,n]=h.useState("loading");return o.jsxs("div",{children:[r==="loading"&&o.jsxs("div",{className:"flex items-center gap-2 p-4 border rounded-lg bg-muted/20",children:[o.jsx(ye,{className:"h-4 w-4 animate-spin"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Cargando imagen..."})]}),r==="error"&&o.jsxs("div",{className:"flex items-center gap-2 p-4 border rounded-lg bg-destructive/10 text-destructive",children:[o.jsx(Kr,{className:"h-4 w-4"}),o.jsx("span",{className:"text-xs",children:"Error al cargar imagen"}),o.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-xs underline ml-2",children:"Abrir enlace"})]}),o.jsx("img",{src:e,alt:t,loading:"lazy",className:`max-w-full max-h-64 rounded-lg border object-contain bg-muted/20 transition-opacity ${r==="loaded"?"opacity-100":"opacity-0 h-0 overflow-hidden"}`,onLoad:()=>n("loaded"),onError:()=>n("error")})]})}function wX({open:e,onOpenChange:t,muestra:r,index:n,structuredFieldData:a=[]}){var v;const[i,s]=h.useState([]),[l,c]=h.useState(!1),[u,d]=h.useState(null),[f,m]=h.useState(null),p=async g=>{if(!g)return{};try{const{data:x,error:b}=await B.from("formulario_campos").select("id, etiqueta, nombre").eq("formulario_id",g);if(b)return{};const j={};return x==null||x.forEach(w=>{j[w.id]=w.etiqueta||w.nombre||w.id}),j}catch{return{}}},y=g=>{const{data:x}=B.storage.from("form-images").getPublicUrl(g);return console.log("Image URL for path:",g,"=>",x.publicUrl),x.publicUrl};return h.useEffect(()=>{r&&e&&(r.formulario_id&&B.from("formularios").select("nombre").eq("id",r.formulario_id).maybeSingle().then(({data:x})=>{d((x==null?void 0:x.nombre)||null)}),r.proceso_ot_id&&B.from("proceso_ot").select("ot_number").eq("id",r.proceso_ot_id).maybeSingle().then(({data:x})=>{m((x==null?void 0:x.ot_number)||null)}),(async()=>{c(!0);try{let x={};r.formulario_id&&(x=await p(r.formulario_id));const b=j=>j.map(w=>{const S=x[w.field_id]||x[w.field_label]||w.field_label||w.field_id||"Campo sin nombre",_=!!w.image_storage_path;return{key:S,value:_&&!w.field_value?"Evidencia fotográfica":w.field_value||"Sin valor",imagePath:w.image_storage_path||void 0}});if(a&&a.length>0){s(b(a)),c(!1);return}if(r.id){const j=await yX(r.id);if(j&&j.length>0){s(b(j)),c(!1);return}}s([])}catch{s([])}c(!1)})())},[r,a,e]),r?o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsxs(It,{className:"max-w-4xl max-h-[90vh] z-[60]",children:[o.jsx(Ut,{children:o.jsxs(Wt,{children:["Detalle de Muestra #",r.num_muestra||(n!==null?n+1:""),o.jsx("span",{className:"text-sm text-muted-foreground ml-2",children:r.created_at?`(${Dr(new Date(r.created_at),"dd/MM/yyyy HH:mm",{locale:Ua})})`:""})]})}),o.jsx(Yo,{className:"h-[70vh] pr-4",children:o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"bg-muted/30 p-4 rounded-lg",children:[o.jsx("h3",{className:"font-medium mb-3 text-lg",children:"Información de la Muestra"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Número de Muestra"}),o.jsx("span",{className:"text-sm",children:r.num_muestra||"No dis
527ponible"})]}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Número de OT"}),o.jsx("span",{className:"text-sm",children:f||((v=r.proceso_ot)==null?void 0:v.ot_number)||"No disponible"})]}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Formulario"}),o.jsx("span",{className:"text-sm",children:u||"No especificado"})]}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Fecha de Creación"}),o.jsx("span",{className:"text-sm",children:r.created_at?Dr(new Date(r.created_at),"dd/MM/yyyy HH:mm:ss",{locale:Ua}):"No disponible"})]})]})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx("h3",{className:"font-medium text-lg",children:"Datos del Formulario"}),l&&o.jsx(ye,{className:"h-4 w-4 animate-spin"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",i.length," campos registrados)"]})]}),l?o.jsx("div",{className:"flex items-center justify-center p-8",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ye,{className:"h-5 w-5 animate-spin"}),o.jsx("span",{className:"text-muted-foreground",children:"Cargando campos del formulario..."})]})}):i.length>0?o.jsx("div",{className:"grid grid-cols-1 gap-3",children:i.map((g,x)=>o.jsxs("div",{className:"p-3 border rounded-lg flex flex-col gap-2 hover:bg-muted/50 transition-colors",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs("span",{className:"font-medium text-sm sm:w-1/3 text-primary",children:[g.key,":"]}),o.jsx("span",{className:"text-sm sm:w-2/3 break-words",children:g.value})]}),g.imagePath&&o.jsxs("div",{className:"mt-2",children:[o.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[o.jsx(Zf,{className:"h-3 w-3"}),o.jsx("span",{children:"Imagen adjunta"})]}),o.jsx(bX,{src:y(g.imagePath),alt:g.key})]})]},x))}):o.jsx("div",{className:"text-center p-6 border rounded-lg bg-muted/20",children:o.jsx("p",{className:"text-muted-foreground",children:"No se encontraron campos de formulario para esta muestra."})})]}),r.valores_formulario&&Object.keys(r.valores_formulario).length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"font-medium mb-3 text-lg",children:"Valores Adicionales del Formulario"}),o.jsx("div",{className:"grid grid-cols-1 gap-3",children:Object.entries(r.valores_formulario).map(([g,x],b)=>o.jsxs("div",{className:"p-3 border rounded-lg flex flex-col sm:flex-row gap-2 hover:bg-muted/50 transition-colors",children:[o.jsxs("span",{className:"font-medium text-sm sm:w-1/3 text-primary",children:[g,":"]}),o.jsx("span",{className:"text-sm sm:w-2/3 break-words",children:x!==null?String(x):"No especificado"})]},b))})]})]})})]})}):null}function g_({open:e,onOpenChange:t,selectedSamples:r,realSamples:n,otNumber:a}){var j,w;const[i,s]=h.useState(!1),[l,c]=h.useState(null),[u,d]=h.useState(null),[f,m]=h.useState([]),[p,y]=h.useState(!1),v=a||((w=(j=n==null?void 0:n[0])==null?void 0:j.proceso_ot)==null?void 0:w.ot_number);h.useEffect(()=>{e?v?g():n&&m(n):(s(!1),c(null),m([]))},[e,v,n]);const g=async()=>{if(v){y(!0);try{console.log("Loading muestras with form data for OT:",v);const S=await Ok(v);m(S)}catch(S){console.error("Error loading muestras with form data:",S),m([])}finally{y(!1)}}},x=(S,_)=>{console.log("Ver detalles de muestra:",S),c(S),d(_),s(!0)},b=f.length>0?f:n||[];return o.jsxs(o.Fragment,{children:[o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsxs(It,{className:"max-w-4xl max-h-[90vh]",children:[o.jsx(Ut,{children:o.jsxs(Wt,{className:"flex items-center gap-2",children:[o.jsx(Ya,{className:"h-5 w-5"}),"Detalles de Muestras",p&&o.jsx(ye,{className:"h-4 w-4 animate-spin"}),v&&o.jsxs("span",{className:"text-sm text-muted-foreground",children:["OT: ",v]})]})}),p?o.jsx("div",{className:"flex items-center justify-center p-8",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ye,{className:"h-5 w-5 animate-spin"}),o.jsx("span",{className:"text-muted-foreground",children:"Cargando muestras y datos de formulario..."})]})}):b&&b.length>0?o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("h3",{className:"text-lg font-medium",children:["Muestras registradas (",b.length,")"]})}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 max-h-[60vh] overflow-y-auto",children:b.map((S,_)=>{var O;const N=((O=S.form_responses)==null?void 0:O.length)||0,E=N>0;return o.jsxs("div",{className:"border rounded-lg p-4 hover:shadow-md transition-shadow",children:[o.jsxs("div",{className:"flex justify-between items-center mb-3",children:[o.jsxs("h4",{className:"font-medium",children:["Muestra #",S.num_muestra||_+1]}),o.jsx(z,{variant:"outline",size:"sm",onClick:()=>x(S,_),children:"Ver detalle"})]}),o.jsxs("div",{className:"space-y-2 text-sm",children:[o.jsxs("p",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"Fecha:"}
vendor: 28,100 bytes, lines 527-530
527)," ",S.date||Dr(new Date(S.created_at||Date.now()),"dd/MM/yyyy",{locale:Ua})]}),o.jsx("div",{className:"pt-2 border-t",children:E?o.jsxs("p",{className:"text-xs font-medium text-green-600",children:["â ",N," campos registrados"]}):o.jsx("p",{className:"text-xs text-amber-600",children:"â ï¸ No hay campos de formulario registrados"})})]})]},S.id)})})]}):r&&r.length>0?o.jsx("div",{className:"space-y-6 max-h-[60vh] overflow-y-auto",children:r.map(S=>o.jsxs("div",{className:"border rounded-md p-4",children:[o.jsx("h3",{className:"font-medium text-lg mb-2",children:S.name}),o.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Fecha: ",Dr(S.date,"dd/MM/yyyy",{locale:Ua})]}),S.parameters&&S.parameters.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{className:"font-medium mb-2",children:"Parámetros"}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-2",children:S.parameters.map((_,N)=>o.jsxs("div",{className:"p-2 border rounded",children:[o.jsxs("span",{className:"font-medium",children:[_.parameter,": "]}),o.jsxs("span",{children:[_.value," ",_.unit]})]},N))})]})]},S.id))}):o.jsxs("div",{className:"py-8 text-center text-muted-foreground",children:[o.jsx(Ya,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),o.jsx("p",{children:"No hay muestras disponibles para mostrar."})]}),o.jsx(dr,{children:o.jsx(z,{onClick:()=>t(!1),children:"Cerrar"})})]})}),l&&o.jsx(wX,{open:i,onOpenChange:s,muestra:l,index:u,structuredFieldData:l.form_responses||[]})]})}function jX(e,t=globalThis==null?void 0:globalThis.document){const r=it(e);h.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var SX="DismissableLayer",lx="dismissableLayer.update",_X="dismissableLayer.pointerDownOutside",NX="dismissableLayer.focusOutside",y_,Pk=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ak=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...c}=e,u=h.useContext(Pk),[d,f]=h.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=h.useState({}),y=Xe(t,N=>f(N)),v=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=v.indexOf(g),b=d?v.indexOf(d):-1,j=u.layersWithOutsidePointerEventsDisabled.size>0,w=b>=x,S=OX(N=>{const E=N.target,O=[...u.branches].some(P=>P.contains(E));!w||O||(a==null||a(N),s==null||s(N),N.defaultPrevented||l==null||l())},m),_=PX(N=>{const E=N.target;[...u.branches].some(P=>P.contains(E))||(i==null||i(N),s==null||s(N),N.defaultPrevented||l==null||l())},m);return jX(N=>{b===u.layers.size-1&&(n==null||n(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},m),h.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(y_=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),x_(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=y_)}},[d,m,r,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),x_())},[d,u]),h.useEffect(()=>{const N=()=>p({});return document.addEventListener(lx,N),()=>document.removeEventListener(lx,N)},[]),o.jsx(Me.div,{...c,ref:y,style:{pointerEvents:j?w?"auto":"none":void 0,...e.style},onFocusCapture:ue(e.onFocusCapture,_.onFocusCapture),onBlurCapture:ue(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:ue(e.onPointerDownCapture,S.onPointerDownCapture)})});Ak.displayName=SX;var EX="DismissableLayerBranch",CX=h.forwardRef((e,t)=>{const r=h.useContext(Pk),n=h.useRef(null),a=Xe(t,n);return h.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),o.jsx(Me.div,{...e,ref:a})});CX.displayName=EX;function OX(e,t=globalThis==null?void 0:globalThis.document){const r=it(e),n=h.useRef(!1),a=h.useRef(()=>{});return h.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){Tk(_X,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function PX(e,t=globalThis==null?void 0:globalThis.document){const r=it(e),n=h.useRef(!1);return h.useEffect(()=>{const a=i=>{i.target&&!n.current&&Tk(NX,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function x_(){const e=new CustomEvent(lx);document.dispatchEvent(e)}function Tk(e,t,r,{discrete:n}){const a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?Go(a,i):a.dispatchEvent(i)}var Sg=0;function AX(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??b_()),document.body.insertAdjacentElement("beforeend",e[1]??b_()),Sg++,()=>{Sg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Sg--}},[])}function b_(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var _g="focusScope.autoFocusOnMount",Ng="focusScope.autoFocusOnUnmount",w_={bubbles:!1,cancelable:!0},TX="FocusScope",Dk=h.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...s}=e,[l,c]=h.useState(null),u=it(a),d=it(i),f=h.useRef(null),m=Xe(t,v=>c(v)),p=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(n){let v=function(j){if(p.paused||!l)return;const w=j.target;l.contains(w)?f.current=w:hi(f.current,{select:!0})},g=function(j){if(p.paused||!l)return;const w=j.relatedTarget;w!==null&&(l.contains(w)||hi(f.current,{select:!0}))},x=function(j){if(document.activeElement===document.body)for(const S of j)S.removedNodes.length>0&&hi(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",g);const b=new MutationObserver(x);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",g),b.disconnect()}}},[n,l,p.paused]),h.useEffect(()=>{if(l){S_.add(p);const v=document.activeElement;if(!l.contains(v)){const x=new CustomEvent(_g,w_);l.addEventListener(_g,u),l.dispatchEvent(x),x.defaultPrevented||(DX(RX($k(l)),{select:!0}),document.activeElement===v&&hi(l))}return()=>{l.removeEventListener(_g,u),setTimeout(()=>{const x=new CustomEvent(Ng,w_);l.addEventListener(Ng,d),l.dispatchEvent(x),x.defaultPrevented||hi(v??document.body,{select:!0}),l.removeEventListener(Ng,d),S_.remove(p)},0)}}},[l,u,d,p]);const y=h.useCallback(v=>{if(!r&&!n||p.paused)return;const g=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(g&&x){const b=v.currentTarget,[j,w]=$X(b);j&&w?!v.shiftKey&&x===w?(v.preventDefault(),r&&hi(j,{select:!0})):v.shiftKey&&x===j&&(v.preventDefault(),r&&hi(w,{select:!0})):x===b&&v.preventDefault()}},[r,n,p.paused]);return o.jsx(Me.div,{tabIndex:-1,...s,ref:m,onKeyDown:y})});Dk.displayName=TX;function DX(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(hi(n,{select:t}),document.activeElement!==r)return}function $X(e){const t=$k(e),r=j_(t,e),n=j_(t.reverse(),e);return[r,n]}function $k(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function j_(e,t){for(const r of e)if(!kX(r,{upTo:t}))return r}function kX(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function MX(e){return e instanceof HTMLInputElement&&"select"in e}function hi(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&MX(e)&&t&&e.select()}}var S_=IX();function IX(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=__(e,t),e.unshift(t)},remove(t){var r;e=__(e,t),(r=e[0])==null||r.resume()}}}function __(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function RX(e){return e.filter(t=>t.tagName!=="A")}var LX="Portal",kk=h.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[a,i]=h.useState(!1);Ka(()=>i(!0),[]);const s=r||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?Ho.createPortal(o.jsx(Me.div,{...n,ref:t}),s):null});kk.displayName=LX;var Mk=Uh(),Eg=function(){},Fp=h.forwardRef(function(e,t){var r=h.useRef(null),n=h.useState({onScrollCapture:Eg,onWheelCapture:Eg,onTouchMoveCapture:Eg}),a=n[0],i=n[1],s=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,p=e.noIsolation,y=e.inert,v=e.allowPinchZoom,g=e.as,x=g===void 0?"div":g,b=e.gapMode,j=Wh(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=m,S=Vh([r,t]),_=Rt(Rt({},j),a);return h.createElement(h.Fragment,null,d&&h.createElement(w,{sideCar:Mk,removeScrollBar:u,shards:f,noIsolation:p,inert:y,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:b}),s?h.cloneElement(h.Children.only(l),Rt(Rt({},_),{ref:S})):h.createElement(x,Rt({},_,{className:c,ref:S}),l))});Fp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Fp.classNames={fullWidth:Gh,zeroRight:Hh};var cx=!1;if(typeof window<"u")try{var vf=Object.defineProperty({},"passive",{get:function(){return cx=!0,!0}});window.addEventListener("test",vf,vf),window.removeEventListener("test",vf,vf)}catch{cx=!1}var ds=cx?{passive:!1}:!1,FX=function(e){return e.tagName==="TEXTAREA"},Ik=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!FX(e)&&r[t]==="visible")},BX=function(e){return Ik(e,"overflowY")},zX=function(e){return Ik(e,"overflowX")},N_=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=Rk(e,n);if(a){var i=Lk(e,n),s=i[1],l=i[2];if(s>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},qX=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},UX=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Rk=function(e,t){return e==="v"?BX(t):zX(t)},Lk=function(e,t){return e==="v"?qX(t):UX(t)},WX=function(e,t){return e==="h"&&t==="rtl"?-1:1},VX=function(e,t,r,n,a){var i=WX(e,window.getComputedStyle(t).direction),s=i*n,l=r.target,c=t.contains(l),u=!1,d=s>0,f=0,m=0;do{var p=Lk(e,l),y=p[0],v=p[1],g=p[2],x=v-g-i*y;(y||x)&&Rk(e,l)&&(f+=x,m+=y),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(Math.abs(f)<1||!a)||!d&&(Math.abs(m)<1||!a))&&(u=!0),u},gf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},E_=function(e){return[e.deltaX,e.deltaY]},C_=function(e){return e&&"current"in e?e.current:e},GX=function(e,t){return e[0]===t[0]&&e[1]===t[1]},HX=function(e){return` 528 .block-interactivity-`.concat(e,` {pointer-events: none;} 529 .allow-interactivity-`).concat(e,` {pointer-events: all;} 530`)},KX=0,fs=[];function YX(e){var t=h.useRef([]),r=h.useRef([0,0]),n=h.useRef(),a=h.useState(KX++)[0],i=h.useState(Kh)[0],s=h.useRef(e);h.useEffect(function(){s.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var v=Yh([e.lockRef.current],(e.shards||[]).map(C_),!0).filter(Boolean);return v.forEach(function(g){return g.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),v.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(v,g){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!s.current.allowPinchZoom;var x=gf(v),b=r.current,j="deltaX"in v?v.deltaX:b[0]-x[0],w="deltaY"in v?v.deltaY:b[1]-x[1],S,_=v.target,N=Math.abs(j)>Math.abs(w)?"h":"v";if("touches"in v&&N==="h"&&_.type==="range")return!1;var E=N_(N,_);if(!E)return!0;if(E?S=N:(S=N==="v"?"h":"v",E=N_(N,_)),!E)return!1;if(!n.current&&"changedTouches"in v&&(j||w)&&(n.current=S),!S)return!0;var O=n.current||S;return VX(O,g,v,O==="h"?j:w,!0)},[]),c=h.useCallback(function(v){var g=v;if(!(!fs.length||fs[fs.length-1]!==i)){var x="deltaY"in g?E_(g):gf(g),b=t.current.filter(function(S){return S.name===g.type&&(S.target===g.target||g.target===S.shadowParent)&&GX(S.delta,x)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var j=(s.current.shards||[]).map(C_).filter(Boolean).filter(function(S){return S.contains(g.target)}),w=j.length>0?l(g,j[0]):!s.current.noIsolation;w&&g.cancelable&&g.preventDefault()}}},[]),u=h.useCallback(function(v,g,x,b){var j={name:v,delta:g,target:x,should:b,shadowParent:XX(x)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(w){return w!==j})},1)},[]),d=h.useCallback(function(v){r.current=gf(v),n.current=void 0},[]),f=h.useCallback(function(v){u(v.type,E_(v),v.target,l(v,e.lockRef.current))},[]),m=h.useCallback(function(v){u(v.type,gf(v),v.target,l(v,e.lockRef.current))},[]);h.useEffect(function(){return fs.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,ds),document.addEventListener("touchmove",c,ds),document.addEventListener("touchstart",d,ds),function(){fs=fs.filter(function(v){return v!==i}),document.removeEventListener("wheel",c,ds),document.removeEventListener("touchmove",c,ds),document.removeEventListener("touchstart",d,ds)}},[]);var p=e.removeScrollBar,y=e.inert;return h.createElement(h.Fragment,null,y?h.createElement(i,{styles:HX(a)}):null,p?h.createElement(Xh,{gapMode:e.gapMode}):null)}function XX(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ZX=Zh(Mk,YX);var Fk=h.forwardRef(function(e,t){return h.createElement(Fp,Rt({},e,{ref:t,sideCar:ZX}))});Fk.classNames=Fp.classNames;var ux=["Enter"," "],QX=["ArrowDown","PageUp","Home"],Bk=["ArrowUp","PageDown","End"],JX=[...QX,...Bk],eZ={ltr:[...ux,"ArrowRight"],rtl:[...ux,"ArrowLeft"]},tZ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Id="Menu",[gu,rZ,nZ]=Rh(Id),[Qo,zk]=Lr(Id,[nZ,$l,Hl]),Bp=$l(),qk=Hl(),[aZ,Jo]=Qo(Id),[iZ,Rd]=Qo(Id),Uk=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:a,onOpenChange:i,modal:s=!0}=e,l=Bp(t),[c,u]=h.useState(null),d=h.useRef(!1),f=it(i),m=kl(a);return h.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),o.jsx(a0,{...l,children:o.jsx(aZ,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:o.jsx(iZ,{scope:t,onClose:h.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:s,children:n})})})};Uk.displayName=Id;var oZ="MenuAnchor",Mw=h.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,a=Bp(r);return o.jsx(Lh,{...a,...n,ref:t})});Mw.displayName=oZ;var Iw="MenuPortal",[sZ,Wk]=Qo(Iw,{forceMount:void 0}),Vk=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:a}=e,i=Jo(Iw,t);return o.jsx(sZ,{scope:t,forceMount:r,children:o.jsx(er,{present:r||i.open,children:o.jsx(kk,{asChild:!0,container:a,children:n})})})};Vk.displayName=Iw;var Mn="MenuContent",[lZ,Rw]=Qo(Mn),Gk=h.forwardRef((e,t)=>{const r=Wk(Mn,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,i=Jo(Mn,e.__scopeMenu),s=Rd(Mn,e.__scopeMenu);return o.jsx(gu.Provider,{scope:e.__scopeMenu,children:o.jsx(er,{present:n||i.open,children:o.jsx(gu.Slot,{scope:e.__scopeMenu,children:s.modal?o.jsx(cZ,{...a,ref:t}):o.jsx(uZ,{...a,ref:t})})})})}),cZ=h.forwardRef((e,t)=>{const r=Jo(Mn,e.__scopeMenu),n=h.useRef(null),a=Xe(t,n);return h.useEffect(()=>{const i=n.current;if(i)return Qh(i)},[]),o.jsx(Lw,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ue(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),uZ=h.forwardRef((e,t)=>{const r=Jo(Mn,e.__scopeMenu);return o.jsx(Lw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Lw=h.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:p,disableOutsideScroll:y,...v}=e,g=Jo(Mn,r),x=Rd(Mn,r),b=Bp(r),j=qk(r),w=rZ(r),[S,_]=h.useState(null),N=h.useRef(null),E=Xe(t,N,g.onContentChange),O=h.useRef(0),P=h.useRef(""),C=h.useRef(0),A=h.useRef(null),T=h.useRef("right"),k=h.useRef(0),D=y?Fk:h.Fragment,M=y?{as:bd,allowPinchZoom:!0}:void 0,F=I=>{var ce,je;const K=P.current+I,W=w().filter(X=>!X.disabled),R=document.activeElement,V=(ce=W.find(X=>X.ref.current===R))==null?void 0:ce.textValue,re=W.map(X=>X.textValue),H=jZ(re,K,V),te=(je=W.find(X=>X.textValue===H))==null?void 0:je.ref.current;(function X(ae){P.current=ae,window.clearTimeout(O.current),ae!==""&&(O.current=window.setTimeout(()=>X(""),1e3))})(K),te&&setTimeout(()=>te.focus())};h.useEffect(()=>()=>window.clearTimeout(O.current),[]),AX();const q=h.useCallback(I=>{var W,R;return T.current===((W=A.current)==null?void 0:W.side)&&_Z(I,(R=A.current)==null?void 0:R.area)},[]);return o.jsx(lZ,{scope:r,searchRef:P,onItemEnter:h.useCallback(I=>{q(I)&&I.preventDefault()},[q]),onItemLeave:h.useCallback(I=>{var K;q(I)||((K=N.current)==null||K.focus(),_(null))},[q]),onTriggerLeave:h.useCallback(I=>{q(I)&&I.preventDefault()},[q]),pointerGraceTimerRef:C,onPointerGraceIntentChange:h.useCallback(I=>{A.current=I},[]),children:o.jsx(D,{...M,children:o.jsx(Dk,{asChild:!0,trapped:a,onMountAutoFocus:ue(i,I=>{var K;I.preventDefault(),(K=N.current)==null||K.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:o.jsx(Ak,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:p,children:o.jsx(Pw,{asChild:!0,...j,dir:x.dir,orientation:"vertical",loop:n,currentTabStopId:S,onCurrentTabStopIdChange:_,onEntryFocus:ue(c,I=>{x.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(r0,{role:"menu","aria-orientation":"vertical","data-state":lM(g.open),"data-radix-menu-content":"",dir:x.dir,...b,...v,ref:E,style:{outline:"none",...v.style},onKeyDown:ue(v.onKeyDown,I=>{const W=I.target.closest("[data-radix-menu-content]")===I.currentTarget,R=I.ctrlKey||I.altKey||I.metaKey,V=I.key.length===1;W&&(I.key==="Tab"&&I.preventDefault(),!R&&V&&F(I.key));const re=N.current;if(I.target!==re||!JX.includes(I.key))return;I.preventDefault();const te=w().filter(ce=>!ce.disabled).map(ce=>ce.ref.current);Bk.includes(I.key)&&te.reverse(),bZ(te)}),onBlur:ue(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(O.current),P.current="")}),onPointerMove:ue(e.onPointerMove,yu(I=>{const K=I.target,W=k.current!==I.clientX;if(I.currentTarget.contains(K)&&W){const R=I.clientX>k.current?"right":"left";T.current=R,k.current=I.clientX}}))})})})})})})});Gk.displayName=Mn;var dZ="MenuGroup",Fw=h.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return o.jsx(Me.div,{role:"group",...n,ref:t})});Fw.displayName=dZ;var fZ="MenuLabel",Hk=h.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return o.jsx(Me.div,{...n,ref:t})});Hk.displayName=fZ;var wm="MenuItem",O_="menu.itemSelect",zp=h.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...a}=e,i=h.useRef(null),s=Rd(wm,e.__scopeMenu),l=Rw(wm,e.__scopeMenu),c=Xe(t,i),u=h.useRef(!1),d=()=>{const f=i.current;if(!r&&f){const m=new CustomEvent(O_,{bubbles:!0,cancelable:!0});f.addEventListener(O_,p=>n==null?void 0:n(p),{once:!0}),Go(f,m),m.defaultPrevented?u.current=!1:s.onClose()}};return o.jsx(Kk,{...a,ref:c,disabled:r,onClick:ue(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:ue(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:ue(e.onKeyDown,f=>{const m=l.searchRef.current!=="";r||m&&f.key===" "||ux.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});zp.displayName=wm;var Kk=h.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:a,...i}=e,s=Rw(wm,r),l=qk(r),c=h.useRef(null),u=Xe(t,c),[d,f]=h.useState(!1),[m,p]=h.useState("");return h.useEffect(()=>{const y=c.current;y&&p((y.textContent??"").trim())},[i.children]),o.jsx(gu.ItemSlot,{scope:r,disabled:n,textValue:a??m,children:o.jsx(Aw,{asChild:!0,...l,focusable:!n,children:o.jsx(Me.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:u,onPointerMove:ue(e.onPointerMove,yu(y=>{n?s.onItemLeave(y):(s.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ue(e.onPointerLeave,yu(y=>s.onItemLeave(y))),onFocus:ue(e.onFocus,()=>f(!0)),onBlur:ue(e.onBlur,()=>f(!1))})})})}),mZ="MenuCheckboxItem",Yk=h.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...a}=e;return o.jsx(eM,{scope:e.__scopeMenu,checked:r,children:o.jsx(zp,{role:"menuitemcheckbox","aria-checked":jm(r)?"mixed":r,...a,ref:t,"data-state":zw(r),onSelect:ue(a.onSelect,()=>n==null?void 0:n(jm(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Yk.displayName=mZ;var Xk="MenuRadioGroup",[hZ,pZ]=Qo(Xk,{value:void 0,onValueChange:()=>{}}),Zk=h.forwardRef((e,t)=>{const{value:r,onValueChange:n,...a}=e,i=it(n);return o.jsx(hZ,{scope:e.__scopeMenu,value:r,onValueChange:i,children:o.jsx(Fw,{...a,ref:t})})});Zk.displayName=Xk;var Qk="MenuRadioItem",Jk=h.forwardRef((e,t)=>{const{value:r,...n}=e,a=pZ(Qk,e.__scopeMenu),i=r===a.value;return o.jsx(eM,{scope:e.__scopeMenu,checked:i,children:o.jsx(zp,{role:"menuitemradio","aria-checked":i,...n,ref:t,"data-state":zw(i),onSelect:ue(n.onSelect,()=>{var s;return(s=a.onValueChange)==null?void 0:s.call(a,r)},{checkForDefaultPrevented:!1})})})});Jk.displayName=Qk;var Bw="MenuItemIndicator",[eM,vZ]=Qo(Bw,{checked:!1}),tM=h.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...a}=e,i=vZ(Bw,r);return o.jsx(er,{present:n||jm(i.checked)||i.checked===!0,children:o.jsx(Me.span,{...a,ref:t,"data-state":zw(i.checked)})})});tM.displayName=Bw;var gZ="MenuSeparator",rM=h.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return o.jsx(Me.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});rM.displayName=gZ;var yZ="MenuArrow",nM=h.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,a=Bp(r);return o.jsx(n0,{...a,...n,ref:t})});nM.displayName=yZ;var xZ="MenuSub",[YPe,aM]=Qo(xZ),kc="MenuSubTrigger",iM=h.forwardRef((e,t)=>{const r=Jo(kc,e.__scopeMenu),n=Rd(kc,e.__scopeMenu),a=aM(kc,e.__scopeMenu),i=Rw(kc,e.__scopeMenu),s=h.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,u={__scopeMenu:e.__scopeMenu},d=h.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return h.useEffect(()=>d,[d]),h.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),o.jsx(Mw,{asChild:!0,...u,children:o.jsx(Kk,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":a.contentId,"data-state":lM(r.open),...e,ref:IP(t,a.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:ue(e.onPointerMove,yu(f=>{i.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:ue(e.onPointerLeave,yu(f=>{var p,y;d();const m=(p=r.content)==null?void 0:p.getBoundingClientRect();if(m){const v=(y=r.content)==null?void 0:y.dataset.side,g=v==="right",x=g?-5:5,b=m[g?"left":"right"],j=m[g?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+x,y:f.clientY},{x:b,y:m.top},{x:j,y:m.top},{x:j,y:m.bottom},{x:b,y:m.bottom}],side:v}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:ue(e.onKeyDown,f=>{var p;const m=i.searchRef.current!=="";e.disabled||m&&f.key===" "||eZ[n.dir].includes(f.key)&&(r.onOpenChange(!0),(p=r.content)==null||p.focus(),f.preventDefault())})})})});iM.displayName=kc;var oM="MenuSubContent",sM=h.forwardRef((e,t)=>{const r=Wk(Mn,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,i=Jo(Mn,e.__scopeMenu),s=Rd(Mn,e.__scopeMenu),l=aM(oM,e.__scopeMenu),c=h.useRef(null),u=Xe(t,c);return o.jsx(gu.Provider,{scope:e.__scopeMenu,children:o.jsx(er,{present:n||i.open,children:o.jsx(gu.Slot,{scope:e.__scopeMenu,children:o.jsx(Lw,{id:l.contentId,"aria-labelledby":l.triggerId,...a,ref:u,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;s.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ue(e.onFocusOutside,d=>{d.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:ue(e.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault()}),onKeyDown:ue(e.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),m=tZ[s.dir].includes(d.key);f&&m&&(i.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});sM.displayName=oM;function lM(e){return e?"open":"closed"}function jm(e){return e==="indeterminate"}function zw(e){return jm(e)?"indeterminate":e?"checked":"unchecked"}function bZ(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function wZ(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function jZ(e,t,r){const a=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=r?e.indexOf(r):-1;let s=wZ(e,Math.max(i,0));a.length===1&&(s=s.filter(u=>u!==r));const c=s.find(u=>u.toLowerCase().startsWith(a.toLowerCase()));return c!==r?c:void 0}function SZ(e,t){const{x:r,y:n}=e;let a=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const l=t[i].x,c=t[i].y,u=t[s].x,d=t[s].y;c>n!=d>n&&r<(u-l)*(n-c)/(d-c)+l&&(a=!a)}return a}function _Z(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return SZ(r,t)}function yu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var NZ=Uk,EZ=Mw,CZ=Vk,OZ=Gk,PZ=Fw,AZ=Hk,TZ=zp,DZ=Yk,$Z=Zk,kZ=Jk,MZ=tM,IZ=rM,RZ=nM,LZ=iM,FZ=sM,qw="DropdownMenu",[BZ,XPe]=Lr(qw,[zk]),Fr=zk(),[zZ,cM]=BZ(qw),uM=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:a,defaultOpen:i,onOpenChange:s,modal:l=!0}=e,c=Fr(t),u=h.useRef(null),[d=!1,f]=hn({prop:a,defaultProp:i,onChange:s});return o.jsx(zZ,{scope:t,triggerId:Qn(),triggerRef:u,contentId:Qn(),open:d,onOpenChange:f,onOpenToggle:h.useCallback(()=>f(m=>!m),[f]),modal:l,children:o.jsx(NZ,{...c,open:d,onOpenChange:f,dir:n,modal:l,children:r})})};uM.displayName=qw;var dM="DropdownMenuTrigger",fM=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...a}=e,i=cM(dM,r),s=Fr(r);
530return o.jsx(EZ,{asChild:!0,...s,children:o.jsx(Me.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...a,ref:IP(t,i.triggerRef),onPointerDown:ue(e.onPointerDown,l=>{!n&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:ue(e.onKeyDown,l=>{n||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});fM.displayName=dM;var qZ="DropdownMenuPortal",mM=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Fr(t);return o.jsx(CZ,{...n,...r})};mM.displayName=qZ;var hM="DropdownMenuContent",pM=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=cM(hM,r),i=Fr(r),s=h.useRef(!1);return o.jsx(OZ,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...n,ref:t,onCloseAutoFocus:ue(e.onCloseAutoFocus,l=>{var c;s.current||(c=a.triggerRef.current)==null||c.focus(),s.current=!1,l.preventDefault()}),onInteractOutside:ue(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!a.modal||d)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});pM.displayName=hM;var UZ="DropdownMenuGroup",WZ=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Fr(r);return o.jsx(PZ,{...a,...n,ref:t})});WZ.displayName=UZ;var VZ="DropdownMenuLabel",vM=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Fr(r);return o.jsx(AZ,{...a,...n,ref:t})});vM.displayName=VZ;var GZ="DropdownMenuItem",gM=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Fr(r);return o.jsx(TZ,{...a,...n,ref:t})});gM.displayName=GZ;var HZ="DropdownMenuCheckboxItem",yM=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Fr(r);return o.jsx(DZ,{...a,...n,ref:t})});yM.displayName=HZ;var KZ="DropdownMenuRadioGroup",YZ=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Fr(r);return o.jsx($Z,{...a,...n,ref:t})});YZ.displayName=KZ;var XZ="DropdownMenuRadioItem",xM=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Fr(r);return o.jsx(kZ,{...a,...n,ref:t})});xM.displayName=XZ;var ZZ="DropdownMenuItemIndicator",bM=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Fr(r);return o.jsx(MZ,{...a,...n,ref:t})});bM.displayName=ZZ;var QZ="DropdownMenuSeparator",wM=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Fr(r);return o.jsx(IZ,{...a,...n,ref:t})});wM.displayName=QZ;var JZ="DropdownMenuArrow",eQ=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Fr(r);return o.jsx(RZ,{...a,...n,ref:t})});eQ.displayName=JZ;var tQ="DropdownMenuSubTrigger",jM=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Fr(r);return o.jsx(LZ,{...a,...n,ref:t})});jM.displayName=tQ;var rQ="DropdownMenuSubContent",SM=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Fr(r);return o.jsx(FZ,{...a,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});SM.displayName=rQ;var nQ=uM,aQ=fM,iQ=mM,_M=pM,NM=vM,EM=gM,CM=yM,OM=xM,PM=bM,AM=wM,TM=jM,DM=SM;const P_=nQ,A_=aQ,oQ=h.forwardRef(({className:e,inset:t,children:r,...n},a)=>o.jsxs(TM,{ref:a,className:oe("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...n,children:[r,o.jsx(Il,{className:"ml-auto h-4 w-4"})]}));oQ.displayName=TM.displayName;const sQ=h.forwardRef(({className:e,...t},r)=>o.jsx(DM,{ref:r,className:oe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
530de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));sQ.displayName=DM.displayName;const dx=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>o.jsx(iQ,{children:o.jsx(_M,{ref:n,sideOffset:t,className:oe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));dx.displayName=_M.displayName;const Ma=h.forwardRef(({className:e,inset:t,...r},n)=>o.jsx(EM,{ref:n,className:oe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));Ma.displayName=EM.displayName;const lQ=h.forwardRef(({className:e,children:t,checked:r,...n},a)=>o.jsxs(CM,{ref:a,className:oe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(PM,{children:o.jsx(iu,{className:"h-4 w-4"})})}),t]}));lQ.displayName=CM.displayName;const cQ=h.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(OM,{ref:n,className:oe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(PM,{children:o.jsx(f0,{className:"h-2 w-2 fill-current"})})}),t]}));cQ.displayName=OM.displayName;const uQ=h.forwardRef(({className:e,inset:t,...r},n)=>o.jsx(NM,{ref:n,className:oe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));uQ.displayName=NM.displayName;const dQ=h.forwardRef(({className:e,...t},r)=>o.jsx(AM,{ref:r,className:oe("-mx-1 my-1 h-px bg-muted",e),...t}));dQ.displayName=AM.displayName;const Cg=e=>{var c;if(!(((c=e.area)==null?void 0:c.toUpperCase().startsWith("EMPAQUE"))||!1)||!e.date||!e.tiempoProceso||!e.cantidad)return{status:"none",remainingMs:1/0};const r=e.tiempoProceso*e.cantidad*1e3,n=new Date(e.date).getTime(),i=Date.now()-n,s=r-i;if(s<=0)return{status:"red",remainingMs:s};const l=s/(60*60*1e3);return l>3?{status:"green",remainingMs:s}:l>2?{status:"yellow",remainingMs:s}:{status:"red",remainingMs:s}};function fQ({orders:e,onFormClick:t}){const r=ql(),n=Array.isArray(e)?e.filter(Boolean):[];console.log("Valid orders in WorkOrdersTable:",n.length);const a=BY(n);console.log("Updated orders with samples:",a.length);const[i,s]=h.useState(!1),[l,c]=h.useState(null),[u,d]=h.useState(null),[f,m]=h.useState(null),[p,y]=h.useState("all"),[v,g]=h.useState("none"),x=h.useMemo(()=>{let S=[...a];return p!=="all"&&(S=S.filter(_=>{const{status:N}=Cg(_);return N===p})),v!=="none"&&S.sort((_,N)=>{const E=Cg(_),O=Cg(N);return E.status==="none"&&O.status!=="none"?1:O.status==="none"&&E.status!=="none"?-1:E.status==="none"&&O.status==="none"?0:v==="asc"?E.remainingMs-O.remainingMs:O.remainingMs-E.remainingMs}),S},[a,p,v]),b=()=>{g(v==="none"?"asc":v==="asc"?"desc":"none")},j=()=>{switch(p){case"red":return"CrÃtico";case"yellow":return"Precaución";case"green":return"En tiempo";default:return"Todos"}},w=(S,_,N)=>{console.log("Viewing samples:",{samples:S,realSamples:_,otNumber:N}),c(S||null),d(_||null),m(N||null),s(!0)};return x.length===0?o.jsxs("div",{className:"text-center p-8 border rounded-md",children:[o.jsx("p",{children:p!=="all"?`No hay OTs con estado "${j()}"`:"No hay órdenes de trabajo para mostrar"}),p!=="all"&&o.jsx(z,{variant:"ghost",size:"sm",onClick:()=>y("all"),className:"mt-2",children:"Ver todas"})]}):r?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex gap-2 mb-4 flex-wrap",children:[o.jsxs(P_,{children:[o.jsx(A_,{asChild:!0,children:o.jsxs(z,{variant:"outline",size:"sm",className:"gap-2",children:[o.jsx(Xf,{className:"h-4 w-4"}),j()]})}),o.jsxs(dx,{children:[o.jsxs(Ma,{onClick:()=>y("all"),children:[o.jsx("span",{className:"w-3 h-3 rounded-full bg-gray-300 mr-2"}),"Todos"]}),o.jsxs(Ma,{onClick:()=>y("red"),children:[o.jsx("span",{className:"w-3 h-3 rounded-full bg-red-500 mr-2"}),"CrÃtico"]}),o.jsxs(Ma,{onClick:()=>y("yellow"),children:[o.jsx("span",{className:"w-3 h-3 rounded-full bg-yellow-500 mr-2"}),"Precaución"]}),o.jsxs(Ma,{onClick:()=>y("green"),children:[o.jsx("span",{className:"w-3 h-3 rounded-full bg-green-500 mr-2"}),"En tiempo"]})]})]}),o.jsxs(z,{variant:"outline",size:"sm",onClick:b,className:"gap-2",children:[o.jsx(Yv,{className:"h-4 w-4"}),v==="asc"?"CrÃtico primero":v==="desc"?"En tiempo primero":"Sin ordenar"]})]}),o.jsx("div",{className:"space-y-4",children:x.map(S=>{var _;return o.jsxs(de,{children:[o.jsx(Le,{className:"pb-2",children:o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsxs(Ie,{className:"text-base",children:["OT: ",S.otNumber]}),o.jsx(ke,{className:`${S.status==="Completado"?"bg-green-100 text-green-800 hover:bg-green-200":S.status==="Incompleto"?"bg-yellow-100 text-yellow-800 hover:bg-yellow-200":"bg-red-100 text-red-800 hover:bg-red-200"}`,children:S.status})]})}),o.jsx(fe,{className:"py-2",children:o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"font-medium text-gray-600",children:"Ãrea:"}),o.jsx("span",{children:S.area})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"font-medium text-gray-600",children:"Fecha:"}),o.jsx("span",{children:S.date})]}),((_=S.area)==null?void 0:_.toUpperCase().startsWith("EMPAQUE"))&&o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"font-medium text-gray-600",children:"Tiempo:"}),o.jsx(Ck,{startDate:S.date,tiempoProceso:S.tiempoProceso,cantidad:S.cantidad})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"font-medium text-gray-600",children:"Muestras:"}),o.jsxs("span",{children:[S.samplesCompleted," / ",S.samplesScheduled]})]}),o.jsxs(z,{variant:"outline",size:"sm",className:"w-full mt-2",onClick:()=>t(S.otNumber,S.area),children:[o.jsx(Ya,{className:"h-4 w-4 mr-2"}),"Llenar Form"]})]})})]},S.id)})}),o.jsx(g_,{open:i,onOpenChange:s,selectedSamples:l,realSamples:u})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex gap-2 mb-4 flex-wrap items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground mr-2",children:"Filtrar por tiempo:"}),o.jsxs(P_,{children:[o.jsx(A_,{asChild:!0,children:o.jsxs(z,{variant:"outline",size:"sm",className:"gap-2",children:[o.jsx(Xf,{className:"h-4 w-4"}),j()]})}),o.jsxs(dx,{children:[o.jsxs(Ma,{onClick:()=>y("all"),children:[o.jsx("span",{className:"w-3 h-3 rounded-full bg-gray-300 mr-2"}),"Todos"]}),o.jsxs(Ma,{onClick:()=>y("red"),children:[o.jsx("span",{className:"w-3 h-3 rounded-full bg-red-500 mr-2"}),"CrÃtico (menos de 2h)"]}),o.jsxs(Ma,{onClick:()=>y("yellow"),children:[o.jsx("span",{className:"w-3 h-3 rounded-full bg-yellow-500 mr-2"}),"Precaución (2-3h)"]}),o.jsxs(Ma,{onClick:()=>y("green"),children:[o.jsx("span",{className:"w-3 h-3 rounded-full bg-green-500 mr-2"}),"En tiempo (más de 3h)"]})]})]}),o.jsxs(z,{variant:"outline",size:"sm",onClick:b,className:"gap-2",children:[o.jsx(Yv,{className:"h-4 w-4"}),v==="asc"?"CrÃtico primero":v==="desc"?"En tiempo primero":"Sin ordenar"]}),(p!=="all"||v!=="none")&&o.jsx(z,{variant:"ghost",size:"sm",onClick:()=>{y("all"),g("none")},className:"text-muted-foreground",children:"Limpiar filtros"})]}),o.jsx("div",{className:"rounded-md border overflow-x-auto",children:o.jsxs(yn,{children:[o.jsx(xn,{children:o.jsxs(Nt,{children:[o.jsx(Pe,{children:"Número OT"}),o.jsx(Pe,{children:"Producto"}),o.jsx(Pe,{children:"Ãrea"}),o.jsx(Pe,{children:"LÃder de Proceso"}),o.jsx(Pe,{children:"Fecha"}),o.jsx(Pe,{children:"Estado"}),o.jsx(Pe,{children:o.jsxs("div",{className:"flex items-center gap-1",children:["Tiempo Estimado",o.jsx(z,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:b,children:o.jsx(Yv,{className:"h-3 w-3"})})]})}),o.jsx(Pe,{children:"Muestras"}),o.jsx(Pe,{children:"Acciones"})]})}),o.jsx(bn,{children:x.map(S=>o.jsx(zY,{order:S,onViewSamples:(_,N)=>w(_,N,S.otNumber),onFormClick:_=>t(_,S.area)},S.id))})]})}),o.jsx(g_,{open:i,onOpenChange:s,selectedSamples:l,realSamples:u,otNumber:f||void 0})]})}function mQ({paginationInfo:e,onGoToPage:t,onNextPage:r,onPreviousPage:n,isLoading:a=!1}){const{currentPage:i,totalPages:s,totalItems:l,itemsPerPage:c,hasNextPage:u,hasPreviousPage:d}=e;if(s<=1)return null;const m=(()=>{const g=[],x=[];for(let b=Math.max(2,i-2);b<=Math.min(s-1,i+2);b++)g.push(b);return i-2>2?x.push(1,"..."):x.push(1),x.push(...g),i+2<s-1?x.push("...",s):s>1&&x.push(s),x})(),p=(i-1)*c+1,y=Math.min(i*c,l);return o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 py-4",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["Mostrando ",p," - ",y," de ",l," órdenes de trabajo"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(z,{variant:"outline",size:"sm",onClick:()=>t(1),disabled:!d||a,className:"hidden sm:flex",children:o.jsx(a3,{className:"h-4 w-4"})}),o.jsxs(z,{variant:"outline",size:"sm",onClick:n,disabled:!d||a,children:[o.jsx(Ao,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline ml-1",children:"Anterior"})]}),o.jsx("div",{className:"flex items-center gap-1",children:m.map((v,g)=>v==="..."?o.jsx("span",{className:"px-2 py-1 text-muted-foreground",children:"..."},`dots-${g}`):o.jsx(z,{variant:i===v?"default":"outline",size:"sm",onClick:()=>t(v),disabled:a,className:"min-w-[40px]",children:v},v))}),o.jsxs(z,{variant:"outline",size:"sm",onClick:r,disabled:!u||a,children:[o.jsx("span",{className:"hidden sm:inline mr-1",children:"Siguiente"}),o.jsx(Il,{className:"h-4 w-4"})]}),o.jsx(z,{variant:"outline",size:"sm",onClick:()=>t(s),disabled:!u||a,className:"hidden sm:flex",children:o.jsx(i3,{className:"h-4 w-4"})})]})]})}function hQ(){const{workOrders:e,allWorkOrders:t,filteredSummaryStats:r,paginationInfo:n,isLoading:a,error:i,goToPage:s,nextPage:l,previousPage:c,refreshData:u,applyFilters:d}=IY(),{user:f,session:m}=Hi(),p=!!m,{toast:y}=Rn(),[v,g]=h.useState(!1),[x,b]=h.useState({otNumber:"",premix:"",resultingProduct:"",area:"",processLeader:"",status:"",supervisor:""}
530),[j,w]=h.useState(null),[S,_]=h.useState(null),[N,E]=h.useState(!1),O=async()=>{g(!0);try{const{data:T,error:k}=await B.functions.invoke("azure-ot",{method:"GET"});if(k)throw k;const D=T.stats||{};y({title:"â
Sincronización exitosa",description:`${D.sincronizados||0} OTs sincronizadas (${D.nuevos||0} nuevas, ${D.actualizados||0} actualizadas)`}),u()}catch(T){console.error("Error sincronizando:",T),y({title:"â Error en sincronización",description:T.message||"No se pudo conectar con Azure",variant:"destructive"})}finally{g(!1)}},P=T=>{b({...x,...T}),d(T)},C=(T,k)=>{console.log("Seleccionando OT para formulario:",T,"Ãrea:",k),w(T),_(k),E(!0)},A=()=>o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[o.jsx(de,{children:o.jsxs(fe,{className:"pt-6",children:[o.jsx(Ie,{className:"text-lg mb-2 r-text-base",children:"Total de OT"}),o.jsx("p",{className:"text-3xl font-bold r-text-xl",children:r.totalOrders})]})}),o.jsx(de,{className:"border-red-200 bg-red-50",children:o.jsxs(fe,{className:"pt-6",children:[o.jsx(Ie,{className:"text-lg mb-2 r-text-base",children:"OT Pendientes"}),o.jsx("p",{className:"text-3xl font-bold text-red-600 r-text-xl",children:r.pendingOrders})]})}),o.jsx(de,{className:"border-yellow-200 bg-yellow-50",children:o.jsxs(fe,{className:"pt-6",children:[o.jsx(Ie,{className:"text-lg mb-2 r-text-base",children:"OT Incompletas"}),o.jsx("p",{className:"text-3xl font-bold text-yellow-600 r-text-xl",children:r.incompleteOrders})]})}),o.jsx(de,{className:"border-green-200 bg-green-50",children:o.jsxs(fe,{className:"pt-6",children:[o.jsx(Ie,{className:"text-lg mb-2 r-text-base",children:"OT Completadas"}),o.jsx("p",{className:"text-3xl font-bold text-green-600 r-text-xl",children:r.completedOrders})]})})]});return p?o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"font-bold r-text-2xl my-[50px] text-2xl text-center",children:"Dashboard de Ãrdenes de Trabajo"}),o.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:["Página ",n.currentPage," de ",n.totalPages," - Mostrando ",e.length," de ",n.totalItems," OT"]})]}),o.jsx("div",{className:"flex gap-2",children:o.jsxs(z,{variant:"default",size:"sm",onClick:O,disabled:v,className:"whitespace-nowrap",children:[o.jsx(rp,{className:`h-4 w-4 mr-1 ${v?"animate-spin":""}`}),v?"Sincronizando...":"Sincronizar OT's"]})})]}),i&&o.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-700 p-4 rounded-md",children:[o.jsx("p",{className:"font-medium r-text-sm",children:"Error al cargar datos:"}),o.jsx("p",{className:"r-text-sm",children:i})]}),A(),o.jsx(DY,{filters:{otNumber:x.otNumber,status:x.status,area:x.area,resultingProduct:x.resultingProduct,supervisor:x.supervisor},setFilters:P,workOrders:t}),a?o.jsx("div",{className:"h-96 flex items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-4",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("span",{className:"text-muted-foreground",children:"Cargando órdenes de trabajo..."})]})}):e.length>0?o.jsxs(o.Fragment,{children:[o.jsx(fQ,{orders:e,onFormClick:C}),o.jsx(mQ,{paginationInfo:n,onGoToPage:s,onNextPage:l,onPreviousPage:c,isLoading:a})]}):o.jsxs("div",{className:"h-96 flex items-center justify-center flex-col gap-4",children:[o.jsx("p",{className:"text-muted-foreground text-lg",children:"No se encontraron órdenes de trabajo"}),o.jsxs(z,{onClick:u,children:[o.jsx($o,{className:"h-4 w-4 mr-2"}),"Intentar nuevamente"]})]}),o.jsx(kY,{open:N,onOpenChange:E,otNumber:j||"",otArea:S||void 0})]}):o.jsxs("div",{className:"h-screen flex flex-col items-center justify-center",children:[o.jsx("h1",{className:"text-2xl font-bold mb-4 r-text-xl",children:"Debe iniciar sesión para ver el dashboard"}),o.jsx("p",{className:"mb-6 text-gray-600 r-text-sm",children:"Por favor, inicie sesión o regÃstrese para acceder a esta sección."})]})}function pQ(){up();const e=vn(),t=or(),{toast:r}=Rn(),[n,a]=h.useState(!1),[i,s]=h.useState(null),[l,c]=h.useState(!0),[u,d]=h.useState(null),m=new URLSearchParams(e.search).get("ot");h.useEffect(()=>{if(!m){d("No se proporcionó número de OT"),c(!1);return}async function g(){var x;try{c(!0);const{data:b,error:j}=await B.from("etlotdelcerro").select("*").eq("OTnum_orden",parseInt(m)).maybeSingle();if(j)throw console.error("Error cargando datos de OT:",j),j;if(!b)throw new Error("No se encontró la orden de trabajo");console.log("Datos de OT cargados:",b);const w={otNumber:((x=b.OTnum_orden)==null?void 0:x.toString())||m,shift:"No especificado",processLeader:b.OTjefedeturno||"No especificado",resultingProduct:b.OTprod_resultante||"No especificado",unitsScheduled:Number(b.OTcant_programada)||0,unitsCompleted:Number(b.OTcant_producida)||0,supervisor:b.OTjefedeturno||"No especificado",samplesScheduled:Number(b.OTmuestraprogramada)||5,samplesCompleted:0};s(w)}catch(b){console.error("Error:",b),d("Error cargando información de la orden de trabajo"),s({otNumber:m||"OT-2025-001",shift:"Mañana",processLeader:"Juan Pérez",resultingProduct:"Producto Final
530X",unitsScheduled:200,unitsCompleted:150,supervisor:"Roberto Gómez",samplesScheduled:5,samplesCompleted:0}),r({variant:"destructive",title:"Error",description:"Se están usando datos de respaldo debido a un error en la conexión"})}finally{c(!1)}}g()},[m,r]);const p=async()=>{a(!0);try{if(m){const{data:g,error:x}=await B.from("proceso_ot").select("id").eq("ot_number",m).maybeSingle();if(x&&console.error("Error verificando proceso_ot:",x),!g){const{data:b,error:j}=await B.from("proceso_ot").insert({ot_number:m,validacion:{responsable:i==null?void 0:i.supervisor,fecha_validacion:new Date().toISOString()}}).select("id").single();j?console.error("Error creando proceso_ot:",j):console.log("Nuevo proceso_ot creado:",b)}}r({title:"Información Validada",description:"La información ha sido validada correctamente."})}catch(g){console.error("Error durante la validación:",g),r({variant:"destructive",title:"Error",description:"No se pudo completar la validación"})}},y=()=>{t(`/preview/technical?ot=${m}`)},v=()=>{t("/dashboard")};return l?o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin"}),o.jsx("p",{children:"Cargando información de OT..."})]})}):u&&!i?o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"text-red-500 font-medium",children:u}),o.jsx(z,{className:"mt-4",onClick:v,children:"Volver al Dashboard"})]})}):i?o.jsxs("div",{className:"max-w-3xl mx-auto py-4 px-4 md:py-6 md:px-0",children:[o.jsxs("div",{className:"flex flex-col space-y-4 mb-6",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsxs(z,{variant:"ghost",onClick:v,size:"sm",className:"self-start",children:[o.jsx(u0,{className:"mr-2 h-4 w-4"}),"Volver al Dashboard"]}),o.jsx("div",{className:"text-lg font-semibold",children:"Fase 1: Validación de Información"})]}),o.jsx("div",{className:"self-end",children:!n&&o.jsxs(z,{onClick:p,disabled:!i||l,children:["Confirmar y Continuar",o.jsx(N1,{className:"ml-2 h-4 w-4"})]})})]}),o.jsxs(de,{className:"shadow-md",children:[o.jsx(Le,{className:"bg-slate-50 border-b py-3 px-4",children:o.jsxs(Ie,{className:"flex flex-col md:flex-row md:items-center md:justify-between text-base",children:[o.jsxs("span",{children:["Validación de Información - ",i==null?void 0:i.otNumber]}),n&&o.jsxs("span",{className:"text-green-600 flex items-center text-sm font-normal mt-2 md:mt-0",children:[o.jsx(To,{className:"h-4 w-4 mr-1"}),"Información Validada"]})]})}),o.jsx(fe,{className:"pt-6 grid gap-6",children:o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"otNumber",children:"Número de OT"}),o.jsx(we,{id:"otNumber",value:i.otNumber,readOnly:!0,className:"bg-slate-50"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"shift",children:"Turno de trabajo"}),o.jsx(we,{id:"shift",value:i.shift,readOnly:!0,className:"bg-slate-50"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"processLeader",children:"LÃder de proceso"}),o.jsx(we,{id:"processLeader",value:i.processLeader,readOnly:!0,className:"bg-slate-50"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"resultingProduct",children:"Producto resultante"}),o.jsx(we,{id:"resultingProduct",value:i.resultingProduct,readOnly:!0,className:"bg-slate-50"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"unitsScheduled",children:"Unidades programadas"}),o.jsx(we,{id:"unitsScheduled",value:i.unitsScheduled,readOnly:!0,className:"bg-slate-50"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"unitsCompleted",children:"Unidades realizadas"}),o.jsx(we,{id:"unitsCompleted",value:i.unitsCompleted,readOnly:!0,className:"bg-slate-50"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"supervisor",children:"Supervisor responsable"}),o.jsx(we,{id:"supervisor",value:i.supervisor,readOnly:!0,className:"bg-slate-50"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"samplesScheduled",children:"Muestras programadas"}),o.jsx(we,{id:"samplesScheduled",value:i.samplesScheduled,readOnly:!0,className:"bg-slate-50"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"samplesCompleted",children:"Muestras realizadas"}),o.jsx(we,{id:"samplesCompleted",value:i.samplesCompleted,readOnly:!0,className:"bg-slate-50"})]})]})}),o.jsxs(jd,{className:"flex flex-col sm:flex-row justify-between items-center border-t pt-6 gap-4",children:[o.jsx(z,{variant:"outline",onClick:v,className:"w-full sm:w-auto",children:"Cancelar"}),o.jsx("div",{className:"w-full sm:w-auto",children:n?o.jsxs(z,{onClick:y,className:"w-full",children:["Continuar a Fase 2",o.jsx(N1,{className:"ml-2 h-4 w-4"})]}):o.jsxs(z,{onClick:p,className:"w-full",children:[o.jsx(To,{className:"mr-2 h-4 w-4"}),"Validar Información"]})})]})]})]}):o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx("p",{children:"No se pudo cargar la
530información."})})}function vQ(e,t){const{toast:r}=Rn(),[n,a]=h.useState({}),[i,s]=h.useState(""),{getOtData:l,isLoading:c}=Xo(),u=h.useMemo(()=>{var x;if(!e)return null;const v=l(e);return v!=null&&v.otData?{ot_numero:((x=v.otData.ot_number)==null?void 0:x.toString())||e,lider_proceso:v.otData.jefe_turno,producto_resultante:v.otData.premezcla,premezcla:v.otData.premezcla,area:v.otData.area,fecha:v.otData.fecha,unidades_programadas:Number(v.otData.cant_programada)||0,unidades_completadas:Number(v.otData.cant_producida)||0,muestras_programadas:Number(v.otData.muestras_programadas)||5,muestras_completadas:0,turno:"No especificado",supervisor:v.otData.supervisor||v.otData.jefe_turno}:null},[e,l]),{data:d,isLoading:f}=lt({queryKey:["form-with-fields",t],queryFn:async()=>{if(!t)throw new Error("No form ID provided");const{data:v,error:g}=await B.from("formularios").select("*").eq("id",t).maybeSingle();if(g)throw console.error("Error loading form data:",g),r({variant:"destructive",title:"Error",description:"No se pudo cargar el formulario seleccionado"}),g;const{data:x,error:b}=await B.from("formulario_campos").select("id, nombre, etiqueta").eq("formulario_id",t).order("orden",{ascending:!0});return b?(console.error("Error loading form fields:",b),{form:v,fields:[]}):(v&&s(v.nombre),{form:v,fields:x||[]})},enabled:!!t,staleTime:5*60*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1}),m=(d==null?void 0:d.form)||null,p=(d==null?void 0:d.fields)||[],y=h.useMemo(()=>p.reduce((v,g)=>(v[g.nombre]=g.etiqueta,v),{}),[p]);return h.useEffect(()=>{if(u){const v={"num-ot":u.ot_numero,turno:u.turno||"No especificado",lider:u.lider_proceso||"No especificado",producto:u.producto_resultante||"No especificado","und-prog":u.unidades_programadas||0,"und-real":u.unidades_completadas||0,supervisor:u.supervisor||"No especificado",ot_numero:u.ot_numero,lider_proceso:u.lider_proceso||"No especificado",producto_resultante:u.producto_resultante||"No especificado",unidades_programadas:u.unidades_programadas||0,unidades_completadas:u.unidades_completadas||0,muestras_programadas:u.muestras_programadas||5};a(v)}},[u]),{otData:u,loadingOtData:c,selectedForm:m,loadingForm:f,formFields:p,loadingFields:f,staticFase1Data:n,formName:i,fieldLabelsMap:y}}function gQ(e,t){const{allOtData:r,isLoading:n,getOtData:a,refetch:i}=Xo(),s=h.useMemo(()=>{var f;if(!e||!t)return null;const c=a(e);if(!c)return console.log("ð SAMPLES DEBUG: No batch data for OT",e),{count:0,total:(t==null?void 0:t.muestras_programadas)||5};const u=c.muestras_count??((f=c.muestras)==null?void 0:f.length)??0,d=(t==null?void 0:t.muestras_programadas)||5;return console.log("ð SAMPLES DEBUG: OT",e,"- Count:",u,"Total:",d,"isCompleted:",u>=d),{count:u,total:d}},[e,t,r]);return{samplesData:s,loadingSamples:n,refetchSamples:()=>{console.log("ð TECHNICAL SAMPLES: Refetching samples for OT:",e),i()},muestrasCount:(s==null?void 0:s.count)||0,muestrasProgramadas:(s==null?void 0:s.total)||5,isCompleted:((s==null?void 0:s.count)||0)>=((s==null?void 0:s.total)||5)}}function yQ(e,t,r,n,a){const i=or(),{toast:s}=Rn(),l=pn(),[c,u]=h.useState(!1),[d,f]=h.useState(null);return{submitForm:async(p,y)=>{if(!e){s({variant:"destructive",title:"Error",description:"No se proporcionó número de OT"});return}if(!t){s({variant:"destructive",title:"Error",description:"No se proporcionó ID de formulario"});return}u(!0),f(null);try{console.log("Submitting form data:",p);const{data:v,error:g}=await B.from("proceso_ot").select("id").eq("ot_number",e).maybeSingle();let x;if(g)throw new Error("Error verificando proceso_ot: "+g.message);if(v){x=v.id;const{error:P}=await B.from("proceso_ot").update({validacion:{responsable:"Sistema",fecha_validacion:new Date().toISOString(),comentario:"Actualizado automáticamente",formulario_id:t,formulario_nombre:r}}).eq("id",x);if(P)throw new Error("Error actualizando proceso_ot: "+P.message)}else{const{data:P,error:C}=await B.from("proceso_ot").insert({ot_number:e,validacion:{responsable:"Sistema",fecha_validacion:new Date().toISOString(),comentario:"Generado automáticamente",formulario_id:t,formulario_nombre:r}}).select("id").single();if(C)throw new Error("Error creando proceso_ot: "+C.message);x=P.id}const{count:b,error:j}=await B.from("proceso_ot_muestra").select("*",{count:"exact",head:!0}).eq("proceso_ot_id",x);if(j)throw new Error("Error contando muestras existentes: "+j.message);const w=(b||0)+1;if(w>y)throw new Error(`Ya se han completado todas las ${y} muestras programadas`);const{data:S,error:_}=await B.from("proceso_ot_muestra").insert({proceso_ot_id:x,num_muestra:w,formulario_id:t}).select().single();if(_)throw new Error("Error guardando muestra: "+_.message);const N=Object.entries(p).map(([P,C])=>{const A=n[P]||P,T=typeof C=="number"?C:typeof C=="string"&&!isNaN(Number(C))?Number(C):null;return{muestra_id:S.id,field_id:P,field_label:A,field_value:typeof C=="string"&&!C.startsWith("data:image")?C:null,image_storage_path:typeof C=="string"&&C.includes("/")?C:null,numeric_value:T}}),{error:E}=await B.from("form_field_responses").insert(N);if(E)throw console.error("Error saving field responses:",E),new Error("Error guardando respuestas: "+E.message);console.log("ð FORM SUBMISSION: Invalidating batch-ot-data cache and refetching samples"),l.invali
530dateQueries({queryKey:["batch-ot-data"]}),a(),s({title:"Muestra guardada",description:`Muestra ${w} de ${y} guardada correctamente`});let O={fecha:new Date().toISOString().split("T")[0],hora:new Date().toISOString().split("T")[1].substring(0,5)};return w>=y?(s({title:"Proceso completado",description:"Se han completado todas las muestras programadas"}),setTimeout(()=>{i("/dashboard")},1500),null):O}catch(v){console.error("Error submitting form:",v),f(v instanceof Error?v.message:String(v)),s({variant:"destructive",title:"Error",description:v instanceof Error?v.message:String(v)});return}finally{u(!1)}},isSubmitting:c,error:d,setError:f}}function xQ({formName:e,otNumber:t}){const r=or();return o.jsxs("div",{className:"flex justify-between items-center mb-6",children:[o.jsxs(z,{variant:"ghost",onClick:()=>r("/dashboard"),children:[o.jsx(u0,{className:"mr-2 h-4 w-4"}),"Volver al Dashboard"]}),o.jsxs("div",{className:"text-lg font-semibold",children:["Formulario: ",e||"Formulario Técnico"," - OT ",t]})]})}function bQ(){const e=or();return o.jsxs("div",{className:"text-center py-4",children:[o.jsx("p",{className:"font-medium text-green-600",children:"Se han completado todas las muestras programadas para esta OT."}),o.jsx(z,{onClick:()=>e("/dashboard"),className:"mt-4",children:"Volver al Dashboard"})]})}function wQ({formId:e,isCompleted:t,formName:r,sampleNumber:n,totalSamples:a,isSubmitting:i,error:s,onSubmit:l,formData:c,onFieldChange:u}){return o.jsxs(de,{className:"mb-6",children:[o.jsx(Le,{className:"py-4 px-6",children:o.jsx(Ie,{className:"text-sm font-medium",children:t?`Fase 2: ${r||"Formulario"} - Completado`:`Fase 2: ${r||"Formulario"} - Muestra ${n} de ${a}`})}),o.jsx(fe,{className:"py-4 px-6",children:t?o.jsx(bQ,{}):o.jsxs("form",{onSubmit:l,className:"space-y-4",children:[o.jsx(bm,{values:c,onFieldChange:u,disabled:i,formId:e}),s&&o.jsx("div",{className:"p-3 bg-red-50 border border-red-200 text-red-600 rounded",children:s}),o.jsx("div",{className:"flex justify-end",children:o.jsx(z,{type:"submit",disabled:i,children:i?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"h-4 w-4 animate-spin mr-2"}),"Guardando..."]}):"Guardar Muestra"})})]})})]})}function jQ(){return o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsxs("div",{className:"text-center",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin mx-auto mb-2"}),o.jsx("p",{children:"Cargando información..."})]})})}function T_({title:e,message:t}){const r=or();return o.jsx("div",{className:"max-w-3xl mx-auto py-6",children:o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{children:e})}),o.jsxs(fe,{children:[o.jsx("p",{children:t}),o.jsx(z,{className:"mt-4",onClick:()=>r("/dashboard"),children:"Volver al Dashboard"})]})]})})}function SQ(){const e=vn();Rn();const t=new URLSearchParams(e.search),r=t.get("ot"),n=t.get("formId"),[a,i]=h.useState({fecha:new Date().toISOString().split("T")[0],hora:new Date().toISOString().split("T")[1].substring(0,5)}),{otData:s,loadingOtData:l,selectedForm:c,loadingForm:u,loadingFields:d,staticFase1Data:f,formName:m,fieldLabelsMap:p}=vQ(r,n),{samplesData:y,muestrasCount:v,muestrasProgramadas:g,isCompleted:x,refetchSamples:b}=gQ(r,s),{submitForm:j,isSubmitting:w,error:S,setError:_}=yQ(r,n,m,p,b),N=(O,P)=>{i(C=>({...C,[O]:P}))},E=async O=>{O.preventDefault();const P=await j(a,g);P&&i(P)};return l||u||d?o.jsx(jQ,{}):r?n?o.jsxs("div",{className:"max-w-3xl mx-auto py-6",children:[o.jsx(xQ,{formName:(c==null?void 0:c.nombre)||"Formulario Técnico",otNumber:r}),o.jsx(_w,{staticFase1Data:f,muestrasProgramadas:g,muestrasCount:v,showTitle:!0,formId:n,formName:m}),o.jsx(wQ,{formId:n,isCompleted:x,formName:(c==null?void 0:c.nombre)||"Formulario",sampleNumber:Math.min(v+1,g),totalSamples:g,isSubmitting:w,error:S,onSubmit:E,formData:a,onFieldChange:N})]}):o.jsx(T_,{title:"Error",message:"No se proporcionó ID de formulario"}):o.jsx(T_,{title:"Error",message:"No se proporcionó número de OT"})}const $M=({className:e,...t})=>o.jsx("nav",{role:"navigation","aria-label":"pagination",className:oe("mx-auto flex w-full justify-center",e),...t});$M.displayName="Pagination";
530const kM=h.forwardRef(({className:e,...t},r)=>o.jsx("ul",{ref:r,className:oe("flex flex-row items-center gap-1",e),...t}));kM.displayName="PaginationContent";const Vf=h.forwardRef(({className:e,...t},r)=>o.jsx("li",{ref:r,className:oe("",e),...t}));Vf.displayName="PaginationItem";const qp=({className:e,isActive:t,size:r="icon",...n})=>o.jsx("a",{"aria-current":t?"page":void 0,className:oe(pp({variant:t?"outline":"ghost",size:r}),e),...n});qp.displayName="PaginationLink";const MM=({className:e,...t})=>o.jsxs(qp,{"aria-label":"Go to previous page",size:"default",className:oe("gap-1 pl-2.5",e),...t,children:[o.jsx(Ao,{className:"h-4 w-4"}),o.jsx("span",{children:"Previous"})]});MM.displayName="PaginationPrevious";const IM=({className:e,...t})=>o.jsxs(qp,{"aria-label":"Go to next page",size:"default",className:oe("gap-1 pr-2.5",e),...t,children:[o.jsx("span",{children:"Next"}),o.jsx(Il,{className:"h-4 w-4"})]});IM.displayName="PaginationNext";function _Q({users:e,onEdit:t,onDelete:r,onViewPermissions:n,onChangePassword:a}){const i=ql(),{userProfile:s}=Hi(),l=(s==null?void 0:s.role)==="Administrador";return i?o.jsx("div",{className:"space-y-4",children:e.length>0?e.map(c=>o.jsxs(de,{children:[o.jsx(Le,{className:"py-2",children:o.jsx(Ie,{className:"text-base",children:c.fullName})}),o.jsxs(fe,{className:"py-2 space-y-2",children:[o.jsxs("div",{className:"responsive-card-row",children:[o.jsx("span",{className:"responsive-card-label",children:"Usuario:"}),o.jsx("span",{children:c.username})]}),o.jsxs("div",{className:"responsive-card-row",children:[o.jsx("span",{className:"responsive-card-label",children:"Identificación:"}),o.jsx("span",{children:c.identification})]}),o.jsxs("div",{className:"responsive-card-row",children:[o.jsx("span",{className:"responsive-card-label",children:"Perfil:"}),o.jsx(ke,{className:"cursor-pointer",variant:c.role==="Administrador"?"default":"outline",onClick:()=>n(c.role),children:c.role})]}),o.jsxs("div",{className:"flex justify-end space-x-2 mt-2",children:[o.jsxs(z,{variant:"outline",size:"sm",onClick:()=>t(c),children:[o.jsx(Ys,{className:"h-4 w-4 mr-1"})," Editar"]}),l&&a&&o.jsxs(z,{variant:"outline",size:"sm",className:"text-blue-600 hover:text-blue-800",onClick:()=>a(c),children:[o.jsx(_y,{className:"h-4 w-4 mr-1"})," Contraseña"]}),o.jsxs(z,{variant:"outline",size:"sm",className:"text-red-500 hover:text-red-700",onClick:()=>r(c),children:[o.jsx(Jf,{className:"h-4 w-4 mr-1"})," Eliminar"]})]})]})]},c.id)):o.jsx("div",{className:"text-center py-10",children:o.jsx("p",{children:"No se encontraron usuarios"})})}):o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(yn,{children:[o.jsx(xn,{children:o.jsxs(Nt,{children:[o.jsx(Pe,{children:"Usuario"}),o.jsx(Pe,{children:"Nombre Completo"}),o.jsx(Pe,{children:"Identificación"}),o.jsx(Pe,{children:"Perfil"}),o.jsx(Pe,{children:"Acciones"})]})}),o.jsx(bn,{children:e.length>0?e.map(c=>o.jsxs(Nt,{children:[o.jsx(Oe,{className:"font-medium","data-label":"Usuario",children:c.username}),o.jsx(Oe,{"data-label":"Nombre Completo",children:c.fullName}),o.jsx(Oe,{"data-label":"Identificación",children:c.identification}),o.jsx(Oe,{"data-label":"Perfil",children:o.jsx(ke,{className:"cursor-pointer",variant:c.role==="Administrador"?"default":"outline",onClick:()=>n(c.role),children:c.role})}),o.jsx(Oe,{"data-label":"Acciones",children:o.jsxs("div",{className:"flex space-x-2",children:[o.jsx(z,{variant:"outline",size:"icon",onClick:()=>t(c),children:o.jsx(Ys,{className:"h-4 w-4"})}),l&&a&&o.jsx(z,{variant:"outline",size:"icon",className:"text-blue-600 hover:text-blue-800",onClick:()=>a(c),title:"Cambiar contraseña",children:o.jsx(_y,{className:"h-4 w-4"})}),o.jsx(z,{variant:"outline",size:"icon",className:"text-red-500 hover:text-red-700",onClick:()=>r(c),children:o.jsx(Jf,{className:"h-4 w-4"})})]})})]},c.id)):o.jsx(Nt,{children:o.jsx(Oe,{colSpan:5,className:"text-center py-10",children:"No se encontraron usuarios"})})})]})})}function NQ(){const[e,t]=h.useState(null),[r,n]=h.useState(!0),[a,i]=h.useState(null);return h.useEffect(()=>{async function u(){var d,f;try{n(!0),console.log("Fetching user permissions...");const{data:{session:m},error:p}=await B.auth.getSession();if(p)throw console.error("Session error:",p),new Error(`Error fetching session: ${p.message}`);if(!m){console.log("No active session found"),t(null),n(!1);return}console.log("User ID:",m.user.id);const{data:y,error:v}=await B.from("profiles").select("role").eq("id",m.user.id).maybeSingle();if(v)if(console.error("Profile error:",v),v.code==="PGRST301"||v.message.includes("row-level security")){console.log("Creating profile due to RLS policy...");const{error:g}=await B.from("profiles").insert({id:m.user.id,username:m.user.email,full_name:((d=m.user.user_metadata)==null?void 0:d.full_name)||m.user.email,identification:((f=m.user.user_metadata)==null?void 0:f.identification)||"",role:"Operador"});if(g)throw console.error("Error creating profile:",g),g;t("Operador")}else throw new Error(`Error fetching user profile: ${v.message}`);else y?(console.log("User role from DB:",y.role),t(y.role)):(console.warn("No profile found for user:",m.user.id),t(null))}catch(m){console.error("Error checking user permissions:",m),i(m instanceof Error?m.message:"Unknown error checking permissions")}finally{n(!1)}}u()},[]),{role:e,canCreateForms:e==="Administrador"||e==="Supervisor",canEditForms:e==="Administrador"||e==="Supervisor",canDeleteForms:e==="Administrador"||e==="Supervisor",isLoading:r,error:a}}function EQ(){const{data:e,isLoading:t,error:r}=lt({queryKey:["empleados"],queryFn:async()=>{const{data:n,error:a}=await B.from("empleadosdelcerro").select("*").order("CliNombre");if(a)throw console.error("Error fetching empleados:",a),a;return n},staleTime:9e5,gcTime:18e5,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1});return{empleados:e||[],isLoading:t,error:r?r.message:null}}function CQ({onSelect:e,selectedEmpleado:t}){const[r,n]=h.useState(!1),[a,i]=h.useState(""),{empleados:s,isLoading:l,error:c}=EQ(),u=s.filter(f=>{var m,p;return((m=f.CliNombre)==null?void 0:m.toLowerCase().includes(a.toLowerCase()))||((p=f.CliCodigo)==null?void 0:p.toLowerCase().includes(a.toLowerCase()))}),d=f=>{e({codigo:f.CliCodigo,nombre:f.CliNombre}),n(!1),i("")};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Empleado Asociado"}),o.jsxs(Ft,{open:r,onOpenChange:n,children:[o.jsx(wq,{asChild:!0,children:o.jsxs(z,{variant:"outline",className:"w-full justify-start",children:[o.jsx(v0,{className:"h-4 w-4 mr-2"}),t?`${t.nombre} (${t.codigo})`:"Seleccionar empleado"]})}),o.jsxs(It,{className:"sm:max-w-[500px] max-h-[80vh] flex flex-col",children:[o.jsx(Ut,{children:o.jsx(Wt,{children:"Seleccionar Empleado"})}),o.jsxs("div",{className:"space-y-4 flex-1 min-h-0",children:[o.jsxs("div",{className:"relative",children:[o.jsx(Ko,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(we,{placeholder:"Buscar por nombre o código...",value:a,onChange:f=>i(f.target.value),className:"pl-8"})]}),l?o.jsxs("div",{className:"flex items-center justify-center h-32",children:[o.jsx(ye,{className:"h-6 w-6 animate-spin"}),o.jsx("span",{className:"ml-2",children:"Cargando empleados..."})]}):c?o.jsx("div",{className:"flex items-center justify-center h-32 text-red-600",children:o.jsxs("p",{children:["Error al cargar empleados: ",c]})}):o.jsx(Yo,{className:"h-[300px]",children:o.jsxs("div",{className:"space-y-2",children:[u.map(f=>o.jsxs("div",{className:"p-3 border rounded-lg cursor-pointer hover:bg-gray-50 transition-colors",onClick:()=>d(f),children:[o.jsx("div",{className:"font-medium text-sm",children:f.CliNombre}),o.jsxs("div",{className:"text-xs text-gray-600",children:["Código: ",f.CliCodigo]}),o.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[f.CliSupervisordeProduccion&&"Supervisor ⢠",f.cliOperariodeProduccion&&"Operario ⢠",f.cliTipoTerceroLiderdeArea&&"LÃder de Ãrea ⢠",f.cliTipoTerceroLiderdeProceso&&"LÃder de Proceso"]})]},f.CliCodigo)),u.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No se encontraron empleados"})]})})]})]})]})]})}function OQ({open:e,onOpenChange:t,onSubmit:r,newUser:n,setNewUser:a,selectedUser:i}
530){const[s,l]=h.useState(""),[c,u]=h.useState(!1),[d,f]=h.useState(!1),[m,p]=h.useState(!i),{role:y,isLoading:v}=NQ(),[g,x]=h.useState(null),[b,j]=h.useState(i!=null&&i.identification?{codigo:i.identification,nombre:i.fullName}:void 0),[w,S]=h.useState([]),[_,N]=h.useState(!1),[E,O]=h.useState([]);h.useEffect(()=>{e&&(p(!i),f(!1),l(""),(async()=>{N(!0);try{const F=[];let I=0;for(;;){const{data:W,error:R}=await B.from("ordenes_de_trabajo").select("jefe_turno").not("jefe_turno","is",null).range(I,I+1e3-1);if(R||!W||W.length===0)break;for(const V of W)V.jefe_turno&&String(V.jefe_turno).trim()!==""&&F.push(V.jefe_turno);if(W.length<1e3)break;I+=1e3}const K=[...new Set(F)].sort();S(K)}catch(F){console.error("Error fetching supervisores:",F)}finally{N(!1)}})(),(async()=>{const{data:F,error:q}=await B.from("roles_catalogo").select("rol, descripcion").order("rol");!q&&F&&O(F)})())},[e,i]),h.useEffect(()=>{e&&!v&&x(y!=="Administrador"?"Solo los usuarios con rol de Administrador pueden gestionar usuarios.":null)},[e,v,y]);const P=M=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(M),C=M=>!M||M.length>=8,A=()=>{u(!c)},T=()=>{if(i&&d&&!s){alert("Por favor ingrese una nueva contraseña o desactive la opción de cambiar contraseña.");return}r(m||d?s:void 0)},k=M=>{j(M),a({...n,identification:M.codigo,fullName:M.nombre})},D=!n.username||!P(n.username)||!n.fullName||!n.role||m&&!C(s)||d&&!C(s);return g?o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsxs(It,{children:[o.jsxs(pa,{variant:"destructive",children:[o.jsx(Kr,{className:"h-4 w-4"}),o.jsx(Ii,{children:"Acceso denegado"}),o.jsx(va,{children:g})]}),o.jsx(dr,{children:o.jsx(z,{variant:"outline",onClick:()=>t(!1),children:"Cerrar"})})]})}):o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsxs(It,{className:"max-w-md",children:[o.jsx(Ut,{children:o.jsx(Wt,{children:i?"Editar Usuario":"Nuevo Usuario"})}),o.jsxs("div",{className:"grid gap-4 py-4 max-h-[70vh] overflow-y-auto",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"username",children:"Correo Electrónico"}),o.jsx(we,{id:"username",type:"email",value:n.username,onChange:M=>a({...n,username:M.target.value}),disabled:i&&!m,placeholder:"[email protected]",className:!P(n.username)&&n.username?"border-red-500":""}),!P(n.username)&&n.username&&o.jsx("p",{className:"text-xs text-destructive",children:"Por favor ingrese un correo electrónico válido"}),i&&!m&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"El correo electrónico no se puede cambiar"})]}),m?o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"password",children:"Contraseña"}),o.jsxs("div",{className:"relative",children:[o.jsx(we,{id:"password",type:c?"text":"password",value:s,onChange:M=>l(M.target.value),placeholder:"MÃnimo 8 caracteres",className:!C(s)&&s?"border-red-500 pr-10":"pr-10"}),o.jsx(z,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full",onClick:A,children:c?o.jsx(Yf,{className:"h-4 w-4"}):o.jsx(Fi,{className:"h-4 w-4"})})]}),!C(s)&&s&&o.jsx("p",{className:"text-xs text-destructive",children:"La contraseña debe tener al menos 8 caracteres"}),!s&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Debe ingresar una contraseña de al menos 8 caracteres."})]}):o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ne,{htmlFor:"changePassword",className:"cursor-pointer",children:"Cambiar contraseña"}),o.jsx("input",{id:"changePassword",type:"checkbox",checked:d,onChange:()=>f(!d),className:"h-4 w-4 cursor-pointer"})]}),d&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"newPassword",children:"Nueva contraseña"}),o.jsxs("div",{className:"relative",children:[o.jsx(we,{id:"newPassword",type:c?"text":"password",value:s,onChange:M=>l(M.target.value),placeholder:"MÃnimo 8 caracteres",className:C(s)?"pr-10":"border-red-500 pr-10"}),o.jsx(z,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full",onClick:A,children:c?o.jsx(Yf,{className:"h-4 w-4"}):o.jsx(Fi,{className:"h-4 w-4"})})]}),!C(s)&&o.jsx("p",{className:"text-xs text-destructive",children:"La contraseña debe tener al menos 8 caracteres"})]})]}),o.jsx(CQ,{onSelect:k,selectedEmpleado:b}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"fullName",children:"Nombre Completo"}),o.jsx(we,{id:"fullName",value:n.fullName,onChange:M=>a({...n,fullName:M.target.value}),className:n.fullName?"":"border-red-500",disabled:!!b}),!n.fullName&&o.jsx("p",{className:"text-xs text-destructive",children:"El nombre completo es requerido"}),b&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Nombre obtenido del empleado seleccionado"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"identification",children:"Identificación"}),o.jsx(we,{id:"identification",value:n.identification,onChange:M=>a({...n,identification:M.target.value}),disabled:!!b}),b&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Identificación obtenida del empleado seleccionado"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"role",children:"Perfil"}),o.jsxs(jt,{value:n.role,onValueChange:M=>a({...n,role:M}),children:[o.jsx(xt,{className:n.role?"":"border-red-500",children:o.jsx(St,{placeholder:"Seleccionar perfil"})}),o.jsx(bt,{children:E.length===0?o.jsx("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:'No hay perfiles configurados. Créalos en "Perfiles y Permisos".'}):E.map(M=>o.jsx($e,{value:M.rol,children:M.rol},M.rol))})]}),!n.role&&o.jsx("p",{className:"text-xs text-destructive",children:"Debe seleccionar un perfil"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"supervisorTurno",children:"Supervisor de Turno"}),o.jsxs(jt,{value:n.supervisorTurno||"__none__",onValueChange:M=>a({...n,supervisorTurno:M==="__none__"?null:M}),children:[o.jsx(xt,{children:o.jsx(St,{placeholder:"Seleccionar supervisor"})}),o.jsxs(bt,{children:[o.jsx($e,{value:"__none__",children:"Sin asignar (ve todas las OTs)"}),_?o.jsx("div",{className:"flex items-center justify-center py-2",children:o.jsx(ye,{className:"h-4 w-4 animate-spin"})}):w.map(M=>o.jsx($e,{value:M,children:M},M))]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Si se asigna un supervisor, el usuario solo verá las OTs de ese turno."})]})]}),o.jsxs(pa,{variant:"default",className:"bg-blue-50",children:[o.jsx(d0,{className:"h-4 w-4"}),o.jsx(Ii,{children:"Información de perfiles"}),o.jsx(va,{children:o.jsxs("ul",{className:"text-xs list-disc pl-5 mt-2",children:[o.jsxs("li",{children:[o.jsx("strong",{children:"Administrador:"})," Acceso completo a todas las funciones"]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Supervisor:"})," Puede crear formularios y gestionar OTs"]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Técnico:"})," Puede completar formularios técnicos"]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Operador:"})," Solo puede ver información básica"]})]})})]}),o.jsxs(dr,{children:[o.jsx(z,{variant:"outline",onClick:()=>t(!1),children:"Cancelar"}),o.jsx(z,{onClick:T,disabled:D,children:i?"Actualizar":"Crear"})]})]})})}function PQ({open:e,onOpenChange:t,onDelete:r,selectedUser:n}){return o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsxs(It,{children:[o.jsx(Ut,{children:o.jsx(Wt,{children:"Confirmar Eliminación"})}),o.jsxs("p",{children:["¿Estás seguro de que deseas eliminar al usuario"," ",o.jsx("strong",{children:n==null?void 0:n.username}),"?"]}),o.jsxs(dr,{children:[o.jsx(z,{variant:"outline",onClick:()=>t(!1),children:"Cancelar"}),o.jsx(z,{variant:"destructive",onClick:r,children:"Eliminar"})]})]})})}function AQ({open:e,onOpenChange:t,selectedRole:r,rolePermissions:n}){var i;const a=r?(i=n.find(s=>s.role===r))==null?void 0:i.permissions:void 0;return o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsxs(It,{children:[o.jsx(Ut,{children:o.jsxs(Wt,{children:["Permisos del Rol: ",r]})}),o.jsx("div",{className:"space-y-4 py-4",children:a&&o.jsxs(yn,{children:[o.jsx(xn,{children:o.jsxs(Nt,{children:[o.jsx(Pe,{children:"Módulo"}),o.jsx(Pe,{children:"Acceso"})]})}),o.jsx(bn,{children:Object.entries(a).map(([s,l])=>o.jsxs(Nt,{children:[o.jsx(Oe,{className:"capitalize",children:s==="dashboard"?"Dashboard":s==="forms"?"Formularios":s==="users"?"Usuarios":"Configuración"}),o.jsx(Oe,{children:o.jsx(ke,{variant:l?"default":"outline",className:l?"bg-green-100 text-green-800 hover:bg-green-200":"bg-red-100 text-red-800 hover:bg-red-200",children:l?"Permitido":"Denegado"})})]},s))})]})}),o.jsx(dr,{children:o.jsx(z,{onClick:()=>t(!1),children:"Cerrar"})})]})})}function TQ({open:e,onOpenChange:t,user:r,onPasswordChanged:n}){const[a,i]=h.useState(""),[s,l]=h.useState(""),[c,u]=h.useState(!1),[d,f]=h.useState(!1),[m,p]=h.useState(!1),y=async g=>{if(g.preventDefault(),!r){Z.error("Usuario no seleccionado");return}if(!a||a.length<6){Z.error("La contraseña debe tener al menos 6 caracteres");return}if(a!==s){Z.error("Las contraseñas no coinciden");return}p(!0);try{const{data:x,error:b}=await B.functions.invoke("update-user-password",{body:{userId:r.id,password:a}});if(b){console.error("Error updating password:",b);let j=b.message;try{if(b.context&&typeof b.context.json=="function"){const w=await b.context.json();j=(w==null?void 0:w.error)||j}}catch{}Z.error(`Error al actualizar contraseña: ${j}`);return}if(x!=null&&x.error){Z.error(`Error al actualizar contraseña: ${x.error}`);return}Z.success(`Contraseña actualizada exitosamente para ${r.fullName}`),i(""),l(""),t(!1),n==null||n()}catch(x){console.error("Error updating password:",x),Z.error("Error inesperado al actualizar la contraseña")}finally{p(!1)}},v=()=>{i(""),l(""),u(!1),f(!1),t(!1)};return o.jsx(Ft,{open:e,onOpenChange:v,children:o.jsxs(It,{className:"sm:max-w-[425px]",children:[o.jsxs(Ut,{children:[o.jsxs(Wt,{className:"flex items-center gap-2",children:[o.jsx(_y,{className:"h-5 w-5 text-primary"}),"Cambiar Contraseña"]}),o.jsxs(Ul,{children:["Cambiar la contraseña para ",o.jsx("span",{className:"font-semibold",children:r==null?void 0:r.fullName})," (",r==null?void 0:r.username,")"]})]}),o.jsxs("form",{onSubmit:y,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"password",children:"Nueva Contraseña"}),o.jsxs("div",{className:"relative",children:[o.jsx(we,{id:"password",type:c?"text":"password",value:a,onChange:g=>i(g.target.value),placeholder:"Ingrese la nueva contraseña",className:"pr-10",disabled:m,minLength:6,required:!0}),o.jsx(z,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>u(!c),disabled:m,children:c?o.jsx(Yf,{className:"h-4 w-4 text-gray-500"}):o.jsx(Fi,{className:"h-4 w-4 text-gray-500"})})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"confirmPassword",children:"Confirmar Contraseña"}),o.jsxs("div",{className:"relative",children:[o.jsx(we,{id:"confirmPassword",type:d?"text":"password",value:s,onChange:g=>l(g.target.value),placeholder:"Confirme la nueva contraseña",className:"pr-10",disabled:m,minLength:6,required:!0}),o.jsx(z,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>f(!d),disabled:m,children:d?o.jsx(Yf,{className:"h-4 w-4 text-gray-500"}):o.jsx(Fi,{className:"h-4 w-4 text-gray-500"})})]})]}),o.jsxs("div",{className:"text-sm text-muted-foreground",children:[o.jsx("p",{children:"⢠La contraseña debe tener al menos 6 caracteres"}),o.jsx("p",{children:"⢠Se recomienda usar una combinación de letras, números y sÃmbolos"})]}),o.jsxs(dr,{children:[o.jsx(z,{type:"button",variant:"outline",onClick:v,disabled:m,children:"Cancelar"}),o.jsx(z,{type:"submit",disabled:m,children:m?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"h-4 w-4 mr-2 animate-spin"}),"Actualizando..."]}):"Actualizar Contraseña"})]})]})]})})}const DQ=[{role:"Administrador",permissions:{dashboard:!0,forms:!0,users:!0,settings:!0}},{role:"Supervisor",permissions:{dashboard:!0,forms:!0,users:!1,settings:!1}},{role:"Técnico",permissions:{dashboard:!0,forms:!0,users:!1,settings:!1}},{role:"Operador",permissions:{dashboard:!0,forms:!1,users:!1,settings:!1}}];function $Q(){const{toast:e}=Rn(),[t,r]=h.useState(""),[n,a]=h.useState([]),[i,s]=h.useState(!1),[l,c]=h.useState(!1),[u,d]=h.useState(null),[f,m]=h.useState({username:"",fullName:"",identification:"",role:"Operador",supervisorTurno:null}),[p,y]=h.useState(1),[v,g]=h.useState(!1),[x,b]=h.useState(null),[j,w]=h.useState(!1),[S,_]=h.useState(null),[N,E]=h.useState(!0);h.useEffect(()=>{(async()=>{try{const{data:K,error:W}=await B.from("profiles").select("id, username, full_name, identification, role, supervisor_turno");if(W){console.error("Error fetching users:",W),Z.error("Error al cargar usuarios");return}const R=K.map(V=>({id:V.id,username:V.username||"",fullName:V.full_name||"",identification:V.identification||"",role:V.role||"Operador",supervisorTurno:V.supervisor_turno||null}));a(R)}catch(K){console.error("Error fetching users:",K),Z.error("Error al cargar usuarios")}finally{E(!1)}})()},[]);const O=n.filter(I=>Object.values(I).some(K=>typeof K=="string"&&K.toLowerCase().includes(t.toLowerCase()))),P=5,C=Math.ceil(O.length/P),A=O.slice((p-1)*P,p*P),T=(I=null)=>{I?(d(I),m({username:I.username,fullName:I.fullName,identification:I.identification,role:I.role,supervisorTurno:I.supervisorTurno||null})):(d(null),m({username:"",fullName:"",identification:"",role:"Operador",supervisorTurno:null})),s(!0)},k=async I=>{E(!0);
530try{if(u){if(I){const{error:W}=await B.functions.invoke("update-user-password",{body:{userId:u.id,password:I}});if(W){console.error("Error updating password:",W),Z.error(`Error al actualizar contraseña: ${W.message}`),E(!1);return}}const{error:K}=await B.from("profiles").update({username:f.username,full_name:f.fullName,identification:f.identification,role:f.role,supervisor_turno:f.supervisorTurno||null}).eq("id",u.id);if(K){console.error("Error updating user:",K),Z.error(`Error al actualizar usuario: ${K.message}`);return}a(n.map(W=>W.id===u.id?{...u,...f}:W)),e({title:"Usuario Actualizado",description:I?`El usuario ${f.username} ha sido actualizado con nueva contraseña.`:`El usuario ${f.username} ha sido actualizado.`})}else{if(!I||I.length<8){Z.error("Debe ingresar una contraseña de al menos 8 caracteres para crear el usuario."),E(!1);return}const{data:K,error:W}=await B.auth.signUp({email:f.username,password:I,options:{data:{full_name:f.fullName,identification:f.identification,role:f.role}}});if(W){console.error("Error creating user in auth:",W),Z.error(`Error al crear usuario: ${W.message}`);return}if(!K.user){Z.error("No se pudo crear el usuario");return}const R={id:K.user.id,...f};a([...n,R]),e({title:"Usuario Creado",description:`El usuario ${f.username} ha sido creado correctamente.`})}}catch(K){console.error("Error in user operation:",K),Z.error("Error en la operación de usuario")}finally{E(!1),s(!1)}},D=I=>{d(I),c(!0)},M=async()=>{if(u){E(!0);try{const{error:I}=await B.functions.invoke("delete-user",{body:{userId:u.id}});if(I){console.error("Error deleting user:",I),Z.error(`Error al eliminar usuario: ${I.message}`);return}a(n.filter(K=>K.id!==u.id)),e({title:"Usuario Eliminado",description:`El usuario ${u.username} ha sido eliminado.`})}catch(I){console.error("Error deleting user:",I),Z.error("Error al eliminar usuario")}finally{E(!1),c(!1)}}},F=I=>{b(I),g(!0)},q=I=>{_(I),w(!0)};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Gestión de Usuarios"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("div",{className:"relative w-64",children:[o.jsx(Ko,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(we,{placeholder:"Buscar usuarios...",value:t,onChange:I=>r(I.target.value),className:"pl-8"})]}),o.jsxs(z,{onClick:()=>T(),disabled:N,children:[N?o.jsx(ye,{className:"h-4 w-4 mr-2 animate-spin"}):o.jsx(_3,{className:"h-4 w-4 mr-2"}),"Nuevo Usuario"]})]})]}),o.jsxs(de,{children:[o.jsx(Le,{className:"bg-slate-50 border-b",children:o.jsx(Ie,{children:"Listado de Usuarios"})}),o.jsx(fe,{className:"p-0",children:N?o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(ye,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):o.jsx(_Q,{users:A,onEdit:T,onDelete:D,onViewPermissions:F,onChangePassword:q})})]}),C>1&&o.jsx($M,{children:o.jsxs(kM,{children:[o.jsx(Vf,{children:o.jsx(MM,{onClick:()=>y(Math.max(1,p-1)),className:p===1?"pointer-events-none opacity-50":""})}),Array.from({length:C},(I,K)=>K+1).map(I=>o.jsx(Vf,{children:o.jsx(qp,{isActive:I===p,onClick:()=>y(I),children:I})},I)),o.jsx(Vf,{children:o.jsx(IM,{onClick:()=>y(Math.min(C,p+1)),className:p===C?"pointer-events-none opacity-50":""})})]})}),o.jsx(OQ,{open:i,onOpenChange:s,onSubmit:k,newUser:f,setNewUser:m,selectedUser:u}),o.jsx(PQ,{open:l,onOpenChange:c,onDelete:M,selectedUser:u}),o.jsx(AQ,{open:v,onOpenChange:g,selectedRole:x,rolePermissions:DQ}),o.jsx(TQ,{open:j,onOpenChange:w,user:S,onPasswordChanged:()=>{console.log("Password changed successfully")}})]})}var Ld=e=>e.type==="checkbox",mo=e=>e instanceof Date,Tr=e=>e==null;const RM=e=>typeof e=="object";var Xt=e=>!Tr(e)&&!Array.isArray(e)&&RM(e)&&!mo(e),LM=e=>Xt(e)&&e.target?Ld(e.target)?e.target.checked:e.target.value:e,kQ=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,FM=(e,t)=>e.has(kQ(t)),MQ=e=>{const t=e.constructor&&e.constructor.prototype;return Xt(t)&&t.hasOwnProperty("isPrototypeOf")},Uw=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ur(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Uw&&(e instanceof Blob||e instanceof FileList))&&(r||Xt(e)))if(t=r?[]:{},!r&&!MQ(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=Ur(e[n]));else return e;return t}var Up=e=>Array.isArray(e)?e.filter(Boolean):[],Gt=e=>e===void 0,ve=(e,t,r)=>{if(!t||!Xt(e))return r;const n=Up(t.split(/[,[\].]+?/)).reduce((a,i)=>Tr(a)?a:a[i],e);return Gt(n)||n===e?Gt(e[t])?r:e[t]:n},Pn=e=>typeof e=="boolean",Ww=e=>/^\w*$/.test(e),BM=e=>Up(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ft=(e,t,r)=>{let n=-1;const a=Ww(t)?[t]:BM(t),i=a.length,s=i-1;for(;++n<i;){const l=a[n];let c=r;if(n!==s){const u=e[l];c=Xt(u)||Array.isArray(u)?u:isNaN(+a[n+1])?{}:[]}if(l==="__proto__")return;e[l]=c,e=e[l]}return e};const Sm={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Kn={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Da={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},zM=$.createContext(null),Wp=()=>$.useContext(zM),IQ=e=>{const{children:t,...r}=e;return $.createElement(zM.Provider,{value:r},t)};var qM=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const s=i;return t._proxyFormState[s]!==Kn.all&&(t._proxyFormState[s]=!n||Kn.all),r&&(r[s]=!0),e[s]}});return a},Gr=e=>Xt(e)&&!Object.keys(e).length,UM=(e,t,r,n)=>{r(e);const{name:a,...i}=e;return Gr(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!n||Kn.all))},Hc=e=>Array.isArray(e)?e:[e],WM=(e,t,r)=>!e||!t||e===t||Hc(e).some(n=>
vendor: 30,344 bytes, line 530
530n&&(r?n===t:n.startsWith(t)||t.startsWith(n)));function Vw(e){const t=$.useRef(e);t.current=e,$.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function RQ(e){const t=Wp(),{control:r=t.control,disabled:n,name:a,exact:i}=e||{},[s,l]=$.useState(r._formState),c=$.useRef(!0),u=$.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=$.useRef(a);return d.current=a,Vw({disabled:n,next:f=>c.current&&WM(d.current,f.name,i)&&UM(f,u.current,r._updateFormState)&&l({...r._formState,...f}),subject:r._subjects.state}),$.useEffect(()=>(c.current=!0,u.current.isValid&&r._updateValid(!0),()=>{c.current=!1}),[r]),qM(s,r,u.current,!1)}var ma=e=>typeof e=="string",VM=(e,t,r,n,a)=>ma(e)?(n&&t.watch.add(e),ve(r,e,a)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),ve(r,i))):(n&&(t.watchAll=!0),r);function LQ(e){const t=Wp(),{control:r=t.control,name:n,defaultValue:a,disabled:i,exact:s}=e||{},l=$.useRef(n);l.current=n,Vw({disabled:i,subject:r._subjects.values,next:d=>{WM(l.current,d.name,s)&&u(Ur(VM(l.current,r._names,d.values||r._formValues,!1,a)))}});const[c,u]=$.useState(r._getWatch(n,a));return $.useEffect(()=>r._removeUnmounted()),c}function FQ(e){const t=Wp(),{name:r,disabled:n,control:a=t.control,shouldUnregister:i}=e,s=FM(a._names.array,r),l=LQ({control:a,name:r,defaultValue:ve(a._formValues,r,ve(a._defaultValues,r,e.defaultValue)),exact:!0}),c=RQ({control:a,name:r,exact:!0}),u=$.useRef(a.register(r,{...e.rules,value:l,...Pn(e.disabled)?{disabled:e.disabled}:{}}));return $.useEffect(()=>{const d=a._options.shouldUnregister||i,f=(m,p)=>{const y=ve(a._fields,m);y&&y._f&&(y._f.mount=p)};if(f(r,!0),d){const m=Ur(ve(a._options.defaultValues,r));ft(a._defaultValues,r,m),Gt(ve(a._formValues,r))&&ft(a._formValues,r,m)}return()=>{(s?d&&!a._state.action:d)?a.unregister(r):f(r,!1)}},[r,a,s,i]),$.useEffect(()=>{ve(a._fields,r)&&a._updateDisabledField({disabled:n,fields:a._fields,name:r,value:ve(a._fields,r)._f.value})},[n,r,a]),{field:{name:r,value:l,...Pn(n)||c.disabled?{disabled:c.disabled||n}:{},onChange:$.useCallback(d=>u.current.onChange({target:{value:LM(d),name:r},type:Sm.CHANGE}),[r]),onBlur:$.useCallback(()=>u.current.onBlur({target:{value:ve(a._formValues,r),name:r},type:Sm.BLUR}),[r,a]),ref:$.useCallback(d=>{const f=ve(a._fields,r);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:m=>d.setCustomValidity(m),reportValidity:()=>d.reportValidity()})},[a._fields,r])},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ve(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!ve(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ve(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ve(c.validatingFields,r)},error:{enumerable:!0,get:()=>ve(c.errors,r)}})}}const BQ=e=>e.render(FQ(e));var GM=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},D_=e=>({isOnSubmit:!e||e===Kn.onSubmit,isOnBlur:e===Kn.onBlur,isOnChange:e===Kn.onChange,isOnAll:e===Kn.all,isOnTouch:e===Kn.onTouched}),$_=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Kc=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const i=ve(e,a);if(i){const{_f:s,...l}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],a)&&!n)return!0;if(s.ref&&t(s.ref,s.name)&&!n)return!0;if(Kc(l,t))break}else if(Xt(l)&&Kc(l,t))break}}};var zQ=(e,t,r)=>{const n=Hc(ve(e,r));return ft(n,"root",t[r]),ft(e,r,n),e},Gw=e=>e.type==="file",Fa=e=>typeof e=="function",_m=e=>{if(!Uw)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Gf=e=>ma(e),Hw=e=>e.type==="radio",Nm=e=>e instanceof RegExp;const k_={value:!1,isValid:!1},M_={value:!0,isValid:!0};var HM=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Gt(e[0].attributes.value)?Gt(e[0].value)||e[0].value===""?M_:{value:e[0].value,isValid:!0}:M_:k_}return k_};const I_={isValid:!1,value:null};var KM=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,I_):I_;function R_(e,t,r="validate"){if(Gf(e)||Array.isArray(e)&&e.every(Gf)||Pn(e)&&!e)return{type:r,message:Gf(e)?e:"",ref:t}}var ms=e=>Xt(e)&&!Nm(e)?e:{value:e,message:""},L_=async(e,t,r,n,a)=>{const{ref:i,refs:s,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:m,validate:p,name:y,valueAsNumber:v,mount:g,disabled:x}=e._f,b=ve(t,y);if(!g||x)return{};const j=s?s[0]:i,w=A=>{n&&j.reportValidity&&(j.setCustomValidity(Pn(A)?"":A||""),j.reportValidity())},S={},_=Hw(i),N=Ld(i),E=_||N,O=(v||Gw(i))&&Gt(i.value)&&Gt(b)||_m(i)&&i.value===""||b===""||Array.isArray(b)&&!b.length,P=GM.bind(null,y,r,S),C=(A,T,k,D=Da.maxLength,M=Da.minLength)=>{const F=A?T:k;S[y]={type:A?D:M,message:F,ref:i,...P(A?D:M,F)}};if(a?!Array.isArray(b)||!b.length:l&&(!E&&(O||Tr(b))||Pn(b)&&!b||N&&!HM(s).isValid||_&&!KM(s).isValid)){const{value:A,message:T}=Gf(l)?{value:!!l,message:l}:ms(l);if(A&&(S[y]={type:Da.required,message:T,ref:j,...P(Da.required,T)},!r))return w(T),S}if(!O&&(!Tr(d)||!Tr(f))){let A,T;const k=ms(f),D=ms(d);if(!Tr(b)&&!isNaN(b)){const M=i.valueAsNumber||b&&+b;Tr(k.value)||(A=M>k.value),Tr(D.value)||(T=M<D.value)}else{const M=i.valueAsDate||new Date(b),F=K=>new Date(new Date().toDateString()+" "+K),q=i.type=="time",I=i.type=="week";ma(k.value)&&b&&(A=q?F(b)>F(k.value):I?b>k.value:M>new Date(k.value)),ma(D.value)&&b&&(T=q?F(b)<F(D.value):I?b<D.value:M<new Date(D.value))}if((A||T)&&(C(!!A,k.message,D.message,Da.max,Da.min),!r))return w(S[y].message),S}if((c||u)&&!O&&(ma(b)||a&&Array.isArray(b))){const A=ms(c),T=ms(u),k=!Tr(A.value)&&b.length>+A.value,D=!Tr(T.value)&&b.length<+T.value;if((k||D)&&(C(k,A.message,T.message),!r))return w(S[y].message),S}if(m&&!O&&ma(b)){const{value:A,message:T}=ms(m);if(Nm(A)&&!b.match(A)&&(S[y]={type:Da.pattern,message:T,ref:i,...P(Da.pattern,T)},!r))return w(T),S}if(p){if(Fa(p)){const A=await p(b,t),T=R_(A,j);if(T&&(S[y]={...T,...P(Da.validate,T.message)},!r))return w(T.message),S}else if(Xt(p)){let A={};for(const T in p){if(!Gr(A)&&!r)break;const k=R_(await p[T](b,t),j,T);k&&(A={...k,...P(T,k.message)},w(k.message),r&&(S[y]=A))}if(!Gr(A)&&(S[y]={ref:j,...A},!r))return S}}return w(!0),S};function qQ(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Gt(e)?n++:e[t[n++]];return e}function UQ(e){for(const t in e)if(e.hasOwnProperty(t)&&!Gt(e[t]))return!1;return!0}function rr(e,t){const r=Array.isArray(t)?t:Ww(t)?[t]:BM(t),n=r.length===1?e:qQ(e,r),a=r.length-1,i=r[a];return n&&delete n[i],a!==0&&(Xt(n)&&Gr(n)||Array.isArray(n)&&UQ(n))&&rr(e,r.slice(0,-1)),e}var Og=()=>{let e=[];return{get observers(){return e},next:a=>{for(const i of e)i.next&&i.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(i=>i!==a)}}),unsubscribe:()=>{e=[]}}},fx=e=>Tr(e)||!RM(e);function gi(e,t){if(fx(e)||fx(t))return e===t;if(mo(e)&&mo(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const a of r){const i=e[a];if(!n.includes(a))return!1;if(a!=="ref"){const s=t[a];if(mo(i)&&mo(s)||Xt(i)&&Xt(s)||Array.isArray(i)&&Array.isArray(s)?!gi(i,s):i!==s)return!1}}return!0}var YM=e=>e.type==="select-multiple",WQ=e=>Hw(e)||Ld(e),Pg=e=>_m(e)&&e.isConnected,XM=e=>{for(const t in e)if(Fa(e[t]))return!0;return!1};function Em(e,t={}){const r=Array.isArray(e);if(Xt(e)||r)for(const n in e)Array.isArray(e[n])||Xt(e[n])&&!XM(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Em(e[n],t[n])):Tr(e[n])||(t[n]=!0);return t}function ZM(e,t,r){const n=Array.isArray(e);if(Xt(e)||n)for(const a in e)Array.isArray(e[a])||Xt(e[a])&&!XM(e[a])?Gt(t)||fx(r[a])?r[a]=Array.isArray(e[a])?Em(e[a],[]):{...Em(e[a])}:ZM(e[a],Tr(t)?{}:t[a],r[a]):r[a]=!gi(e[a],t[a]);return r}var gc=(e,t)=>ZM(e,t,Em(t)),QM=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Gt(e)?e:t?e===""?NaN:e&&+e:r&&ma(e)?new Date(e):n?n(e):e;function Ag(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return Gw(t)?t.files:Hw(t)?KM(e.refs).value:YM(t)?[...t.selectedOptions].map(({value:r})=>r):Ld(t)?HM(e.refs).value:QM(Gt(t.value)?e.ref.value:t.value,e)}var VQ=(e,t,r,n)=>{const a={};for(const i of e){const s=ve(t,i);s&&ft(a,i,s._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}},yc=e=>Gt(e)?e:Nm(e)?e.source:Xt(e)?Nm(e.value)?e.value.source:e.value:e;const F_="AsyncFunction";var GQ=e=>(!e||!e.validate)&&!!(Fa(e.validate)&&e.validate.constructor.name===F_||Xt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===F_)),HQ=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function B_(e,t,r){const n=ve(e,r);if(n||Ww(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const i=a.join("."),s=ve(t,i),l=ve(e,i);if(s&&!Array.isArray(s)&&r!==i)return{name:r};if(l&&l.type)return{name:i,error:l};a.pop()}return{name:r}}var KQ=(e,t,r,n,a)=>a.isOnAll?!1:!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:(r?n.isOnChange:a.isOnChange)?e:!0,YQ=(e,t)=>!Up(ve(e,t)).length&&rr(e,t);const XQ={mode:Kn.onSubmit,reValidateMode:Kn.onChange,shouldFocusError:!0};function ZQ(e={}){let t={...XQ,...e},r={submitCount:0,isDirty:!1,isLoading:Fa(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},a=Xt(t.defaultValues)||Xt(t.values)?Ur(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Ur(a),s={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:Og(),array:Og(),state:Og()},m=D_(t.mode),p=D_(t.reValidateMode),y=t.criteriaMode===Kn.all,v=L=>G=>{clearTimeout(u),u=setTimeout(L,G)},g=async L=>{if(!e.disabled&&(d.isValid||L)){const G=t.resolver?Gr((await E()).errors):await P(n,!0);G!==r.isValid&&f.state.next({isValid:G})}},x=(L,G)=>{!e.disabled&&(d.isValidating||d.validatingFields)&&((L||Array.from(l.mount)).forEach(Y=>{Y&&(G?ft(r.validatingFields,Y,G):rr(r.validatingFields,Y))}),f.state.next({validatingFields:r.validatingFields,isValidating:!Gr(r.validatingFields)}))},b=(L,G=[],Y,ie,se=!0,ee=!0)=>{if(ie&&Y&&!e.disabled){if(s.action=!0,ee&&Array.isArray(ve(n,L))){const ge=Y(ve(n,L),ie.argA,ie.argB);se&&ft(n,L,ge)}if(ee&&Array.isArray(ve(r.errors,L))){const ge=Y(ve(r.errors,L),ie.argA,ie.argB);se&&ft(r.errors,L,ge),YQ(r.errors,L)}if(d.touchedFields&&ee&&Array.isArray(ve(r.touchedFields,L))){const ge=Y(ve(r.touchedFields,L),ie.argA,ie.argB);se&&ft(r.touchedFields,L,ge)}d.dirtyFields&&(r.dirtyFields=gc(a,i)),f.state.next({name:L,isDirty:A(L,G),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ft(i,L,G)},j=(L,G)=>{ft(r.errors,L,G),f.state.next({errors:r.errors})},w=L=>{r.errors=L,f.state.next({errors:r.errors,isValid:!1})},S=(L,G,Y,ie)=>{const se=ve(n,L);if(se){const ee=ve(i,L,Gt(Y)?ve(a,L):Y);Gt(ee)||ie&&ie.defaultChecked||G?ft(i,L,G?ee:Ag(se._f)):D(L,ee),s.mount&&g()}},_=(L,G,Y,ie,se)=>{let ee=!1,ge=!1;const He={name:L};if(!e.disabled){const Tt=!!(ve(n,L)&&ve(n,L)._f&&ve(n,L)._f.disabled);if(!Y||ie){d.isDirty&&(ge=r.isDirty,r.isDirty=He.isDirty=A(),ee=ge!==He.isDirty);const wt=Tt||gi(ve(a,L),G);ge=!!(!Tt&&ve(r.dirtyFields,L)),wt||Tt?rr(r.dirtyFields,L):ft(r.dirtyFields,L,!0),He.dirtyFields=r.dirtyFields,ee=ee||d.dirtyFields&&ge!==!wt}if(Y){const wt=ve(r.touchedFields,L);wt||(ft(r.touchedFields,L,Y),He.touchedFields=r.touchedFields,ee=ee||d.touchedFields&&wt!==Y)}ee&&se&&f.state.next(He)}return ee?He:{}},N=(L,G,Y,ie)=>{const se=ve(r.errors,L),ee=d.isValid&&Pn(G)&&r.isValid!==G;if(e.delayError&&Y?(c=v(()=>j(L,Y)),c(e.delayError)):(clearTimeout(u),c=null,Y?ft(r.errors,L,Y):rr(r.errors,L)),(Y?!gi(se,Y):se)||!Gr(ie)||ee){const ge={...ie,...ee&&Pn(G)?{isValid:G}:{},errors:r.errors,name:L};r={...r,...ge},f.state.next(ge)}},E=async L=>{x(L,!0);const G=await t.resolver(i,t.context,VQ(L||l.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return x(L),G},O=async L=>{const{errors:G}=await E(L);if(L)for(const Y of L){const ie=ve(G,Y);ie?ft(r.errors,Y,ie):rr(r.errors,Y)}else r.errors=G;return G},P=async(L,G,Y={valid:!0})=>{for(const ie in L){const se=L[ie];if(se){const{_f:ee,...ge}=se;if(ee){const He=l.array.has(ee.name),Tt=se._f&&GQ(se._f);Tt&&d.validatingFields&&x([ie],!0);const wt=await L_(se,i,y,t.shouldUseNativeValidation&&!G,He);if(Tt&&d.validatingFields&&x([ie]),wt[ee.name]&&(Y.valid=!1,G))break;!G&&(ve(wt,ee.name)?He?zQ(r.errors,wt,ee.name):ft(r.errors,ee.name,wt[ee.name]):rr(r.errors,ee.name))}!Gr(ge)&&await P(ge,G,Y)}}return Y.valid},C=()=>{for(const L of l.unMount){const G=ve(n,L);G&&(G._f.refs?G._f.refs.every(Y=>!Pg(Y)):!Pg(G._f.ref))&&te(L)}l.unMount=new Set},A=(L,G)=>!e.disabled&&(L&&G&&ft(i,L,G),!gi(W(),a)),T=(L,G,Y)=>VM(L,l,{...s.mount?i:Gt(G)?a:ma(L)?{[L]:G}:G},Y,G),k=L=>Up(ve(s.mount?i:a,L,e.shouldUnregister?ve(a,L,[]):[])),D=(L,G,Y={})=>{const ie=ve(n,L);let se=G;if(ie){const ee=ie._f;ee&&(!ee.disabled&&ft(i,L,QM(G,ee)),se=_m(ee.ref)&&Tr(G)?"":G,YM(ee.ref)?[...ee.ref.options].forEach(ge=>ge.selected=se.includes(ge.value)):ee.refs?Ld(ee.ref)?ee.refs.length>1?ee.refs.forEach(ge=>(!ge.defaultChecked||!ge.disabled)&&(ge.checked=Array.isArray(se)?!!se.find(He=>He===ge.value):se===ge.value)):ee.refs[0]&&(ee.refs[0].checked=!!se):ee.refs.forEach(ge=>ge.checked=ge.value===se):Gw(ee.ref)?ee.ref.value="":(ee.ref.value=se,ee.ref.type||f.values.next({name:L,values:{...i}})))}(Y.shouldDirty||Y.shouldTouch)&&_(L,se,Y.shouldTouch,Y.shouldDirty,!0),Y.shouldValidate&&K(L)},M=(L,G,Y)=>{for(const ie in G){const se=G[ie],ee=`${L}.${ie}`,ge=ve(n,ee);(l.array.has(L)||Xt(se)||ge&&!ge._f)&&!mo(se)?M(ee,se,Y):D(ee,se,Y)}},F=(L,G,Y={})=>{const ie=ve(n,L),se=l.array.has(L),ee=Ur(G);ft(i,L,ee),se?(f.array.next({name:L,values:{...i}}),(d.isDirty||d.dirtyFields)&&Y.shouldDirty&&f.state.next({name:L,dirtyFields:gc(a,i),isDirty:A(L,ee)})):ie&&!ie._f&&!Tr(ee)?M(L,ee,Y):D(L,ee,Y),$_(L,l)&&f.state.next({...r}),f.values.next({name:s.mount?L:void 0,values:{...i}})},q=async L=>{s.mount=!0;const G=L.target;let Y=G.name,ie=!0;const se=ve(n,Y),ee=()=>G.type?Ag(se._f):LM(L),ge=He=>{ie=Number.isNaN(He)||mo(He)&&isNaN(He.getTime())||gi(He,ve(i,Y,He))};if(se){let He,Tt;const wt=ee(),wn=L.type===Sm.BLUR||L.type===Sm.FOCUS_OUT,Zr=!HQ(se._f)&&!t.resolver&&!ve(r.errors,Y)&&!se._f.deps||KQ(wn,ve(r.touchedFields,Y),r.isSubmitted,p,m),Br=$_(Y,l,wn);ft(i,Y,wt),wn?(se._f.onBlur&&se._f.onBlur(L),c&&c(0)):se._f.onChange&&se._f.onChange(L);const Se=_(Y,wt,wn,!1),vr=!Gr(Se)||Br;if(!wn&&f.values.next({name:Y,type:L.type,values:{...i}}),Zr)return d.isValid&&(e.mode==="onBlur"?wn&&g():g()),vr&&f.state.next({name:Y,...Br?{}:Se});if(!wn&&Br&&f.state.next({...r}),t.resolver){const{errors:Er}=await E([Y]);if(ge(wt),ie){const qn=B_(r.errors,n,Y),Qr=B_(Er,n,qn.name||Y);He=Qr.error,Y=Qr.name,Tt=Gr(Er)}}else x([Y],!0),He=(await L_(se,i,y,t.shouldUseNativeValidation))[Y],x([Y]),ge(wt),ie&&(He?Tt=!1:d.isValid&&(Tt=await P(n,!0)));ie&&(se._f.deps&&K(se._f.deps),N(Y,Tt,He,Se))}},I=(L,G)=>{if(ve(r.errors,G)&&L.focus)return L.focus(),1},K=async(L,G={})=>{let Y,ie;const se=Hc(L);if(t.resolver){const ee=await O(Gt(L)?L:se);Y=Gr(ee),ie=L?!se.some(ge=>ve(ee,ge)):Y}else L?(ie=(await Promise.all(se.map(async ee=>{const ge=ve(n,ee);return await P(ge&&ge._f?{[ee]:ge}:ge)}))).every(Boolean),!(!ie&&!r.isValid)&&g()):ie=Y=await P(n);return f.state.next({...!ma(L)||d.isValid&&Y!==r.isValid?{}:{name:L},...t.resolver||!L?{isValid:Y}:{},errors:r.errors}),G.shouldFocus&&!ie&&Kc(n,I,L?se:l.mount),ie},W=L=>{const G={...s.mount?i:a};return Gt(L)?G:ma(L)?ve(G,L):L.map(Y=>ve(G,Y))},R=(L,G)=>({invalid:!!ve((G||r).errors,L),isDirty:!!ve((G||r).dirtyFields,L),error:ve((G||r).errors,L),isValidating:!!ve(r.validatingFields,L),isTouched:!!ve((G||r).touchedFields,L)}),V=L=>{L&&Hc(L).forEach(G=>rr(r.errors,G)),f.state.next({errors:L?r.errors:{}})},re=(L,G,Y)=>{const ie=(ve(n,L,{_f:{}})._f||{}).ref,se=ve(r.errors,L)||{},{ref:ee,message:ge,type:He,...Tt}=se;ft(r.errors,L,{...Tt,...G,ref:ie}),f.state.next({name:L,errors:r.errors,isValid:!1}),Y&&Y.shouldFocus&&ie&&ie.focus&&ie.focus()},H=(L,G)=>Fa(L)?f.values.subscribe({next:Y=>L(T(void 0,G),Y)}):T(L,G,!0),te=(L,G={})=>{for(const Y of L?Hc(L):l.mount)l.mount.delete(Y),l.array.delete(Y),G.keepValue||(rr(n,Y),rr(i,Y)),!G.keepError&&rr(r.errors,Y),!G.keepDirty&&rr(r.dirtyFields,Y),!G.keepTouched&&rr(r.touchedFields,Y),!G.keepIsValidating&&rr(r.validatingFields,Y),!t.shouldUnregister&&!G.keepDefaultValue&&rr(a,Y);f.values.next({values:{...i}}),f.state.next({...r,...G.keepDirty?{isDirty:A()}:{}}),!G.keepIsValid&&g()},ce=({disabled:L,name:G,field:Y,fields:ie,value:se})=>{if(Pn(L)&&s.mount||L){const ee=L?void 0:Gt(se)?Ag(Y?Y._f:ve(ie,G)._f):se;ft(i,G,ee),_(G,ee,!1,!1,!0)}},je=(L,G={})=>{let Y=ve(n,L);const ie=Pn(G.disabled)||Pn(e.disabled);return ft(n,L,{...Y||{},_f:{...Y&&Y._f?Y._f:{ref:{name:L}},name:L,mount:!0,...G}}),l.mount.add(L),Y?ce({field:Y,disabled:Pn(G.disabled)?G.disabled:e.disabled,name:L,value:G.value}):S(L,!0,G.value),{...ie?{disabled:G.disabled||e.disabled}:{},...t.progressive?{required:!!G.required,min:yc(G.min),max:yc(G.max),minLength:yc(G.minLength),maxLength:yc(G.maxLength),pattern:yc(G.pattern)}:{},name:L,onChange:q,onBlur:q,ref:se=>{if(se){je(L,G),Y=ve(n,L);const ee=Gt(se.value)&&se.querySelectorAll&&se.querySelectorAll("input,select,textarea")[0]||se,ge=WQ(ee),He=Y._f.refs||[];if(ge?He.find(Tt=>Tt===ee):ee===Y._f.ref)return;ft(n,L,{_f:{...Y._f,...ge?{refs:[...He.filter(Pg),ee,...Array.isArray(ve(a,L))?[{}]:[]],ref:{type:ee.type,name:L}}:{ref:ee}}}),S(L,!1,void 0,ee)}else Y=ve(n,L,{}),Y._f&&(Y._f.mount=!1),(t.shouldUnregister||G.shouldUnregister)&&!(FM(l.array,L)&&s.action)&&l.unMount.add(L)}}},X=()=>t.shouldFocusError&&Kc(n,I,l.mount),ae=L=>{Pn(L)&&(f.state.next({disabled:L}),Kc(n,(G,Y)=>{const ie=ve(n,Y);ie&&(G.disabled=ie._f.disabled||L,Array.isArray(ie._f.refs)&&ie._f.refs.forEach(se=>{se.disabled=ie._f.disabled||L}))},0,!1))},_e=(L,G)=>async Y=>{let ie;Y&&(Y.preventDefault&&Y.preventDefault(),Y.persist&&Y.persist());let se=Ur(i);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:ee,values:ge}=await E();r.errors=ee,se=ge}else await P(n);if(rr(r.errors,"root"),Gr(r.errors)){f.state.next({errors:{}});try{await L(se,Y)}catch(ee){ie=ee}}else G&&await G({...r.errors},Y),X(),setTimeout(X);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Gr(r.errors)&&!ie,submitCount:r.submitCount+1,errors:r.errors}),ie)throw ie},J=(L,G={})=>{ve(n,L)&&(Gt(G.defaultValue)?F(L,Ur(ve(a,L))):(F(L,G.defaultValue),ft(a,L,Ur(G.defaultValue))),G.keepTouched||rr(r.touchedFields,L),G.keepDirty||(rr(r.dirtyFields,L),r.isDirty=G.defaultValue?A(L,Ur(ve(a,L))):A()),G.keepError||(rr(r.errors,L),d.isValid&&g()),f.state.next({...r}))},Ke=(L,G={})=>{const Y=L?Ur(L):a,ie=Ur(Y),se=Gr(L),ee=se?a:ie;if(G.keepDefaultValues||(a=Y),!G.keepValues){if(G.keepDirtyValues){const ge=new Set([...l.mount,...Object.keys(gc(a,i))]);for(const He of Array.from(ge))ve(r.dirtyFields,He)?ft(ee,He,ve(i,He)):F(He,ve(ee,He))}else{if(Uw&&Gt(L))for(const ge of l.mount){const He=ve(n,ge);if(He&&He._f){const Tt=Array.isArray(He._f.refs)?He._f.refs[0]:He._f.ref;if(_m(Tt)){const wt=Tt.closest("form");if(wt){wt.reset();break}}}}n={}}i=e.shouldUnregister?G.keepDefaultValues?Ur(a):{}:Ur(ee),f.array.next({values:{...ee}}),f.values.next({values:{...ee}})}l={mount:G.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!G.keepIsValid||!!G.keepDirtyValues,s.watch=!!e.shouldUnregister,f.state.next({submitCount:G.keepSubmitCount?r.submitCount:0,isDirty:se?!1:G.keepDirty?r.isDirty:!!(G.keepDefaultValues&&!gi(L,a)),isSubmitted:G.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:se?{}:G.keepDirtyValues?G.keepDefaultValues&&i?gc(a,i):r.dirtyFields:G.keepDefaultValues&&L?gc(a,L):G.keepDirty?r.dirtyFields:{},touchedFields:G.keepTouched?r.touchedFields:{},errors:G.keepErrors?r.errors:{},isSubmitSuccessful:G.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},Ne=(L,G)=>Ke(Fa(L)?L(i):L,G);return{control:{register:je,unregister:te,getFieldState:R,handleSubmit:_e,setError:re,_executeSchema:E,_getWatch:T,_getDirty:A,_updateValid:g,_removeUnmounted:C,_updateFieldArray:b,_updateDisabledField:ce,_getFieldArray:k,_reset:Ke,_resetDefaultValues:()=>Fa(t.defaultValues)&&t.defaultValues().then(L=>{Ne(L,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:L=>{r={...r,...L}},_disableForm:ae,_subjects:f,_proxyFormState:d,_setErrors:w,get _fields(){return n},get _formValues(){return i},get _state(){return s},set _state(L){s=L},get _defaultValues(){return a},get _names(){return l},set _names(L){l=L},get _formState(){return r},set _formState(L){r=L},get _options(){return t},set _options(L){t={...t,...L}}},trigger:K,register:je,handleSubmit:_e,watch:H,setValue:F,getValues:W,reset:Ne,resetField:J,clearErrors:V,unregister:te,setError:re,setFocus:(L,G={})=>{const Y=ve(n,L),ie=Y&&Y._f;if(ie){const se=ie.refs?ie.refs[0]:ie.ref;se.focus&&(se.focus(),G.shouldSelect&&se.select())}},getFieldState:R}}function QQ(e={}){const t=$.useRef(),r=$.useRef(),[n,a]=$.useState({isDirty:!1,isValidating:!1,isLoading:Fa(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Fa(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...ZQ(e),formState:n});const i=t.current.control;return i._options=e,Vw({subject:i._subjects.state,next:s=>{UM(s,i._proxyFormState,i._updateFormState,!0)&&a({...i._formState})}}),$.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),$.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==n.isDirty&&i._subjects.state.next({isDirty:s})}},[i,n.isDirty]),$.useEffect(()=>{e.values&&!gi(e.values,r.current)?(i._reset(e.values,i._options.resetOptions),r.current=e.values,a(s=>({...s}))):i._resetDefaultValues()},[e.values,i]),$.useEffect(()=>{e.errors&&i._setErrors(e.errors)},[e.errors,i]),$.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),$.useEffect(()=>{e.shouldUnregister&&i._subjects.values.next({values:i._getWatch()})},[e.shouldUnregister,i]),$.useEffect(()=>{t.current&&(t.current.watch=t.current.watch.bind({}))},[n]),t.current.formState=qM(n,i),t.current}const JQ=IQ,JM=h.createContext({}),yf=({...e})=>o.jsx(JM.Provider,{value:{name:e.name},children:o.jsx(BQ,{...e})}),Vp=()=>{const e=h.useContext(JM),t=h.useContext(eI),{getFieldState:r,formState:n}=Wp(),a=r(e.name,n);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...a}},eI=h.createContext({}),Mc=h.forwardRef(({className:e,...t},r)=>{const n=h.useId();return o.jsx(eI.Provider,{value:{id:n},children:o.jsx("div",{ref:r,className:oe("space-y-2",e),...t})})});Mc.displayName="FormItem";const Ic=h.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:a}=Vp();return o.jsx(ne,{ref:r,className:oe(n&&"text-destructive",e),htmlFor:a,...t})});Ic.displayName="FormLabel";const Rc=h.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:a,formMessageId:i}=Vp();return o.jsx(bd,{ref:t,id:n,"aria-describedby":r?`${a} ${i}`:`${a}`,"aria-invalid":!!r,...e})});Rc.displayName="FormControl";const Lc=h.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=Vp();return o.jsx("p",{ref:r,id:n,className:oe("text-sm text-muted-foreground",e),...t})});Lc.displayName="FormDescription";const Fc=h.forwardRef(({className:e,children:t,...r},n)=>{const{error:a,formMessageId:i}=Vp(),s=a?String(a==null?void 0:a.message):t;return s?o.jsx("p",{ref:n,id:i,className:oe("text-sm font-medium text-destructive",e),...r,children:s}):null});Fc.displayName="FormMessage";var ot;(function(e){e.assertEqual=a=>a;function t(a){}e.assertIs=t;function r(a){throw new Error}e.assertNever=r,e.arrayToEnum=a=>{const i={};for(const s of a)i[s]=s;return i},e.getValidEnumValues=a=>{const i=e.objectKeys(a).filter(l=>typeof a[a[l]]!="number"),s={};for(const l of i)s[l]=a[l];return e.objectValues(s)},e.objectValues=a=>e.objectKeys(a).map(function(i){return a[i]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},e.find=(a,i)=>{for(const s of a)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(ot||(ot={}));var mx;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(mx||(mx={}));const Ce=ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),yi=e=>{switch(typeof e){case"undefined":return Ce.undefined;case"string":return Ce.string;case"number":return isNaN(e)?Ce.nan:Ce.number;case"boolean":return Ce.boolean;case"function":return Ce.function;case"bigint":return Ce.bigint;case"symbol":return Ce.symbol;case"object":return Array.isArray(e)?Ce.array:e===null?Ce.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ce.promise:typeof Map<"u"&&e instanceof Map?Ce.map:typeof Set<"u"&&e instanceof Set?Ce.set:typeof Date<"u"&&e instanceof Date?Ce.date:Ce.object;default:return Ce.unknown}},le=ot.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),eJ=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class un extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const r=t||function(i){return i.message},n={_errors:[]},a=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let l=n,c=0;for(;c<s.path.length;){const u=s.path[c];c===s.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(r(s))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}};return a(this),n}static assert(t){if(!(t instanceof un))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ot.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},n=[];for(const a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}un.create=e=>new un(e);const nl=(e,t)=>{let r;switch(e.code){case le.invalid_type:e.received===Ce.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case le.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ot.jsonStringifyReplacer)}`;break;case le.unrecognized_keys:r=`Unrecognized key(s) in object: ${ot.joinValues(e.keys,", ")}`;break;case le.invalid_union:r="Invalid input";break;case le.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ot.joinValues(e.options)}`;break;case le.invalid_enum_value:r=`Invalid enum value. Expected ${ot.joinValues(e.options)}, received '${e.received}'`;break;case le.invalid_arguments:r="Invalid function arguments";break;case le.invalid_return_type:r="Invalid function return type";break;case le.invalid_date:r="Invalid date";break;case le.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ot.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case le.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case le.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case le.custom:r="Invalid input";break;
vendor: 2,197 bytes, line 530
530case le.invalid_intersection_types:r="Intersection results could not be merged";break;case le.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case le.not_finite:r="Number must be finite";break;default:r=t.defaultError,ot.assertNever(e)}return{message:r}};let tI=nl;function tJ(e){tI=e}function Cm(){return tI}const Om=e=>{const{data:t,path:r,errorMaps:n,issueData:a}=e,i=[...r,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let l="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)l=u(s,{data:t,defaultError:l}).message;return{...a,path:i,message:l}},rJ=[];function be(e,t){const r=Cm(),n=Om({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===nl?void 0:nl].filter(a=>!!a)});e.common.issues.push(n)}class Nr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const a of r){if(a.status==="aborted")return Ve;a.status==="dirty"&&t.dirty(),n.push(a.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const a of r){const i=await a.key,s=await a.value;n.push({key:i,value:s})}return Nr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const a of r){const{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return Ve;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}}const Ve=Object.freeze({status:"aborted"}),js=e=>({status:"dirty",value:e}),Rr=e=>({status:"valid",value:e}),hx=e=>e.status==="aborted",px=e=>e.status==="dirty",xu=e=>e.status==="valid",bu=e=>typeof Promise<"u"&&e instanceof Promise;function Pm(e,t,r,n){if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function rI(e,t,r,n,a){if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var Fe;
vendor: 49,433 bytes, line 530
530(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Fe||(Fe={}));var Bc,zc;class Sa{constructor(t,r,n,a){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const z_=(e,t)=>{if(xu(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new un(e.common.issues);return this._error=r,this._error}}};function Ze(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(s,l)=>{var c,u;const{message:d}=e;return s.code==="invalid_enum_value"?{message:d??l.defaultError}:typeof l.data>"u"?{message:(c=d??n)!==null&&c!==void 0?c:l.defaultError}:s.code!=="invalid_type"?{message:l.defaultError}:{message:(u=d??r)!==null&&u!==void 0?u:l.defaultError}},description:a}}class nt{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return yi(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:yi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Nr,ctx:{common:t.parent.common,data:t.data,parsedType:yi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(bu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;const a={common:{issues:[],async:(n=r==null?void 0:r.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:yi(t)},i=this._parseSync({data:t,path:a.path,parent:a});return z_(a,i)}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:yi(t)},a=this._parse({data:t,path:n.path,parent:n}),i=await(bu(a)?a:Promise.resolve(a));return z_(n,i)}refine(t,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,i)=>{const s=t(a),l=()=>i.addIssue({code:le.custom,...n(a)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(l(),!1)):s?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,a)=>t(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(t){return new ta({schema:this,typeName:Ue.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return ga.create(this,this._def)}nullable(){return Vi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Jn.create(this,this._def)}promise(){return il.create(this,this._def)}or(t){return _u.create([this,t],this._def)}and(t){return Nu.create(this,t,this._def)}transform(t){return new ta({...Ze(this._def),schema:this,typeName:Ue.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new Au({...Ze(this._def),innerType:this,defaultValue:r,typeName:Ue.ZodDefault})}brand(){return new Kw({typeName:Ue.ZodBranded,type:this,...Ze(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new Tu({...Ze(this._def),innerType:this,catchValue:r,typeName:Ue.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Fd.create(this,t)}readonly(){return Du.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const nJ=/^c[^\s-]{8,}$/i,aJ=/^[0-9a-z]+$/,iJ=/^[0-9A-HJKMNP-TV-Z]{26}$/,oJ=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,sJ=/^[a-z0-9_-]{21}$/i,lJ=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,cJ=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,uJ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Tg;const dJ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,fJ=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,mJ=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nI="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",hJ=new RegExp(`^${nI}$`);function aI(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function pJ(e){return new RegExp(`^${aI(e)}$`)}function iI(e){let t=`${nI}T${aI(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function vJ(e,t){return!!((t==="v4"||!t)&&dJ.test(e)||(t==="v6"||!t)&&fJ.test(e))}class Zn extends nt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ce.string){const i=this._getOrReturnCtx(t);return be(i,{code:le.invalid_type,expected:Ce.string,received:i.parsedType}),Ve}const n=new Nr;let a;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(a=this._getOrReturnCtx(t,a),be(a,{code:le.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(a=this._getOrReturnCtx(t,a),be(a,{code:le.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const s=t.data.length>i.value,l=t.data.length<i.value;(s||l)&&(a=this._getOrReturnCtx(t,a),s?be(a,{code:le.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&be(a,{code:le.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")cJ.test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{validation:"email",code:le.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Tg||(Tg=new RegExp(uJ,"u")),Tg.test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{validation:"emoji",code:le.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")oJ.test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{validation:"uuid",code:le.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")sJ.test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{validation:"nanoid",code:le.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")nJ.test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{validation:"cuid",code:le.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")aJ.test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{validation:"cuid2",code:le.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")iJ.test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{validation:"ulid",code:le.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),be(a,{validation:"url",code:le.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{validation:"regex",code:le.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(t,a),be(a,{code:le.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(a=this._getOrReturnCtx(t,a),be(a,{code:le.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(a=this._getOrReturnCtx(t,a),be(a,{code:le.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?iI(i).test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{code:le.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?hJ.test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{code:le.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?pJ(i).test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{code:le.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?lJ.test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{validation:"duration",code:le.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?vJ(t.data,i.version)||(a=this._getOrReturnCtx(t,a),be(a,{validation:"ip",code:le.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?mJ.test(t.data)||(a=this._getOrReturnCtx(t,a),be(a,{validation:"base64",code:le.invalid_string,message:i.message}),n.dirty()):ot.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(a=>t.test(a),{validation:r,code:le.invalid_string,...Fe.errToObj(n)})}_addCheck(t){return new Zn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Fe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Fe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Fe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Fe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Fe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Fe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Fe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Fe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Fe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Fe.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(r=t==null?void 0:t.offset)!==null&&r!==void 0?r:!1,local:(n=t==null?void 0:t.local)!==null&&n!==void 0?n:!1,...Fe.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Fe.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Fe.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Fe.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...Fe.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Fe.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Fe.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Fe.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Fe.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Fe.errToObj(r)})}nonempty(t){return this.min(1,Fe.errToObj(t))}trim(){return new Zn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Zn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Zn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}Zn.create=e=>{var t;return new Zn({checks:[],typeName:Ue.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};function gJ(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n,i=parseInt(e.toFixed(a).replace(".","")),s=parseInt(t.toFixed(a).replace(".",""));return i%s/Math.pow(10,a)}class qi extends nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Ce.number){const i=this._getOrReturnCtx(t);return be(i,{code:le.invalid_type,expected:Ce.number,received:i.parsedType}),Ve}let n;const a=new Nr;for(const i of this._def.checks)i.kind==="int"?ot.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),be(n,{code:le.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),be(n,{code:le.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),be(n,{code:le.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?gJ(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),be(n,{code:le.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),be(n,{code:le.not_finite,message:i.message}),a.dirty()):ot.assertNever(i);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Fe.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Fe.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Fe.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Fe.toString(r))}setLimit(t,r,n,a){return new qi({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Fe.toString(a)}]})}_addCheck(t){return new qi({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Fe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Fe.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Fe.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Fe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Fe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Fe.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ot.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}}qi.create=e=>new qi({checks:[],typeName:Ue.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class Ui extends nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==Ce.bigint){const i=this._getOrReturnCtx(t);return be(i,{code:le.invalid_type,expected:Ce.bigint,received:i.parsedType}),Ve}let n;const a=new Nr;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),be(n,{code:le.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),be(n,{code:le.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),be(n,{code:le.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):ot.assertNever(i);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Fe.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Fe.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Fe.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Fe.toString(r))}setLimit(t,r,n,a){return new Ui({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Fe.toString(a)}]})}_addCheck(t){return new Ui({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Fe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Fe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Fe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Fe.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Fe.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}Ui.create=e=>{var t;return new Ui({checks:[],typeName:Ue.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Ze(e)})};class wu extends nt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ce.boolean){const n=this._getOrReturnCtx(t);return be(n,{code:le.invalid_type,expected:Ce.boolean,received:n.parsedType}),Ve}return Rr(t.data)}}wu.create=e=>new wu({typeName:Ue.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ze(e)});class Lo extends nt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ce.date){const i=this._getOrReturnCtx(t);return be(i,{code:le.invalid_type,expected:Ce.date,received:i.parsedType}),Ve}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return be(i,{code:le.invalid_date}),Ve}const n=new Nr;let a;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(a=this._getOrReturnCtx(t,a),be(a,{code:le.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(a=this._getOrReturnCtx(t,a),be(a,{code:le.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):ot.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Lo({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Fe.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Fe.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}}Lo.create=e=>new Lo({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ue.ZodDate,...Ze(e)});class Am extends nt{_parse(t){if(this._getType(t)!==Ce.symbol){const n=this._getOrReturnCtx(t);return be(n,{code:le.invalid_type,expected:Ce.symbol,received:n.parsedType}),Ve}return Rr(t.data)}}Am.create=e=>new Am({typeName:Ue.ZodSymbol,...Ze(e)});class ju extends nt{_parse(t){if(this._getType(t)!==Ce.undefined){const n=this._getOrReturnCtx(t);return be(n,{code:le.invalid_type,expected:Ce.undefined,received:n.parsedType}),Ve}return Rr(t.data)}}ju.create=e=>new ju({typeName:Ue.ZodUndefined,...Ze(e)});class Su extends nt{_parse(t){if(this._getType(t)!==Ce.null){const n=this._getOrReturnCtx(t);return be(n,{code:le.invalid_type,expected:Ce.null,received:n.parsedType}),Ve}return Rr(t.data)}}Su.create=e=>new Su({typeName:Ue.ZodNull,...Ze(e)});class al extends nt{constructor(){super(...arguments),this._any=!0}_parse(t){return Rr(t.data)}}al.create=e=>new al({typeName:Ue.ZodAny,...Ze(e)});class Eo extends nt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Rr(t.data)}}Eo.create=e=>new Eo({typeName:Ue.ZodUnknown,...Ze(e)});class Za extends nt{_parse(t){const r=this._getOrReturnCtx(t);return be(r,{code:le.invalid_type,expected:Ce.never,received:r.parsedType}),Ve}}Za.create=e=>new Za({typeName:Ue.ZodNever,...Ze(e)});class Tm extends nt{_parse(t){if(this._getType(t)!==Ce.undefined){const n=this._getOrReturnCtx(t);return be(n,{code:le.invalid_type,expected:Ce.void,received:n.parsedType}),Ve}return Rr(t.data)}}Tm.create=e=>new Tm({typeName:Ue.ZodVoid,...Ze(e)});class Jn extends nt{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),a=this._def;if(r.parsedType!==Ce.array)return be(r,{code:le.invalid_type,expected:Ce.array,received:r.parsedType}),Ve;if(a.exactLength!==null){const s=r.data.length>a.exactLength.value,l=r.data.length<a.exactLength.value;(s||l)&&(be(r,{code:s?le.too_big:le.too_small,minimum:l?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(be(r,{code:le.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(be(r,{code:le.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,l)=>a.type._parseAsync(new Sa(r,s,r.path,l)))).then(s=>Nr.mergeArray(n,s));const i=[...r.data].map((s,l)=>a.type._parseSync(new Sa(r,s,r.path,l)));return Nr.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new Jn({...this._def,minLength:{value:t,message:Fe.toString(r)}})}max(t,r){return new Jn({...this._def,maxLength:{value:t,message:Fe.toString(r)}})}length(t,r){return new Jn({...this._def,exactLength:{value:t,message:Fe.toString(r)}})}nonempty(t){return this.min(1,t)}}Jn.create=(e,t)=>new Jn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ue.ZodArray,...Ze(t)});function bs(e){if(e instanceof Bt){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=ga.create(bs(n))}return new Bt({...e._def,shape:()=>t})}else return e instanceof Jn?new Jn({...e._def,type:bs(e.element)}):e instanceof ga?ga.create(bs(e.unwrap())):e instanceof Vi?Vi.create(bs(e.unwrap())):e instanceof _a?_a.create(e.items.map(t=>bs(t))):e}class Bt extends nt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=ot.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==Ce.object){const u=this._getOrReturnCtx(t);return be(u,{code:le.invalid_type,expected:Ce.object,received:u.parsedType}),Ve}const{status:n,ctx:a}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),l=[];if(!(this._def.catchall instanceof Za&&this._def.unknownKeys==="strip"))for(const u in a.data)s.includes(u)||l.push(u);const c=[];for(const u of s){const d=i[u],f=a.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Sa(a,f,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof Za){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:a.data[d]}});else if(u==="strict")l.length>0&&(be(a,{code:le.unrecognized_keys,keys:l}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const f=a.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Sa(a,f,a.path,d)),alwaysSet:d in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,m=await d.value;u.push({key:f,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>Nr.mergeObjectSync(n,u)):Nr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return Fe.errToObj,new Bt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var a,i,s,l;const c=(s=(i=(a=this._def).errorMap)===null||i===void 0?void 0:i.call(a,r,n).message)!==null&&s!==void 0?s:n.defaultError;return r.code==="unrecognized_keys"?{message:(l=Fe.errToObj(t).message)!==null&&l!==void 0?l:c}:{message:c}}}:{}})}strip(){return new Bt({...this._def,unknownKeys:"strip"})}passthrough(){return new Bt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Bt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Bt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ue.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Bt({...this._def,catchall:t})}pick(t){const r={};return ot.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Bt({...this._def,shape:()=>r})}omit(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new Bt({...this._def,shape:()=>r})}deepPartial(){return bs(this)}partial(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{const a=this.shape[n];t&&!t[n]?r[n]=a:r[n]=a.optional()}),new Bt({...this._def,shape:()=>r})}required(t){const r={};return ot.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ga;)i=i._def.innerType;r[n]=i}}),new Bt({...this._def,shape:()=>r})}keyof(){return oI(ot.objectKeys(this.shape))}}Bt.create=(e,t)=>new Bt({shape:()=>e,unknownKeys:"strip",catchall:Za.create(),typeName:Ue.ZodObject,...Ze(t)});Bt.strictCreate=(e,t)=>new Bt({shape:()=>e,unknownKeys:"strict",catchall:Za.create(),typeName:Ue.ZodObject,...Ze(t)});Bt.lazycreate=(e,t)=>new Bt({shape:e,unknownKeys:"strip",catchall:Za.create(),typeName:Ue.ZodObject,...Ze(t)});class _u extends nt{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function a(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;const s=i.map(l=>new un(l.ctx.common.issues));return be(r,{code:le.invalid_union,unionErrors:s}),Ve}if(r.common.async)return Promise.all(n.map(async i=>{const s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(a);{let i;const s=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const l=s.map(c=>new un(c));return be(r,{code:le.invalid_union,unionErrors:l}),Ve}}get options(){return this._def.options}}_u.create=(e,t)=>new _u({options:e,typeName:Ue.ZodUnion,...Ze(t)});const Ia=e=>e instanceof Cu?Ia(e.schema):e instanceof ta?Ia(e.innerType()):e instanceof Ou?[e.value]:e instanceof Wi?e.options:e instanceof Pu?ot.objectValues(e.enum):e instanceof Au?Ia(e._def.innerType):e instanceof ju?[void 0]:e instanceof Su?[null]:e instanceof ga?[void 0,...Ia(e.unwrap())]:e instanceof Vi?[null,...Ia(e.unwrap())]:e instanceof Kw||e instanceof Du?Ia(e.unwrap()):e instanceof Tu?Ia(e._def.innerType):[];class Gp extends nt{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==Ce.object)return be(r,{code:le.invalid_type,expected:Ce.object,received:r.parsedType}),Ve;const n=this.discriminator,a=r.data[n],i=this.optionsMap.get(a);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(be(r,{code:le.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ve)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const a=new Map;for(const i of r){const s=Ia(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const l of s){if(a.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);a.set(l,i)}}return new Gp({typeName:Ue.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:a,...Ze(n)})}}function vx(e,t){const r=yi(e),n=yi(t);if(e===t)return{valid:!0,data:e};if(r===Ce.object&&n===Ce.object){const a=ot.objectKeys(t),i=ot.objectKeys(e).filter(l=>a.indexOf(l)!==-1),s={...e,...t};for(const l of i){const c=vx(e[l],t[l]);if(!c.valid)return{valid:!1};s[l]=c.data}return{valid:!0,data:s}}else if(r===Ce.array&&n===Ce.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let i=0;i<e.length;i++){const s=e[i],l=t[i],c=vx(s,l);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return r===Ce.date&&n===Ce.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Nu extends nt{_parse(t){const{status:r,ctx:n}=this._processInputParams(t),a=(i,s)=>{if(hx(i)||hx(s))return Ve;const l=vx(i.value,s.value);return l.valid?((px(i)||px(s))&&r.dirty(),{status:r.value,value:l.data}):(be(n,{code:le.invalid_intersection_types}),Ve)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>a(i,s)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Nu.create=(e,t,r)=>new Nu({left:e,right:t,typeName:Ue.ZodIntersection,...Ze(r)});class _a extends nt{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Ce.array)return be(n,{code:le.invalid_type,expected:Ce.array,received:n.parsedType}),Ve;if(n.data.length<this._def.items.length)return be(n,{code:le.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ve;!this._def.rest&&n.data.length>this._def.items.length&&(be(n,{code:le.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((s,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new Sa(n,s,n.path,l)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>Nr.mergeArray(r,s)):Nr.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new _a({...this._def,rest:t})}}_a.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _a({items:e,typeName:Ue.ZodTuple,rest:null,...Ze(t)})};class Eu extends nt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Ce.object)return be(n,{code:le.invalid_type,expected:Ce.object,received:n.parsedType}),Ve;const a=[],i=this._def.keyType,s=this._def.valueType;for(const l in n.data)a.push({key:i._parse(new Sa(n,l,n.path,l)),value:s._parse(new Sa(n,n.data[l],n.path,l)),alwaysSet:l in n.data});return n.common.async?Nr.mergeObjectAsync(r,a):Nr.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof nt?new Eu({keyType:t,valueType:r,typeName:Ue.ZodRecord,...Ze(n)}):new Eu({keyType:Zn.create(),valueType:t,typeName:Ue.ZodRecord,...Ze(r)})}}class Dm extends nt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Ce.map)return be(n,{code:le.invalid_type,expected:Ce.map,received:n.parsedType}),Ve;const a=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([l,c],u)=>({key:a._parse(new Sa(n,l,n.path,[u,"key"])),value:i._parse(new Sa(n,c,n.path,[u,"value"]))}));if(n.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of s){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Ve;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),l.set(u.value,d.value)}return{status:r.value,value:l}})}else{const l=new Map;for(const c of s){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Ve;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),l.set(u.value,d.value)}return{status:r.value,value:l}}}}Dm.create=(e,t,r)=>new Dm({valueType:t,keyType:e,typeName:Ue.ZodMap,...Ze(r)});class Fo extends nt{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Ce.set)return be(n,{code:le.invalid_type,expected:Ce.set,received:n.parsedType}),Ve;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(be(n,{code:le.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(be(n,{code:le.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const i=this._def.valueType;function s(c){const u=new Set;for(const d of c){if(d.status==="aborted")return Ve;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const l=[...n.data.values()].map((c,u)=>i._parse(new Sa(n,c,n.path,u)));return n.common.async?Promise.all(l).then(c=>s(c)):s(l)}min(t,r){return new Fo({...this._def,minSize:{value:t,message:Fe.toString(r)}})}max(t,r){return new Fo({...this._def,maxSize:{value:t,message:Fe.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}Fo.create=(e,t)=>new Fo({valueType:e,minSize:null,maxSize:null,typeName:Ue.ZodSet,...Ze(t)});class Ts extends nt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==Ce.function)return be(r,{code:le.invalid_type,expected:Ce.function,received:r.parsedType}),Ve;function n(l,c){return Om({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Cm(),nl].filter(u=>!!u),issueData:{code:le.invalid_arguments,argumentsError:c}})}function a(l,c){return Om({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Cm(),nl].filter(u=>!!u),issueData:{code:le.invalid_return_type,returnTypeError:c}})}const i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof il){const l=this;return Rr(async function(...c){const u=new un([]),d=await l._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),f=await Reflect.apply(s,this,d);return await l._def.returns._def.type.parseAsync(f,i).catch(p=>{throw u.addIssue(a(f,p)),u})})}else{const l=this;return Rr(function(...c){const u=l._def.args.safeParse(c,i);if(!u.success)throw new un([n(c,u.error)]);const d=Reflect.apply(s,this,u.data),f=l._def.returns.safeParse(d,i);if(!f.success)throw new un([a(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Ts({...this._def,args:_a.create(t).rest(Eo.create())})}returns(t){return new Ts({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new Ts({args:t||_a.create([]).rest(Eo.create()),returns:r||Eo.create(),typeName:Ue.ZodFunction,...Ze(n)})}}class Cu extends nt{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Cu.create=(e,t)=>new Cu({getter:e,typeName:Ue.ZodLazy,...Ze(t)});class Ou extends nt{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return be(r,{received:r.data,code:le.invalid_literal,expected:this._def.value}),Ve}return{status:"valid",value:t.data}}get value(){return this._def.value}}Ou.create=(e,t)=>new Ou({value:e,typeName:Ue.ZodLiteral,...Ze(t)});function oI(e,t){return new Wi({values:e,typeName:Ue.ZodEnum,...Ze(t)})}class Wi extends nt{constructor(){super(...arguments),Bc.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return be(r,{expected:ot.joinValues(n),received:r.parsedType,code:le.invalid_type}),Ve}if(Pm(this,Bc)||rI(this,Bc,new Set(this._def.values)),!Pm(this,Bc).has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return be(r,{received:r.data,code:le.invalid_enum_value,options:n}),Ve}return Rr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return Wi.create(t,{...this._def,...r})}exclude(t,r=this._def){return Wi.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}Bc=new WeakMap;Wi.create=oI;class Pu extends nt{constructor(){super(...arguments),zc.set(this,void 0)}_parse(t){const r=ot.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Ce.string&&n.parsedType!==Ce.number){const a=ot.objectValues(r);return be(n,{expected:ot.joinValues(a),received:n.parsedType,code:le.invalid_type}),Ve}if(Pm(this,zc)||rI(this,zc,new Set(ot.getValidEnumValues(this._def.values))),!Pm(this,zc).has(t.data)){const a=ot.objectValues(r);return be(n,{received:n.data,code:le.invalid_enum_value,options:a}),Ve}return Rr(t.data)}get enum(){return this._def.values}}zc=new WeakMap;Pu.create=(e,t)=>new Pu({values:e,typeName:Ue.ZodNativeEnum,...Ze(t)});class il extends nt{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==Ce.promise&&r.common.async===!1)return be(r,{code:le.invalid_type,expected:Ce.promise,received:r.parsedType}),Ve;const n=r.parsedType===Ce.promise?r.data:Promise.resolve(r.data);return Rr(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}il.create=(e,t)=>new il({type:e,typeName:Ue.ZodPromise,...Ze(t)});class ta extends nt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ue.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),a=this._def.effect||null,i={addIssue:s=>{be(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const s=a.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async l=>{if(r.value==="aborted")return Ve;const c=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return c.status==="aborted"?Ve:c.status==="dirty"||r.value==="dirty"?js(c.value):c});{if(r.value==="aborted")return Ve;const l=this._def.schema._parseSync({data:s,path:n.path,parent:n});return l.status==="aborted"?Ve:l.status==="dirty"||r.value==="dirty"?js(l.value):l}}if(a.type==="refinement"){const s=l=>{const c=a.refinement(l,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(n.common.async===!1){const l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?Ve:(l.status==="dirty"&&r.dirty(),s(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?Ve:(l.status==="dirty"&&r.dirty(),s(l.value).then(()=>({status:r.value,value:l.value}))))}if(a.type==="transform")if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!xu(s))return s;const l=a.transform(s.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>xu(s)?Promise.resolve(a.transform(s.value,i)).then(l=>({status:r.value,value:l})):s);ot.assertNever(a)}}ta.create=(e,t,r)=>new ta({schema:e,typeName:Ue.ZodEffects,effect:t,...Ze(r)});ta.createWithPreprocess=(e,t,r)=>new ta({schema:t,effect:{type:"preprocess",transform:e},typeName:Ue.ZodEffects,...Ze(r)});class ga extends nt{_parse(t){return this._getType(t)===Ce.undefined?Rr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ga.create=(e,t)=>new ga({innerType:e,typeName:Ue.ZodOptional,...Ze(t)});class Vi extends nt{_parse(t){return this._getType(t)===Ce.null?Rr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Vi.create=(e,t)=>new Vi({innerType:e,typeName:Ue.ZodNullable,...Ze(t)});class Au extends nt{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===Ce.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Au.create=(e,t)=>new Au({innerType:e,typeName:Ue.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ze(t)});class Tu extends nt{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return bu(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new un(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new un(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Tu.create=(e,t)=>new Tu({innerType:e,typeName:Ue.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ze(t)});class $m extends nt{_parse(t){if(this._getType(t)!==Ce.nan){const n=this._getOrReturnCtx(t);return be(n,{code:le.invalid_type,expected:Ce.nan,received:n.parsedType}),Ve}return{status:"valid",value:t.data}}}$m.create=e=>new $m({typeName:Ue.ZodNaN,...Ze(e)});const yJ=Symbol("zod_brand");class Kw extends nt{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Fd extends nt{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Ve:i.status==="dirty"?(r.dirty(),js(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Ve:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(t,r){return new Fd({in:t,out:r,typeName:Ue.ZodPipeline})}}class Du extends nt{_parse(t){const r=this._def.innerType._parse(t),n=a=>(xu(a)&&(a.value=Object.freeze(a.value)),a);return bu(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}Du.create=(e,t)=>new Du({innerType:e,typeName:Ue.ZodReadonly,...Ze(t)});function sI(e,t={},r){return e?al.create().superRefine((n,a)=>{var i,s;if(!e(n)){const l=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,c=(s=(i=l.fatal)!==null&&i!==void 0?i:r)!==null&&s!==void 0?s:!0,u=typeof l=="string"?{message:l}:l;a.addIssue({code:"custom",...u,fatal:c})}}):al.create()}const xJ={object:Bt.lazycreate};var Ue;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ue||(Ue={}));const bJ=(e,t={message:`Input not instance of ${e.name}`})=>sI(r=>r instanceof e,t),lI=Zn.create,cI=qi.create,wJ=$m.create,jJ=Ui.create,uI=wu.create,SJ=Lo.create,_J=Am.create,NJ=ju.create,EJ=Su.create,CJ=al.create,OJ=Eo.create,PJ=Za.create,AJ=Tm.create,TJ=Jn.create,DJ=Bt.create,$J=Bt.strictCreate,kJ=_u.create,MJ=Gp.create,IJ=Nu.create,RJ=_a.create,LJ=Eu.create,FJ=Dm.create,BJ=Fo.create,zJ=Ts.create,qJ=Cu.create,UJ=Ou.create,WJ=Wi.create,VJ=Pu.create,GJ=il.create,q_=ta.create,HJ=ga.create,KJ=Vi.create,YJ=ta.createWithPreprocess,XJ=Fd.create,ZJ=()=>lI().optional(),QJ=()=>cI().optional(),JJ=()=>uI().optional(),eee={string:e=>Zn.create({...e,coerce:!0}),number:e=>qi.create({...e,coerce:!0}),boolean:e=>wu.create({...e,coerce:!0}),bigint:e=>Ui.create({...e,coerce:!0}),date:e=>Lo.create({...e,coerce:!0})},tee=Ve;var xc=Object.freeze({__proto__:null,defaultErrorMap:nl,setErrorMap:tJ,getErrorMap:Cm,makeIssue:Om,EMPTY_PATH:rJ,addIssueToContext:be,ParseStatus:Nr,INVALID:Ve,DIRTY:js,OK:Rr,isAborted:hx,isDirty:px,isValid:xu,isAsync:bu,get util(){return ot},get objectUtil(){return mx},ZodParsedType:Ce,getParsedType:yi,ZodType:nt,datetimeRegex:iI,ZodString:Zn,ZodNumber:qi,ZodBigInt:Ui,ZodBoolean:wu,ZodDate:Lo,ZodSymbol:Am,ZodUndefined:ju,ZodNull:Su,ZodAny:al,ZodUnknown:Eo,ZodNever:Za,ZodVoid:Tm,ZodArray:Jn,ZodObject:Bt,ZodUnion:_u,ZodDiscriminatedUnion:Gp,ZodIntersection:Nu,ZodTuple:_a,ZodRecord:Eu,ZodMap:Dm,ZodSet:Fo,ZodFunction:Ts,ZodLazy:Cu,ZodLiteral:Ou,ZodEnum:Wi,ZodNativeEnum:Pu,ZodPromise:il,ZodEffects:ta,ZodTransformer:ta,ZodOptional:ga,ZodNullable:Vi,ZodDefault:Au,ZodCatch:Tu,ZodNaN:$m,BRAND:yJ,ZodBranded:Kw,ZodPipeline:Fd,ZodReadonly:Du,custom:sI,Schema:nt,ZodSchema:nt,late:xJ,get ZodFirstPartyTypeKind(){return Ue},coerce:eee,any:CJ,array:TJ,bigint:jJ,boolean:uI,date:SJ,discriminatedUnion:MJ,effect:q_,enum:WJ,function:zJ,instanceof:bJ,intersection:IJ,lazy:qJ,literal:UJ,map:FJ,nan:wJ,nativeEnum:VJ,never:PJ,null:EJ,nullable:KJ,number:cI,object:DJ,oboolean:JJ,onumber:QJ,optional:HJ,ostring:ZJ,pipeline:XJ,preprocess:YJ,promise:GJ,re
530cord:LJ,set:BJ,strictObject:$J,string:lI,symbol:_J,transformer:q_,tuple:RJ,undefined:NJ,union:kJ,unknown:OJ,void:AJ,NEVER:tee,ZodIssueCode:le,quotelessJson:eJ,ZodError:un});const U_=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ve(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},dI=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?U_(n.ref,r,e):n.refs&&n.refs.forEach(a=>U_(a,r,e))}},ree=(e,t)=>{t.shouldUseNativeValidation&&dI(e,t);const r={};for(const n in e){const a=ve(t.fields,n),i=Object.assign(e[n]||{},{ref:a&&a.ref});if(nee(t.names||Object.keys(e),n)){const s=Object.assign({},ve(r,n));ft(s,"root",i),ft(r,n,s)}else ft(r,n,i)}return r},nee=(e,t)=>e.some(r=>r.startsWith(t+"."));var aee=function(e,t){for(var r={};e.length;){var n=e[0],a=n.code,i=n.message,s=n.path.join(".");if(!r[s])if("unionErrors"in n){var l=n.unionErrors[0].errors[0];r[s]={message:l.message,type:l.code}}else r[s]={message:i,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=r[s].types,u=c&&c[n.code];r[s]=GM(s,t,r,a,u?[].concat(u,n.message):n.message)}e.shift()}return r},iee=function(e,t,r){return r===void 0&&(r={}),function(n,a,i){try{return Promise.resolve(function(s,l){try{var c=Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(u){return i.shouldUseNativeValidation&&dI({},i),{errors:{},values:r.raw?n:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(s){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(s))return{values:{},errors:ree(aee(s.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}}};const oee=xc.object({clientId:xc.string().min(1,"El ID de cliente es requerido"),clientSecret:xc.string().min(1,"El secreto de cliente es requerido"),tenantId:xc.string().min(1,"El ID de tenant es requerido"),folderPath:xc.string().min(1,"La ruta de la carpeta es requerida")});function see(){const{toast:e}=Rn(),[t,r]=h.useState(!1),[n,a]=h.useState("idle"),i=QQ({resolver:iee(oee),defaultValues:{clientId:"",clientSecret:"",tenantId:"",folderPath:"/Documentos/FormForgeSamples"}}),s=async l=>{r(!0),a("idle"),setTimeout(()=>{Math.random()>.3?(a("success"),e({title:"Conexión exitosa",description:"La conexión con OneDrive se ha configurado correctamente."})):(a("error"),e({title:"Error de conexión",description:"No se pudo establecer conexión con OneDrive. Verifique sus credenciales.",variant:"destructive"})),r(!1)},2e3)};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Configuración de OneDrive"}),o.jsx("p",{className:"text-muted-foreground mt-2",children:"Configura la conexión a Microsoft OneDrive para almacenar las imágenes de las muestras."})]}),o.jsxs(de,{className:"max-w-2xl",children:[o.jsxs(Le,{children:[o.jsx(Ie,{children:"Credenciales de OneDrive"}),o.jsx(zt,{children:"Ingresa las credenciales de tu aplicación de Microsoft Azure para conectar con OneDrive."})]}),o.jsx(fe,{children:o.jsx(JQ,{...i,children:o.jsxs("form",{onSubmit:i.handleSubmit(s),className:"space-y-4",children:[o.jsx(yf,{control:i.control,name:"clientId",render:({field:l})=>o.jsxs(Mc,{children:[o.jsx(Ic,{children:"ID de Cliente"}),o.jsx(Rc,{children:o.jsx(we,{...l,placeholder:"Ingrese el ID de cliente de Azure"})}),o.jsx(Lc,{children:"El ID de cliente (Client ID) de tu aplicación registrada en Azure."}),o.jsx(Fc,{})]})}),o.jsx(yf,{control:i.control,name:"clientSecret",render:({field:l})=>o.jsxs(Mc,{children:[o.jsx(Ic,{children:"Secreto de Cliente"}),o.jsx(Rc,{children:o.jsx(we,{...l,type:"password",placeholder:"Ingrese el secreto de cliente de Azure"})}),o.jsx(Lc,{children:"El secreto de cliente (Client Secret) de tu aplicación registrada en Azure."}),o.jsx(Fc,{})]})}),o.jsx(yf,{control:i.control,name:"tenantId",render:({field:l})=>o.jsxs(Mc,{children:[o.jsx(Ic,{children:"ID de Tenant"}),o.jsx(Rc,{children:o.jsx(we,{...l,placeholder:"Ingrese el ID de tenant de Azure"})}),o.jsx(Lc,{children:"El ID de tenant de tu organización en Azure."}),o.jsx(Fc,{})]})}),o.jsx(yf,{control:i.control,name:"folderPath",render:({field:l})=>o.jsxs(Mc,{children:[o.jsx(Ic,{children:"Ruta de Carpeta"}),o.jsx(Rc,{children:o.jsx(we,{...l,placeholder:"Ej: /Documentos/FormForgeSamples"})}),o.jsx(Lc,{children:"La ruta de la carpeta en OneDrive donde se guardarán las imágenes."}),o.jsx(Fc,{})]})}),o.jsx("div",{className:"pt-4",children:o.jsx(z,{type:"submit",disabled:t,className:"w-full",children:t?"Conectando...":"Probar Conexión"})}),n==="success"&&o.jsxs("div",{className:"flex items-center gap-2 text-green-600 p-2 bg-green-50 rounded",children:[o.jsx(To,{className:"h-5 w-5"}),o.jsx("span",{children:"Conexión exitosa con OneDrive"})]}),n==="error"&&o.jsxs("div",{className:"flex items-center gap-2 text-red-600 p-2 bg-red-50 rounded",children:[o.jsx(Kf,{className:"h-5 w-5"}),o.jsx("span",{children:"Error al conectar con OneDrive. Verifique sus credenciales."})]})]})})}),o.jsx(jd,{className:"flex-col items-start",children:o.jsxs("div",{className:"text-sm text-muted-foreground",children:[o.jsx("p",{children:"Para obtener estas credenciales:"}),o.jsxs("ol",{className:"list-decimal list-inside space-y-1 mt-2",children:[o.jsxs("li",{children:["Registra una aplicación en el ",o.jsx("a",{href:"https://portal.azure.com",target:"_blank",className:"text-primary hover:underline",children:"Portal de Azure"})]}),o.jsx("li",{children:'En "Registros de aplicaciones", crea una nueva aplicación'}),o.jsx("li",{children:"Configura los permisos necesarios para OneDrive"}),o.jsx("li",{children:'Genera un secreto de cliente en "Certificados y secretos"'})]})]})})]})]})}function lee(){var T,k;const[e,t]=h.useState(!0),[r,n]=h.useState(!1),[a,i]=h.useState([]),[s,l]=
530h.useState([]),[c,u]=h.useState({}),[d,f]=h.useState({}),[m,p]=h.useState(null),[y,v]=h.useState(!1),[g,x]=h.useState(!1),[b,j]=h.useState(""),[w,S]=h.useState("");h.useEffect(()=>{(async()=>{const{data:{session:D}}=await B.auth.getSession();if(D){const{data:M}=await B.from("profiles").select("role").eq("id",D.user.id).maybeSingle();v((M==null?void 0:M.role)==="Administrador")}await _()})()},[]);const _=async()=>{t(!0);try{const[D,M,F,q]=await Promise.all([B.from("roles_catalogo").select("*").order("rol"),B.from("app_modulos").select("id, nombre, modulo_padre_id").eq("activo",!0).order("orden"),B.from("app_role_permisos").select("rol, modulo_id, puede_leer, puede_escribir"),B.from("profiles").select("role")]);if(D.error)throw D.error;if(M.error)throw M.error;if(F.error)throw F.error;i(D.data||[]),l(M.data||[]);const I={};(F.data||[]).forEach(W=>{I[W.rol]||(I[W.rol]=new Map),I[W.rol].set(W.modulo_id,W)}),u(I);const K={};(q.data||[]).forEach(W=>{W.role&&(K[W.role]=(K[W.role]||0)+1)}),f(K),!m&&D.data&&D.data.length>0&&p(D.data[0].rol)}catch(D){console.error(D),Z.error("Error al cargar perfiles: "+D.message)}finally{t(!1)}},N=h.useMemo(()=>{const D=s.filter(F=>!F.modulo_padre_id),M=[];return D.forEach(F=>{M.push({mod:F,depth:0}),s.filter(q=>q.modulo_padre_id===F.id).forEach(q=>M.push({mod:q,depth:1}))}),M},[s]),E=(D,M,F)=>{!m||!y||u(q=>{const I={...q},K=new Map(I[m]||new Map),R={...K.get(D)||{modulo_id:D,puede_leer:!1,puede_escribir:!1},[M]:F};return M==="puede_escribir"&&F&&(R.puede_leer=!0),M==="puede_leer"&&!F&&(R.puede_escribir=!1),K.set(D,R),I[m]=K,I})},O=async()=>{var D;if(m){n(!0);try{const M=Array.from(((D=c[m])==null?void 0:D.values())||[]).filter(q=>q.puede_leer||q.puede_escribir),{error:F}=await B.from("app_role_permisos").delete().eq("rol",m);if(F)throw F;if(M.length>0){const q=M.map(K=>({rol:m,modulo_id:K.modulo_id,puede_leer:K.puede_leer,puede_escribir:K.puede_escribir})),{error:I}=await B.from("app_role_permisos").insert(q);if(I)throw I}Z.success(`Permisos del rol "${m}" guardados`)}catch(M){Z.error("Error al guardar: "+M.message)}finally{n(!1)}}},P=async()=>{const D=b.trim();if(D)try{const{error:M}=await B.from("roles_catalogo").insert({rol:D,descripcion:w.trim()||null,es_sistema:!1});if(M)throw M;Z.success(`Rol "${D}" creado`),x(!1),j(""),S(""),await _(),p(D)}catch(M){Z.error("Error al crear rol: "+M.message)}},C=async D=>{if(confirm(`¿Eliminar el rol "${D}"? Los usuarios con este rol perderán sus permisos.`))try{const{error:M}=await B.from("roles_catalogo").delete().eq("rol",D);if(M)throw M;Z.success(`Rol "${D}" eliminado`),m===D&&p(null),await _()}catch(M){Z.error("Error al eliminar: "+M.message)}};if(e)return o.jsx("div",{className:"flex items-center justify-center py-16",children:o.jsx(ye,{className:"h-8 w-8 animate-spin text-muted-foreground"})});const A=m?c[m]:void 0;return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-2",children:[o.jsx(pA,{className:"h-7 w-7"})," Perfiles y Permisos"]}),o.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Configura qué módulos puede ver y editar cada rol del sistema."})]}),y&&o.jsxs(z,{onClick:()=>x(!0),children:[o.jsx(wa,{className:"h-4 w-4 mr-2"})," Nuevo Rol"]})]}),!y&&o.jsx(de,{className:"border-yellow-300 bg-yellow-50",children:o.jsx(fe,{className:"py-3 text-sm text-yellow-900",children:"Solo administradores pueden modificar perfiles. Estás viendo en modo lectura."})}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[o.jsxs(de,{className:"lg:col-span-1",children:[o.jsx(Le,{children:o.jsxs(Ie,{className:"text-base",children:["Roles (",a.length,")"]})}),o.jsxs(fe,{className:"space-y-1 p-2",children:[a.map(D=>o.jsxs("div",{className:`flex items-center justify-between rounded-md p-2 cursor-pointer transition-colors ${m===D.rol?"bg-primary text-primary-foreground":"hover:bg-muted"}`,onClick:()=>p(D.rol),children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"font-medium truncate",children:D.rol}),o.jsxs("div",{className:`text-xs ${m===D.rol?"opacity-90":"text-muted-foreground"}`,children:[d[D.rol]||0," usuario(s)"]})]}),D.es_sistema&&o.jsx(ke,{variant:m===D.rol?"secondary":"outline",className:"text-[10px]",children:"sistema"})]},D.rol)),a.length===0&&o.jsx("div",{className:"text-sm text-muted-foreground p-2",children:"Sin roles configurados."})]})]}),o.jsxs(de,{className:"lg:col-span-3",children:[o.jsxs(Le,{className:"flex flex-row items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(Ie,{className:"text-base",children:m?`Permisos de "${m}"`:"Selecciona un rol"}),m&&o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:((T=a.find(D=>D.rol===m))==null?void 0:T.descripcion)||"Sin descripción"})]}),m&&y&&o.jsxs("div",{className:"flex gap-2",children:[!((k=a.find(D=>D.rol===m))!=null&&k.es_sistema)&&o.jsxs(z,{variant:"outline",size:"sm",onClick:()=>C(m),children:[o.jsx(Gi,{className:"h-4 w-4 mr-1"})," Eliminar rol"]}),o.jsxs(z,{size:"sm",onClick:O,disabled:r,children:[r?o.jsx(ye,{className:"h-4 w-4 mr-1 animate-spin"}):o.jsx(np,{className:"h-4 w-4 mr-1"}),"Guardar"]})]})]}),o.jsx(fe,{children:m?o.jsxs(yn,{children:[o.jsx(xn,{children:o.jsxs(Nt,{children:[o.jsx(Pe,{children:"Módulo"}),o.jsx(Pe,{className:"w-32 text-center",children:"Lectura"}),o.jsx(Pe,{className:"w-32 text-center",children:"Escritura"})]})}),o.jsx(bn,{children:N.map(({mod:D,depth:M})=>{const F=A==null?void 0:A.get(D.id);return o.jsxs(Nt,{children:[o.jsx(Oe,{children:o.jsxs("div",{style:{paddingLeft:M*20},className:"flex items-center gap-2",children:[M===1&&o.jsx("span",{className:"text-muted-foreground",children:"â³"}),o.jsx("span",{className:M===0?"font-medium":"",children:D.nombre}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",D.id,")"]})]})}),o.jsx(Oe,{className:"text-center",children:o.jsx(ja,{checked:!!(
530F!=null&&F.puede_leer),disabled:!y,onCheckedChange:q=>E(D.id,"puede_leer",!!q)})}),o.jsx(Oe,{className:"text-center",children:o.jsx(ja,{checked:!!(F!=null&&F.puede_escribir),disabled:!y,onCheckedChange:q=>E(D.id,"puede_escribir",!!q)})})]},D.id)})})]}):o.jsx("div",{className:"text-sm text-muted-foreground py-8 text-center",children:"Selecciona un rol del panel izquierdo para ver y editar sus permisos."})})]})]}),o.jsx(Ft,{open:g,onOpenChange:x,children:o.jsxs(It,{children:[o.jsx(Ut,{children:o.jsx(Wt,{children:"Nuevo Rol"})}),o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium",children:"Nombre del rol *"}),o.jsx(we,{placeholder:"Ej: Jefe de Turno",value:b,onChange:D=>j(D.target.value)})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium",children:"Descripción"}),o.jsx(Kt,{placeholder:"Para qué se usa este rol",value:w,onChange:D=>S(D.target.value)})]})]}),o.jsxs(dr,{children:[o.jsx(z,{variant:"outline",onClick:()=>x(!1),children:"Cancelar"}),o.jsx(z,{onClick:P,disabled:!b.trim(),children:"Crear"})]})]})})]})}const Yw=()=>{const[e,t]=h.useState(null),[r,n]=h.useState([]),[a,i]=h.useState([]),[s,l]=h.useState(!0),[c,u]=h.useState(null),{toast:d}=Rn(),f=[{codigo:"A",nombre:"Turno A - Mañana",hora_inicio:"06:00",hora_fin:"14:00"},{codigo:"B",nombre:"Turno B - Tarde",hora_inicio:"14:00",hora_fin:"22:00"},{codigo:"C",nombre:"Turno C - Noche",hora_inicio:"22:00",hora_fin:"06:00"}],m=async()=>{try{l(!0);const{data:{user:N}}=await B.auth.getUser();if(!N)return;const{data:E}=await B.from("profiles").select("role").eq("id",N.id).single();E&&u(E.role);const{data:O,error:P}=await B.rpc("get_active_shift",{user_uuid:N.id});P?console.error("Error loading active shift:",P):O&&O.length>0&&(t({...O[0],tiempo_transcurrido:String(O[0].tiempo_transcurrido||"")}),await p(O[0].turno)),((E==null?void 0:E.role)==="Administrador"||(E==null?void 0:E.role)==="Supervisor")&&await y()}catch(N){console.error("Error in loadInitialData:",N)}finally{l(!1)}},p=async N=>{try{const{data:{user:E}}=await B.auth.getUser();if(!E)return;const{data:O,error:P}=await B.rpc("get_user_production_shift_tasks",{user_uuid:E.id,current_shift:N,shift_date:new Date().toISOString().split("T")[0]});P?console.error("Error loading user tasks:",P):n(O||[])}catch(E){console.error("Error in loadUserTasks:",E)}},y=async()=>{try{const{data:N,error:E}=await B.rpc("get_all_production_tasks_admin");E?console.error("Error loading all tasks:",E):i(N||[])}catch(N){console.error("Error in loadAllTasks:",N)}},v=async N=>{try{const{data:{user:E}}=await B.auth.getUser();if(!E)return;const{error:O}=await B.from("tareas_produccion").insert({nombre:N.nombre,descripcion:N.descripcion,turnos:N.turnos,areas_asignadas:[],formulario_id:N.formulario_id,prioridad:N.prioridad,activo:!0,created_by:E.id});O?(console.error("Error creating task:",O),d({title:"Error",description:"No se pudo crear la tarea",variant:"destructive"})):(d({title:"Tarea creada",description:"La tarea se ha creado correctamente"}),await y())}catch(E){console.error("Error in createTask:",E)}},g=async(N,E)=>{try{const{error:O}=await B.from("tareas_produccion").update(E).eq("id",N);O?(console.error("Error updating task:",O),d({title:"Error",description:"No se pudo actualizar la tarea",variant:"destructive"})):(d({title:"Tarea actualizada",description:"La tarea se ha actualizado correctamente"}),await y())}catch(O){console.error("Error in updateTask:",O)}},x=async N=>{try{const{error:E}=await B.from("tareas_produccion").update({activo:!1}).eq("id",N);E?(console.error("Error deleting task:",E),d({title:"Error",description:"No se pudo eliminar la tarea",variant:"destructive"})):(d({title:"Tarea eliminada",description:"La tarea se ha eliminado correctamente"}),await y())}catch(E){console.error("Error in deleteTask:",E)}},b=async(N,E,O)=>{try{const{data:{user:P}}=await B.auth.getUser();if(!P)return;e&&await j();const{error:C}=await B.from("turnos_empleados").insert({user_id:P.id,empleado_codigo:E,empleado_nombre:O,turno:N,estado:"activo"});C?(console.error("Error starting shift:",C),d({title:"Error",description:"No se pudo iniciar el turno",variant:"destructive"})):(d({title:"Turno iniciado",description:`Turno ${N} iniciado correctamente`}),await m())}catch(P){console.error("Error in startShift:",P)}},j=async()=>
530{if(e)try{const{data:N,error:E}=await B.rpc("close_active_shift",{shift_id:e.id});E?(console.error("Error closing shift:",E),d({title:"Error",description:"No se pudo cerrar el turno",variant:"destructive"})):N&&(d({title:"Turno cerrado",description:"Turno cerrado correctamente"}),t(null),n([]))}catch(N){console.error("Error in closeShift:",N)}},w=async N=>{try{const{data:{user:E}}=await B.auth.getUser();if(!E)throw new Error("User not authenticated");const{data:O,error:P}=await B.from("tareas_produccion_ejecuciones").insert({tarea_produccion_id:N,usuario_id:E.id,turno_actual:(e==null?void 0:e.turno)||"A",fecha_turno:new Date().toISOString().split("T")[0],estado:"en_progreso",hora_inicio:new Date().toISOString(),respuestas:{}}).select().single();if(P)throw console.error("Error starting task execution:",P),d({title:"Error",description:"No se pudo iniciar la tarea",variant:"destructive"}),P;return d({title:"Tarea iniciada",description:"Tarea iniciada correctamente"}),c==="Administrador"||c==="Supervisor"?await y():e&&await p(e.turno),O.id}catch(E){throw console.error("Error in startTaskExecution:",E),E}},S=async(N,E)=>{try{const{error:O}=await B.from("tareas_produccion_ejecuciones").update({respuestas:E,updated_at:new Date().toISOString()}).eq("id",N);if(O)throw console.error("Error saving task progress:",O),d({title:"Error",description:"No se pudo guardar el progreso",variant:"destructive"}),O}catch(O){throw console.error("Error in saveTaskProgress:",O),O}},_=async(N,E)=>{try{const{error:O}=await B.from("tareas_produccion_ejecuciones").update({estado:"completada",hora_fin:new Date().toISOString(),respuestas:E}).eq("id",N);if(O)throw console.error("Error completing task execution:",O),d({title:"Error",description:"No se pudo completar la tarea",variant:"destructive"}),O;d({title:"Tarea completada",description:"Tarea completada y enviada para validación"}),c==="Administrador"||c==="Supervisor"?await y():e&&await p(e.turno)}catch(O){throw console.error("Error in completeTaskExecution:",O),O}};return h.useEffect(()=>{m()},[]),{activeShift:e,userTasks:r,allTasks:a,isLoading:s,userRole:c,availableShifts:f,createTask:v,updateTask:g,deleteTask:x,startShift:b,closeShift:j,startTaskExecution:w,saveTaskProgress:S,completeTaskExecution:_,refreshData:m,refreshAllTasks:y}},cee=({tasks:e,onCreateTask:t,onUpdateTask:r,onDeleteTask:n,isLoading:a})=>{const{formularios:i}=k2(),[s,l]=h.useState(!1),[c,u]=h.useState(null),[d,f]=h.useState({nombre:"",descripcion:"",turnos:[],formulario_id:"",prioridad:"media"}),m=["A","B","C","todos"],p=[{value:"alta",label:"Alta",color:"bg-red-100 text-red-800"},{value:"media",label:"Media",color:"bg-yellow-100 text-yellow-800"},{value:"baja",label:"Baja",color:"bg-green-100 text-green-800"}],y=()=>{f({nombre:"",descripcion:"",turnos:[],formulario_id:"",prioridad:"media"}),u(null),l(!1)},v=j=>{j.preventDefault(),!(!d.nombre.trim()||d.turnos.length===0)&&(c?r(c.tarea_id,d):t(d),y())},g=j=>{f({nombre:j.tarea_nombre,descripcion:j.tarea_descripcion||"",turnos:j.turnos,formulario_id:"",prioridad:j.prioridad}),u(j),l(!0)},x=(j,w)=>{f(w?S=>({...S,turnos:[...S.turnos,j]}):S=>({...S,turnos:S.turnos.filter(_=>_!==j)}))},b=j=>{const w=p.find(S=>S.value===j)||p[1];return o.jsx(ke,{className:w.color,children:w.label})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-2xl font-bold",children:"Gestión de Tareas de Producción"}),o.jsx("p",{className:"text-muted-foreground",children:"Crear, editar y gestionar tareas de producción por turno"})]}),o.jsxs(z,{onClick:()=>l(!0),disabled:a,children:[o.jsx(wa,{className:"h-4 w-4 mr-2"}),"Nueva Tarea"]})]}),s&&o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsx(Ie,{children:c?"Editar Tarea":"Nueva Tarea de Producción"}),o.jsx(zt,{children:c?"Modifica los datos de la tarea":"Completa la información para crear una nueva tarea"})]}),o.jsx(fe,{children:o.jsxs("form",{onSubmit:v,className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"nombre",children:"Nombre de la Tarea *"}),o.jsx(we,{id:"nombre",value:d.nombre,onChange:j=>
530f(w=>({...w,nombre:j.target.value})),placeholder:"Ej: Limpieza de equipos",required:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"prioridad",children:"Prioridad"}),o.jsxs(jt,{value:d.prioridad,onValueChange:j=>f(w=>({...w,prioridad:j})),children:[o.jsx(xt,{children:o.jsx(St,{})}),o.jsx(bt,{children:p.map(j=>o.jsx($e,{value:j.value,children:j.label},j.value))})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"descripcion",children:"Descripción"}),o.jsx(Kt,{id:"descripcion",value:d.descripcion,onChange:j=>f(w=>({...w,descripcion:j.target.value})),placeholder:"Describe los detalles de la tarea...",rows:3})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Turnos Asignados *"}),o.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:m.map(j=>o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ja,{id:`shift-${j}`,checked:d.turnos.includes(j),onCheckedChange:w=>x(j,w)}),o.jsx(ne,{htmlFor:`shift-${j}`,className:"text-sm",children:j==="todos"?"Todos los turnos":`Turno ${j}`})]},j))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"formulario",children:"Formulario a Llenar"}),o.jsxs(jt,{value:d.formulario_id,onValueChange:j=>
530f(w=>({...w,formulario_id:j})),children:[o.jsx(xt,{children:o.jsx(St,{placeholder:"Selecciona un formulario"})}),o.jsxs(bt,{children:[o.jsx($e,{value:"none",children:"Sin formulario"}),i.map(j=>o.jsx($e,{value:j.id,children:j.nombre},j.id))]})]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(z,{type:"submit",disabled:a,children:[c?"Actualizar":"Crear"," Tarea"]}),o.jsx(z,{type:"button",variant:"outline",onClick:y,children:"Cancelar"})]})]})})]}),o.jsx("div",{className:"grid gap-4",children:e.length===0?o.jsx(de,{children:o.jsx(fe,{className:"text-center py-8",children:o.jsx("p",{className:"text-muted-foreground",children:"No hay tareas de producción creadas"})})}):e.map(j=>{var w;return o.jsxs(de,{children:[o.jsx(Le,{children:o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(Ie,{className:"text-lg",children:j.tarea_nombre}),j.tarea_descripcion&&o.jsx(zt,{children:j.tarea_descripcion})]}),o.jsx("div",{className:"flex gap-1",children:b(j.prioridad)})]})}),o.jsx(fe,{children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"Turnos:"}),j.turnos.map(S=>o.jsx(ke,{variant:"outline",children:S==="todos"?"Todos":`Turno ${S}`},S))]}),j.formulario_id&&o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"Formulario:"}),o.jsx(ke,{variant:"secondary",children:((w=i.find(S=>S.id===j.formulario_id))==null?void 0:w.nombre)||"Formulario no encontrado"})]}),j.total_ejecuciones!==void 0&&o.jsxs("div",{className:"grid grid-cols-4 gap-4 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Total: "}),o.jsx("span",{className:"font-medium",children:j.total_ejecuciones})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Pendientes: "}),o.jsx("span",{className:"font-medium text-gray-600",children:j.pendientes})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"En Progreso: "}),o.jsx("span",{className:"font-medium text-blue-600",children:j.en_progreso})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Completadas: "}),o.jsx("span",{className:"font-medium text-green-600",children:j.completadas})]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(z,{size:"sm",variant:"outline",onClick:()=>g(j),children:[o.jsx(Ys,{className:"h-3 w-3 mr-1"}),"Editar"]}),o.jsxs(z,{size:"sm",variant:"outline",onClick:()=>n(j.tarea_id),children:[o.jsx(Gi,{className:"h-3 w-3 mr-1"}),"Eliminar"]})]})]})})]},j.tarea_id)})})]})},uee=()=>{const{allTasks:e,isLoading:t,createTask:r,updateTask:n,deleteTask:a}=Yw();return h.useEffect(()=>{document.title="Gestión de Tareas - Tareas de Producción"},[]),t?o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(de,{className:"p-8",children:o.jsxs(fe,{className:"flex flex-col items-center gap-4",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-muted-foreground",children:"Cargando gestión de tareas..."})]})})}):o.jsxs("div",{className:"container mx-auto p-6",children:[o.jsxs("div",{className:"mb-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[o.jsx(No,{className:"h-6 w-6 text-primary"}),o.jsx("h1",{className:"text-3xl font-bold",children:"Gestión de Tareas"})]}),o.jsx("p",{className:"text-muted-foreground",children:"Crear, editar y gestionar tareas de producción por turno"})]}),o.jsx(cee,{tasks:e,onCreateTask:r,onUpdateTask:n,onDeleteTask:a,isLoading:t})]})},dee=({availableShifts:e,onStartShift:t,isLoading:r})=>{const[n,a]=h.useState(""),[i,s]=h.useState(""),[l,c]=h.useState(""),u=()=>{n&&i&&l&&t(n,i,l)},d=e.find(f=>f.codigo===n);return o.jsxs(de,{className:"w-full max-w-2xl mx-auto",children:[o.jsxs(Le,{children:[o.jsxs(Ie,{className:"flex items-center gap-2",children:[o.jsx(mn,{className:"h-5 w-5"}),"Iniciar Turno de Trabajo"]}),o.jsx(zt,{children:"Selecciona tu turno e ingresa tus datos para comenzar a trabajar"})]}),o.jsxs(fe,{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"shift-select",children:"Turno"}),o.jsxs(jt,{value:n,onValueChange:a,children:[o.jsx(xt,{children:o.jsx(St,{placeholder:"Selecciona tu turno"})}),o.jsx(bt,{children:e.map(f=>o.jsx($e,{value:f.codigo,children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ke,{variant:"outline",children:f.codigo}),o.jsx("span",{children:f.nombre}),o.jsxs("span",{className:"text-muted-foreground",children:["(",f.hora_inicio," - ",f.hora_fin,")"]})]})},f.codigo))})]}),d&&o.jsx("div",{className:"p-3 bg-muted rounded-lg",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.jsx("strong",{children:"Horario:"})," ",d.hora_inicio," - ",d.hora_fin]})})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"employee-code",children:"Código de Empleado"}),o.jsxs("div",{className:"relative",children:[o.jsx(p3,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(we,{id:"employee-code",placeholder:"Ej: EMP001",value:i,onChange:f=>s(f.target.value),className:"pl-8"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"employee-name",children:"Nombre Completo"}),o.jsxs("div",{className:"relative",children:[o.jsx(v0,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(we,{id:"employee-name",placeholder:"Tu nombre completo",value:l,onCh
530ange:f=>c(f.target.value),className:"pl-8"})]})]})]}),o.jsx(z,{onClick:u,disabled:!n||!i||!l||r,className:"w-full",size:"lg",children:r?"Iniciando...":"Iniciar Turno"})]})]})},fee=({tasks:e,onStartTask:t,onCompleteTask:r})=>{const n=[{id:"pendiente",title:"Pendientes",color:"border-gray-200",bgColor:"bg-gray-50",tasks:e.filter(c=>c.estado==="pendiente")},{id:"en_progreso",title:"En Progreso",color:"border-blue-200",bgColor:"bg-blue-50",tasks:e.filter(c=>c.estado==="en_progreso")},{id:"completada",title:"Completadas",color:"border-green-200",bgColor:"bg-green-50",tasks:e.filter(c=>c.estado==="completada")},{id:"en_validacion",title:"En Validación",color:"border-yellow-200",bgColor:"bg-yellow-50",tasks:e.filter(c=>c.estado==="en_validacion")}],a=c=>{switch(c){case"pendiente":return o.jsx(mn,{className:"h-4 w-4 text-gray-500"});case"en_progreso":return o.jsx(C1,{className:"h-4 w-4 text-blue-500"});case"completada":return o.jsx(To,{className:"h-4 w-4 text-green-500"});case"en_validacion":return o.jsx(Kr,{className:"h-4 w-4 text-yellow-500"});default:return o.jsx(Fi,{className:"h-4 w-4 text-gray-500"})}},i=c=>{const u={pendiente:{variant:"secondary",text:"Pendiente"},en_progreso:{variant:"default",text:"En Progreso"},completada:{variant:"default",text:"Completada"},en_validacion:{variant:"outline",text:"En Validación"},validada:{variant:"default",text:"Validada"},rechazada:{variant:"destructive",text:"Rechazada"}},d=u[c]||u.pendiente;return o.jsx(ke,{variant:d.variant,className:"text-xs",children:d.text})},s=c=>{c.estado==="pendiente"?t(c.tarea_id):c.estado==="en_progreso"&&c.ejecucion_id&&r(c.ejecucion_id,{})},l=c=>c.estado==="pendiente"?o.jsxs(z,{size:"sm",onClick:()=>s(c),children:[o.jsx(C1,{className:"h-3 w-3 mr-1"}),"Iniciar"]}):c.estado==="en_progreso"?o.jsxs(z,{size:"sm",variant:"outline",onClick:()=>s(c),children:[o.jsx(To,{className:"h-3 w-3 mr-1"}),"Completar"]}):null;return o.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-4",children:n.map(c=>o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:`p-3 rounded-lg ${c.bgColor} border ${c.color}`,children:o.jsxs("h3",{className:"font-semibold text-sm text-center",children:[c.title," (",c.tasks.length,")"]})}),o.jsxs("div",{className:"space-y-3 min-h-[400px]",children:[c.tasks.map(u=>o.jsxs(de,{className:"cursor-pointer hover:shadow-md transition-shadow",children:[o.jsxs(Le,{className:"pb-2",children:[o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsx(Ie,{className:"text-sm font-medium line-clamp-2",children:u.tarea_nombre}),a(u.estado)]}),u.tarea_descripcion&&o.jsx(zt,{className:"text-xs line-clamp-2",children:u.tarea_descripcion})]}),o.jsxs(fe,{className:"pt-0 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[i(u.estado),u.areas_asignadas&&u.areas_asignadas.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Ãreas: ",u.areas_asignadas.slice(0,2).join(", ")]})]}),u.areas_asignadas&&u.areas_asignadas.length>0&&o.jsxs("div",{className:"flex flex-wrap gap-1",children:[u.areas_asignadas.slice(0,2).map(d=>o.jsx(ke,{variant:"outline",className:"text-xs",children:d},d)),u.areas_asignadas.length>2&&o.jsxs(ke,{variant:"outline",className:"text-xs",children:["+",u.areas_asignadas.length-2]})]}),u.ot_number&&o.jsxs("div",{className:"text-xs text-muted-foreground",children:["OT: ",u.ot_number]}),u.hora_inicio&&o.jsxs("div",{className:"text-xs text-muted-foreground",children:["Iniciado: ",new Date(u.hora_inicio).toLocaleTimeString()]}),l(u)]})]},u.tarea_id)),c.tasks.length===0&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-8",children:"No hay tareas en esta columna"})]})]},c.id))})},mee=({activeShift:e,shiftTasks:t,onCloseShift:r,onStartTask:n,onCompleteTask:a,isLoading:i})=>{h.useState("kanban");const s=u=>{switch(u){case"A":return"bg-blue-100 text-blue-800 border-blue-200";case"B":return"bg-orange-100 text-orange-800 border-orange-200";case"C":return"bg-purple-100 text-purple-800 border-purple-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},l=u=>{const d=u.match(/(\d+):(\d+):(\d+)/);if(d){const[,f,m]=d;return`${f}h ${m}m`}return u},c={pendiente:t.filter(u=>u.estado==="pendiente"),en_progreso:t.filter(u=>u.estado==="en_progreso"),completada:t.filter(u=>u.estado==="completada"),en_validacion:t.filter(u=>u.estado==="en_validacion"),validada:t.filter(u=>u.estado==="validada"),rechazada:t.filter(u=>u.estado==="rechazada")};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs(de,{children:[o.jsx(Le,{children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(mn,{className:"h-6 w-6 text-primary"}),o.jsxs("div",{children:[o.jsxs(Ie,{className:"flex items-center gap-2",children:["Turno Activo",o.jsxs(ke,{className:s(e.turno),children:["Turno ",e.turno]})]}),o.jsxs(zt,{children:[e.empleado_nombre," (",e.empleado_codigo,")"]})]})]}),o.jsxs(z,{variant:"outline",onClick:r,disabled:i,children:[o.jsx(mA,{className:"h-4 w-4 mr-2"}
530),"Cerrar Turno"]})]})}),o.jsx(fe,{children:o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(mn,{className:"h-4 w-4 text-muted-foreground"}),o.jsxs("span",{className:"text-sm",children:["Tiempo trabajado: ",o.jsx("strong",{children:l(e.tiempo_transcurrido)})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Rl,{className:"h-4 w-4 text-muted-foreground"}),o.jsxs("span",{className:"text-sm",children:["Tareas asignadas: ",o.jsx("strong",{children:t.length})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(To,{className:"h-4 w-4 text-green-600"}),o.jsxs("span",{className:"text-sm",children:["Completadas: ",o.jsx("strong",{children:c.completada.length+c.validada.length})]})]})]})})]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 bg-gray-500 rounded-full"}),o.jsx("span",{className:"text-sm font-medium",children:"Pendientes"})]}),o.jsx("p",{className:"text-2xl font-bold mt-1",children:c.pendiente.length})]})}),o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),o.jsx("span",{className:"text-sm font-medium",children:"En Progreso"})]}),o.jsx("p",{className:"text-2xl font-bold mt-1",children:c.en_progreso.length})]})}),o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 bg-yellow-500 rounded-full"}),o.jsx("span",{className:"text-sm font-medium",children:"En Validación"})]}),o.jsx("p",{className:"text-2xl font-bold mt-1",children:c.en_validacion.length})]})}),o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),o.jsx("span",{className:"text-sm font-medium",children:"Completadas"})]}),o.jsx("p",{className:"text-2xl font-bold mt-1",children:c.validada.length})]})})]}),o.jsx(fee,{tasks:t,onStartTask:n,onCompleteTask:a})]})},hee=()=>{const{activeShift:e,userTasks:t,isLoading:r,availableShifts:n,startShift:a,closeShift:i,startTaskExecution:s,completeTaskExecution:l}=Yw();return h.useEffect(()=>{document.title="Mi Turno - Tareas de Producción"},[]),r?o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(de,{className:"p-8",children:o.jsxs(fe,{className:"flex flex-col items-center gap-4",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-muted-foreground",children:"Cargando información del turno..."})]})})}):o.jsxs("div",{className:"container mx-auto p-6",children:[o.jsxs("div",{className:"mb-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[o.jsx(mn,{className:"h-6 w-6 text-primary"}),o.jsx("h1",{className:"text-3xl font-bold",children:"Mi Turno"})]}),o.jsx("p",{className:"text-muted-foreground",children:e?`Gestionando tareas del Turno ${e.turno}`:"Selecciona tu turno para comenzar a trabajar"})]}),e?o.jsx(mee,{activeShift:e,shiftTasks:t,onCloseShift:i,onStartTask:s,onCompleteTask:l,isLoading:r}):o.jsx("div",{className:"flex justify-center",children:o.jsx(dee,{availableShifts:n,onStartShift:a,isLoading:r})})]})},pee=({allTasks:e,onRefreshTasks:t,isLoading:r})=>{const[n,a]=h.useState("all"),[i,s]=h.useState("all"),l=e.filter(d=>{const f=n==="all"||d.turnos.includes(n)||d.turnos.includes("todos"),m=i==="all"||d.prioridad===i;return f&&m}),c={totalTasks:e.length,totalExecutions:e.reduce((d,f)=>d+(f.total_ejecuciones||0),0),totalPending:e.reduce((d,f)=>d+(f.pendientes||0),0),totalInProgress:e.reduce((d,f)=>d+(f.en_progreso||0),0),totalCompleted:e.reduce((d,f)=>d+(f.completadas||0),0)},u=d=>{switch(d){case"alta":return"bg-red-100 text-red-800 border-red-200";case"media":return"bg-yellow-100 text-yellow-800 border-yellow-200";case"baja":return"bg-green-100 text-green-800 border-green-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-2xl font-bold",children:"Panel Administrativo"}),o.jsx("p",{className:"text-muted-foreground",children:"Vista general de todas las tareas de producción en todos los turnos"})]}),o.jsx(z,{onClick:t,disabled:r,children:"Actualizar"})]}
530),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(au,{className:"h-4 w-4 text-primary"}),o.jsx("span",{className:"text-sm font-medium",children:"Total Tareas"})]}),o.jsx("p",{className:"text-2xl font-bold mt-1",children:c.totalTasks})]})}),o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(mn,{className:"h-4 w-4 text-gray-500"}),o.jsx("span",{className:"text-sm font-medium",children:"Pendientes"})]}),o.jsx("p",{className:"text-2xl font-bold mt-1 text-gray-600",children:c.totalPending})]})}),o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Rl,{className:"h-4 w-4 text-blue-500"}),o.jsx("span",{className:"text-sm font-medium",children:"En Progreso"})]}),o.jsx("p",{className:"text-2xl font-bold mt-1 text-blue-600",children:c.totalInProgress})]})}),o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(mn,{className:"h-4 w-4 text-green-500"}),o.jsx("span",{className:"text-sm font-medium",children:"Completadas"})]}),o.jsx("p",{className:"text-2xl font-bold mt-1 text-green-600",children:c.totalCompleted})]})}),o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(au,{className:"h-4 w-4 text-purple-500"}),o.jsx("span",{className:"text-sm font-medium",children:"Total Ejecuciones"})]}),o.jsx("p",{className:"text-2xl font-bold mt-1 text-purple-600",children:c.totalExecutions})]})})]}),o.jsxs(de,{children:[o.jsx(Le,{children:o.jsxs(Ie,{className:"flex items-center gap-2",children:[o.jsx(Xf,{className:"h-5 w-5"}),"Filtros"]})}),o.jsx(fe,{children:o.jsxs("div",{className:"flex gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Turno"}),o.jsxs(jt,{value:n,onValueChange:a,children:[o.jsx(xt,{className:"w-40",children:o.jsx(St,{})}),o.jsxs(bt,{children:[o.jsx($e,{value:"all",children:"Todos los turnos"}),o.jsx($e,{value:"A",children:"Turno A"}),o.jsx($e,{value:"B",children:"Turno B"}),o.jsx($e,{value:"C",children:"Turno C"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Prioridad"}),o.jsxs(jt,{value:i,onValueChange:s,children:[o.jsx(xt,{className:"w-40",children:o.jsx(St,{})}),o.jsxs(bt,{children:[o.jsx($e,{value:"all",children:"Todas"}),o.jsx($e,{value:"alta",children:"Alta"}),o.jsx($e,{value:"media",children:"Media"}),o.jsx($e,{value:"baja",children:"Baja"})]})]})]})]})})]}),o.jsx("div",{className:"grid gap-4",children:l.length===0?o.jsx(de,{children:o.jsx(fe,{className:"text-center py-8",children:o.jsx("p",{className:"text-muted-foreground",children:"No hay tareas que coincidan con los filtros seleccionados"})})}):l.map(d=>o.jsxs(de,{children:[o.jsx(Le,{children:o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(Ie,{className:"text-lg",children:d.tarea_nombre}),d.tarea_descripcion&&o.jsx(zt,{children:d.tarea_descripcion})]}),o.jsx(ke,{className:u(d.prioridad),children:d.prioridad.charAt(0).toUpperCase()+d.prioridad.slice(1)})]})}),o.jsx(fe,{children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-wrap gap-1",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Turnos:"}),d.turnos.map(f=>o.jsx(ke,{variant:"outline",className:"text-xs",children:f==="todos"?"Todos":`Turno ${f}`},f))]}),d.areas_asignadas.length>0&&o.jsxs("div",{className:"flex flex-wrap gap-1",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Ãreas:"}),d.areas_asignadas.map(f=>o.jsx(ke,{variant:"secondary",className:"text-xs",children:f},f))]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"Estado de Ejecuciones:"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{children:"Pendientes:"}),o.jsx("span",{className:"font-medium text-gray-600",children:d.pendientes||0})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{children:"En Progreso:"}),o.jsx("span",{className:"font-medium text-blue-600",children:d.en_progreso||0})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{children:"Completadas:"}),o.jsx("span",{className:"font-medium text-green-600",children:d.completadas||0})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{children:"Total:"}),o.jsx("span",{className:"font-medium",children:d.total_ejecuciones||0})]})]})]})]}),(d.total_ejecuciones||0)>0&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"Progreso de Completación"}
530),o.jsxs("span",{children:[Math.round((d.completadas||0)/(d.total_ejecuciones||1)*100),"%"]})]}),o.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:o.jsx("div",{className:"bg-green-600 h-2 rounded-full transition-all",style:{width:`${(d.completadas||0)/(d.total_ejecuciones||1)*100}%`}})})]}),d.created_at&&o.jsxs("div",{className:"text-xs text-muted-foreground",children:["Creada: ",new Date(d.created_at).toLocaleDateString("es-ES",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})})]},d.tarea_id))})]})},vee=()=>{const{allTasks:e,isLoading:t,refreshAllTasks:r}=Yw();return h.useEffect(()=>{document.title="Vista Administrativa - Tareas de Producción"},[]),t?o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(de,{className:"p-8",children:o.jsxs(fe,{className:"flex flex-col items-center gap-4",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-muted-foreground",children:"Cargando vista administrativa..."})]})})}):o.jsxs("div",{className:"container mx-auto p-6",children:[o.jsxs("div",{className:"mb-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[o.jsx(au,{className:"h-6 w-6 text-primary"}),o.jsx("h1",{className:"text-3xl font-bold",children:"Vista Administrativa"})]}),o.jsx("p",{className:"text-muted-foreground",children:"Monitoreo y control de todas las tareas de producción"})]}),o.jsx(pee,{allTasks:e,onRefreshTasks:r,isLoading:t})]})};function gee(){const{data:e=[],isLoading:t}=lt({queryKey:["gestor-ciclos-semanas"],queryFn:async()=>{const{data:a,error:i}=await B.from("gestor_ciclos_semanas").select("*").eq("activo",!0).order("año",{ascending:!1}).order("numero_semana",{ascending:!0});if(i)throw i;return a}}),{data:r=[],isLoading:n}=lt({queryKey:["maquinas"],queryFn:async()=>{const{data:a,error:i}=await B.from("maquinas").select("*").eq("activo",!0).order("nombre");if(i)throw i;return a}});return{semanas:e,maquinas:r,isLoading:t||n}}function yee(e){const t=pn(),{data:r=[],isLoading:n,error:a}=lt({queryKey:["programacion-maquinas",e],queryFn:async()=>{if(!e)return[];const{data:c,error:u}=await B.from("programacion_maquinas").select("*").eq("fecha",e).order("hora_inicio",{ascending:!0});if(u)throw u;return c},enabled:!!e}),i=Ir({mutationFn:async c=>{const{data:{user:u}}=await B.auth.getUser();if(!u)throw new Error("Usuario no autenticado");const{data:d,error:f}=await B.from("programacion_maquinas").insert({...c,usuario_id:u.id,usuario_nombre:u.email}).select().single();if(f)throw f;return d},onSuccess:()=>{t.invalidateQueries({queryKey:["programacion-maquinas"]}),Z.success("Programación creada exitosamente")},onError:c=>{const u=c.message||"Error al crear programación";Z.error(u)}}),s=Ir({mutationFn:async({id:c,...u})=>{const{data:d,error:f}=await B.from("programacion_maquinas").update(u).eq("id",c).select().single();if(f)throw f;return d},onSuccess:()=>{t.invalidateQueries({queryKey:["programacion-maquinas"]}),Z.success("Programación actualizada")},onError:c=>{const u=c.message||"Error al actualizar programación";Z.error(u)}}),l=Ir({mutationFn:async c=>{const{error:u}=await B.from("programacion_maquinas").delete().eq("id",c);if(u)throw u},onSuccess:()=>{t.invalidateQueries({queryKey:["programacion-maquinas"]}),Z.success("Programación eliminada")},onError:c=>{Z.error("Error al eliminar programación")}});return{programaciones:r,isLoading:n,error:a,crearProgramacion:i,actualizarProgramacion:s,eliminarProgramacion:l}}function xee({maquinas:e,programaciones:t,onCrearProgramacion:r,onEditarProgramacion:n,onEliminarProgramacion:a}){const i=c=>t.filter(u=>u.maquina_id===c),s=c=>({programado:"bg-blue-500",en_proceso:"bg-yellow-500",completado:"bg-green-500",cancelado:"bg-gray-500"})[c]||"bg-gray-500",l=(c,u)=>{const d=new Date(u).getTime()-new Date(c).getTime(),f=Math.floor(d/(1e3*60*60)),m=Math.floor(d%(1e3*60*60)/(1e3*60));return`${f}h ${m}m`};return o.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:e.map(c=>{const u=i(c.id);return o.jsxs(de,{className:"flex-shrink-0 w-80",children:[o.jsxs(Le,{className:"pb-3 space-y-2",children:[o.jsx(Ie,{className:"text-base",children:c.nombre}),o.jsxs(z,{size:"sm",className:"w-full",onClick:()=>r(c.id,c.nombre),children:[o.jsx(wa,{className:"h-4 w-4 mr-1"}),"Nueva OT"]})]}),o.jsx(fe,{className:"min-h-[400px]",children:u.length===0?o.jsx("div",{className:"text-center py-8 text-sm text-muted-foreground",children:"Sin OTs programadas"}):o.jsx("div",{className:"space-y-2",children:u.map(d=>o.jsxs("div",{className:"p-3 border rounded-lg hover:bg-accent/50 transition-colors group",children:[o.jsx("div",{className:`w-1 h-full rounded absolute left-0 ${s(d.estado)}`}),o.jsxs("div",{className:"pl-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs("span",{className:"font-semibold text-sm",children:["OT: ",d.ot_number]}),o.jsx(ke,{variant:"outline",className:"text-xs",children:d.estado})]}),o.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:[o.jsx(mn,{className:"h-3 w-3"}),Dr(new Date(d.hora_inicio),"HH:mm",{locale:Ua})," -"," ",Dr(new Date(d.hora_final),"HH:mm",{locale:Ua})]}),o.jsx("div",{className:"text-xs text-muted-foreground",children:l(d.hora_inicio,d.hora_final)}),d.notas&&o.jsx("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:d.notas}),o.jsxs("div",{className:"flex gap-1 mt-2 opacity-0 group-hover:opacity-100 transition-opacity",children:[o.jsx(z,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>n(d),children:o.jsx(Ys,{className:"h-3 w-3"})}),o.jsx(z,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>a(d.id),children:o.jsx(Gi,{className:"h-3 w-3"})})]})]})]},d.id))})})]},c.id)})})}const Dg=[{nombre:"Turno A",inicio:6,fin:14,minutos:480},{nombre:"Turno B",inicio:14,fin:22,minutos:480},{nombre:"Turno C",inicio:22,fin:6,minutos:480}];function bee({open:e,onOpenChange:t,maquinaId:r,maquinaNombre:n,fecha:a,cicloId:i,programacion:s,onSave:l,otsDisponibles:c,programacionesExistentes:u}){const[d,f]=h.useState(""),[m,p]=h.useState(""),[y,v]=h.useState(""),[g,x]=h.useState(""),b=O=>{if(!O)return null;const[P]=O.split(":").map(Number);return P>=6&&P<14?Dg[0]:P>=14&&P<22?Dg[1]:P>=22||P<6?Dg[2]:null},j=O=>O?u.filter(P=>{if(s&&P.id===s.id)return!1;const C=new Date(P.hora_inicio).getHours();return O.nombre==="Turno A"&&C>=6&&C<14||O.nombre==="Turno B"&&C>=14&&C<22||O.nombre==="Turno C"&&(C>=22||C<6)}).reduce((P,C)=>{const A=new Date(C.hora_inicio),k=(new Date(C.hora_final).getTime()-A.getTime())/(1e3*60);return P+k},0):0,w=h.useMemo(()=>b(m),[m]),S=h.useMemo(()=>j(w),[w,u,s]),_=w?w.minutos-S:0,N=h.useMemo(()=>
530{if(!m||!y)return 0;const O=new Date(`${a}T${m}:00`);return(new Date(`${a}T${y}:00`).getTime()-O.getTime())/(1e3*60)},[m,y,a]);h.useEffect(()=>{s?(f(s.ot_number),p(Dr(new Date(s.hora_inicio),"HH:mm")),v(Dr(new Date(s.hora_final),"HH:mm")),x(s.notas||"")):(f(""),p(""),v(""),x(""))},[s]);const E=O=>{if(O.preventDefault(),!d||!m||!y)return;const P=new Date(`${a}T${m}:00`),C=new Date(`${a}T${y}:00`);if(C<=P){alert("La hora final debe ser mayor que la hora inicial");return}if(N>_){alert(`Esta programación excede el tiempo disponible en ${w==null?void 0:w.nombre}. Disponible: ${_} minutos`);return}l({fecha:a,ciclo_id:i,maquina_id:r,ot_number:d,hora_inicio:P.toISOString(),hora_final:C.toISOString(),notas:g||void 0}),t(!1)};return o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsxs(It,{className:"sm:max-w-[500px]",children:[o.jsx(Ut,{children:o.jsxs(Wt,{children:[s?"Editar":"Crear"," Programación - ",n]})}),o.jsxs("form",{onSubmit:E,className:"space-y-4",children:[w&&o.jsxs(pa,{children:[o.jsx(mn,{className:"h-4 w-4"}),o.jsxs(va,{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ke,{variant:"outline",children:w.nombre}),o.jsxs("span",{className:"text-sm",children:[w.inicio,":00 - ",w.fin===6?"06:00":`${w.fin}:00`]})]}),o.jsxs("div",{className:"text-sm font-medium",children:["Disponible: ",o.jsxs("span",{className:_<60?"text-destructive":"",children:[_," min"]}),N>0&&o.jsxs("span",{className:"ml-2",children:["(Usando: ",N," min)"]})]})]})]}),N>_&&_>=0&&o.jsxs(pa,{variant:"destructive",children:[o.jsx(d0,{className:"h-4 w-4"}),o.jsx(va,{children:"Esta programación excede el tiempo disponible en el turno"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"ot",children:"Número de OT"}),c.length>0?o.jsxs(jt,{value:d,onValueChange:f,children:[o.jsx(xt,{children:o.jsx(St,{placeholder:"Seleccionar OT"})}),o.jsx(bt,{children:c.map(O=>o.jsx($e,{value:O.value,children:O.label},O.value))})]}):o.jsx(we,{id:"ot",value:d,onChange:O=>f(O.target.value),placeholder:"Ingrese número de OT",required:!0})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"hora-inicio",children:"Hora Inicio"}),o.jsx(we,{id:"hora-inicio",type:"time",value:m,onChange:O=>p(O.target.value),required:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"hora-final",children:"Hora Final"}),o.jsx(we,{id:"hora-final",type:"time",value:y,onChange:O=>v(O.target.value),required:!0})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"notas",children:"Notas (opcional)"}),o.jsx(Kt,{id:"notas",value:g,onChange:O=>x(O.target.value),placeholder:"Observaciones adicionales",rows:3})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(z,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancelar"}),o.jsx(z,{type:"submit",children:s?"Actualizar":"Crear"})]})]})]})})}const W_=e=>{const t=(e||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").trim().toUpperCase();return t&&t!=="SIN ASIGNAR"?t:null};function wee(){const{user:e,userProfile:t}=Hi(),{formsByArea:r}=Nk(),[n,a]=h.useState({totalOrders:0,pendingOrders:0,completedOrders:0,incompleteOrders:0}),{allOtData:i,isLoading:s,error:l,refetch:c,invalidateCache:u}=Xo(),d="https://hakrnctolecgwjmvkcvm.supabase.co",f=h.useMemo(()=>({url:d,status:!0,recordCount:Object.keys(i).length,error:null}),[i]),m=h.useCallback((S,_={})=>{const N=(O,P,C,A)=>A===0?"Pendiente":A>=C?"Completado":"Incompleto";return S.map(O=>{const P=O.otData,C=O.otNumber,A=Number(P.cant_programada)||0,T=Number(P.cant_producida)||0,k=Number(P.cant_programada)||0,D=P.area||"",M=Number(P.muestras_programadas);let F;if(Number.isFinite(M)&&M>0)F=M;else if(D.toUpperCase().startsWith("BATIDOS"))F=1;else{const V=k*2e-4;F=V<=1?2:Math.ceil(V)}const q=_[C]||0,I=P.fecha||"N/A",K=r[D]||0;D==="BAÃADO L2"&&console.log("DEBUG - BAÃADO L2 (optimized):",{areaName:D,formsAssigned:K,formsByArea:r});const W=F*K,R=N(A,T,W,q);return{id:O.procesoOtId||`ot-${C}`,otNumber:C,premix:P.premezcla||"-",productoResultante:P.producto_resultante||P.premezcla||"-",area:D,processLeader:P.jefe_turno||"-",status:R,date:I,formsCompleted:q,formsRequired:W,formsAssigned:K,shift:"No especificado",unitsScheduled:A,unitsCompleted:T,supervisor:P.supervisor||"No asignado",samplesScheduled:F,samplesCompleted:q,samples:[],realSamples:O.muestras||[]}})},[t==null?void 0:t.role,t==null?void 0:t.identification,r]),p=h.useCallback(S=>{const _=[{id:"mock-id-1",OTnum_orden:1001,OTpremezcla:"Premezcla A",OTprod_resultante:"Galletas Chocolate",OTarea:"Producción",OTjefedeturno:"Juan Pérez",OTfecha:"2024-01-15",OTmuestraprogramada:5,OTcant_programada:100,OTcant_producida:50},{id:"mock-id-2",OTnum_orden:1002,OTpremezcla:"Premezcla B",OTprod_resultante:"Galletas Vainilla",OTarea:"Envasado",OTjefedeturno:"MarÃa López",OTfecha:"2024-02-10",OTmuestraprogramada:8,OTcant_programada:200,OTcant_producida:0}],N={1001:3,1002:0};return m([{otNumber:"1001",otData:{..._[0],cant_programada:100,cant_producida:50,area:"Producción",premezcla:"Premezcla A",producto_resultante:"Galletas Chocolate",jefe_turno:"Juan Pérez",fecha:"2024-01-15"},muestras:[]},{otNumber:"1002",otData:{..._[1],cant_programada:200,cant_producida:0,area:"Envasado",premezcla:"Premezcla B",producto_resultante:"Galletas Vainilla",jefe_turno:"MarÃa López",fecha:"2024-02-10"},muestras:[]}],N).sort((E,O)=>O.otNumber.localeCompare(E.otNumber))},[m]),{data:y,isLoading:v,error:g,refetch:x}=lt({queryKey:Ek(["optimized-workOrders"],e==null?void 0:e.id,{role:t==null?void 0:t.role,identification:t==null?void 0:t.identification,supervisorTurno:t==null?void 0:t.supervisor_turno,dataCount:Object.keys(i).length,formsByAreaKeys:Object.keys(r).sort().join(",")}),queryFn:async()=>{try{const S=Object.values(i);if(S.length===0){const C=(t==null?void 0:t.role)==="Operador";return p(C?"No hay OT asignadas para este operador":"No hay registros en la tabla etlotdelcerro")}let _=S;const N=(t==null?void 0:t.role)==="Operador",E=W_(t==null?void 0:t.supervisor_turno);if(_=_.filter(C=>{var A;return((A=C.otData)==null?void 0:A.area)!=="SUPERVISOR BODEGA"}),N&&E&&(_=_.filter(C=>{var A;return W_((A=C.otData)==null?void 0:A.jefe_turno)===E})),_.length===0)return p("No hay OT asignadas para este operador");const O={};return _.forEach(C=>{if(C.otNumber){const A=C.muestras_count??0;O[C.otNumber]=Number(A)||0}}),m(_,O).sort((C,A)=>A.otNumber.localeCompare(C.otNumber))}catch(S){return p("Error en transformación: "+S.message)}},enabled:!!e&&!!t&&!s,staleTime:0,gcTime:0,refetchOnWindowFocus:!0,refetchOnMount:!0,refetchOnReconnect:!0,retry:1});h.useEffect(()=>{if(y&&y.length>0){const S=_k(y);a(S)}},[y]);const b=h.useCallback(async()=>{u(),await c(),await x()},[x,c,u]),j=s||v,w=l||g;return{workOrders:y||[],isLoading:j,error:w?w.message:null,summaryStats:n,refreshData:b,connectionInfo:f,isAuthenticated:!!e}}function jee(){const[e,t]=h.useState(""),[r,n]=h.useState(void 0),[a,i]=h.useState(null),[s,l]=h.useState(null),[c,u]=h.useState(!1),d=pn(),{semanas:f,maquinas:m,isLoading:p}=gee(),{workOrders:y}=wee(),v=r?Dr(r,"yyyy-MM-dd"):null,{programaciones:g,isLoading:x,crearProgramacion:b,actualizarProgramacion:j,eliminarProgramacion:w}=yee(v),S=h.useMemo(()=>f.find(T=>T.id===e),[f,e]),_=h.useMemo(()=>{var k;const T=new Date;return(k=f.find(D=>{const M=new Date(D.fecha_inicio),F=new Date(D.fecha_fin);return T>=M&&T<=F}))==null?void 0:k.id},[f]),N=h.useMemo(()=>
530{if(!S)return[];const T=new Date(S.fecha_inicio),k=new Date(S.fecha_fin),D=[];for(let M=new Date(T);M<=k;M.setDate(M.getDate()+1))D.push(new Date(M));return D},[S]),E=h.useMemo(()=>r?y.filter(T=>T.area&&T.otNumber).map(T=>({value:T.otNumber,label:`OT ${T.otNumber} - ${T.area}`})):[],[y,r]),O=(T,k)=>{i({id:T,nombre:k}),l(null),u(!0)},P=T=>{const k=m.find(D=>D.id===T.maquina_id);k&&(i({id:k.id,nombre:k.nombre}),l(T),u(!0))},C=T=>{s?j.mutate({id:s.id,...T}):b.mutate(T)},A=T=>{confirm("¿Está seguro de eliminar esta programación?")&&w.mutate(T)};return p?o.jsx("div",{className:"flex items-center justify-center h-96",children:o.jsx(ye,{className:"h-8 w-8 animate-spin"})}):o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Control de Tiempos OT"}),o.jsx("p",{className:"text-muted-foreground",children:"Programación de órdenes de trabajo por máquina"})]}),o.jsxs(de,{children:[o.jsx(Le,{className:"py-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(Ie,{className:"text-base",children:"Seleccionar Semana"}),o.jsxs(z,{variant:"outline",size:"sm",onClick:()=>d.invalidateQueries({queryKey:["gestor-ciclos-semanas"]}),children:[o.jsx($o,{className:"h-4 w-4 mr-2"}),"Refrescar"]})]})}),o.jsx(fe,{className:"pt-0",children:o.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map(T=>o.jsx(z,{variant:e===T.id?"default":"outline",size:"sm",className:`h-10 w-10 text-base font-bold p-0 ${_===T.id&&e!==T.id?"ring-2 ring-primary ring-offset-1":""}`,onClick:()=>{t(T.id),n(void 0)},children:T.numero_semana},T.id))})})]}),e&&o.jsxs(de,{children:[o.jsx(Le,{className:"py-3",children:o.jsx(Ie,{className:"text-base",children:"Seleccionar Fecha"})}),o.jsx(fe,{className:"pt-0",children:o.jsx("div",{className:"flex flex-wrap gap-1.5",children:N.map(T=>{const k=Dr(T,"yyyy-MM-dd"),D=r&&Dr(r,"yyyy-MM-dd")===k;return o.jsxs(z,{variant:D?"default":"outline",size:"sm",className:"h-12 w-12 flex flex-col items-center justify-center p-0.5 gap-0",onClick:()=>n(T),children:[o.jsx("span",{className:"text-[9px] leading-none uppercase",children:Dr(T,"MMM",{locale:Ua})}),o.jsx("span",{className:"text-sm font-bold leading-none",children:Dr(T,"dd")}),o.jsx("span",{className:"text-[8px] leading-none",children:Dr(T,"EEE",{locale:Ua})})]},k)})})})]}),r&&o.jsxs(de,{children:[o.jsx(Le,{children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs(Ie,{children:["Programación del ",Dr(r,"PPP",{locale:Ua})]}),o.jsxs(zt,{children:["Asigna y visualiza las OTs por máquina (",m.length," máquinas)"]})]}),o.jsxs(z,{variant:"outline",size:"sm",onClick:()=>d.invalidateQueries({queryKey:["maquinas"]}),children:[o.jsx($o,{className:"h-4 w-4 mr-2"}),"Refrescar Máquinas"]})]})}),o.jsx(fe,{children:x?o.jsx("div",{className:"flex justify-center py-8",children:o.jsx(ye,{className:"h-6 w-6 animate-spin"})}):o.jsx(xee,{maquinas:m,programaciones:g,onCrearProgramacion:O,onEditarProgramacion:P,onEliminarProgramacion:A})})]}),a&&v&&o.jsx(bee,{open:c,onOpenChange:u,maquinaId:a.id,maquinaNombre:a.nombre,fecha:v,cicloId:e||void 0,programacion:s||void 0,onSave:C,otsDisponibles:E,programacionesExistentes:g.filter(T=>T.maquina_id===a.id)})]})}function See(){const[e,t]=h.useState(!1),[r,n]=h.useState(null),[a,i]=h.useState({nombre:"",descripcion:"",activo:!0}),s=pn(),{data:l=[],isLoading:c}=lt({queryKey:["maquinas-all"],queryFn:async()=>{const{data:g,error:x}=await B.from("maquinas").select("*").order("nombre");if(x)throw x;return g}}),u=Ir({mutationFn:async g=>{const{error:x}=await B.from("maquinas").insert([g]);if(x)throw x},onSuccess:()=>{s.invalidateQueries({queryKey:["maquinas-all"]}),s.invalidateQueries({queryKey:["maquinas"]}),Z.success("Máquina creada exitosamente"),p()},onError:g=>{Z.error("Error al crear máquina: "+g.message)}}),d=Ir({mutationFn:async({id:g,data:x})=>{const{error:b}=await B.from("maquinas").update(x).eq("id",g);if(b)throw b},onSuccess:()=>{s.invalidateQueries({queryKey:["maquinas-all"]}),s.invalidateQueries({queryKey:["maquinas"]}),Z.success("Máquina actualizada exitosamente"),p()},onError:g=>{Z.error("Error al actualizar máquina: "+g.message)}}),f=Ir({mutationFn:async g=>{const{error:x}=await B.from("maquinas").delete().eq("id",g);if(x)throw x},onSuccess:()=>{s.invalidateQueries({queryKey:["maquinas-all"]}),s.invalidateQueries({queryKey:["maquinas"]}),Z.success("Máquina eliminada exitosamente")},onError:g=>{Z.error("Error al eliminar máquina: "+g.message)}}),m=g=>{g?(n(g),i({nombre:g.nombre,descripcion:g.descripcion||"",activo:g.activo})):(n(null),i({nombre:"",descripcion:"",activo:!0})),t(!0)},p=()=>{t(!1),n(null),i({nombre:"",descripcion:"",activo:!0})},y=g=>{g.preventDefault(),r?d.mutate({id:r.id,data:a}):u.mutate(a)},v=g=>{confirm("¿Está seguro de eliminar esta máquina?")&&f.mutate(g)};return c?o.jsx("div",{className:"flex items-center justify-center h-96",children:o.jsx(ye,{className:"h-8 w-8 animate-spin"})}):o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Máquinas"}),o.jsx("p",{className:"text-muted-foreground",children:"Gestiona las máquinas del sistema de control de tiempos"})]}),o.jsxs(z,{onClick:()=>m(),children:[o.jsx(wa,{className:"h-4 w-4 mr-2"}),"Nueva Máquina"]})]}),o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsx(Ie,{children:"Lista de Máquinas"}),o.jsx(zt,{children:"Máquinas disponibles para programación de OTs"})]}),o.jsx(fe,{children:o.jsxs(yn,{children:[o.jsx(xn,{children:o.jsxs(Nt,{children:[o.jsx(Pe,{children:"Nombre"}),o.jsx(Pe,{children:"Descripción"}),o.jsx(Pe,{children:"Estado"}),o.jsx(Pe,{className:"text-right",children:"Acciones"})]})}),o.jsxs(bn,{children:[l.map(g=>o.jsxs(Nt,{children:[o.jsx(Oe,{className:"font-medium",children:g.nombre}),o.jsx(Oe,{children:g.descripcion||"-"}),o.jsx(Oe,{children:o.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${g.activo?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:g.activo?"Activa":"Inactiva"})}),o.jsx(Oe,{className:"text-right",children:o.jsxs("div",{className:"flex gap-2 justify-end",children:[o.jsx(z,{size:"icon",variant:"ghost",onClick:()=>m(g),children:o.jsx(Ys,{className:"h-4 w-4"})}),o.jsx(z,{size:"icon",variant:"ghost",onClick:()=>v(g.id),children:o.jsx(Gi,{className:"h-4 w-4"})})]})})]},g.id)),l.length===0&&o.jsx(Nt,{children:o.jsx(Oe,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No hay máquinas registradas"})})]})]})})]}),o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsx(It,{children:o.jsxs("form",{onSubmit:y,children:[o.jsxs(Ut,{children:[o.jsx(Wt,{children:r?"Editar Máquina":"Nueva Máquina"}),o.jsx(Ul,{children:r?"Modifica los datos de la máquina":"Completa la información de la nueva máquina"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"nombre",children:"Nombre *"}),o.jsx(we,{id:"nombre",value:a.nombre,onChange:g=>i({...a,nombre:g.target.value}),placeholder:"Ej: Mezcladora 1",required:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"descripcion",children:"Descripción"}),o.jsx(Kt,{id:"descripcion",value:a.descripcion,onChange:g=>i({...a,descripcion:g.target.value}),placeholder:"Descripción opcional de la máquina",rows:3})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(On,{id:"activo",checked:a.activo,onCheckedChange:g=>i({...a,activo:g})}),o.jsx(ne,{htmlFor:"activo",children:"Máquina activa"})]})]}),o.jsxs(dr,{children:[o.jsx(z,{type:"button",variant:"outline",onClick:p,children:"Cancelar"}),o.jsx(z,{type:"submit",disabled:u.isPending||d.isPending,children:u.isPending||d.isPending?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"h-4 w-4 mr-2 animate-spin"}),"Guardando..."]}):"Guardar"})]})]})})})]})}function _ee(){const[e,t]=h.useState(new Date().getFullYear()),r=pn(),n=Ir({mutationFn:async i=>{const s=[],l=new Date(i,0,1),c=l.getDay(),u=c===0?-6:1-c,d=new Date(l);d.setDate(l.getDate()+u);for(let m=1;m<=52;m++){const p=new Date(d);p.setDate(d.getDate()+(m-1)*7);const y=new Date(p);y.setDate(p.getDate()+6),s.push({numero_semana:m,año:i,fecha_inicio:p.toISOString().split("T")[0],fecha_fin:y.toISOString().split("T")[0],activo:!0})}const{error:f}=await B.from("gestor_ciclos_semanas").insert(s);if(f)throw f},onSuccess:()=>{r.invalidateQueries({queryKey:["gestor-ciclos-semanas"]}),Z.success(`52 semanas del año ${e} generadas exitosamente`)},onError:i=>{Z.error("Error al generar semanas: "+i.message)}}),a=()=>{confirm(`¿Está seguro de generar las 52 semanas del año ${e}?`)&&n.mutate(e)};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold",children:"Generar Semanas del Año"}),o.jsx("p",{className:"text-muted-foreground",children:"Genera automáticamente las 52 semanas del año para el control de tiempos"})]}),o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsx(Ie,{children:"Configuración de Semanas"}),o.jsx(zt,{children:"Selecciona el año para el cual deseas generar las semanas"})]}),o.jsxs(fe,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{htmlFor:"año",children:"Año"}
530),o.jsx(we,{id:"año",type:"number",value:e,onChange:i=>t(parseInt(i.target.value)),min:2020,max:2030})]}),o.jsx(z,{onClick:a,disabled:n.isPending,className:"w-full",children:n.isPending?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"h-4 w-4 mr-2 animate-spin"}),"Generando semanas..."]}):`Generar 52 semanas del año ${e}`})]})]}),o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{children:"Información"})}),o.jsx(fe,{children:o.jsxs("ul",{className:"list-disc list-inside space-y-2 text-sm text-muted-foreground",children:[o.jsx("li",{children:"Se generarán 52 semanas automáticamente"}),o.jsx("li",{children:"Cada semana inicia en lunes y termina en domingo"}),o.jsx("li",{children:"Las semanas se ajustan al calendario del año seleccionado"}),o.jsx("li",{children:"Si ya existen semanas para ese año, se creará un error de duplicado"})]})})]})]})}function Nee(){const[e,t]=h.useState(null),[r,n]=h.useState(!0),[a,i]=h.useState(null);h.useEffect(()=>{async function u(){try{n(!0),console.log("[SimplePermissions] Checking user permissions");const{data:{session:d},error:f}=await B.auth.getSession();if(f)throw console.error("[SimplePermissions] Session error:",f),new Error(`Error fetching session: ${f.message}`);if(!d){console.log("[SimplePermissions] No active session found"),t(null),n(!1);return}console.log("[SimplePermissions] User ID:",d.user.id);try{const{data:m,error:p}=await B.rpc("user_role");if(p){console.error("[SimplePermissions] RPC error:",p);const{data:y,error:v}=await B.from("profiles").select("role").eq("id",d.user.id).maybeSingle();if(v)throw v;t((y==null?void 0:y.role)||null)}else t(m)}catch(m){console.error("[SimplePermissions] Fallback error:",m),t(null)}}catch(d){console.error("[SimplePermissions] Error checking permissions:",d),i(d instanceof Error?d.message:"Unknown error checking permissions")}finally{n(!1)}}u()},[]);const s=e==="Administrador",l=e==="Supervisor",c=s||l;return console.log("[SimplePermissions] Final permission checks:"),console.log("- User role:",e),console.log("- Is admin:",s),console.log("- Is supervisor:",l),console.log("- Can manage forms:",c),{isAdmin:s,isSupervisor:l,canManageForms:c,userRole:e,isLoading:r,error:a}}const Eee=({children:e,requireAdmin:t=!1})=>{const{isAdmin:r,isSupervisor:n,isLoading:a}=Nee();return a?o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(de,{className:"p-8",children:o.jsxs(fe,{className:"flex flex-col items-center gap-4",children:[o.jsx(ye,{className:"h-8 w-8 animate-spin text-primary"}),o.jsx("p",{className:"text-muted-foreground",children:"Verificando permisos..."})]})})}):t&&!r&&!n?o.jsx(fp,{to:"/shifts/my-shift",replace:!0}):o.jsx(o.Fragment,{children:e})};function Cee(e,t=[]){let r=[];function n(i,s){const l=h.createContext(s),c=r.length;r=[...r,s];function u(f){const{scope:m,children:p,...y}=f,v=(m==null?void 0:m[e][c])||l,g=h.useMemo(()=>y,Object.values(y));return o.jsx(v.Provider,{value:g,children:p})}function d(f,m){const p=(m==null?void 0:m[e][c])||l,y=h.useContext(p);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const a=()=>{const i=r.map(s=>h.createContext(s));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[n,Oee(a,...t)]}function Oee(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const s=n.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var Xw="Progress",Zw=100,[Pee,ZPe]=Cee(Xw),[Aee,Tee]=Pee(Xw),fI=h.forwardRef((e,t)=>{const{__scopeProgress:r,value:n=null,max:a,getValueLabel:i=Dee,...s}=e;(a||a===0)&&!V_(a)&&console.error($ee(`${a}`,"Progress"));const l=V_(a)?a:Zw;n!==null&&!G_(n,l)&&console.error(kee(`${n}`,"Progress"));const c=G_(n,l)?n:null,u=km(c)?i(c,l):void 0;return o.jsx(Aee,{scope:r,value:c,max:l,children:o.jsx(Me.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":km(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":pI(c,l),"data-value":c??void 0,"data-max":l,...s,ref:t})})});fI.displayName=Xw;var mI="ProgressIndicator",hI=h.forwardRef((e,t)=>
530{const{__scopeProgress:r,...n}=e,a=Tee(mI,r);return o.jsx(Me.div,{"data-state":pI(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});hI.displayName=mI;function Dee(e,t){return`${Math.round(e/t*100)}%`}function pI(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function km(e){return typeof e=="number"}function V_(e){return km(e)&&!isNaN(e)&&e>0}function G_(e,t){return km(e)&&!isNaN(e)&&e<=t&&e>=0}function $ee(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Zw}\`.`}function kee(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: 531 - a positive number 532 - less than the value passed to \`max\` (or ${Zw} if no \`max\` prop is set) 533 - \`null\` or \`undefined\` if the progress is indeterminate. 534 535Defaulting to \`null\`.`}var vI=fI,Mee=hI;const Hp=h.forwardRef(({className:e,value:t,...r},n)=>o.jsx(vI,{ref:n,className:oe("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:o.jsx(Mee,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Hp.displayName=vI.displayName;function H_(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Iee(){const[e,t]=h.useState(!1),[r,n]=h.useState(null),[a,i]=h.useState(!1),[s,l]=h.useState(null),[c,u]=h.useState(!1),[d,f]=h.useState(null),{toast:m}=Rn(),p=async()=>{t(!0),n(null);try{m({title:"Iniciando mantenimiento",description:"Esto puede tomar varios minutos. Por favor espera..."});const{data:g,error:x}=await B.functions.invoke("database-maintenance");if(x)throw x;n(g),g.success?m({title:"â Mantenimiento completado",description:"La base de datos ha sido optimizada exitosamente."}):m({title:"â Mantenimiento completado con errores",description:"Revisa los detalles para más información.",variant:"destructive"})}catch(g){console.error("Error running maintenance:",g),m({title:"Error",description:g.message||"No se pudo ejecutar el mantenimiento",variant:"destructive"})}finally{t(!1)}},y=async()=>{var g;i(!0),l({processed:0,uploaded:0,updated:0,total:0});try{let x=0;const b=50;let j=0;const w=await B.functions.invoke("migrate-form-images",{body:{offset:x,limit:b,dryRun:!0}});if(w.error)throw w.error;for(j=((g=w.data)==null?void 0:g.total_candidates)||0,l(S=>S?{...S,total:j}:{processed:0,uploaded:0,updated:0,total:j});;){const{data:S,error:_}=await B.functions.invoke("migrate-form-images",{body:{offset:x,limit:b}});if(_)throw _;if(l(N=>({processed:((N==null?void 0:N.processed)||0)+((S==null?void 0:S.processed)||0),uploaded:((N==null?void 0:N.uploaded)||0)+((S==null?void 0:S.uploaded)||0),updated:((N==null?void 0:N.updated)||0)+((S==null?void 0:S.updated)||0),total:j})),x=(S==null?void 0:S.next_offset)??x+b,S!=null&&S.completed)break}m({title:"â Migración completada",description:"Imágenes base64 migradas a Storage y filas actualizadas."})}catch(x){console.error("Error migrating images:",x),m({title:"Error en migración",description:x.message||"No se pudo migrar imágenes",variant:"destructive"})}finally{i(!1)}},v=async()=>{u(!0);const g={total:0,processed:0,compressed:0,errors:0,savedBytes:0};f({...g});try{const{data:x,error:b}=await B.functions.invoke("compress-existing-images",{method:"GET"});if(b)throw b;if(g.total=x.total||0,f({...g}),g.total===0){m({title:"Sin imágenes para comprimir",description:"Todas las imágenes ya están en formato WebP."}),u(!1);return}const j=50,w=5;for(let S=0;S<g.total;S+=j){const E=(await(await fetch(`https://hakrnctolecgwjmvkcvm.supabase.co/functions/v1/compress-existing-images?offset=${S}&limit=${j}`,{headers:{apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imhha3JuY3RvbGVjZ3dqbXZrY3ZtIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDUzMzM1NzgsImV4cCI6MjA2MDkwOTU3OH0.NknESViMe4JVjQEdUKLQb402YuORBXalu3Sbz9hojM4"}})).json()).candidates||[];if(E.length===0)break;for(let O=0;O<E.length;O+=w){const P=E.slice(O,O+w);await Promise.allSettled(P.map(async C=>{try{const{image_storage_path:A,id:T}=C;if(!A||A==="N/A"||A.trim()===""||!A.includes("/")&&!A.includes(".")){g.processed++,f({...g});return}const{data:k,error:D}=await B.storage.from("form-images").download(A);if(D||!k)throw D||new Error("Download failed");const M=k.size,F=new File([k],A.split("/").pop()||"image.jpg",{type:k.type}),q=await m$(F,{maxWidth:1280,quality:.75}),I=M-q.size,W=`${A.replace(/\.[^.]+$/,"")}.webp`,{error:R}=await B.storage.from("form-images").upload(W,q,{contentType:q.type,upsert:!0});if(R)throw R;const{data:V}=B.storage.from("form-images").getPublicUrl(W);await B.functions.invoke("compress-existing-images",{body:{action:"update_record",id:T,new_storage_path:W,new_public_url:V.publicUrl}}),W!==A&&await B.functions.invoke("compress-existing-images",{body:{action:"delete_original",path:A}}),g.compressed++,g.savedBytes+=Math.max(I,0)}catch(A){console.error("Error compressing image:",C.image_storage_path,A),g.errors++}finally{g.processed++,f({...g})}}))}}m({title:"â Compresión completada",description:`${g.compressed} imágenes comprimidas. Espacio ahorrado: ${H_(g.savedBytes)}`})}catch(x){console.error("Error in compression:",x),m({title:"Error en compresión",description:x.message,variant:"destructive"})}finally{u(!1)}};return o.jsxs("div",{className:"container mx-auto py-8 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Mantenimiento de Base de Datos"}),o.jsx("p",{className:"text-muted-foreground",children:"Optimiza el tamaño de la base de datos ejecutando REINDEX y VACUUM FULL"})]}),o.jsxs(pa,{children:[o.jsx(d0,{className:"h-4 w-4"}),o.jsx(Ii,{children:"Advertencia"}),o.jsx(va,{children:"Esta operación puede tomar varios minutos y bloqueará temporalmente las tablas afectadas. Recomendamos ejecutarla durante horas de bajo tráfico."})]}),o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsx(Ie,{children:"Ejecutar Mantenimiento"}),o.jsx(zt,{children:"Esta operación ejecutará REINDEX y VACUUM FULL en las tablas form_field_responses y proceso_ot_muestra"})]}),o.jsx(fe,{children:o.jsx(z,{onClick:p,disabled:e,size:"lg",className:"w-full sm:w-auto",children:e?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin"}),"Ejecutando mantenimiento..."]}):o.jsxs(o.Fragment,{children:[o.jsx(rp,{className:"mr-2 h-4 w-4"}),"Ejecutar Mantenimiento"]})})})]}),o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsx(Ie,{children:"Migrar imágenes base64 a Storage"}),o.jsx(zt,{children:"Convierte valores data:image;base64 almacenados en form_field_responses a URLs públicas en el bucket form-images."})]}),o.jsx(fe,{className:"space-y-4",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(z,{onClick:y,disabled:a,size:"lg",className:"w-full sm:w-auto",children:a?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin"}),"Migrando imágenes..."]}):o.jsx(o.Fragment,{children:"Iniciar migración"})}),s&&o.jsxs("div",{className:"text-sm text-muted-foreground",children:["Procesadas: ",o.jsx("span",{className:"text-foreground font-medium",children:s.processed})," / Total: ",o.jsx("span",{className:"text-foreground font-medium",children:s.total})," ⢠Subidas: ",o.jsx("span",{className:"text-foreground font-medium",children:s.uploaded})," ⢠Actualizadas: ",o.jsx("span",{className:"text-foreground font-medium",children:s.updated})]})]})})]}),o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsxs(Ie,{className:"flex items-center gap-2",children:[o.jsx(Zf,{className:"h-5 w-5"}),"Comprimir imágenes existentes"]}),o.jsx(zt,{children:"Descarga imágenes del bucket form-images, las comprime a WebP (max 1280px, calidad 0.75) y las re-sube. Esto reduce significativamente el peso de las imágenes antiguas."})]}),o.jsxs(fe,{className:"space-y-4",children:[o.jsx(z,{onClick:v,disabled:c,size:"lg",className:"w-full sm:w-auto",children:c?o.jsxs(o.Fragment,{children:[o.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin"}),"Comprimiendo imágenes..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Zf,{className:"mr-2 h-4 w-4"}),"Iniciar compresión"]})}),d&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(Hp,{value:d.total>
5350?d.processed/d.total*100:0,className:"h-3"}),o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 text-sm",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-muted-foreground",children:"Procesadas"}),o.jsxs("div",{className:"font-medium text-foreground",children:[d.processed," / ",d.total]})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-muted-foreground",children:"Comprimidas"}),o.jsx("div",{className:"font-medium text-green-600",children:d.compressed})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-muted-foreground",children:"Errores"}),o.jsx("div",{className:"font-medium text-destructive",children:d.errors})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-muted-foreground",children:"Espacio ahorrado"}),o.jsx("div",{className:"font-medium text-primary",children:H_(d.savedBytes)})]})]})]})]})]}),r&&o.jsx("div",{className:"space-y-4",children:o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsxs(Ie,{className:"flex items-center gap-2",children:[r.success?o.jsx(Do,{className:"h-5 w-5 text-green-500"}):o.jsx(Kf,{className:"h-5 w-5 text-red-500"}),"Resultado del Mantenimiento"]}),o.jsxs(zt,{children:["Iniciado: ",new Date(r.started_at).toLocaleString(),r.completed_at&&` ⢠Completado: ${new Date(r.completed_at).toLocaleString()}`]})]}),o.jsxs(fe,{className:"space-y-6",children:[r.space_saved&&r.space_saved.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"font-semibold mb-3",children:"Espacio Recuperado"}),o.jsx("div",{className:"space-y-2",children:r.space_saved.map(g=>o.jsx(de,{children:o.jsxs(fe,{className:"pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("span",{className:"font-medium",children:g.table}),o.jsx("span",{className:"text-2xl font-bold text-primary",children:g.saved})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{children:[o.jsx("div",{children:"Antes"}),o.jsx("div",{className:"font-medium text-foreground",children:g.before})]}),o.jsxs("div",{children:[o.jsx("div",{children:"Después"}),o.jsx("div",{className:"font-medium text-foreground",children:g.after})]}),o.jsxs("div",{children:[o.jsx("div",{children:"Reducción"}),o.jsx("div",{className:"font-medium text-green-600",children:g.reduction_percent})]})]})]})},g.table))})]}),r.operations&&r.operations.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"font-semibold mb-3",children:"Operaciones Completadas"}),o.jsx("div",{className:"space-y-2",children:r.operations.map((g,x)=>o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx(Do,{className:"h-4 w-4 text-green-500 flex-shrink-0"}),o.jsxs("span",{children:[o.jsx("strong",{children:g.operation})," en ",o.jsx("code",{children:g.table})]}),o.jsx("span",{className:"text-muted-foreground ml-auto",children:new Date(g.timestamp).toLocaleTimeString()})]},x))})]}),r.errors&&r.errors.length>0&&o.jsxs("div",{children:[o.jsx("h3",{className:"font-semibold mb-3 text-destructive",children:"Errores"}),o.jsx("div",{className:"space-y-2",children:r.errors.map((g,x)=>o.jsxs(pa,{variant:"destructive",children:[o.jsx(Kf,{className:"h-4 w-4"}),o.jsxs(Ii,{children:[g.operation," en ",g.table]}),o.jsx(va,{children:g.error})]},x))})]})]})]})})]})}function Ree(){const{allowedModules:e,isLoading:t}=C0(),r=e.has("*")||e.has("reportes"),[n,a]=h.useState(""),[i,s]=h.useState(!1),[l,c]=h.useState(null),[u,d]=h.useState([]),[f,m]=h.useState(!1),p=h.useRef(null);if(t)return o.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:o.jsx(ye,{className:"h-8 w-8 animate-spin text-primary"})});if(!r)return o.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] gap-4",children:[o.jsx(j3,{className:"h-12 w-12 text-destructive"}),o.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Acceso Denegado"}),o.jsx("p",{className:"text-muted-foreground",children:"No tienes permisos para acceder a este módulo."})]});const y=async()=>{const x=n.trim();if(x){s(!0),m(!0);try{const{data:b}=await B.from("ordenes_de_trabajo").select("ot_numero, area, producto_resultante, premezcla, fecha, jefe_turno, supervisor_doc, cantidad, cantidad_programada").eq("ot_numero",Number(x)).maybeSingle();c(b);const j=await Ok(x);d(j),!b&&j.length===0&&Z.error("No se encontraron datos para la OT "+x)}catch(b){console.error(b),Z.error("Error al buscar la OT")}finally{s(!1)}}},v=()=>{window.print()},g=x=>!x||x==="N/A"?null:x.startsWith("http")?x:`https://hakrnctolecgwjmvkcvm.supabase.co/storage/v1/object/public/form-images/${x}`;return o.jsxs("div",{className:"p-4 md:p-6 max-w-5xl mx-auto",children:[o.jsxs("div",{className:"print:hidden mb-6",children:[o.jsx("h1",{className:"text-2xl font-bold text-foreground mb-4",children:"Reportes de Muestras"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{placeholder:"Número de OT",value:n,onChange:x=>a(x.target.value),onKeyDown:x=>x.key==="Enter"&&y(),className:"max-w-xs"}),o.jsxs(z,{onClick:y,disabled:i,children:[i?o.jsx(ye,{className:"h-4 w-4 animate-spin"}):o.jsx(Ko,{className:"h-4 w-4 mr-1"}),"Buscar"]}),u.length>0&&o.jsxs(z,{variant:"outline",onClick:v,children:[o.jsx(w3,{className:"h-4 w-4 mr-1"}),"Imprimir / PDF"]})]})]}),f&&!i&&o.jsxs("div",{ref:p,className:"report-content",children:[o.jsxs("div",{className:"flex items-center gap-4 mb-6 border-b pb-4 border-border",children:[o.jsx("img",{src:"/lovable-uploads/487fc73a-aeac-4c0f-b546-1e5ecf9ea9da.png",alt:"Logo",className:"h-14 w-auto"}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Sistema Integrado de Control de Muestras de Producción"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Reporte de OT: ",n]})]})]}),l&&o.jsxs(de,{className:"mb-6 print:shadow-none print:border",children:[o.jsx(Le,{className:"pb-2",children:o.jsx(Ie,{className:"text-base",children:"Datos de la Orden de Trabajo"})}),o.jsx(fe,{children:o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"OT:"})," ",o.jsx("strong",{children:l.ot_numero})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Fecha:"})," ",o.jsx("strong",{children:l.fecha||"N/A"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Ãrea:"})," ",o.jsx("strong",{children:l.area||"N/A"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Producto:"})," ",o.jsx("strong",{children:l.producto_resultante||l.premezcla||"N/A"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Jefe de Turno:"})," ",o.jsx("strong",{children:l.jefe_turno||"N/A"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Cantidad:"})," ",o.jsx("strong",{children:l.cantidad_programada??l.cantidad??"N/A"})]})]})})]}),u.length===0?o.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No se encontraron muestras para esta OT."}):o.jsxs("div",{className:"space-y-6",children:[o.jsxs("p",{className:"text-sm text-muted-foreground print:hidden",children:["Total de muestras: ",o.jsx("strong",{children:u.length})]}),u.map((x,b)=>o.jsxs("div",{className:"break-inside-avoid border rounded-lg p-4 border-border",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsxs("h3",{className:"font-semibold text-foreground",children:["Muestra #",x.num_muestra??b+1]}),o.jsx(ke,{variant:"secondary",className:"text-xs",children:new Date(x.created_at).toLocaleStr
535ing("es-CO")})]}),o.jsx(Ow,{className:"mb-3"}),x.form_responses&&x.form_responses.length>0?o.jsx("div",{className:"space-y-2",children:x.form_responses.map(j=>{var _;const w=g(j.image_storage_path),S=w!=null;return o.jsxs("div",{className:"grid grid-cols-[180px_1fr] gap-2 text-sm items-start",children:[o.jsxs("span",{className:"text-muted-foreground font-medium truncate",children:[((_=j.formulario_campos)==null?void 0:_.etiqueta)||j.field_label,":"]}),o.jsx("div",{children:S?o.jsx("img",{src:w,alt:j.field_label,className:"max-w-[300px] max-h-[200px] rounded border border-border object-contain print:max-w-[250px] print:max-h-[180px]"}):o.jsx("span",{className:"text-foreground",children:j.field_value||(j.numeric_value??"-")})})]},j.id)})}):o.jsx("p",{className:"text-sm text-muted-foreground italic",children:"Sin datos de formulario"})]},x.id))]}),o.jsxs("div",{className:"hidden print:block mt-8 pt-4 border-t border-border text-center text-xs text-muted-foreground",children:["Generado el ",new Date().toLocaleString("es-CO")," â Sistema Integrado de Control de Muestras"]})]})]})}var K_=1,Lee=.9,Fee=.8,Bee=.17,$g=.1,kg=.999,zee=.9999,qee=.99,Uee=/[\\\/_+.#"@\[\(\{&]/,Wee=/[\\\/_+.#"@\[\(\{&]/g,Vee=/[\s-]/,gI=/[\s-]/g;function gx(e,t,r,n,a,i,s){if(i===t.length)return a===e.length?K_:qee;var l=`${a},${i}`;if(s[l]!==void 0)return s[l];for(var c=n.charAt(i),u=r.indexOf(c,a),d=0,f,m,p,y;u>=0;)f=gx(e,t,r,n,u+1,i+1,s),f>d&&(u===a?f*=K_:Uee.test(e.charAt(u-1))?(f*=Fee,p=e.slice(a,u-1).match(Wee),p&&a>0&&(f*=Math.pow(kg,p.length))):Vee.test(e.charAt(u-1))?(f*=Lee,y=e.slice(a,u-1).match(gI),y&&a>0&&(f*=Math.pow(kg,y.length))):(f*=Bee,a>0&&(f*=Math.pow(kg,u-a))),e.charAt(u)!==t.charAt(i)&&(f*=zee)),(f<$g&&r.charAt(u-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(u-1)!==n.charAt(i))&&(m=gx(e,t,r,n,u+1,i+2,s),m*$g>f&&(f=m*$g)),f>d&&(d=f),u=r.indexOf(c,u+1);return s[l]=d,d}function Y_(e){return e.toLowerCase().replace(gI," ")}function Gee(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,gx(e,t,Y_(e),Y_(t),0,0,{})}function Ds(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e==null||e(a),r===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function Hee(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function yI(...e){return t=>e.forEach(r=>Hee(r,t))}function Bd(...e){return h.useCallback(yI(...e),e)}function Kee(e,t=[]){let r=[];function n(i,s){const l=h.createContext(s),c=r.length;r=[...r,s];function u(f){const{scope:m,children:p,...y}=f,v=(m==null?void 0:m[e][c])||l,g=h.useMemo(()=>y,Object.values(y));return h.createElement(v.Provider,{value:g},p)}function d(f,m){const p=(m==null?void 0:m[e][c])||l,y=h.useContext(p);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const a=()=>{const i=r.map(s=>h.createContext(s));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[n,Yee(a,...t)]}function Yee(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const s=n.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}const Xee=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},Zee=RP.useId||(()=>{});let Qee=0;function Mg(e){const[t,r]=h.useState(Zee());return Xee(()=>{e||r(n=>n??String(Qee++))},[e]),e||(t?`radix-${t}`:"")}function xI(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...r)=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t,...r)},[])}function Jee({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,a]=ete({defaultProp:t,onChange:r}),i=e!==void 0,s=i?e:n,l=xI(r),c=h.useCallback(u=>{if(i){const f=typeof u=="function"?u(e):u;f!==e&&l(f)}else a(u)},[i,e,a,l]);return[s,c]}function ete({defaultProp:e,onChange:t}){const r=h.useState(e),[n]=r,a=h.useRef(n),i=xI(t);return h.useEffect(()=>{a.current!==n&&(i(n),a.current=n)},[n,a,i]),r}function tte(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function rte(...e){return t=>e.forEach(r=>tte(r,t))}const bI=h.forwardRef((e,t)=>
535{const{children:r,...n}=e,a=h.Children.toArray(r),i=a.find(ate);if(i){const s=i.props.children,l=a.map(c=>c===i?h.Children.count(s)>1?h.Children.only(null):h.isValidElement(s)?s.props.children:null:c);return h.createElement(yx,Ae({},n,{ref:t}),h.isValidElement(s)?h.cloneElement(s,void 0,l):null)}return h.createElement(yx,Ae({},n,{ref:t}),r)});bI.displayName="Slot";const yx=h.forwardRef((e,t)=>{const{children:r,...n}=e;return h.isValidElement(r)?h.cloneElement(r,{...ite(n,r.props),ref:t?rte(t,r.ref):r.ref}):h.Children.count(r)>1?h.Children.only(null):null});yx.displayName="SlotClone";const nte=({children:e})=>h.createElement(h.Fragment,null,e);function ate(e){return h.isValidElement(e)&&e.type===nte}function ite(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...l)=>{i(...l),a(...l)}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}const ote=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Fn=ote.reduce((e,t)=>{const r=h.forwardRef((n,a)=>{const{asChild:i,...s}=n,l=i?bI:t;return h.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),h.createElement(l,Ae({},s,{ref:a}))});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ste(e,t){e&&wd.flushSync(()=>e.dispatchEvent(t))}function Qw(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...r)=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t,...r)},[])}function lte(e,t=globalThis==null?void 0:globalThis.document){const r=Qw(e);h.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n),()=>t.removeEventListener("keydown",n)},[r,t])}const xx="dismissableLayer.update",cte="dismissableLayer.pointerDownOutside",ute="dismissableLayer.focusOutside";let X_;const dte=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fte=h.forwardRef((e,t)=>{var r;const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=h.useContext(dte),[f,m]=h.useState(null),p=(r=f==null?void 0:f.ownerDocument)!==null&&r!==void 0?r:globalThis==null?void 0:globalThis.document,[,y]=h.useState({}),v=Bd(t,E=>m(E)),g=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(x),j=f?g.indexOf(f):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,S=j>=b,_=mte(E=>{const O=E.target,P=[...d.branches].some(C=>C.contains(O));!S||P||(i==null||i(E),l==null||l(E),E.defaultPrevented||c==null||c())},p),N=hte(E=>{const O=E.target;[...d.branches].some(C=>C.contains(O))||(s==null||s(E),l==null||l(E),E.defaultPrevented||c==null||c())},p);return lte(E=>{j===d.layers.size-1&&(a==null||a(E),!E.defaultPrevented&&c&&(E.preventDefault(),c()))},p),h.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(X_=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Z_(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=X_)}},[f,p,n,d]),h.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Z_())},[f,d]),h.useEffect(()=>{const E=()=>y({});return document.addEventListener(xx,E),()=>document.removeEventListener(xx,E)},[]),h.createElement(Fn.div,Ae({},u,{ref:v,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:Ds(e.onFocusCapture,N.onFocusCapture),onBlurCapture:Ds(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Ds(e.onPointerDownCapture,_.onPointerDownCapture)}))});function mte(e,t=globalThis==null?void 0:globalThis.document){const r=Qw(e),n=h.useRef(!1),a=h.useRef(()=>{});return h.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let u=function(){wI(cte,r,c,{discrete:!0})};const c={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=u,t.addEventListener("click",a.current,{once:!0})):u()}else t.removeEventListener("click",a.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function hte(e,t=globalThis==null?void 0:globalThis.document){const r=Qw(e),n=h.useRef(!1);return h.useEffect(()=>{const a=i=>{i.target&&!n.current&&wI(ute,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Z_(){const e=new CustomEvent(xx);document.dispatchEvent(e)}function wI(e,t,r,{discrete:n}){const a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?ste(a,i):a.dispatchEvent(i)}function Q_(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...r)=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t,...r)},[])}const Ig="focusScope.autoFocusOnMount",Rg="focusScope.autoFocusOnUnmount",J_={bubbles:!1,cancelable:!0},pte=h.forwardRef((e,t)=>
535{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...s}=e,[l,c]=h.useState(null),u=Q_(a),d=Q_(i),f=h.useRef(null),m=Bd(t,v=>c(v)),p=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(n){let v=function(j){if(p.paused||!l)return;const w=j.target;l.contains(w)?f.current=w:pi(f.current,{select:!0})},g=function(j){if(p.paused||!l)return;const w=j.relatedTarget;w!==null&&(l.contains(w)||pi(f.current,{select:!0}))},x=function(j){if(document.activeElement===document.body)for(const S of j)S.removedNodes.length>0&&pi(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",g);const b=new MutationObserver(x);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",g),b.disconnect()}}},[n,l,p.paused]),h.useEffect(()=>{if(l){tN.add(p);const v=document.activeElement;if(!l.contains(v)){const x=new CustomEvent(Ig,J_);l.addEventListener(Ig,u),l.dispatchEvent(x),x.defaultPrevented||(vte(wte(jI(l)),{select:!0}),document.activeElement===v&&pi(l))}return()=>{l.removeEventListener(Ig,u),setTimeout(()=>{const x=new CustomEvent(Rg,J_);l.addEventListener(Rg,d),l.dispatchEvent(x),x.defaultPrevented||pi(v??document.body,{select:!0}),l.removeEventListener(Rg,d),tN.remove(p)},0)}}},[l,u,d,p]);const y=h.useCallback(v=>{if(!r&&!n||p.paused)return;const g=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(g&&x){const b=v.currentTarget,[j,w]=gte(b);j&&w?!v.shiftKey&&x===w?(v.preventDefault(),r&&pi(j,{select:!0})):v.shiftKey&&x===j&&(v.preventDefault(),r&&pi(w,{select:!0})):x===b&&v.preventDefault()}},[r,n,p.paused]);return h.createElement(Fn.div,Ae({tabIndex:-1},s,{ref:m,onKeyDown:y}))});function vte(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(pi(n,{select:t}),document.activeElement!==r)return}function gte(e){const t=jI(e),r=eN(t,e),n=eN(t.reverse(),e);return[r,n]}function jI(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function eN(e,t){for(const r of e)if(!yte(r,{upTo:t}))return r}function yte(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function xte(e){return e instanceof HTMLInputElement&&"select"in e}function pi(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&xte(e)&&t&&e.select()}}const tN=bte();function bte(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=rN(e,t),e.unshift(t)},remove(t){var r;e=rN(e,t),(r=e[0])===null||r===void 0||r.resume()}}}function rN(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function wte(e){return e.filter(t=>t.tagName!=="A")}const jte=h.forwardRef((e,t)=>{var r;const{container:n=globalThis==null||(r=globalThis.document)===null||r===void 0?void 0:r.body,...a}=e;return n?Ho.createPortal(h.createElement(Fn.div,Ae({},a,{ref:t})),n):null}),nN=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{};function Ste(e,t){return h.useReducer((r,n)=>{const a=t[r][n];return a??r},e)}const Kp=e=>{const{present:t,children:r}=e,n=_te(t),a=typeof r=="function"?r({present:n.isPresent}):h.Children.only(r),i=Bd(n.ref,a.ref);return typeof r=="function"||n.isPresent?h.cloneElement(a,{ref:i}):null};Kp.displayName="Presence";function _te(e){const[t,r]=h.useState(),n=h.useRef({}),a=h.useRef(e),i=h.useRef("none"),s=e?"mounted":"unmounted",[l,c]=Ste(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=xf(n.current);i.current=l==="mounted"?u:"none"},[l]),nN(()=>{const u=n.current,d=a.current;if(d!==e){const m=i.current,p=xf(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==p?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),nN(()=>
535{if(t){const u=f=>{const p=xf(n.current).includes(f.animationName);f.target===t&&p&&wd.flushSync(()=>c("ANIMATION_END"))},d=f=>{f.target===t&&(i.current=xf(n.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function xf(e){return(e==null?void 0:e.animationName)||"none"}let Lg=0;function Nte(){h.useEffect(()=>{var e,t;const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=r[0])!==null&&e!==void 0?e:aN()),document.body.insertAdjacentElement("beforeend",(t=r[1])!==null&&t!==void 0?t:aN()),Lg++,()=>{Lg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),Lg--}},[])}function aN(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var SI=Uh(),Fg=function(){},Yp=h.forwardRef(function(e,t){var r=h.useRef(null),n=h.useState({onScrollCapture:Fg,onWheelCapture:Fg,onTouchMoveCapture:Fg}),a=n[0],i=n[1],s=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,p=e.noIsolation,y=e.inert,v=e.allowPinchZoom,g=e.as,x=g===void 0?"div":g,b=Wh(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),j=m,w=Vh([r,t]),S=Rt(Rt({},b),a);return h.createElement(h.Fragment,null,d&&h.createElement(j,{sideCar:SI,removeScrollBar:u,shards:f,noIsolation:p,inert:y,setCallbacks:i,allowPinchZoom:!!v,lockRef:r}),s?h.cloneElement(h.Children.only(l),Rt(Rt({},S),{ref:w})):h.createElement(x,Rt({},S,{className:c,ref:w}),l))});Yp.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Yp.classNames={fullWidth:Gh,zeroRight:Hh};var bx=!1;if(typeof window<"u")try{var bf=Object.defineProperty({},"passive",{get:function(){return bx=!0,!0}});window.addEventListener("test",bf,bf),window.removeEventListener("test",bf,bf)}catch{bx=!1}var hs=bx?{passive:!1}:!1,Ete=function(e){return e.tagName==="TEXTAREA"},_I=function(e,t){var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!Ete(e)&&r[t]==="visible")},Cte=function(e){return _I(e,"overflowY")},Ote=function(e){return _I(e,"overflowX")},iN=function(e,t){var r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var n=NI(e,r);if(n){var a=EI(e,r),i=a[1],s=a[2];if(i>s)return!0}r=r.parentNode}while(r&&r!==document.body);return!1},Pte=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},Ate=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},NI=function(e,t){return e==="v"?Cte(t):Ote(t)},EI=function(e,t){return e==="v"?Pte(t):Ate(t)},Tte=function(e,t){return e==="h"&&t==="rtl"?-1:1},Dte=function(e,t,r,n,a){var i=Tte(e,window.getComputedStyle(t).direction),s=i*n,l=r.target,c=t.contains(l),u=!1,d=s>0,f=0,m=0;do{var p=EI(e,l),y=p[0],v=p[1],g=p[2],x=v-g-i*y;(y||x)&&NI(e,l)&&(f+=x,m+=y),l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(f===0||!a)||!d&&(m===0||!a))&&(u=!0),u},wf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},oN=function(e){return[e.deltaX,e.deltaY]},sN=function(e){return e&&"current"in e?e.current:e},$te=function(e,t){return e[0]===t[0]&&e[1]===t[1]},kte=function(e){return` 536 .block-interactivity-`.concat(e,` {pointer-events: none;} 537 .allow-interactivity-`).concat(e,` {pointer-events: all;} 538`)},Mte=0,ps=[];function Ite(e){var t=h.useRef([]),r=h.useRef([0,0]),n=h.useRef(),a=h.useState(Mte++)[0],i=h.useState(function(){return Kh()})[0],s=h.useRef(e);h.useEffect(function(){s.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));
538var v=Yh([e.lockRef.current],(e.shards||[]).map(sN),!0).filter(Boolean);return v.forEach(function(g){return g.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),v.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(v,g){if("touches"in v&&v.touches.length===2)return!s.current.allowPinchZoom;var x=wf(v),b=r.current,j="deltaX"in v?v.deltaX:b[0]-x[0],w="deltaY"in v?v.deltaY:b[1]-x[1],S,_=v.target,N=Math.abs(j)>Math.abs(w)?"h":"v";if("touches"in v&&N==="h"&&_.type==="range")return!1;var E=iN(N,_);if(!E)return!0;if(E?S=N:(S=N==="v"?"h":"v",E=iN(N,_)),!E)return!1;if(!n.current&&"changedTouches"in v&&(j||w)&&(n.current=S),!S)return!0;var O=n.current||S;return Dte(O,g,v,O==="h"?j:w,!0)},[]),c=h.useCallback(function(v){var g=v;if(!(!ps.length||ps[ps.length-1]!==i)){var x="deltaY"in g?oN(g):wf(g),b=t.current.filter(function(S){return S.name===g.type&&S.target===g.target&&$te(S.delta,x)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var j=(s.current.shards||[]).map(sN).filter(Boolean).filter(function(S){return S.contains(g.target)}),w=j.length>0?l(g,j[0]):!s.current.noIsolation;w&&g.cancelable&&g.preventDefault()}}},[]),u=h.useCallback(function(v,g,x,b){var j={name:v,delta:g,target:x,should:b};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(w){return w!==j})},1)},[]),d=h.useCallback(function(v){r.current=wf(v),n.current=void 0},[]),f=h.useCallback(function(v){u(v.type,oN(v),v.target,l(v,e.lockRef.current))},[]),m=h.useCallback(function(v){u(v.type,wf(v),v.target,l(v,e.lockRef.current))},[]);h.useEffect(function(){return ps.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,hs),document.addEventListener("touchmove",c,hs),document.addEventListener("touchstart",d,hs),function(){ps=ps.filter(function(v){return v!==i}),document.removeEventListener("wheel",c,hs),document.removeEventListener("touchmove",c,hs),document.removeEventListener("touchstart",d,hs)}},[]);var p=e.removeScrollBar,y=e.inert;return h.createElement(h.Fragment,null,y?h.createElement(i,{styles:kte(a)}):null,p?h.createElement(Xh,{gapMode:"margin"}):null)}const Rte=Zh(SI,Ite);var CI=h.forwardRef(function(e,t){return h.createElement(Yp,Rt({},e,{ref:t,sideCar:Rte}))});CI.classNames=Yp.classNames;const OI=h.forwardRef((e,t)=>{const{children:r,...n}=e,a=h.Children.toArray(r),i=a.find(Fte);if(i){const s=i.props.children,l=a.map(c=>c===i?h.Children.count(s)>1?h.Children.only(null):h.isValidElement(s)?s.props.children:null:c);return h.createElement(wx,Ae({},n,{ref:t}),h.isValidElement(s)?h.cloneElement(s,void 0,l):null)}return h.createElement(wx,Ae({},n,{ref:t}),r)});OI.displayName="Slot";const wx=h.forwardRef((e,t)=>{const{children:r,...n}=e;return h.isValidElement(r)?h.cloneElement(r,{...Bte(n,r.props),ref:t?yI(t,r.ref):r.ref}):h.Children.count(r)>1?h.Children.only(null):null});wx.displayName="SlotClone";const Lte=({children:e})=>h.createElement(h.Fragment,null,e);function Fte(e){return h.isValidElement(e)&&e.type===Lte}function Bte(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...l)=>{i(...l),a(...l)}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}const PI="Dialog",[AI,QPe]=Kee(PI),[zte,es]=AI(PI),qte=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:a,onOpenChange:i,modal:s=!0}=e,l=h.useRef(null),c=h.useRef(null),[u=!1,d]=Jee({prop:n,defaultProp:a,onChange:i});return h.createElement(zte,{scope:t,triggerRef:l,contentRef:c,contentId:Mg(),titleId:Mg(),descriptionId:Mg(),open:u,onOpenChange:d,onOpenToggle:h.useCallback(()=>d(f=>!f),[d]),modal:s},r)},TI="DialogPortal",[Ute,DI]=AI(TI,{forceMount:void 0}),Wte=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:a}=e,i=es(TI,t);return h.createElement(Ute,{scope:t,forceMount:r},h.Children.map(n,s=>h.createElement(Kp,{present:r||i.open},h.createElement(jte,{asChild:!0,container:a}
538,s))))},jx="DialogOverlay",Vte=h.forwardRef((e,t)=>{const r=DI(jx,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=es(jx,e.__scopeDialog);return i.modal?h.createElement(Kp,{present:n||i.open},h.createElement(Gte,Ae({},a,{ref:t}))):null}),Gte=h.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=es(jx,r);return h.createElement(CI,{as:OI,allowPinchZoom:!0,shards:[a.contentRef]},h.createElement(Fn.div,Ae({"data-state":kI(a.open)},n,{ref:t,style:{pointerEvents:"auto",...n.style}})))}),$u="DialogContent",Hte=h.forwardRef((e,t)=>{const r=DI($u,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=es($u,e.__scopeDialog);return h.createElement(Kp,{present:n||i.open},i.modal?h.createElement(Kte,Ae({},a,{ref:t})):h.createElement(Yte,Ae({},a,{ref:t})))}),Kte=h.forwardRef((e,t)=>{const r=es($u,e.__scopeDialog),n=h.useRef(null),a=Bd(t,r.contentRef,n);return h.useEffect(()=>{const i=n.current;if(i)return Qh(i)},[]),h.createElement($I,Ae({},e,{ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ds(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=r.triggerRef.current)===null||s===void 0||s.focus()}),onPointerDownOutside:Ds(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&i.preventDefault()}),onFocusOutside:Ds(e.onFocusOutside,i=>i.preventDefault())}))}),Yte=h.forwardRef((e,t)=>{const r=es($u,e.__scopeDialog),n=h.useRef(!1),a=h.useRef(!1);return h.createElement($I,Ae({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s;if((s=e.onCloseAutoFocus)===null||s===void 0||s.call(e,i),!i.defaultPrevented){var l;n.current||(l=r.triggerRef.current)===null||l===void 0||l.focus(),i.preventDefault()}n.current=!1,a.current=!1},onInteractOutside:i=>{var s,l;(s=e.onInteractOutside)===null||s===void 0||s.call(e,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=i.target;((l=r.triggerRef.current)===null||l===void 0?void 0:l.contains(c))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}}))}),$I=h.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,...s}=e,l=es($u,r),c=h.useRef(null),u=Bd(t,c);return Nte(),h.createElement(h.Fragment,null,h.createElement(pte,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i},h.createElement(fte,Ae({role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":kI(l.open)},s,{ref:u,onDismiss:()=>l.onOpenChange(!1)}))),!1)});function kI(e){return e?"open":"closed"}const Xte=qte,Zte=Wte,Qte=Vte,Jte=Hte;var bc='[cmdk-group=""]',Bg='[cmdk-group-items=""]',ere='[cmdk-group-heading=""]',Jw='[cmdk-item=""]',lN=`${Jw}:not([aria-disabled="true"])`,Sx="cmdk-item-select",uo="data-value",tre=(e,t,r)=>Gee(e,t,r),MI=h.createContext(void 0),zd=()=>h.useContext(MI),II=h.createContext(void 0),ej=()=>h.useContext(II),RI=h.createContext(void 0),LI=h.forwardRef((e,t)=>{let r=ws(()=>{var R,V;return{search:"",value:(V=(R=e.value)!=null?R:e.defaultValue)!=null?V:"",filtered:{count:0,items:new Map,groups:new Set}}}),n=ws(()=>new Set),a=ws(()=>new Map),i=ws(()=>new Map),s=ws(()=>new Set),l=FI(e),{label:c,children:u,value:d,onValueChange:f,filter:m,shouldFilter:p,loop:y,disablePointerSelection:v=!1,vimBindings:g=!0,...x}=e,b=h.useId(),j=h.useId(),w=h.useId(),S=h.useRef(null),_=fre();Bo(()=>{if(d!==void 0){let R=d.trim();r.current.value=R,N.emit()}},[d]),Bo(()=>{_(6,T)},[]);let N=h.useMemo(()=>({subscribe:R=>(s.current.add(R),()=>s.current.delete(R)),snapshot:()=>r.current,setState:(R,V,re)=>{var H,te,ce;if(!Object.is(r.current[R],V)){if(r.current[R]=V,R==="search")A(),P(),_(1,C);else if(R==="value"&&(re||_(5,T),((H=l.current)==null?void 0:H.value)!==void 0)){let je=V??"";(ce=(te=l.current).onValueChange)==null||ce.call(te,je);return}N.emit()}},emit:()=>{s.current.forEach(R=>R())}}),[]),E=h.useMemo(()=>({value:(R,V,re)=>{var H;V!==((H=i.current.get(R))==null?void 0:H.value)&&(i.current.set(R,{value:V,keywords:re}),r.current.filtered.items.set(R,O(V,re)),_(2,()=>{P(),N.emit()}))},item:(R,V)=>
vendor: 4,815 bytes, line 538
538(n.current.add(R),V&&(a.current.has(V)?a.current.get(V).add(R):a.current.set(V,new Set([R]))),_(3,()=>{A(),P(),r.current.value||C(),N.emit()}),()=>{i.current.delete(R),n.current.delete(R),r.current.filtered.items.delete(R);let re=k();_(4,()=>{A(),(re==null?void 0:re.getAttribute("id"))===R&&C(),N.emit()})}),group:R=>(a.current.has(R)||a.current.set(R,new Set),()=>{i.current.delete(R),a.current.delete(R)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],disablePointerSelection:v,listId:b,inputId:w,labelId:j,listInnerRef:S}),[]);function O(R,V){var re,H;let te=(H=(re=l.current)==null?void 0:re.filter)!=null?H:tre;return R?te(R,r.current.search,V):0}function P(){if(!r.current.search||l.current.shouldFilter===!1)return;let R=r.current.filtered.items,V=[];r.current.filtered.groups.forEach(H=>{let te=a.current.get(H),ce=0;te.forEach(je=>{let X=R.get(je);ce=Math.max(X,ce)}),V.push([H,ce])});let re=S.current;D().sort((H,te)=>{var ce,je;let X=H.getAttribute("id"),ae=te.getAttribute("id");return((ce=R.get(ae))!=null?ce:0)-((je=R.get(X))!=null?je:0)}).forEach(H=>{let te=H.closest(Bg);te?te.appendChild(H.parentElement===te?H:H.closest(`${Bg} > *`)):re.appendChild(H.parentElement===re?H:H.closest(`${Bg} > *`))}),V.sort((H,te)=>te[1]-H[1]).forEach(H=>{let te=S.current.querySelector(`${bc}[${uo}="${encodeURIComponent(H[0])}"]`);te==null||te.parentElement.appendChild(te)})}function C(){let R=D().find(re=>re.getAttribute("aria-disabled")!=="true"),V=R==null?void 0:R.getAttribute(uo);N.setState("value",V||void 0)}function A(){var R,V,re,H;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let te=0;for(let ce of n.current){let je=(V=(R=i.current.get(ce))==null?void 0:R.value)!=null?V:"",X=(H=(re=i.current.get(ce))==null?void 0:re.keywords)!=null?H:[],ae=O(je,X);r.current.filtered.items.set(ce,ae),ae>0&&te++}for(let[ce,je]of a.current)for(let X of je)if(r.current.filtered.items.get(X)>0){r.current.filtered.groups.add(ce);break}r.current.filtered.count=te}function T(){var R,V,re;let H=k();H&&(((R=H.parentElement)==null?void 0:R.firstChild)===H&&((re=(V=H.closest(bc))==null?void 0:V.querySelector(ere))==null||re.scrollIntoView({block:"nearest"})),H.scrollIntoView({block:"nearest"}))}function k(){var R;return(R=S.current)==null?void 0:R.querySelector(`${Jw}[aria-selected="true"]`)}function D(){var R;return Array.from((R=S.current)==null?void 0:R.querySelectorAll(lN))}function M(R){let V=D()[R];V&&N.setState("value",V.getAttribute(uo))}function F(R){var V;let re=k(),H=D(),te=H.findIndex(je=>je===re),ce=H[te+R];(V=l.current)!=null&&V.loop&&(ce=te+R<0?H[H.length-1]:te+R===H.length?H[0]:H[te+R]),ce&&N.setState("value",ce.getAttribute(uo))}function q(R){let V=k(),re=V==null?void 0:V.closest(bc),H;for(;re&&!H;)re=R>0?ure(re,bc):dre(re,bc),H=re==null?void 0:re.querySelector(lN);H?N.setState("value",H.getAttribute(uo)):F(R)}let I=()=>M(D().length-1),K=R=>{R.preventDefault(),R.metaKey?I():R.altKey?q(1):F(1)},W=R=>{R.preventDefault(),R.metaKey?M(0):R.altKey?q(-1):F(-1)};return h.createElement(Fn.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:R=>{var V;if((V=x.onKeyDown)==null||V.call(x,R),!R.defaultPrevented)switch(R.key){case"n":case"j":{g&&R.ctrlKey&&K(R);break}case"ArrowDown":{K(R);break}case"p":case"k":{g&&R.ctrlKey&&W(R);break}case"ArrowUp":{W(R);break}case"Home":{R.preventDefault(),M(0);break}case"End":{R.preventDefault(),I();break}case"Enter":if(!R.nativeEvent.isComposing&&R.keyCode!==229){R.preventDefault();let re=k();if(re){let H=new Event(Sx);re.dispatchEvent(H)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:hre},c),Xp(e,R=>h.createElement(II.Provider,{value:N},h.createElement(MI.Provider,{value:E},R))))}),rre=h.forwardRef((e,t)=>{var r,n;let a=h.useId(),i=h.useRef(null),s=h.useContext(RI),l=zd(),c=FI(e),u=(n=(r=c.current)==null?void 0:r.forceMount)!=null?n:s==null?void 0:s.forceMount;Bo(()=>{if(!u)return l.item(a,s==null?void 0:s.id)},[u]);let d=BI(a,i,[e.value,e.children,i],e.keywords),f=ej(),m=zo(_=>_.value&&_.value===d.current),p=zo(_=>u||l.filter()===!1?!0:_.search?_.filtered.items.get(a)>0:!0);h.useEffect(()=>{let _=i.current;if(!(!_||e.disabled))return _.addEventListener(Sx,y),()=>_.removeEventListener(Sx,y)},[p,e.onSelect,e.disabled]);function y(){var _,N;v(),(N=(_=c.current).onSelect)==null||N.call(_,d.current)}function v(){f.setState("value",d.current,!0)}if(!p)return null;let{disabled:g,value:x,onSelect:b,forceMount:j,keywords:w,...S}=e;return h.createElement(Fn.div,{ref:ku([i,t]),...S,id:a,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!m,"data-disabled":!!g,"data-selected":!!m,onPointerMove:g||l.disablePointerSelection?void 0:v,onClick:g?void 0:y},e.children)}),nre=h.forwardRef((e,t)=>
538{let{heading:r,children:n,forceMount:a,...i}=e,s=h.useId(),l=h.useRef(null),c=h.useRef(null),u=h.useId(),d=zd(),f=zo(p=>a||d.filter()===!1?!0:p.search?p.filtered.groups.has(s):!0);Bo(()=>d.group(s),[]),BI(s,l,[e.value,e.heading,c]);let m=h.useMemo(()=>({id:s,forceMount:a}),[a]);return h.createElement(Fn.div,{ref:ku([l,t]),...i,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},r&&h.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},r),Xp(e,p=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?u:void 0},h.createElement(RI.Provider,{value:m},p))))}),are=h.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,a=h.useRef(null),i=zo(s=>!s.search);return!r&&!i?null:h.createElement(Fn.div,{ref:ku([a,t]),...n,"cmdk-separator":"",role:"separator"})}),ire=h.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,a=e.value!=null,i=ej(),s=zo(d=>d.search),l=zo(d=>d.value),c=zd(),u=h.useMemo(()=>{var d;let f=(d=c.listInnerRef.current)==null?void 0:d.querySelector(`${Jw}[${uo}="${encodeURIComponent(l)}"]`);return f==null?void 0:f.getAttribute("id")},[]);return h.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),h.createElement(Fn.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":u,id:c.inputId,type:"text",value:a?e.value:s,onChange:d=>{a||i.setState("search",d.target.value),r==null||r(d.target.value)}})}),ore=h.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...a}=e,i=h.useRef(null),s=h.useRef(null),l=zd();return h.useEffect(()=>{if(s.current&&i.current){let c=s.current,u=i.current,d,f=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let m=c.offsetHeight;u.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return f.observe(c),()=>{cancelAnimationFrame(d),f.unobserve(c)}}},[]),h.createElement(Fn.div,{ref:ku([i,t]),...a,"cmdk-list":"",role:"listbox","aria-label":n,id:l.listId},Xp(e,c=>h.createElement("div",{ref:ku([s,l.listInnerRef]),"cmdk-list-sizer":""},c)))}),sre=h.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:i,container:s,...l}=e;return h.createElement(Xte,{open:r,onOpenChange:n},h.createElement(Zte,{container:s},h.createElement(Qte,{"cmdk-overlay":"",className:a}),h.createElement(Jte,{"aria-label":e.label,"cmdk-dialog":"",className:i},h.createElement(LI,{ref:t,...l}))))}),lre=h.forwardRef((e,t)=>zo(r=>r.filtered.count===0)?h.createElement(Fn.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),cre=h.forwardRef((e,t)=>{let{progress:r,children:n,label:a="Loading...",...i}=e;return h.createElement(Fn.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Xp(e,s=>h.createElement("div",{"aria-hidden":!0},s)))}),Yr=Object.assign(LI,{List:ore,Item:rre,Input:ire,Group:nre,Separator:are,Dialog:sre,Empty:lre,Loading:cre});function ure(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function dre(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function FI(e){let t=h.useRef(e);return Bo(()=>{t.current=e}),t}var Bo=typeof window>"u"?h.useEffect:h.useLayoutEffect;function ws(e){let t=h.useRef();return t.current===void 0&&(t.current=e()),t}function ku(e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}function zo(e){let t=ej(),r=()=>e(t.snapshot());return h.useSyncExternalStore(t.subscribe,r,r)}function BI(e,t,r,n=[]){let a=h.useRef(),i=zd();return Bo(()=>{var s;let l=(()=>{var u;for(let d of r){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(u=d.current.textContent)==null?void 0:u.trim():a.current}})(),c=n.map(u=>u.trim());i.value(e,l,c),(s=t.current)==null||s.setAttribute(uo,l),a.current=l}),a}var fre=()=>{let[e,t]=h.useState(),r=ws(()=>new Map);return Bo(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,a)=>{r.current.set(n,a),t({})}};function mre(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Xp({asChild:e,children:t},r){return e&&h.isValidElement(t)?h.cloneElement(mre(t),{ref:t.ref},r(t.props.children)):r(t)}var hre={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const zI=h.forwardRef(({className:e,...t},r)=>o.jsx(Yr,{ref:r,className:oe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));
538zI.displayName=Yr.displayName;const qI=h.forwardRef(({className:e,...t},r)=>o.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[o.jsx(Ko,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),o.jsx(Yr.Input,{ref:r,className:oe("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));qI.displayName=Yr.Input.displayName;const UI=h.forwardRef(({className:e,...t},r)=>o.jsx(Yr.List,{ref:r,className:oe("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));UI.displayName=Yr.List.displayName;const WI=h.forwardRef((e,t)=>o.jsx(Yr.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));WI.displayName=Yr.Empty.displayName;const VI=h.forwardRef(({className:e,...t},r)=>o.jsx(Yr.Group,{ref:r,className:oe("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));VI.displayName=Yr.Group.displayName;const pre=h.forwardRef(({className:e,...t},r)=>o.jsx(Yr.Separator,{ref:r,className:oe("-mx-1 h-px bg-border",e),...t}));pre.displayName=Yr.Separator.displayName;const _x=h.forwardRef(({className:e,...t},r)=>o.jsx(Yr.Item,{ref:r,className:oe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),...t}));_x.displayName=Yr.Item.displayName;function tj(e){if(e.no_aplica)return"N/A";const t=[e.valor_min,e.valor_normal,e.valor_max].map(n=>n==null||n===""?"â":String(n));if(t.every(n=>n==="â"))return null;const r=e.unidad?` ${e.unidad}`:"";return`${t.join(" / ")}${r}`}function vre({open:e,onOpenChange:t,products:r,formularios:n,defaultProducto:a,defaultFormularioId:i}){const s=pn(),[l,c]=h.useState(a||""),[u,d]=h.useState(a||""),[f,m]=h.useState(!1),[p,y]=h.useState(i||""),[v,g]=h.useState([]);h.useEffect(()=>{e&&(c(a||""),d(a||""),m(!1),y(i||""))},[e,a,i]);const x=h.useMemo(()=>{const T=u.trim().toLowerCase();return T?r.filter(k=>k.toLowerCase().includes(T)):r},[r,u]),{data:b=[],isLoading:j}=lt({queryKey:["bulk-campos",p],queryFn:async()=>{if(!p)return[];const{data:T,error:k}=await B.from("formulario_campos").select("id, etiqueta, orden").eq("formulario_id",p).order("orden");if(k)throw k;return T},enabled:!!p}),{data:w=[],isLoading:S}=lt({queryKey:["bulk-existing-guides",l,p],queryFn:async()=>{if(!l||!p)return[];const{data:T,error:k}=await B.from("guias_producto").select("*").eq("producto",l).eq("formulario_id",p);if(k)throw k;return T},enabled:!!l&&!!p}),_=h.useMemo(()=>b.map(T=>T.id).join(","),[b]),N=h.useMemo(()=>w.map(T=>T.id||T.campo_id).join(","),[w]);h.useEffect(()=>{if(!b.length){g([]);return}const T=new Map;w.forEach(k=>{k.campo_id&&T.set(k.campo_id,k)}),g(b.map(k=>{const D=T.get(k.id);return{campo_id:k.id,campo_etiqueta:k.etiqueta,valor_min:(D==null?void 0:D.valor_min)!=null?String(D.valor_min):"",valor_normal:(D==null?void 0:D.valor_normal)!=null?String(D.valor_normal):"",valor_max:(D==null?void 0:D.valor_max)!=null?String(D.valor_max):"",unidad:(D==null?void 0:D.unidad)||"",no_aplica:!!(D!=null&&D.no_aplica),imagen_referencia_url:(D==null?void 0:D.imagen_referencia_url)||"",imagen_pending:null,instrucciones:(D==null?void 0:D.instrucciones)||"",existing_id:D==null?void 0:D.id}}))},[_,N]);const E=h.useMemo(()=>v.filter(T=>T.no_aplica||T.instrucciones.trim()||T.valor_min!==""||T.valor_normal!==""||T.valor_max!=="").length,[v]),O=(T,k)=>{g(D=>D.map((M,F)=>F===T?{...M,...k}:M))},P=async(T,k,D)=>{const M=T.name.split(".").pop()||"jpg",q=`${k.replace(/[^a-zA-Z0-9_-]/g,"_")}/${D}-${Date.now()}.${M}`,{error:I}=await B.storage.from("guias-imagenes").upload(q,T,{upsert:!0,contentType:T.type});
538if(I)throw I;const{data:K}=B.storage.from("guias-imagenes").getPublicUrl(q);return K.publicUrl},C=Ir({mutationFn:async()=>{const T=[];for(const D of v){if(!(D.no_aplica||D.instrucciones.trim()||D.valor_min!==""||D.valor_normal!==""||D.valor_max!==""))continue;let F=D.imagen_referencia_url||null;D.no_aplica&&D.imagen_pending&&(F=await P(D.imagen_pending,l,D.campo_id)),D.no_aplica||(F=null);const q=R=>R===""?null:Number(R),I=D.no_aplica?null:q(D.valor_min),K=D.no_aplica?null:q(D.valor_normal),W=D.no_aplica?null:q(D.valor_max);T.push({producto:l,formulario_id:p,campo_id:D.campo_id,campo_etiqueta:D.campo_etiqueta,valor_min:I,valor_normal:K,valor_max:W,unidad:D.no_aplica?null:D.unidad.trim()||null,no_aplica:D.no_aplica,imagen_referencia_url:F,instrucciones:D.instrucciones.trim()||null,valor_referencia:tj({no_aplica:D.no_aplica,valor_min:I,valor_normal:K,valor_max:W,unidad:D.unidad})})}const k=v.filter(D=>D.existing_id&&!(D.no_aplica||D.instrucciones.trim()||D.valor_min!==""||D.valor_normal!==""||D.valor_max!=="")).map(D=>D.existing_id);if(T.length){const{error:D}=await B.from("guias_producto").upsert(T,{onConflict:"producto,formulario_id,campo_id"});if(D)throw D}if(k.length){const{error:D}=await B.from("guias_producto").delete().in("id",k);if(D)throw D}return{saved:T.length,deleted:k.length}},onSuccess:T=>{s.invalidateQueries({queryKey:["guias-producto-admin"]}),s.invalidateQueries({queryKey:["bulk-existing-guides"]}),Z.success(`Guardadas ${T.saved}, eliminadas ${T.deleted}`),t(!1)},onError:T=>Z.error("Error: "+T.message)}),A=!!l&&!!p;return o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsxs(It,{className:"max-w-6xl max-h-[90vh] flex flex-col",children:[o.jsx(Ut,{children:o.jsx(Wt,{children:"Editor masivo de guÃas por formulario"})}),o.jsxs("div",{className:"grid grid-cols-2 gap-4 flex-shrink-0",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ne,{children:"Producto *"}),o.jsx(we,{value:u,onChange:T=>{const k=T.target.value;d(k),c(r.includes(k)?k:""),m(!0)},onFocus:()=>m(!0),placeholder:"Buscar producto...",autoComplete:"off"}),f&&o.jsx("div",{className:"absolute left-0 right-0 top-full z-50 mt-1 max-h-64 overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md",children:x.length===0?o.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Sin resultados."}):x.map(T=>o.jsx("button",{type:"button",onMouseDown:k=>k.preventDefault(),onClick:()=>{c(T),d(T),m(!1)},className:"block w-full rounded-sm px-3 py-2 text-left text-sm hover:bg-accent hover:text-accent-foreground",children:T},T))})]}),o.jsxs("div",{children:[o.jsx(ne,{children:"Formulario *"}),o.jsxs(jt,{value:p,onValueChange:y,children:[o.jsx(xt,{children:o.jsx(St,{placeholder:"Seleccionar formulario"})}),o.jsx(bt,{children:n.map(T=>o.jsx($e,{value:T.id,children:T.nombre},T.id))})]})]})]}),A&&o.jsxs("div",{className:"flex items-center justify-between flex-shrink-0",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Define mÃn/normal/máx o marca N/A para subir una imagen de referencia."}),o.jsxs(ke,{variant:"secondary",children:[E," / ",v.length," con guÃa"]})]}),o.jsx("div",{className:"flex-1 min-h-0 border rounded-md",children:A?j||S?o.jsx("div",{className:"p-8 flex justify-center",children:o.jsx(ye,{className:"h-6 w-6 animate-spin"})}):v.length===0?o.jsx("div",{className:"p-8 text-center text-muted-foreground text-sm",children:"Este formulario no tiene campos."}):o.jsx(Yo,{className:"h-[60vh]",children:o.jsxs("table",{className:"w-full text-sm",children:[o.jsx("thead",{className:"sticky top-0 bg-muted z-10",children:o.jsxs("tr",{children:[o.jsx("th",{className:"text-left p-2 w-[20%]",children:"Campo"}),o.jsx("th",{className:"text-left p-2 w-[40%]",children:"Valor de referencia"}),o.jsx("th",{className:"text-left p-2",children:"Instrucciones"})]})}),o.jsx("tbody",{children:v.map((T,k)=>o.jsxs("tr",{className:"border-t align-top",children:[o.jsx("td",{className:"p-2 font-medium",children:T.campo_etiqueta}),o.jsx("td",{className:"p-2",children:o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ja,{id:`na-${T.campo_id}`,checked:T.no_aplica,onCheckedChange:D=>O(k,{no_aplica:!!D})}),o.jsx("label",{htmlFor:`na-${T.campo_id}`,className:"text-xs cursor-pointer",children:"N/A (no aplica valor â usar imagen)"})]}),T.no_aplica?o.jsxs("div",{className:"space-y-1",children:[(T.imagen_pending||T.imagen_referencia_url)&&o.jsxs("div",{className:"relative inline-block",children:[o.jsx("img",{src:T.imagen_pending?URL.createObjectURL(T.imagen_pending):T.imagen_referencia_url,alt:"ref",className:"h-16 rounded border object-cover"}),o.jsx("button",{type:"button",onClick:()=>O(k,{imagen_pending:null,imagen_referencia_url:""}),className:"absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-0.5",children:o.jsx(_r,{className:"h-3 w-3"})})]}),o.jsxs("label",{className:"flex items-center gap-1 text-xs cursor-pointer text-primary hover:underline",children:[o.jsx(ou,{className:"h-3 w-3"}),T.imagen_pending||T.imagen_referencia_url?"Reemplazar imagen":"Subir imagen",o.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:D=>{var F;const M=(F=D.target.files)==null?void 0:F[0];M&&O(k,{imagen_pending:M})}})]})]}):o.jsxs("div",{className:"grid grid-cols-4 gap-1",children:[o.jsx(we,{type:"number",step:"any",value:T.valor_min,onChange:D=>O(k,{valor_min:D.target.value}),placeholder:"MÃn",className:"h-8 text-xs"}),o.jsx(we,{type:"number",step:"any",value:T.valor_normal,onChange:D=>O(k,{valor_normal:D.target.value}),placeholder:"Normal",className:"h-8 text-xs"}),o.jsx(we,{type:"number",step:"any",value:T.valor_max,onChange:D=>O(k,{valor_max:D.target.value}),placeholder:"Máx",className:"h-8 text-xs"}),o.jsx(we,{value:T.unidad,onChange:D=>O(k,{unidad:D.target.value}),placeholder:"Unidad",className:"h-8 text-xs"})]})]})}),o.jsx("td",{className:"p-2",children:o.jsx(Kt,{value:T.instrucciones,onChange:D=>O(k,{instrucciones:D.target.value}),rows:2,placeholder:"Instrucciones..."})})]},T.campo_id))})]})}):o.jsx("div",{className:"p-8 text-center text-muted-foreground text-sm",children:"Selecciona producto y formulario para empezar."})}),o.jsxs(dr,{className:"flex-shrink-0",children:[o.jsx(z,{variant:"outline",onClick:()=>t(!1),children:"Cancelar"}),o.jsxs(z,{onClick:()=>C.mutate(),disabled:!A||C.isPending||v.length===0,children:[C.isPending?o.jsx(ye,{className:"h-4 w-4 mr-1 animate-spin"}):o.jsx(np,{className:"h-4 w-4 mr-1"}),"Guardar todo"]})]})]})})}function gre(e){if(e==null)return"";const t=String(e);return/[",\n\r]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function yre(e,t){if(!e.length&&!t)return"";const r=t??Object.keys(e[0]??{}),n=[r.join(",")];for(const a of e)n.push(r.map(i=>gre(a[i])).join(","));return n.join(` 539`)}function xre(e,t){const r=new Blob(["\uFEFF"+t],{type:"text/csv;charset=utf-8;"}),n=URL.createObjectURL(r),a=document.createElement("a");a.href=n,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(n)}function bre(e){e.charCodeAt(0)===65279&&(e=e.slice(1));const t=[];let r=[],n="",a=!1;for(let l=0;l<e.length;l++){const c=e[l];a?c==='"'?e[l+1]==='"'?(n+='"',l++):a=!1:n+=c:c==='"'?a=!0:c===","?(r.push(n),n=""):c===` 540`?(r.push(n),t.push(r),r=[],n=""):c==="\r"||(n+=c)}(n.length>0||r.length>0)&&(r.push(n),t.push(r));const i=t.filter(l=>l.length>0&&!(l.length===1&&l[0]==="")&&!(l[0]??"").startsWith("#"));if(i.length===0)return[];
540const s=i[0].map(l=>l.trim());return i.slice(1).map(l=>{const c={};return s.forEach((u,d)=>{c[u]=(l[d]??"").trim()}),c})}const wre=e=>/^(true|1|si|sÃ|yes)$/i.test((e||"").trim()),zg=e=>{const t=(e||"").trim();if(t==="")return null;const r=Number(t);return Number.isFinite(r)?r:NaN};function jre({open:e,onOpenChange:t,products:r,formularios:n,campos:a}){const i=pn(),[s,l]=h.useState([]),[c,u]=h.useState(""),d=async y=>{u(y.name);const v=await y.text(),g=bre(v),x=new Set(r),b=new Map(n.map(S=>[S.id,S])),j=new Map(a.map(S=>[S.id,S])),w=g.map(S=>{var F;const _=(S.producto||"").trim(),N=(S.formulario_id||"").trim(),E=(S.campo_id||"").trim(),O=wre(S.no_aplica||""),P=zg(S.valor_min||""),C=zg(S.valor_normal||""),A=zg(S.valor_max||""),T=(S.unidad||"").trim(),k=(S.imagen_referencia_url||"").trim(),D=(S.instrucciones||"").trim();let M;if(!_)M="Falta producto";else if(!x.has(_))M=`Producto no existe: ${_}`;else if(!N)M="Falta formulario_id";else if(!b.has(N))M="formulario_id inválido";else if(!E)M="Falta campo_id";else{const q=j.get(E);q?q.formulario_id!==N?M="campo no pertenece al formulario":Number.isNaN(P)||Number.isNaN(C)||Number.isNaN(A)?M="valor numérico inválido":!O&&P===null&&C===null&&A===null&&!D&&(M="sin valores ni instrucciones (use no_aplica=true para imagen)"):M="campo_id inválido"}return{raw:S,producto:_,formulario_id:N,campo_id:E,campo_etiqueta:((F=j.get(E))==null?void 0:F.etiqueta)||"",valor_min:O?null:P,valor_normal:O?null:C,valor_max:O?null:A,unidad:O?"":T,no_aplica:O,imagen_referencia_url:O?k:"",instrucciones:D,error:M}});l(w)},f=s.filter(y=>!y.error),m=s.filter(y=>y.error),p=Ir({mutationFn:async()=>{const y=f.map(g=>({producto:g.producto,formulario_id:g.formulario_id,campo_id:g.campo_id,campo_etiqueta:g.campo_etiqueta,valor_min:g.valor_min,valor_normal:g.valor_normal,valor_max:g.valor_max,unidad:g.unidad||null,no_aplica:g.no_aplica,imagen_referencia_url:g.imagen_referencia_url||null,instrucciones:g.instrucciones||null,valor_referencia:tj({no_aplica:g.no_aplica,valor_min:g.valor_min,valor_normal:g.valor_normal,valor_max:g.valor_max,unidad:g.unidad})}));if(!y.length)return 0;const{error:v}=await B.from("guias_producto").upsert(y,{onConflict:"producto,formulario_id,campo_id"});if(v)throw v;return y.length},onSuccess:y=>{i.invalidateQueries({queryKey:["guias-producto-admin"]}),Z.success(`Se importaron ${y} guÃas`),l([]),u(""),t(!1)},onError:y=>Z.error("Error: "+y.message)});return o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsxs(It,{className:"max-w-3xl max-h-[90vh] flex flex-col",children:[o.jsx(Ut,{children:o.jsx(Wt,{children:"Importar guÃas desde CSV"})}),o.jsxs("div",{className:"flex-shrink-0 space-y-2",children:[o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Columnas: ",o.jsx("code",{children:"producto, formulario_id, campo_id, valor_min, valor_normal, valor_max, unidad, no_aplica, imagen_referencia_url, instrucciones"}),". Filas que comienzan con ",o.jsx("code",{children:"#"})," se ignoran."]}),o.jsxs("label",{className:"flex items-center gap-2 border rounded-md p-3 cursor-pointer hover:bg-muted",children:[o.jsx(ou,{className:"h-4 w-4"}),o.jsx("span",{className:"text-sm",children:c||"Seleccionar archivo CSV"}),o.jsx("input",{type:"file",accept:".csv,text/csv",className:"hidden",onChange:y=>{var g;const v=(g=y.target.files)==null?void 0:g[0];v&&d(v)}})]}),s.length>0&&o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(ke,{variant:"secondary",children:["Total: ",s.length]}),o.jsxs(ke,{className:"bg-green-600 text-white",children:["Válidas: ",f.length]}),m.length>0&&o.jsxs(ke,{variant:"destructive",children:["Errores: ",m.length]})]})]}),s.length>0&&o.jsx("div",{className:"flex-1 min-h-0 border rounded-md",children:o.jsx(Yo,{className:"h-[50vh]",children:o.jsxs("table",{className:"w-full text-xs",children:[o.jsx("thead",{className:"sticky top-0 bg-muted",children:o.jsxs("tr",{children:[o.jsx("th",{className:"text-left p-2",children:"#"}),o.jsx("th",{className:"text-left p-2",children:"Producto"}),o.jsx("th",{className:"text-left p-2",children:"Campo"}),o.jsx("th",{className:"text-left p-2",children:"Valores"}),o.jsx("th",{className:"text-left p-2",children:"Estado"})]})}),o.jsx("tbody",{children:s.map((y,v)=>o.jsxs("tr",{className:"border-t",children:[o.jsx("td",{className:"p-2",children:v+1}),o.jsx("td",{className:"p-2",children:y.producto}),o.jsx("td",{className:"p-2",children:y.campo_etiqueta||y.campo_id}),o.jsx("td",{className:"p-2 font-mono",children:y.no_aplica?"N/A":`${y.valor_min??"â"} / ${y.valor_normal??"â"} / ${y.valor_max??"â"} ${y.unidad}`}),o.jsx("td",{className:"p-2",children:y.error?o.jsx("span",{className:"text-destructive",children:y.error}):o.jsx("span",{className:"text-green-600",children:"OK"})})]},v))})]})})}),o.jsxs(dr,{className:"flex-shrink-0",children:[o.jsx(z,{variant:"outline",onClick:()=>t(!1),children:"Cancelar"}),o.jsxs(z,{onClick:()=>p.mutate(),disabled:!f.length||p.isPending,children:[p.isPending&&o.jsx(ye,{className:"h-4 w-4 mr-1 animate-spin"}),"Importar ",f.length," válidas"]})]})]})})}function Sre(){const e=pn(),[t,r]=h.useState(""),[n,a]=h.useState(""),[i,s]=h.useState(!1),[l,c]=h.useState(null),[u,d]=h.useState(!1),[f,m]=h.useState({}),[p,y]=h.useState(!1),[v,g]=h.useState({producto:"",formulario_id:"",campo_id:"",campo_etiqueta:"",valor_min:"",valor_normal:"",valor_max:"",unidad:"",no_aplica:!1,imagen_referencia_url:"",imagen_pending:null,instrucciones:""}),{data:x=[]}=lt({queryKey:["distinct-products"],queryFn:async()=>{const{data:C,error:A}=await B.rpc("get_distinct_productos_resultantes");if(A)throw A;return(C??[]).map(T=>
540T.producto_resultante).filter(Boolean)},staleTime:15*60*1e3}),{data:b=[]}=lt({queryKey:["formularios-list"],queryFn:async()=>{const{data:C,error:A}=await B.from("formularios").select("id, nombre").order("nombre");if(A)throw A;return C},staleTime:10*60*1e3}),{data:j=[]}=lt({queryKey:["form-fields-by-form",v.formulario_id],queryFn:async()=>{if(!v.formulario_id)return[];const{data:C,error:A}=await B.from("formulario_campos").select("id, etiqueta, formulario_id").eq("formulario_id",v.formulario_id).order("orden");if(A)throw A;return C},enabled:!!v.formulario_id,staleTime:10*60*1e3});lt({queryKey:["form-fields-by-form",n],queryFn:async()=>{if(!n)return[];const{data:C,error:A}=await B.from("formulario_campos").select("id, etiqueta, formulario_id").eq("formulario_id",n).order("orden");if(A)throw A;return C},enabled:!!n,staleTime:10*60*1e3});const{data:w=[]}=lt({queryKey:["all-formulario-campos"],queryFn:async()=>{const{data:C,error:A}=await B.from("formulario_campos").select("id, etiqueta, formulario_id");if(A)throw A;return C},staleTime:10*60*1e3}),{data:S=[],isLoading:_}=lt({queryKey:["guias-producto-admin",t,n],queryFn:async()=>{let C=B.from("guias_producto").select("*").order("campo_etiqueta");t&&t!=="__all__"&&(C=C.eq("producto",t)),n&&n!=="__all__"&&(C=C.eq("formulario_id",n));const{data:A,error:T}=await C;if(T)throw T;return A}}),N=Ir({mutationFn:async C=>{if(l){const{error:A}=await B.from("guias_producto").update(C).eq("id",l.id);if(A)throw A}else{const{error:A}=await B.from("guias_producto").insert(C);if(A)throw A}},onSuccess:()=>{e.invalidateQueries({queryKey:["guias-producto-admin"]}),s(!1),c(null),Z.success(l?"GuÃa actualizada":"GuÃa creada")},onError:C=>Z.error("Error: "+C.message)});Ir({mutationFn:async C=>{const{error:A}=await B.from("guias_producto").delete().eq("id",C);if(A)throw A},onSuccess:()=>{e.invalidateQueries({queryKey:["guias-producto-admin"]}),Z.success("GuÃa eliminada")},onError:C=>Z.error("Error: "+C.message)});const E=async()=>{if(!v.producto){Z.error("Seleccione un producto");return}if(!v.formulario_id){Z.error("Seleccione un formulario");return}let C=v.imagen_referencia_url||null;if(v.no_aplica&&v.imagen_pending){const M=v.imagen_pending,F=M.name.split(".").pop()||"jpg",I=`${v.producto.replace(/[^a-zA-Z0-9_-]/g,"_")}/${v.campo_id||"general"}-${Date.now()}.${F}`,{error:K}=await B.storage.from("guias-imagenes").upload(I,M,{upsert:!0,contentType:M.type});if(K){Z.error("Error subiendo imagen: "+K.message);return}C=B.storage.from("guias-imagenes").getPublicUrl(I).data.publicUrl}v.no_aplica||(C=null);const A=M=>M===""?null:Number(M),T=v.no_aplica?null:A(v.valor_min),k=v.no_aplica?null:A(v.valor_normal),D=v.no_aplica?null:A(v.valor_max);N.mutate({producto:v.producto,formulario_id:v.formulario_id||null,campo_id:v.campo_id||null,campo_etiqueta:v.campo_etiqueta||null,valor_min:T,valor_normal:k,valor_max:D,unidad:v.no_aplica?null:v.unidad||null,no_aplica:v.no_aplica,imagen_referencia_url:C,instrucciones:v.instrucciones||null,valor_referencia:tj({no_aplica:v.no_aplica,valor_min:T,valor_normal:k,valor_max:D,unidad:v.unidad})})},O=C=>{const A=j.find(T=>T.id===C);g(T=>({...T,campo_id:C,campo_etiqueta:(A==null?void 0:A.etiqueta)||""}))},P=C=>{var A;return C?((A=b.find(T=>T.id===C))==null?void 0:A.nombre)||C:"-"};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[o.jsxs(R$,{children:[o.jsx(L$,{asChild:!0,children:o.jsxs(z,{variant:"outline",role:"combobox",className:"w-[260px] justify-between font-normal",children:[o.jsx("span",{className:"truncate",children:!t||t==="__all__"?"Todos los productos":t}),o.jsx(o3,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(Cw,{className:"w-[320px] p-0",align:"start",children:o.jsxs(zI,{children:[o.jsx(qI,{placeholder:"Buscar producto..."}),o.jsxs(UI,{children:[o.jsx(WI,{children:"Sin resultados."}),o.jsxs(VI,{children:[o.jsxs(_x,{value:"Todos los productos",onSelect:()=>r("__all__"),children:[o.jsx(iu,{className:`mr-2 h-4 w-4 ${!t||t==="__all__"?"opacity-100":"opacity-0"}`}),"Todos los productos"]}),x.map(C=>o.jsxs(_x,{value:C,onSelect:()=>r(C),children:[o.jsx(iu,{className:`mr-2 h-4 w-4 ${t===C?"opacity-100":"opacity-0"}`}),C]},C))]})]})]})})]}),o.jsxs(jt,{value:n,onValueChange:a,children:[o.jsx(xt,{className:"w-[240px]",children:o.jsx(St,{placeholder:"Filtrar por formulario..."})}),o.jsxs(bt,{children:[o.jsx($e,{value:"__all__",children:"Todos los formularios"}),b.map(C=>o.jsx($e,{value:C.id,children:C.nombre},C.id))]})]}),o.jsxs(z,{onClick:()=>d(!0),size:"sm",children:[o.jsx(v3,{className:"h-4 w-4 mr-1"})," Nueva GuÃa (por formulario)"]}),o.jsxs(z,{variant:"outline",size:"sm",onClick:()=>{const C=new Map(b.map(k=>[k.id,k.nombre])),A=S.map(k=>({producto:k.producto,formulario_nombre:C.get(k.formulario_id)||"",formulario_id:k.formulario_id||"",campo_etiqueta:k.campo_etiqueta||"",campo_id:k.campo_id||"",valor_min:k.valor_min??"",valor_normal:k.valor_normal??"",valor_max:k.valor_max??"",unidad:k.unidad||"",no_aplica:k.no_aplica?"true":"false",imagen_referencia_url:k.imagen_referencia_url||"",instrucciones:k.instrucciones||""})),T=yre(A,["producto","formulario_nombre","formulario_id","campo_etiqueta","campo_id","valor_min","valor_normal","valor_max","unidad","no_aplica","imagen_referencia_url","instrucciones"]);
540xre(`guias-producto-${new Date().toISOString().slice(0,10)}.csv`,T)},children:[o.jsx(dA,{className:"h-4 w-4 mr-1"})," Exportar CSV"]}),o.jsxs(z,{variant:"outline",size:"sm",onClick:async()=>{var I,K,W,R;const C=await vB(()=>import("./xlsx-B6sNpj_1.js"),[]),A=new Map(b.map(V=>[V.id,V.nombre])),T=[{producto:"EJEMPLO PRODUCTO",formulario_id:((I=b[0])==null?void 0:I.id)||"<formulario_id>",campo_id:((K=w[0])==null?void 0:K.id)||"<campo_id>",valor_min:22,valor_normal:25,valor_max:28,unidad:"°C",no_aplica:"false",imagen_referencia_url:"",instrucciones:"Mantener entre los valores de referencia"},{producto:"EJEMPLO PRODUCTO",formulario_id:((W=b[0])==null?void 0:W.id)||"<formulario_id>",campo_id:((R=w[0])==null?void 0:R.id)||"<campo_id>",valor_min:"",valor_normal:"",valor_max:"",unidad:"",no_aplica:"true",imagen_referencia_url:"https://ejemplo.com/ref.jpg",instrucciones:"Comparar visualmente con la imagen"}],k=C.utils.json_to_sheet(T,{header:["producto","formulario_id","campo_id","valor_min","valor_normal","valor_max","unidad","no_aplica","imagen_referencia_url","instrucciones"]});k["!cols"]=[{wch:25},{wch:38},{wch:38},{wch:10},{wch:12},{wch:10},{wch:10},{wch:10},{wch:35},{wch:40}];const D=C.utils.json_to_sheet(x.map(V=>({producto:V})));D["!cols"]=[{wch:50}];const M=C.utils.json_to_sheet(b.map(V=>({formulario_id:V.id,nombre:V.nombre})));M["!cols"]=[{wch:38},{wch:50}];const F=C.utils.json_to_sheet(w.map(V=>({campo_id:V.id,etiqueta:V.etiqueta,formulario_id:V.formulario_id,formulario_nombre:A.get(V.formulario_id)||""})));F["!cols"]=[{wch:38},{wch:35},{wch:38},{wch:35}];const q=C.utils.book_new();C.utils.book_append_sheet(q,k,"Plantilla"),C.utils.book_append_sheet(q,D,"Productos"),C.utils.book_append_sheet(q,M,"Formularios"),C.utils.book_append_sheet(q,F,"Campos"),C.writeFile(q,"plantilla-guias-producto.xlsx")},children:[o.jsx(d3,{className:"h-4 w-4 mr-1"})," Descargar plantilla"]}),o.jsxs(z,{variant:"outline",size:"sm",onClick:()=>y(!0),children:[o.jsx(ou,{className:"h-4 w-4 mr-1"})," Importar CSV"]})]}),_?o.jsx("div",{className:"flex justify-center py-8",children:o.jsx(ye,{className:"h-6 w-6 animate-spin"})}):S.length===0?o.jsxs("p",{className:"text-muted-foreground text-center py-8",children:["No hay guÃas registradas",t&&t!=="__all__"?` para "${t}"`:"","."]}):o.jsx("div",{className:"rounded-md border",children:o.jsxs(yn,{children:[o.jsx(xn,{children:o.jsxs(Nt,{children:[o.jsx(Pe,{children:"Producto"}),o.jsx(Pe,{children:"Formulario"}),o.jsx(Pe,{className:"text-center",children:"Campos configurados"}),o.jsx(Pe,{children:"Resumen"}),o.jsx(Pe,{className:"w-[140px]",children:"Acciones"})]})}),o.jsx(bn,{children:(()=>{const C=new Map;return S.forEach(T=>{const k=`${T.producto}::${T.formulario_id||""}`;C.has(k)||C.set(k,{producto:T.producto,formulario_id:T.formulario_id,items:[]}),C.get(k).items.push(T)}),Array.from(C.values()).sort((T,k)=>(T.producto||"").localeCompare(k.producto||"")||P(T.formulario_id).localeCompare(P(k.formulario_id))).map(T=>{const k=T.items.length,D=T.items.filter(W=>W.no_aplica).length,M=k-D,F=T.items.slice(0,3).map(W=>W.campo_etiqueta||W.campo_id).filter(Boolean).join(", "),q=k>3?k-3:0,I=()=>{if(!T.formulario_id){Z.error("Esta guÃa no tiene formulario asociado.");return}m({producto:T.producto,formularioId:T.formulario_id}),d(!0)},K=async()=>{if(!confirm(`¿Eliminar las ${k} guÃa(s) de "${T.producto}" en "${P(T.formulario_id)}"?`))return;const W=T.items.map(V=>V.id),{error:R}=await B.from("guias_producto").delete().in("id",W);if(R){Z.error("Error al eliminar: "+R.message);return}
540Z.success("GuÃas eliminadas"),e.invalidateQueries({queryKey:["guias-producto-admin"]})};return o.jsxs(Nt,{className:"cursor-pointer hover:bg-muted/50",onClick:I,children:[o.jsx(Oe,{children:o.jsx(ke,{variant:"outline",children:T.producto})}),o.jsx(Oe,{className:"text-sm font-medium",children:P(T.formulario_id)}),o.jsx(Oe,{className:"text-center",children:o.jsxs("div",{className:"flex items-center justify-center gap-1",children:[o.jsxs(ke,{variant:"secondary",children:[k," campo",k!==1?"s":""]}),D>0&&o.jsxs(ke,{variant:"outline",className:"text-xs",children:[D," N/A"]}),M>0&&o.jsxs(ke,{variant:"outline",className:"text-xs",children:[M," num."]})]})}),o.jsxs(Oe,{className:"max-w-[300px] truncate text-xs text-muted-foreground",children:[F,q>0?` +${q} más`:""]}),o.jsx(Oe,{onClick:W=>W.stopPropagation(),children:o.jsxs("div",{className:"flex gap-1",children:[o.jsxs(z,{variant:"ghost",size:"sm",onClick:I,children:[o.jsx(h0,{className:"h-4 w-4 mr-1"})," Editar"]}),o.jsx(z,{variant:"ghost",size:"icon",onClick:K,children:o.jsx(Gi,{className:"h-4 w-4 text-destructive"})})]})})]},`${T.producto}-${T.formulario_id}`)})})()})]})}),o.jsx(Ft,{open:i,onOpenChange:s,children:o.jsxs(It,{className:"max-w-lg",children:[o.jsx(Ut,{children:o.jsx(Wt,{children:l?"Editar GuÃa":"Nueva GuÃa de Producto"})}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx(ne,{children:"Producto *"}),o.jsxs(jt,{value:v.producto,onValueChange:C=>g(A=>({...A,producto:C})),children:[o.jsx(xt,{children:o.jsx(St,{placeholder:"Seleccionar producto"})}),o.jsx(bt,{children:x.map(C=>o.jsx($e,{value:C,children:C},C))})]})]}),o.jsxs("div",{children:[o.jsx(ne,{children:"Formulario *"}),o.jsxs(jt,{value:v.formulario_id,onValueChange:C=>g(A=>({...A,formulario_id:C,campo_id:"",campo_etiqueta:""})),children:[o.jsx(xt,{children:o.jsx(St,{placeholder:"Seleccionar formulario"})}),o.jsx(bt,{children:b.map(C=>o.jsx($e,{value:C.id,children:C.nombre},C.id))})]})]}),o.jsxs("div",{children:[o.jsx(ne,{children:"Campo del formulario"}),o.jsxs(jt,{value:v.campo_id,onValueChange:O,disabled:!v.formulario_id,children:[o.jsx(xt,{children:o.jsx(St,{placeholder:v.formulario_id?"Seleccionar campo...":"Primero seleccione un formulario"})}),o.jsx(bt,{children:j.map(C=>o.jsx($e,{value:C.id,children:C.etiqueta},C.id))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ja,{id:"dlg-na",checked:v.no_aplica,onCheckedChange:C=>g(A=>({...A,no_aplica:!!C}))}),o.jsx("label",{htmlFor:"dlg-na",className:"text-sm cursor-pointer",children:"N/A â no aplica valor numérico (subir imagen de referencia)"})]}),v.no_aplica?o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Imagen de referencia"}),(v.imagen_pending||v.imagen_referencia_url)&&o.jsxs("div",{className:"relative inline-block",children:[o.jsx("img",{src:v.imagen_pending?URL.createObjectURL(v.imagen_pending):v.imagen_referencia_url,alt:"ref",className:"h-24 rounded border object-cover"}),o.jsx("button",{type:"button",onClick:()=>g(C=>({...C,imagen_pending:null,imagen_referencia_url:""})),className:"absolute -top-2 -right-2 bg-destructive text-destructive-foreground rounded-full p-1",children:o.jsx(_r,{className:"h-3 w-3"})})]}),o.jsxs("label",{className:"flex items-center gap-2 border rounded-md p-2 cursor-pointer hover:bg-muted text-sm w-fit",children:[o.jsx(ou,{className:"h-4 w-4"}),v.imagen_pending||v.imagen_referencia_url?"Reemplazar imagen":"Subir imagen",o.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:C=>{var T;const A=(T=C.target.files)==null?void 0:T[0];A&&g(k=>({...k,imagen_pending:A}))}})]})]}):o.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[o.jsxs("div",{children:[o.jsx(ne,{className:"text-xs",children:"MÃn"}),o.jsx(we,{type:"number",step:"any",value:v.valor_min,onChange:C=>g(A=>({...A,valor_min:C.target.value}))})]}),o.jsxs("div",{children:[o.jsx(ne,{className:"text-xs",children:"Normal"}),o.jsx(we,{type:"number",step:"any",value:v.valor_normal,onChange:C=>g(A=>({...A,valor_normal:C.target.value}))})]}),o.jsxs("div",{children:[o.jsx(ne,{className:"text-xs",children:"Máx"}),o.jsx(we,{type:"number",step:"any",value:v.valor_max,onChange:C=>g(A=>({...A,valor_max:C.target.value}))})]}),o.jsxs("div",{children:[o.jsx(ne,{className:"text-xs",children:"Unidad"}),o.jsx(we,{value:v.unidad,onChange:C=>g(A=>({...A,unidad:C.target.value})),placeholder:"°C"})]})]})]}),o.jsxs("div",{children:[o.jsx(ne,{children:"Instrucciones"}),o.jsx(Kt,{value:v.instrucciones,onChange:C=>g(A=>({...A,instrucciones:C.target.value})),placeholder:"Instrucciones detalladas...",rows:3})]})]}),o.jsxs(dr,{children:[o.jsx(z,{variant:"outline",onClick:()=>s(!1),children:"Cancelar"}),o.jsxs(z,{onClick:E,disabled:N.isPending,children:[N.isPending&&o.jsx(ye,{className:"h-4 w-4 mr-1 animate-spin"}),l?"Actualizar":"Crear"]})]})]})}),o.jsx(vre,{open:u,onOpenChange:C=>{d(C),C||m({})},products:x,formularios:b,defaultProducto:f.producto??(t&&t!=="__all__"?t:void 0),defaultFormularioId:f.formularioId??(n&&n!=="__all__"?n:void 0)}),o.jsx(jre,{open:p,onOpenChange:y,products:x,formularios:b,campos:w})]})}function _re(){const e=pn(),[t,r]=h.useState(!1),[n,a]=h.useState(null),[i,s]=h.useState({termino:"",definicion:"",categoria:""}),[l,c]=h.useState(""),{data:u=[],isLoading:d}=lt({queryKey:["glosario-admin"],queryFn:async()=>{const{data:x,error:b}=await B.from("glosario_terminos").select("*").order("termino");if(b)throw b;return x}}),f=l?u.filter(x=>x.termino.toLowerCase().includes(l.toLowerCase())||x.definicion.toLowerCase().includes(l.toLowerCase())):u,m=Ir({mutationFn:async x=>{if(n){const{error:b}=await B.from("glosario_terminos").update(x).eq("id",n.id);if(b)throw b}else{const{error:b}=await B.from("glosario_terminos").insert(x);if(b)throw b}},onSuccess:()=>
540{e.invalidateQueries({queryKey:["glosario-admin"]}),e.invalidateQueries({queryKey:["glosario-terminos"]}),r(!1),a(null),Z.success(n?"Término actualizado":"Término creado")},onError:x=>Z.error("Error: "+x.message)}),p=Ir({mutationFn:async x=>{const{error:b}=await B.from("glosario_terminos").delete().eq("id",x);if(b)throw b},onSuccess:()=>{e.invalidateQueries({queryKey:["glosario-admin"]}),e.invalidateQueries({queryKey:["glosario-terminos"]}),Z.success("Término eliminado")},onError:x=>Z.error("Error: "+x.message)}),y=()=>{a(null),s({termino:"",definicion:"",categoria:""}),r(!0)},v=x=>{a(x),s({termino:x.termino,definicion:x.definicion,categoria:x.categoria||""}),r(!0)},g=()=>{if(!i.termino||!i.definicion){Z.error("Término y definición son obligatorios");return}m.mutate({termino:i.termino,definicion:i.definicion,categoria:i.categoria||null})};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[o.jsx(we,{value:l,onChange:x=>c(x.target.value),placeholder:"Buscar término...",className:"w-[280px]"}),o.jsxs(z,{onClick:y,size:"sm",children:[o.jsx(wa,{className:"h-4 w-4 mr-1"})," Nuevo Término"]})]}),d?o.jsx("div",{className:"flex justify-center py-8",children:o.jsx(ye,{className:"h-6 w-6 animate-spin"})}):f.length===0?o.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No hay términos en el glosario."}):o.jsx("div",{className:"rounded-md border",children:o.jsxs(yn,{children:[o.jsx(xn,{children:o.jsxs(Nt,{children:[o.jsx(Pe,{children:"Término"}),o.jsx(Pe,{children:"Definición"}),o.jsx(Pe,{children:"CategorÃa"}),o.jsx(Pe,{className:"w-[100px]",children:"Acciones"})]})}),o.jsx(bn,{children:f.map(x=>o.jsxs(Nt,{children:[o.jsx(Oe,{className:"font-medium",children:x.termino}),o.jsx(Oe,{className:"max-w-[400px]",children:x.definicion}),o.jsx(Oe,{children:x.categoria?o.jsx(ke,{variant:"secondary",children:x.categoria}):"-"}),o.jsx(Oe,{children:o.jsxs("div",{className:"flex gap-1",children:[o.jsx(z,{variant:"ghost",size:"icon",onClick:()=>v(x),children:o.jsx(h0,{className:"h-4 w-4"})}),o.jsx(z,{variant:"ghost",size:"icon",onClick:()=>p.mutate(x.id),children:o.jsx(Gi,{className:"h-4 w-4 text-destructive"})})]})})]},x.id))})]})}),o.jsx(Ft,{open:t,onOpenChange:r,children:o.jsxs(It,{children:[o.jsx(Ut,{children:o.jsx(Wt,{children:n?"Editar Término":"Nuevo Término"})}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx(ne,{children:"Término *"}),o.jsx(we,{value:i.termino,onChange:x=>s(b=>({...b,termino:x.target.value})),placeholder:"Ej: Humedad relativa"})]}),o.jsxs("div",{children:[o.jsx(ne,{children:"Definición *"}),o.jsx(Kt,{value:i.definicion,onChange:x=>s(b=>({...b,definicion:x.target.value})),placeholder:"Definición del término...",rows:3})]}),o.jsxs("div",{children:[o.jsx(ne,{children:"CategorÃa (opcional)"}),o.jsx(we,{value:i.categoria,onChange:x=>s(b=>({...b,categoria:x.target.value})),placeholder:"Ej: Calidad, Proceso"})]})]}),o.jsxs(dr,{children:[o.jsx(z,{variant:"outline",onClick:()=>r(!1),children:"Cancelar"}),o.jsxs(z,{onClick:g,disabled:m.isPending,children:[m.isPending&&o.jsx(ye,{className:"h-4 w-4 mr-1 animate-spin"}),n?"Actualizar":"Crear"]})]})]})})]})}function Nre(){const e=pn(),{areas:t}=Sw(),[r,n]=h.useState(!1),[a,i]=h.useState(null),[s,l]=h.useState({area:"",titulo:"",contenido:"",pagina_destino:"form_fill",orden:0,activo:!0}),{data:c=[],isLoading:u}=lt({queryKey:["manuales-admin"],queryFn:async()=>{const{data:g,error:x}=await B.from("manuales_area").select("*").order("area").order("orden");if(x)throw x;return g}}),d=Ir({mutationFn:async g=>{if(a){const{error:x}=await B.from("manuales_area").update(g).eq("id",a.id);if(x)throw x}else{const{error:x}=await B.from("manuales_area").insert(g);if(x)throw x}},onSuccess:()=>{e.invalidateQueries({queryKey:["manuales-admin"]}),e.invalidateQueries({queryKey:["manuales-area"]}),n(!1),i(null),Z.success(a?"Manual actualizado":"Manual creado")},onError:g=>Z.error("Error: "+g.message)}),f=Ir({mutationFn:async g=>{const{error:x}=await B.from("manuales_area").delete().eq("id",g);if(x)throw x},onSuccess:()=>
540{e.invalidateQueries({queryKey:["manuales-admin"]}),e.invalidateQueries({queryKey:["manuales-area"]}),Z.success("Manual eliminado")},onError:g=>Z.error("Error: "+g.message)}),m=()=>{i(null),l({area:"",titulo:"",contenido:"",pagina_destino:"form_fill",orden:0,activo:!0}),n(!0)},p=g=>{i(g),l({area:g.area,titulo:g.titulo,contenido:g.contenido,pagina_destino:g.pagina_destino,orden:g.orden,activo:g.activo}),n(!0)},y=()=>{if(!s.area||!s.titulo||!s.contenido){Z.error("Ãrea, tÃtulo y contenido son obligatorios");return}d.mutate(s)},v=[{value:"form_fill",label:"Llenado de formulario"},{value:"dashboard",label:"Dashboard"},{value:"preview",label:"Vista previa"}];return o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex justify-end",children:o.jsxs(z,{onClick:m,size:"sm",children:[o.jsx(wa,{className:"h-4 w-4 mr-1"})," Nuevo Manual"]})}),u?o.jsx("div",{className:"flex justify-center py-8",children:o.jsx(ye,{className:"h-6 w-6 animate-spin"})}):c.length===0?o.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No hay manuales registrados."}):o.jsx("div",{className:"rounded-md border",children:o.jsxs(yn,{children:[o.jsx(xn,{children:o.jsxs(Nt,{children:[o.jsx(Pe,{children:"Ãrea"}),o.jsx(Pe,{children:"TÃtulo"}),o.jsx(Pe,{children:"Página destino"}),o.jsx(Pe,{children:"Orden"}),o.jsx(Pe,{children:"Estado"}),o.jsx(Pe,{className:"w-[100px]",children:"Acciones"})]})}),o.jsx(bn,{children:c.map(g=>{var x;return o.jsxs(Nt,{children:[o.jsx(Oe,{children:o.jsx(ke,{variant:"outline",children:g.area})}),o.jsx(Oe,{className:"font-medium",children:g.titulo}),o.jsx(Oe,{children:((x=v.find(b=>b.value===g.pagina_destino))==null?void 0:x.label)||g.pagina_destino}),o.jsx(Oe,{children:g.orden}),o.jsx(Oe,{children:o.jsx(ke,{variant:g.activo?"default":"secondary",children:g.activo?"Activo":"Inactivo"})}),o.jsx(Oe,{children:o.jsxs("div",{className:"flex gap-1",children:[o.jsx(z,{variant:"ghost",size:"icon",onClick:()=>p(g),children:o.jsx(h0,{className:"h-4 w-4"})}),o.jsx(z,{variant:"ghost",size:"icon",onClick:()=>f.mutate(g.id),children:o.jsx(Gi,{className:"h-4 w-4 text-destructive"})})]})})]},g.id)})})]})}),o.jsx(Ft,{open:r,onOpenChange:n,children:o.jsxs(It,{className:"max-w-lg",children:[o.jsx(Ut,{children:o.jsx(Wt,{children:a?"Editar Manual":"Nuevo Manual de Ãrea"})}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx(ne,{children:"Ãrea *"}),o.jsxs(jt,{value:s.area,onValueChange:g=>l(x=>({...x,area:g})),children:[o.jsx(xt,{children:o.jsx(St,{placeholder:"Seleccionar área"})}),o.jsx(bt,{children:t.map(g=>o.jsx($e,{value:g.areNombre,children:g.areNombre},g.areCodigo))})]})]}),o.jsxs("div",{children:[o.jsx(ne,{children:"TÃtulo *"}),o.jsx(we,{value:s.titulo,onChange:g=>l(x=>({...x,titulo:g.target.value})),placeholder:"TÃtulo de la tarjeta de ayuda"})]}),o.jsxs("div",{children:[o.jsx(ne,{children:"Contenido *"}),o.jsx(Kt,{value:s.contenido,onChange:g=>l(x=>({...x,contenido:g.target.value})),placeholder:"Contenido del manual...",rows:5})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{children:[o.jsx(ne,{children:"Página destino"}),o.jsxs(jt,{value:s.pagina_destino,onValueChange:g=>l(x=>({...x,pagina_destino:g})),children:[o.jsx(xt,{children:o.jsx(St,{})}),o.jsx(bt,{children:v.map(g=>o.jsx($e,{value:g.value,children:g.label},g.value))})]})]}),o.jsxs("div",{children:[o.jsx(ne,{children:"Orden"}),o.jsx(we,{type:"number",value:s.orden,onChange:g=>l(x=>({...x,orden:Number(g.target.value)}))})]})]})]}),o.jsxs(dr,{children:[o.jsx(z,{variant:"outline",onClick:()=>n(!1),children:"Cancelar"}),o.jsxs(z,{onClick:y,disabled:d.isPending,children:[d.isPending&&o.jsx(ye,{className:"h-4 w-4 mr-1 animate-spin"}),a?"Actualizar":"Crear"]})]})]})})]})}function Ere(){const{allowedModules:e,isLoading:t}=C0(),r=e.has("*")||e.has("base_conocimiento");return t?o.jsx("div",{className:"flex justify-center items-center h-64",children:o.jsx(ye,{className:"h-8 w-8 animate-spin"})}):r?o.jsxs("div",{className:"space-y-6 p-4 md:p-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold",children:"Base de Conocimiento"}),o.jsx("p",{className:"text-muted-foreground",children:"Gestiona guÃas de producto, glosario y manuales por área"})]}),o.jsxs(Kl,{defaultValue:"productos",className:"w-full",children:[o.jsxs(Zo,{className:"grid w-full grid-cols-3",children:[o.jsxs(Yt,{value:"productos",className:"flex items-center gap-2",children:[o.jsx(nu,{className:"h-4 w-4"}),"GuÃas de Producto"]}),o.jsxs(Yt,{value:"glosario",className:"flex items-center gap-2",children:[o.jsx(y3,{className:"h-4 w-4"}),"Glosario"]}),o.jsxs(Yt,{value:"manuales",className:"flex items-center gap-2",children:[o.jsx(Ya,{className:"h-4 w-4"}),"Manuales por Ãrea"]})]}),o.jsx(Qt,{value:"productos",children:o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsx(Ie,{children:"GuÃas de Producto"}),o.jsx(zt,{children:"Información de referencia especÃfica por producto y campo del formulario"})]}),o.jsx(fe,{children:o.jsx(Sre,{})})]})}),o.jsx(Qt,{value:"glosario",children:o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsx(Ie,{children:"Glosario de Términos"}),o.jsx(zt,{children:"Definiciones de términos utilizados en los formularios"})]}),o.jsx(fe,{children:o.jsx(_re,{})})]})}),o.jsx(Qt,{value:"manuales",children:o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsx(Ie,{children:"Manuales por Ãrea"}),o.jsx(zt,{children:"Tarjetas de ayuda asociadas a áreas de trabajo especÃficas"})]}),o.jsx(fe,{children:o.jsx(Nre,{})})]})})]})]}):o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx(de,{className:"max-w-md",children:o.jsxs(fe,{className:"pt-6 text-center",children:[o.jsx("p",{className:"text-lg font-semibold",children:"Acceso denegado"}),o.jsx("p",{className:"text-muted-foreground mt-2",children:"No tienes permisos para acceder a este módulo."})]})})})}const qg={analista:1,jefe:2,gerencia:3};function Cre(){const[e,t]=h.useState({isAuditor:!1,nivel:null,auditorId:null,isAdmin:!1,canViewAnalista:!1,canViewJefe:!1,canViewGerencia:!1,isLoading:!0});return h.useEffect(()=>{let r=!1;return(async()=>{try{const{data:{session:n}}=await B.auth.getSession();if(!n){r||t(d=>({...d,isLoading:!1}));return}const[{data:a},{data:i}]=await Promise.all([B.from("profiles").select("role").eq("id",n.user.id).maybeSingle(),B.from("auditores").select("id, nivel").eq("user_id",n.user.id).eq("activo",!0)]),s=(a==null?void 0:a.role)==="Administrador";let l=null,c=null;if(i&&i.length>0){const d=[...i].sort((f,m)=>qg[m.nivel]-qg[f.nivel]);l=d[0].nivel,c=d[0].id}const u=l?qg[l]:0;if(r)return;t({isAuditor:!!l,nivel:l,auditorId:c,isAdmin:s,canViewAnalista:s||u>=1,canViewJefe:s||u>=2,canViewGerencia:s||u>=3,isLoading:!1})}catch(n){console.error("useAuditorPermissions error:",n),r||t(a=>({...a,isLoading:!1}))}})(),()=>{r=!0}},[]),e}var rj="Collapsible",[Ore,GI]=Lr(rj),[Pre,nj]=Ore(rj),HI=h.forwardRef((e,t)=>
540{const{__scopeCollapsible:r,open:n,defaultOpen:a,disabled:i,onOpenChange:s,...l}=e,[c=!1,u]=hn({prop:n,defaultProp:a,onChange:s});return o.jsx(Pre,{scope:r,disabled:i,contentId:Qn(),open:c,onOpenToggle:h.useCallback(()=>u(d=>!d),[u]),children:o.jsx(Me.div,{"data-state":ij(c),"data-disabled":i?"":void 0,...l,ref:t})})});HI.displayName=rj;var KI="CollapsibleTrigger",YI=h.forwardRef((e,t)=>{const{__scopeCollapsible:r,...n}=e,a=nj(KI,r);return o.jsx(Me.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":ij(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...n,ref:t,onClick:ue(e.onClick,a.onOpenToggle)})});YI.displayName=KI;var aj="CollapsibleContent",XI=h.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=nj(aj,e.__scopeCollapsible);return o.jsx(er,{present:r||a.open,children:({present:i})=>o.jsx(Are,{...n,ref:t,present:i})})});XI.displayName=aj;var Are=h.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:n,children:a,...i}=e,s=nj(aj,r),[l,c]=h.useState(n),u=h.useRef(null),d=Xe(t,u),f=h.useRef(0),m=f.current,p=h.useRef(0),y=p.current,v=s.open||l,g=h.useRef(v),x=h.useRef();return h.useEffect(()=>{const b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),Ka(()=>{const b=u.current;if(b){x.current=x.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const j=b.getBoundingClientRect();f.current=j.height,p.current=j.width,g.current||(b.style.transitionDuration=x.current.transitionDuration,b.style.animationName=x.current.animationName),c(n)}},[s.open,n]),o.jsx(Me.div,{"data-state":ij(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!v,...i,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:v&&a})});function ij(e){return e?"open":"closed"}var Tre=HI,Dre=YI,$re=XI,ni="Accordion",kre=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[oj,Mre,Ire]=Rh(ni),[Zp,JPe]=Lr(ni,[Ire,GI]),sj=GI(),ZI=$.forwardRef((e,t)=>{const{type:r,...n}=e,a=n,i=n;return o.jsx(oj.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?o.jsx(Bre,{...i,ref:t}):o.jsx(Fre,{...a,ref:t})})});ZI.displayName=ni;var[QI,Rre]=Zp(ni),[JI,Lre]=Zp(ni,{collapsible:!1}),Fre=$.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:a=()=>{},collapsible:i=!1,...s}=e,[l,c]=hn({prop:r,defaultProp:n,onChange:a});return o.jsx(QI,{scope:e.__scopeAccordion,value:l?[l]:[],onItemOpen:c,onItemClose:$.useCallback(()=>i&&c(""),[i,c]),children:o.jsx(JI,{scope:e.__scopeAccordion,collapsible:i,children:o.jsx(eR,{...s,ref:t})})})}),Bre=$.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:a=()=>{},...i}=e,[s=[],l]=hn({prop:r,defaultProp:n,onChange:a}),c=$.useCallback(d=>l((f=[])=>[...f,d]),[l]),u=$.useCallback(d=>l((f=[])=>f.filter(m=>m!==d)),[l]);return o.jsx(QI,{scope:e.__scopeAccordion,value:s,onItemOpen:c,onItemClose:u,children:o.jsx(JI,{scope:e.__scopeAccordion,collapsible:!0,children:o.jsx(eR,{...i,ref:t})})})}),[zre,Qp]=Zp(ni),eR=$.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:n,dir:a,orientation:i="vertical",...s}=e,l=$.useRef(null),c=Xe(l,t),u=Mre(r),f=kl(a)==="ltr",m=ue(e.onKeyDown,p=>{var E;if(!kre.includes(p.key))return;const y=p.target,v=u().filter(O=>{var P;return!((P=O.ref.current)!=null&&P.disabled)}),g=v.findIndex(O=>O.ref.current===y),x=v.length;if(g===-1)return;p.preventDefault();let b=g;const j=0,w=x-1,S=()=>{b=g+1,b>w&&(b=j)},_=()=>{b=g-1,b<j&&(b=w)};switch(p.key){case"Home":b=j;break;case"End":b=w;break;case"ArrowRight":i==="horizontal"&&(f?S():_());break;case"ArrowDown":i==="vertical"&&S();break;case"ArrowLeft":i==="horizontal"&&(f?_():S());break;case"ArrowUp":i==="vertical"&&_();break}const N=b%x;(E=v[N].ref.current)==null||E.focus()});return o.jsx(zre,{scope:r,disabled:n,direction:a,orientation:i,children:o.jsx(oj.Slot,{scope:r,children:o.jsx(Me.div,{...s,"data-orientation":i,ref:c,onKeyDown:n?void 0:m})})})}),Mm="AccordionItem",[qre,lj]=Zp(Mm),tR=$.forwardRef((e,t)=>
540{const{__scopeAccordion:r,value:n,...a}=e,i=Qp(Mm,r),s=Rre(Mm,r),l=sj(r),c=Qn(),u=n&&s.value.includes(n)||!1,d=i.disabled||e.disabled;return o.jsx(qre,{scope:r,open:u,disabled:d,triggerId:c,children:o.jsx(Tre,{"data-orientation":i.orientation,"data-state":sR(u),...l,...a,ref:t,disabled:d,open:u,onOpenChange:f=>{f?s.onItemOpen(n):s.onItemClose(n)}})})});tR.displayName=Mm;var rR="AccordionHeader",nR=$.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,a=Qp(ni,r),i=lj(rR,r);return o.jsx(Me.h3,{"data-orientation":a.orientation,"data-state":sR(i.open),"data-disabled":i.disabled?"":void 0,...n,ref:t})});nR.displayName=rR;var Nx="AccordionTrigger",aR=$.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,a=Qp(ni,r),i=lj(Nx,r),s=Lre(Nx,r),l=sj(r);return o.jsx(oj.ItemSlot,{scope:r,children:o.jsx(Dre,{"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":a.orientation,id:i.triggerId,...l,...n,ref:t})})});aR.displayName=Nx;var iR="AccordionContent",oR=$.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,a=Qp(ni,r),i=lj(iR,r),s=sj(r);return o.jsx($re,{role:"region","aria-labelledby":i.triggerId,"data-orientation":a.orientation,...s,...n,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});oR.displayName=iR;function sR(e){return e?"open":"closed"}var Ure=ZI,Wre=tR,Vre=nR,lR=aR,cR=oR;const Gre=Ure,uR=h.forwardRef(({className:e,...t},r)=>o.jsx(Wre,{ref:r,className:oe("border-b",e),...t}));uR.displayName="AccordionItem";const dR=h.forwardRef(({className:e,children:t,...r},n)=>o.jsx(Vre,{className:"flex",children:o.jsxs(lR,{ref:n,className:oe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[t,o.jsx(tp,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));dR.displayName=lR.displayName;const fR=h.forwardRef(({className:e,children:t,...r},n)=>o.jsx(cR,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:o.jsx("div",{className:oe("pb-4 pt-0",e),children:t})}));fR.displayName=cR.displayName;function Hre({novedadId:e,urls:t,onChange:r}){const[n,a]=h.useState(!1),i=h.useRef(null),s=async u=>{var f;const d=(f=u.target.files)==null?void 0:f[0];if(d){a(!0);try{const m=`${e}/${Date.now()}_${d.name.replace(/[^\w.-]/g,"_")}`,{error:p}=await B.storage.from("auditoria-evidencias").upload(m,d);if(p)throw p;const y=[...t,m];r(y),Z.success("Evidencia subida")}catch(m){Z.error("Error subiendo: "+m.message)}finally{a(!1),i.current&&(i.current.value="")}}},l=async u=>{confirm("¿Eliminar este archivo?")&&(await B.storage.from("auditoria-evidencias").remove([u]),r(t.filter(d=>d!==u)))},c=async u=>{const{data:d}=await B.storage.from("auditoria-evidencias").createSignedUrl(u,3600);d!=null&&d.signedUrl&&window.open(d.signedUrl,"_blank")};return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("label",{className:"text-sm font-medium",children:"Archivos adjuntos"}),o.jsxs(z,{type:"button",size:"sm",variant:"outline",onClick:()=>{var u;return(u=i.current)==null?void 0:u.click()},disabled:n,children:[n?o.jsx(ye,{className:"h-4 w-4 animate-spin mr-2"}):o.jsx(ou,{className:"h-4 w-4 mr-2"}),"Subir archivo"]}),o.jsx("input",{ref:i,type:"file",className:"hidden",onChange:s})]}),t.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Sin archivos adjuntos."}):o.jsx("ul",{className:"space-y-1",children:t.map(u=>{const d=u.split("/").pop()||u;return o.jsxs("li",{className:"flex items-center justify-between gap-2 text-sm bg-muted/30 rounded px-2 py-1",children:[o.jsxs("button",{type:"button",onClick:()=>c(u),className:"flex items-center gap-2 hover:underline flex-1 text-left truncate",children:[o.jsx(m3,{className:"h-4 w-4 shrink-0"}),o.jsx("span",{className:"truncate",children:d})]}),o.jsx(z,{type:"button",size:"icon",variant:"ghost",className:"h-6 w-6",onClick:()=>l(u),children:o.jsx(_r,{className:"h-3 w-3"})})]},u)})})]})}const cN={abierta:"Abierta",analisis_causa:"Análisis de causa",plan_accion:"Plan de acción",en_ejecucion:"En ejecución",verificacion:"Verificación",cerrada_eficaz:"Cerrada (eficaz)",cerrada_no_eficaz:"Cerrada (no eficaz)",descartada:"Descartada"};function Kre({novedadId:e,open:t,onOpenChange:r}){const[n,a]=h.useState([]),[i,s]=h.useState(!1);return h.useEffect(()=>{t&&(async()=>{s(!0);const{data:l}=await B.from("auditoria_novedad_historial").select("*").eq("novedad_id",e).order("cambiado_at",{ascending:!0}),c=[...new Set((l||[]).map(d=>
540d.cambiado_por).filter(Boolean))];let u={};if(c.length){const{data:d}=await B.from("profiles").select("id, full_name").in("id",c);u=Object.fromEntries((d||[]).map(f=>[f.id,f.full_name]))}a((l||[]).map(d=>({...d,_user:u[d.cambiado_por]||"â"}))),s(!1)})()},[t,e]),o.jsx(fT,{open:t,onOpenChange:r,children:o.jsxs(O0,{className:"w-[400px] sm:w-[500px]",children:[o.jsx(P0,{children:o.jsx(A0,{children:"Historial de cambios"})}),o.jsx("div",{className:"mt-6 space-y-3",children:i?o.jsx("div",{className:"flex justify-center py-8",children:o.jsx(ye,{className:"h-6 w-6 animate-spin"})}):n.length===0?o.jsx("p",{className:"text-sm text-muted-foreground",children:"Sin movimientos registrados."}):n.map(l=>o.jsxs("div",{className:"border-l-2 border-primary pl-3 pb-3",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap text-sm",children:[l.estado_anterior&&o.jsxs(o.Fragment,{children:[o.jsx(ke,{variant:"outline",className:"text-xs",children:cN[l.estado_anterior]||l.estado_anterior}),o.jsx("span",{className:"text-muted-foreground",children:"â"})]}),o.jsx(ke,{className:"text-xs",children:cN[l.estado_nuevo]||l.estado_nuevo})]}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[new Date(l.cambiado_at).toLocaleString()," · ",l._user]}),l.comentario&&o.jsx("p",{className:"text-sm mt-1",children:l.comentario})]},l.id))})]})})}const Yre={abierta:"Abierta",analisis_causa:"Análisis de causa",plan_accion:"Plan de acción",en_ejecucion:"En ejecución",verificacion:"Verificación",cerrada_eficaz:"Cerrada (eficaz)",cerrada_no_eficaz:"Cerrada (no eficaz)",descartada:"Descartada",en_revision:"En revisión",cerrada:"Cerrada"};function cj({open:e,onOpenChange:t,asignacionId:r,otNumero:n,nivel:a,muestraId:i,fieldId:s,fieldLabel:l,fieldValue:c,revisionId:u,existing:d,onSaved:f}){const[m,p]=h.useState(null),[y,v]=h.useState(!1),[g,x]=h.useState(!1),[b,j]=h.useState("hallazgo"),[w,S]=h.useState(!1),[_,N]=h.useState([]),[E,O]=h.useState("nc_menor"),[P,C]=h.useState("moderada"),[A,T]=h.useState(""),[k,D]=h.useState(""),[M,F]=h.useState(""),[q,I]=h.useState(""),[K,W]=h.useState("cinco_porques"),[R,V]=h.useState(""),[re,H]=h.useState(""),[te,ce]=h.useState(""),[je,X]=h.useState(""),[ae,_e]=h.useState(""),[J,Ke]=h.useState([]),[Ne,Re]=h.useState(""),[pe,De]=h.useState(""),L=(m==null?void 0:m.estado)||"abierta",G=!(m!=null&&m.id);h.useEffect(()=>{e&&(async()=>{const{data:Se}=await B.from("profiles").select("id, full_name").order("full_name");if(N(Se||[]),d!=null&&d.id){v(!0);const{data:vr}=await B.from("auditoria_novedades").select("*").eq("id",d.id).maybeSingle();vr&&Y(vr),v(!1)}else p(null),O("nc_menor"),C("moderada"),T(""),D(""),F(l?`Hallazgo en "${l}": valor observado "${c??"â"}"`:""),I(""),W("cinco_porques"),V(""),H(""),ce(""),X(""),_e(""),Ke([]),Re(""),De(""),j("hallazgo")})()},[e,d==null?void 0:d.id]);const Y=Se=>{p(Se),O(Se.tipo||"nc_menor"),C(Se.severidad||"moderada"),T(Se.categoria||""),D(Se.criterio_referencia||""),F(Se.descripcion||""),I(Se.accion_contencion||""),W(Se.metodo_analisis||"cinco_porques"),V(Se.causa_raiz||""),H(Se.accion_propuesta||""),ce(Se.responsable_id||""),X(Se.fecha_compromiso||""),_e(Se.evidencia_cierre||""),Ke(Se.evidencia_urls||[]),Re(Se.verificacion_resultado||""),De(Se.verificacion_comentario||""),j({abierta:"hallazgo",analisis_causa:"causa",plan_accion:"plan",en_ejecucion:"ejecucion",verificacion:"verificacion",cerrada_eficaz:"verificacion",cerrada_no_eficaz:"verificacion",descartada:"hallazgo"}[Se.estado]||"hallazgo")},ie=async(Se,vr)=>{x(!0);try{const{data:{session:Er}}=await B.auth.getSession();if(G){if(!M.trim())return Z.error("La descripción es obligatoria"),x(!1),null;const qn={asignacion_id:r,revision_id:u,ot_numero:n,muestra_id:i,field_id:s,field_label:l,field_value_observado:c,nivel:a,tipo:E,severidad:P,categoria:A||null,criterio_referencia:k||null,descripcion:M,accion_contencion:q||null,estado:vr||"abierta",creado_por:Er==null?void 0:Er.user.id,...Se},{data:Qr,error:zr}=await B.from("auditoria_novedades").insert(qn).select().maybeSingle();if(zr)throw zr;return Y(Qr),Z.success("Novedad creada"),f(),Qr}else{const qn={...Se};vr&&(qn.estado=vr);const{data:Qr,error:zr}=await B.from("auditoria_novedades").update(qn).eq("id",m.id).select().maybeSingle();if(zr)throw zr;return Qr&&Y(Qr),Z.success("Guardado"),f(),Qr}}catch(Er){return Z.error("Error: "+Er.message),null}finally{x(!1)}},se=async(Se=!1)=>{await ie({tipo:E,severidad:P,categoria:A||null,criterio_referencia:k||null,descripcion:M,accion_contencion:q||null},Se?"analisis_causa":void 0),Se&&j("causa")},ee=async(Se=!1)=>
540{if(Se&&!R.trim()){Z.error("La causa raÃz es obligatoria para avanzar");return}await ie({metodo_analisis:K,causa_raiz:R||null},Se?"plan_accion":void 0),Se&&j("plan")},ge=async(Se=!1)=>{if(Se&&(!re.trim()||!te||!je)){Z.error("Acción, responsable y fecha compromiso son obligatorios");return}await ie({accion_propuesta:re||null,responsable_id:te||null,fecha_compromiso:je||null},Se?"en_ejecucion":void 0),Se&&j("ejecucion")},He=async(Se=!1)=>{await ie({evidencia_cierre:ae||null,evidencia_urls:J},Se?"verificacion":void 0),Se&&j("verificacion")},Tt=async(Se=!1)=>{if(Se&&!Ne){Z.error("Debe indicar el resultado de la verificación");return}const{data:{session:vr}}=await B.auth.getSession(),Er={verificacion_resultado:Ne||null,verificacion_comentario:pe||null};let qn;Se&&(Er.verificado_por=vr==null?void 0:vr.user.id,Er.verificado_at=new Date().toISOString(),qn=Ne==="eficaz"?"cerrada_eficaz":"cerrada_no_eficaz"),await ie(Er,qn)},wt=async()=>{confirm("¿Descartar esta novedad? Esta acción quedará registrada en el historial.")&&await ie({},"descartada")},wn=async()=>{await ie({verificacion_resultado:null,verificacion_comentario:null,verificado_at:null,verificado_por:null},"en_ejecucion")},Zr=Se=>G?Se===0:!0,Br=L==="cerrada_eficaz"||L==="cerrada_no_eficaz"||L==="descartada";return o.jsxs(o.Fragment,{children:[o.jsx(Ft,{open:e,onOpenChange:t,children:o.jsxs(It,{className:"max-w-3xl max-h-[92vh] flex flex-col overflow-hidden",children:[o.jsxs(Ut,{children:[o.jsxs(Wt,{className:"flex items-center gap-2 flex-wrap",children:[o.jsx(Kr,{className:"h-5 w-5 text-destructive"}),G?"Nueva novedad":`Novedad â OT ${m==null?void 0:m.ot_numero}`,!G&&o.jsx(ke,{variant:"outline",className:"ml-2",children:Yre[L]||L}),!G&&o.jsx(z,{size:"sm",variant:"ghost",className:"ml-auto",onClick:()=>S(!0),children:"Ver historial"})]}),l&&o.jsxs("p",{className:"text-sm text-muted-foreground",children:[l," · Valor observado: ",o.jsx("span",{className:"font-mono",children:c??"â"})]})]}),y?o.jsx("div",{className:"flex justify-center p-8",children:o.jsx(ye,{className:"h-6 w-6 animate-spin"})}):o.jsxs(Kl,{value:b,onValueChange:j,className:"flex-1 overflow-hidden flex flex-col",children:[o.jsxs(Zo,{className:"grid grid-cols-5 shrink-0",children:[o.jsxs(Yt,{value:"hallazgo",className:"gap-1 text-xs",children:[o.jsx(Ya,{className:"h-3 w-3"})," Hallazgo"]}),o.jsxs(Yt,{value:"causa",disabled:!Zr(1),className:"gap-1 text-xs",children:[o.jsx(Ko,{className:"h-3 w-3"})," Causa"]}),o.jsxs(Yt,{value:"plan",disabled:!Zr(2),className:"gap-1 text-xs",children:[o.jsx(l3,{className:"h-3 w-3"})," Plan"]}),o.jsxs(Yt,{value:"ejecucion",disabled:!Zr(3),className:"gap-1 text-xs",children:[o.jsx(N3,{className:"h-3 w-3"})," Ejecución"]}),o.jsxs(Yt,{value:"verificacion",disabled:!Zr(4),className:"gap-1 text-xs",children:[o.jsx(Do,{className:"h-3 w-3"})," Verificación"]})]}),o.jsxs("div",{className:"overflow-y-auto pr-2 mt-4 flex-1",children:[o.jsxs(Qt,{value:"hallazgo",className:"space-y-4 mt-0",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Tipo *"}),o.jsxs(jt,{value:E,onValueChange:O,children:[o.jsx(xt,{children:o.jsx(St,{})}),o.jsxs(bt,{children:[o.jsx($e,{value:"nc_mayor",children:"NC Mayor"}),o.jsx($e,{value:"nc_menor",children:"NC Menor"}),o.jsx($e,{value:"observacion",children:"Observación"}),o.jsx($e,{value:"oportunidad_mejora",children:"Oportunidad de mejora"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Severidad *"}),o.jsxs(jt,{value:P,onValueChange:C,children:[o.jsx(xt,{children:o.jsx(St,{})}),o.jsxs(bt,{children:[o.jsx($e,{value:"leve",children:"Leve"}),o.jsx($e,{value:"moderada",children:"Moderada"}),o.jsx($e,{value:"grave",children:"Grave"}),o.jsx($e,{value:"critica",children:"CrÃtica"})]})]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"CategorÃa"}),o.jsx(we,{value:A,onChange:Se=>T(Se.target.value),placeholder:"Ej: Fuera de especificación"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Criterio / Referencia"}),o.jsx(we,{value:k,onChange:Se=>D(Se.target.value),placeholder:"Ej: ISO 9001 cl. 8.5.1, PRO-CAL-001"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Descripción del hallazgo *"}),o.jsx(Kt,{value:M,onChange:Se=>F(Se.target.value),rows:3})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Acción de contención inmediata"}),o.jsx(Kt,{value:q,onChange:Se=>I(Se.target.value),rows:2,placeholder:"¿Qué se hizo inmediatamente para evitar que el problema se propague?"})]})]}
540),o.jsxs(Qt,{value:"causa",className:"space-y-4 mt-0",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Método de análisis"}),o.jsxs(jt,{value:K,onValueChange:W,children:[o.jsx(xt,{children:o.jsx(St,{})}),o.jsxs(bt,{children:[o.jsx($e,{value:"cinco_porques",children:"5 Porqués"}),o.jsx($e,{value:"ishikawa",children:"Ishikawa (Espina de pescado)"}),o.jsx($e,{value:"otro",children:"Otro"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Causa raÃz *"}),o.jsx(Kt,{value:R,onChange:Se=>V(Se.target.value),rows:8,placeholder:K==="cinco_porques"?`Por qué 1: 541Por qué 2: 542Por qué 3: 543Por qué 4: 544Por qué 5: 545 546Causa raÃz identificada:`:K==="ishikawa"?`Mano de obra: 547Método: 548Máquina: 549Material: 550Medio ambiente: 551Medición: 552 553Causa raÃz identificada:`:"Describa la causa raÃz identificada"})]})]}),o.jsxs(Qt,{value:"plan",className:"space-y-4 mt-0",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Acción correctiva propuesta *"}),o.jsx(Kt,{value:re,onChange:Se=>H(Se.target.value),rows:4,placeholder:"Describa la acción que eliminará la causa raÃz"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Responsable *"}),o.jsxs(jt,{value:te,onValueChange:ce,children:[o.jsx(xt,{children:o.jsx(St,{placeholder:"Seleccionar"})}),o.jsx(bt,{children:_.map(Se=>o.jsx($e,{value:Se.id,children:Se.full_name||Se.id},Se.id))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Fecha compromiso *"}),o.jsx(we,{type:"date",value:je,onChange:Se=>X(Se.target.value)})]})]})]}),o.jsxs(Qt,{value:"ejecucion",className:"space-y-4 mt-0",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Evidencia de implementación"}),o.jsx(Kt,{value:ae,onChange:Se=>_e(Se.target.value),rows:4,placeholder:"Describa qué se hizo y los resultados obtenidos"})]}),(m==null?void 0:m.id)&&o.jsx(Hre,{novedadId:m.id,urls:J,onChange:Ke})]}),o.jsxs(Qt,{value:"verificacion",className:"space-y-4 mt-0",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Resultado de la verificación de eficacia *"}),o.jsxs(jt,{value:Ne,onValueChange:Re,children:[o.jsx(xt,{children:o.jsx(St,{placeholder:"Seleccionar"})}),o.jsxs(bt,{children:[o.jsx($e,{value:"eficaz",children:"Eficaz â el problema fue resuelto"}),o.jsx($e,{value:"no_eficaz",children:"No eficaz â requiere nueva acción"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ne,{children:"Comentario del verificador"}),o.jsx(Kt,{value:pe,onChange:Se=>De(Se.target.value),rows:3})]}),(m==null?void 0:m.verificado_at)&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Verificado el ",new Date(m.verificado_at).toLocaleString()]})]})]})]}),o.jsxs(dr,{className:"border-t pt-4 flex-wrap gap-2",children:[!Br&&!G&&L!=="descartada"&&o.jsx(z,{variant:"ghost",className:"text-destructive mr-auto",onClick:wt,disabled:g,children:"Descartar"}),Br&&L!=="descartada"&&o.jsx(z,{variant:"outline",className:"mr-auto",onClick:wn,disabled:g,children:"Reabrir"}),o.jsx(z,{variant:"outline",onClick:()=>t(!1),children:"Cerrar"}),b==="hallazgo"&&!Br&&o.jsxs(o.Fragment,{children:[o.jsxs(z,{variant:"secondary",onClick:()=>se(!1),disabled:g,children:[g&&o.jsx(ye,{className:"h-4 w-4 animate-spin mr-2"}),"Guardar"]}),(G||L==="abierta")&&o.jsx(z,{onClick:()=>se(!0),disabled:g,children:"Avanzar a Causa"})]}),b==="causa"&&!Br&&o.jsxs(o.Fragment,{children:[o.jsx(z,{variant:"secondary",onClick:()=>ee(!1),disabled:g,children:"Guardar"}),(L==="abierta"||L==="analisis_causa")&&o.jsx(z,{onClick:()=>ee(!0),disabled:g,children:"Avanzar a Plan"})]}),b==="plan"&&!Br&&o.jsxs(o.Fragment,{children:[o.jsx(z,{variant:"secondary",onClick:()=>ge(!1),disabled:g,children:"Guardar"}),["abierta","analisis_causa","plan_accion"].includes(L)&&o.jsx(z,{onClick:()=>ge(!0),disabled:g,children:"Avanzar a Ejecución"})]}),b==="ejecucion"&&!Br&&o.jsxs(o.Fragment,{children:[o.jsx(z,{variant:"secondary",onClick:()=>He(!1),disabled:g,children:"Guardar"}),["plan_accion","en_ejecucion"].includes(L)&&o.jsx(z,{onClick:()=>He(!0),disabled:g,children:"Enviar a Verificación"})]}),b==="verificacion"&&!Br&&o.jsxs(o.Fragment,{children:[o.jsx(z,{variant:"secondary",onClick:()=>Tt(!1),disabled:g,children:"Guardar"}),L==="verificacion"&&o.jsx(z,{onClick:()=>Tt(!0),disabled:g,children:"Cerrar novedad"})]})]})]})}),(m==null?void 0:m.id)&&o.jsx(Kre,{novedadId:m.id,open:w,onOpenChange:S})]})}const Xre={bajo:"bg-green-100 text-green-800 border-green-200",medio:"bg-yellow-100 text-yellow-800 border-yellow-200",alto:"bg-orange-100 text-orange-800 border-orange-200",critico:"bg-red-100 text-red-800 border-red-200"};function Zre(e){return e>=90?"bajo":e>=75?"medio":e>=60?"alto":"critico"}const wc=(e,t)=>`${e}::${t}`;function Qre({asignacion:e,open:t,onOpenChange:r,onSaved:n,canEdit:a,auditorId:i}){var W,R,V,re;
553const[s,l]=h.useState([]),[c,u]=h.useState({}),[d,f]=h.useState({}),[m,p]=h.useState({}),[y,v]=h.useState([]),[g,x]=h.useState(""),[b,j]=h.useState(""),[w,S]=h.useState(!0),[_,N]=h.useState(!1),[E,O]=h.useState(null),P=!a||e.estado==="completada"||e.estado==="no_conforme",C=async()=>{S(!0);try{const{data:H}=await B.from("proceso_ot").select("id").eq("ot_number",String(e.ot_numero)).maybeSingle();let te=[];if(H){const{data:Ne}=await B.from("proceso_ot_muestra").select("id, num_muestra, formulario_id").eq("proceso_ot_id",H.id).order("num_muestra"),Re=(Ne||[]).map(De=>De.id);let pe={};if(Re.length>0){const{data:De}=await B.from("form_field_responses").select("id, muestra_id, field_id, field_label, field_value, numeric_value, image_storage_path").in("muestra_id",Re);(De||[]).forEach(L=>{(pe[L.muestra_id]=pe[L.muestra_id]||[]).push(L)})}te=(Ne||[]).map(De=>({id:De.id,num_muestra:De.num_muestra,formulario_id:De.formulario_id,responses:pe[De.id]||[]}))}const ce=Array.from(new Set(te.map(Ne=>Ne.formulario_id).filter(Boolean))),je={},X={};if(ce.length>0){const{data:Ne}=await B.from("formularios").select("id, nombre").in("id",ce);(Ne||[]).forEach(pe=>{pe!=null&&pe.id&&(pe!=null&&pe.nombre)&&(X[pe.id]=pe.nombre)});const{data:Re}=await B.from("formulario_campos").select("id, formulario_id, etiqueta, nombre, orden").in("formulario_id",ce).order("orden",{ascending:!0});(Re||[]).forEach(pe=>{const De=(pe==null?void 0:pe.etiqueta)||(pe==null?void 0:pe.nombre);pe!=null&&pe.id&&De&&(je[`${pe.formulario_id}::${pe.id}`]=De,je[pe.id]||(je[pe.id]=De))})}const{data:ae}=await B.from("auditoria_revisiones").select("*").eq("asignacion_id",e.id),{data:_e}=await B.from("auditoria_hallazgos").select("*").eq("asignacion_id",e.id).maybeSingle(),{data:J}=await B.from("auditoria_novedades").select("*").eq("asignacion_id",e.id),Ke={};(ae||[]).forEach(Ne=>{Ke[wc(Ne.muestra_id,Ne.field_id)]={id:Ne.id,muestra_id:Ne.muestra_id,field_id:Ne.field_id,field_label:Ne.field_label,field_value:Ne.field_value,field_response_id:Ne.field_response_id,estado:Ne.estado,observacion:Ne.observacion||""}}),l(te),u(je),f(X),p(Ke),v(J||[]),x((_e==null?void 0:_e.comentario_general)||""),j((_e==null?void 0:_e.plan_accion)||"")}catch(H){console.error(H),Z.error("Error cargando datos: "+H.message)}finally{S(!1)}};h.useEffect(()=>{t&&C()},[t,e.id]);const A=h.useMemo(()=>s.reduce((H,te)=>H+te.responses.length,0),[s]),T=Object.keys(m).length,k=h.useMemo(()=>{const H=Object.values(m).filter(ce=>ce.estado!=="na");if(H.length===0)return 0;const te=H.filter(ce=>ce.estado==="ok").length;return Math.round(te/H.length*1e4)/100},[m]),D=Zre(k),M=(H,te,ce)=>{const je=H?`${H}::${te}`:null;return je&&c[je]||c[te]||(ce&&ce!==te?ce:null)||te},F=(H,te,ce,je)=>{const X=wc(te,H.field_id);p(ae=>({...ae,[X]:{...ae[X]||{muestra_id:te,field_id:H.field_id,field_label:M(ce,H.field_id,H.field_label),field_value:H.field_value,field_response_id:H.id,observacion:"",estado:je},estado:je}}))},q=(H,te,ce,je)=>{const X=wc(te,H.field_id);p(ae=>({...ae,[X]:{...ae[X]||{muestra_id:te,field_id:H.field_id,field_label:M(ce,H.field_id,H.field_label),field_value:H.field_value,field_response_id:H.id,estado:"ok",observacion:je},observacion:je}}))},I=(H,te)=>y.find(ce=>ce.muestra_id===H&&ce.field_id===te),K=async H=>{if(H&&T<A){Z.error(`Faltan ${A-T} preguntas por revisar.`);return}N(!0);try{!e.auditor_id&&i&&await B.from("auditoria_asignaciones").update({auditor_id:i,estado:"en_progreso"}).eq("id",e.id);const{data:{session:te}}=await B.auth.getSession(),ce=Object.values(m).map(X=>({asignacion_id:e.id,muestra_id:X.muestra_id,field_response_id:X.field_response_id,field_id:X.field_id,field_label:X.field_label,field_value:X.field_value,estado:X.estado,observacion:X.observacion||null,revisado_por:te==null?void 0:te.user.id,revisado_at:new Date().toISOString()}));if(ce.length>0){const{error:X}=await B.from("auditoria_revisiones").upsert(ce,{onConflict:"asignacion_id,muestra_id,field_id"});if(X)throw X}const{error:je}=await B.from("auditoria_hallazgos").upsert({asignacion_id:e.id,score:k,nivel_riesgo:D,comentario_general:g||null,plan_accion:b||null,firma_auditor_id:H?te==null?void 0:te.user.id:null},{onConflict:"asignacion_id"});if(je)throw je;if(H){const X=k<75?"no_conforme":"completada";await B.from("auditoria_asignaciones").update({estado:X,fecha_completada:new Date().toISOString()}).eq("id",e.id),Z.success(`AuditorÃa finalizada · Score ${k} · Riesgo ${D}`)}else Z.success("Progreso guardado");n()}catch(te){Z.error("Error al guardar: "+te.message)}finally{N(!1)}};return o.jsxs(o.Fragment,{children:[o.jsx(Ft,{open:t,onOpenChange:r,children:o.jsxs(It,{className:"max-w-5xl h-[90vh] max-h-[90vh] !flex flex-col overflow-hidden",children:[o.jsxs(Ut,{children:[o.jsxs(Wt,{className:"flex items-center justify-between gap-4",children:[o.jsxs("span",{children:["AuditorÃa OT #",e.ot_numero]}),o.jsxs("div",{className:"flex gap-2 items-center",children:[o.jsxs(ke,{variant:"outline",children:["Nivel: ",e.nivel]}),o.jsxs(ke,{className:Xre[D],children:["Score: ",k," · ",D]}),y.length>0&&o.jsxs(ke,{variant:"destructive",children:[y.length," novedad",y.length>1?"es":""]})]})]}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:[((W=e.ot)==null?void 0:W.producto_resultante)||"â"," · ",((V=(R=e.ot)==null?void 0:R.fecha)==null?void 0:V.slice(0,10))||"â"," · Jefe: ",((re=e.ot)==null?void 0:re.jefe_turno)||"â"]}
553)]}),w?o.jsx("div",{className:"flex justify-center p-8",children:o.jsx(ye,{className:"h-6 w-6 animate-spin"})}):s.length===0?o.jsx(de,{children:o.jsx(fe,{className:"p-8 text-center text-muted-foreground",children:"Esta OT no tiene muestras registradas para auditar."})}):o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pr-4 -mr-2 overscroll-contain",children:o.jsxs("div",{className:"pb-2 pr-2",children:[o.jsx(Gre,{type:"multiple",defaultValue:s.map(H=>H.id),className:"space-y-2",children:s.map(H=>{const te=H.responses.map(X=>m[wc(H.id,X.field_id)]).filter(Boolean),ce=te.filter(X=>X.estado==="ok").length,je=te.filter(X=>X.estado==="no_conforme").length;return o.jsxs(uR,{value:H.id,className:"border rounded-md",children:[o.jsx(dR,{className:"px-4 hover:no-underline",children:o.jsxs("div",{className:"flex items-center justify-between w-full mr-4",children:[o.jsxs("span",{className:"font-semibold text-left",children:["Muestra #",H.num_muestra??"â",o.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:[H.formulario_id&&d[H.formulario_id]||"Sin formulario"," · ",H.responses.length," respuestas"]})]}),o.jsxs("div",{className:"flex gap-2",children:[ce>0&&o.jsxs(ke,{className:"bg-green-100 text-green-700",children:[ce," OK"]}),je>0&&o.jsxs(ke,{variant:"destructive",children:[je," NC"]}),o.jsxs(ke,{variant:"outline",children:[te.length,"/",H.responses.length]})]})]})}),o.jsx(fR,{className:"px-4 pb-4",children:H.responses.length===0?o.jsx("p",{className:"text-sm text-muted-foreground italic",children:"Esta muestra
553no tiene respuestas registradas."}):o.jsx("div",{className:"space-y-2",children:H.responses.map(X=>{const ae=m[wc(H.id,X.field_id)],_e=I(H.id,X.field_id),J=M(H.formulario_id,X.field_id,X.field_label);return o.jsxs("div",{className:"border rounded p-3 space-y-2 bg-muted/20",children:[o.jsxs("div",{className:"flex justify-between items-start gap-3",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-medium",children:J}),o.jsx("p",{className:"text-sm font-mono mt-1 break-words",children:X.field_value??o.jsx("span",{className:"italic text-muted-foreground",children:"â sin respuesta â"})}),X.image_storage_path&&o.jsxs("a",{href:`https://hakrnctolecgwjmvkcvm.supabase.co/storage/v1/object/public/${X.image_storage_path}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary mt-1",children:[o.jsx(Zf,{className:"h-3 w-3"})," Ver imagen"]})]}),o.jsxs("div",{className:"flex gap-1 shrink-0",children:[o.jsx(z,{size:"sm",variant:(ae==null?void 0:ae.estado)==="ok"?"default":"outline",className:(ae==null?void 0:ae.estado)==="ok"?"bg-green-600 hover:bg-green-700":"",onClick:()=>F(X,H.id,H.formulario_id,"ok"),disabled:P,children:o.jsx(Do,{className:"h-4 w-4"})}),o.jsx(z,{size:"sm",variant:(ae==null?void 0:ae.estado)==="no_conforme"?"destructive":"outline",onClick:()=>F(X,H.id,H.formulario_id,"no_conforme"),disabled:P,children:o.jsx(Kf,{className:"h-4 w-4"})}),o.jsx(z,{size:"sm",variant:(ae==null?void 0:ae.estado)==="na"?"secondary":"outline",onClick:()=>F(X,H.id,H.formulario_id,"na"),disabled:P,children:o.jsx(s3,{className:"h-4 w-4"})})]})]}),((ae==null?void 0:ae.estado)==="no_conforme"||(ae==null?void 0:ae.observacion))&&o.jsx(Kt,{placeholder:"Observaciónâ¦",value:(ae==null?void 0:ae.observacion)||"",onChange:Ke=>q(X,H.id,H.formulario_id,Ke.target.value),disabled:P,rows:2,className:"text-sm"}),((ae==null?void 0:ae.estado)==="no_conforme"||_e)&&!P&&o.jsxs("div",{className:"flex justify-between items-center",children:[_e?o.jsxs(ke,{variant:"destructive",className:"gap-1",children:[o.jsx(Kr,{className:"h-3 w-3"}),"Novedad: ",_e.severidad]}):o.jsx("span",{}),o.jsxs(z,{size:"sm",variant:_e?"outline":"secondary",onClick:()=>O({muestra_id:H.id,field_id:X.field_id,field_label:J,field_value:X.field_value,revision_id:(ae==null?void 0:ae.id)||null,existing:_e||null}),children:[o.jsx(Kr,{className:"h-4 w-4 mr-1"}),_e?"Editar novedad":"+ Novedad"]})]})]},X.id)})})})]},H.id)})}),o.jsxs("div",{className:"space-y-2 pt-4 border-t mt-4",children:[o.jsx(ne,{children:"Comentario general"}),o.jsx(Kt,{value:g,onChange:H=>x(H.target.value),disabled:P,rows:2})]}),o.jsxs("div",{className:"space-y-2 mt-3",children:[o.jsx(ne,{children:"Plan de acción (si hay no conformidades)"}),o.jsx(Kt,{value:b,onChange:H=>j(H.target.value),disabled:P,rows:2})]})]})}),o.jsxs(dr,{className:"flex-shrink-0 border-t pt-4",children:[o.jsxs("div",{className:"text-sm text-muted-foreground mr-auto",children:["Revisadas: ",o.jsxs("span",{className:"font-semibold",children:[T,"/",A]})]}),o.jsx(z,{variant:"outline",onClick:()=>r(!1),children:"Cerrar"}),!P&&o.jsxs(o.Fragment,{children:[o.jsxs(z,{variant:"secondary",onClick:()=>K(!1),disabled:_,children:[_?o.jsx(ye,{className:"h-4 w-4 animate-spin mr-2"}):o.jsx(np,{className:"h-4 w-4 mr-2"}),"Guardar progreso"]}),o.jsx(z,{onClick:()=>K(!0),disabled:_||T<A||A===0,children:"Finalizar auditorÃa"})]})]})]})}),E&&o.jsx(cj,{open:!!E,onOpenChange:H=>!H&&O(null),asignacionId:e.id,otNumero:e.ot_numero,nivel:e.nivel,muestraId:E.muestra_id,fieldId:E.field_id,fieldLabel:E.field_label,fieldValue:E.field_value,revisionId:E.revision_id,existing:E.existing,onSaved:C})]})}var Jre=Array.isArray,Xr=Jre,ene=typeof ef=="object"&&ef&&ef.Object===Object&&ef,mR=ene,tne=mR,rne=typeof self=="object"&&self&&self.Object===Object&&self,nne=tne||rne||Function("return this")(),Pa=nne,ane=Pa,ine=ane.Symbol,qd=ine,uN=qd,hR=Object.prototype,one=hR.hasOwnProperty,sne=hR.toString,jc=uN?uN.toStringTag:void 0;function lne(e){var t=one.call(e,jc),r=e[jc];try{e[jc]=void 0;var n=!0}catch{}var a=sne.call(e);return n&&(t?e[jc]=r:delete e[jc]),a}var cne=lne,une=Object.prototype,dne=une.toString;function fne(e){return dne.call(e)}var mne=fne,dN=qd,hne=cne,pne=mne,vne="[object Null]",gne="[object Undef
553ined]",fN=dN?dN.toStringTag:void 0;function yne(e){return e==null?e===void 0?gne:vne:fN&&fN in Object(e)?hne(e):pne(e)}var ai=yne;function xne(e){return e!=null&&typeof e=="object"}var ii=xne,bne=ai,wne=ii,jne="[object Symbol]";function Sne(e){return typeof e=="symbol"||wne(e)&&bne(e)==jne}var Yl=Sne,_ne=Xr,Nne=Yl,Ene=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cne=/^\w*$/;function One(e,t){if(_ne(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Nne(e)?!0:Cne.test(e)||!Ene.test(e)||t!=null&&e in Object(t)}var uj=One;function Pne(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Xi=Pne;const Xl=pt(Xi);var Ane=ai,Tne=Xi,Dne="[object AsyncFunction]",$ne="[object Function]",kne="[object GeneratorFunction]",Mne="[object Proxy]";function Ine(e){if(!Tne(e))return!1;var t=Ane(e);return t==$ne||t==kne||t==Dne||t==Mne}var dj=Ine;const Ge=pt(dj);var Rne=Pa,Lne=Rne["__core-js_shared__"],Fne=Lne,Ug=Fne,mN=function(){var e=/[^.]+$/.exec(Ug&&Ug.keys&&Ug.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Bne(e){return!!mN&&mN in e}var zne=Bne,qne=Function.prototype,Une=qne.toString;function Wne(e){if(e!=null){try{return Une.call(e)}catch{}try{return e+""}catch{}}return""}var pR=Wne,Vne=dj,Gne=zne,Hne=Xi,Kne=pR,Yne=/[\\^$.*+?()[\]{}|]/g,Xne=/^\[object .+?Constructor\]$/,Zne=Function.prototype,Qne=Object.prototype,Jne=Zne.toString,eae=Qne.hasOwnProperty,tae=RegExp("^"+Jne.call(eae).replace(Yne,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function rae(e){if(!Hne(e)||Gne(e))return!1;var t=Vne(e)?tae:Xne;return t.test(Kne(e))}var nae=rae;function aae(e,t){return e==null?void 0:e[t]}var iae=aae,oae=nae,sae=iae;function lae(e,t){var r=sae(e,t);return oae(r)?r:void 0}var ts=lae,cae=ts,uae=cae(Object,"create"),Jp=uae,hN=Jp;function dae(){this.__data__=hN?hN(null):{},this.size=0}var fae=dae;function mae(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var hae=mae,pae=Jp,vae="__lodash_hash_undefined__",gae=Object.prototype,yae=gae.hasOwnProperty;function xae(e){var t=this.__data__;if(pae){var r=t[e];return r===vae?void 0:r}return yae.call(t,e)?t[e]:void 0}var bae=xae,wae=Jp,jae=Object.prototype,Sae=jae.hasOwnProperty;function _ae(e){var t=this.__data__;return wae?t[e]!==void 0:Sae.call(t,e)}var Nae=_ae,Eae=Jp,Cae="__lodash_hash_undefined__";function Oae(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Eae&&t===void 0?Cae:t,this}var Pae=Oae,Aae=fae,Tae=hae,Dae=bae,$ae=Nae,kae=Pae;function Zl(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Zl.prototype.clear=Aae;Zl.prototype.delete=Tae;Zl.prototype.get=Dae;Zl.prototype.has=$ae;Zl.prototype.set=kae;var Mae=Zl;function Iae(){this.__data__=[],this.size=0}var Rae=Iae;function Lae(e,t){return e===t||e!==e&&t!==t}var fj=Lae,Fae=fj;function Bae(e,t){for(var r=e.length;r--;)if(Fae(e[r][0],t))return r;return-1}var ev=Bae,zae=ev,qae=Array.prototype,Uae=qae.splice;function Wae(e){var t=this.__data__,r=zae(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Uae.call(t,r,1),--this.size,!0}var Vae=Wae,Gae=ev;function Hae(e){var t=this.__data__,r=Gae(t,e);return r<0?void 0:t[r][1]}var Kae=Hae,Yae=ev;function Xae(e){return Yae(this.__data__,e)>-1}var Zae=Xae,Qae=ev;function Jae(e,t){var r=this.__data__,n=Qae(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var eie=Jae,tie=Rae,rie=Vae,nie=Kae,aie=Zae,iie=eie;function Ql(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ql.prototype.clear=tie;Ql.prototype.delete=rie;Ql.prototype.get=nie;Ql.prototype.has=aie;Ql.prototype.set=iie;var tv=Ql,oie=ts,sie=Pa,lie=oie(sie,"Map"),mj=lie,pN=Mae,cie=tv,uie=mj;function die(){this.size=0,this.__data__={hash:new pN,map:new(uie||cie),string:new pN}}var fie=die;function mie(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var hie=mie,pie=hie;function vie(e,t){var r=e.__data__;return pie(t)?r[typeof t=="string"?"string":"hash"]:r.map}var rv=vie,gie=rv;function yie(e){var t=gie(this,e).delete(e);return this.size-=t?1:0,t}var xie=yie,bie=rv;function wie(e){return bie(this,e).get(e)}var jie=wie,Sie=rv;function _ie(e){return Sie(this,e).has(e)}var Nie=_ie,Eie=rv;function Cie(e,t){var r=Eie(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var Oie=Cie,Pie=fie,Aie=xie,Tie=jie,Die=Nie,$ie=Oie;function Jl(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Jl.prototype.clear=Pie;Jl.prototype.delete=Aie;Jl.prototype.get=Tie;Jl.prototype.has=Die;Jl.prototype.set=$ie;var hj=Jl,vR=hj,kie="Expected a function";function pj(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(kie);var r=function(){var n=arguments,a=t?t.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var s=e.apply(this,n);return r.cache=i.set(a,s)||i,s};return r.cache=new(pj.Cache||vR),r}pj.Cache=vR;var gR=pj;const Mie=pt(gR);var Iie=gR,Rie=500;function Lie(e){var t=Iie(e,function(n){return r.size===Rie&&r.clear(),n}
553),r=t.cache;return t}var Fie=Lie,Bie=Fie,zie=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qie=/\\(\\)?/g,Uie=Bie(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(zie,function(r,n,a,i){t.push(a?i.replace(qie,"$1"):n||r)}),t}),Wie=Uie;function Vie(e,t){for(var r=-1,n=e==null?0:e.length,a=Array(n);++r<n;)a[r]=t(e[r],r,e);return a}var vj=Vie,vN=qd,Gie=vj,Hie=Xr,Kie=Yl,Yie=1/0,gN=vN?vN.prototype:void 0,yN=gN?gN.toString:void 0;function yR(e){if(typeof e=="string")return e;if(Hie(e))return Gie(e,yR)+"";if(Kie(e))return yN?yN.call(e):"";var t=e+"";return t=="0"&&1/e==-Yie?"-0":t}var Xie=yR,Zie=Xie;function Qie(e){return e==null?"":Zie(e)}var xR=Qie,Jie=Xr,eoe=uj,toe=Wie,roe=xR;function noe(e,t){return Jie(e)?e:eoe(e,t)?[e]:toe(roe(e))}var bR=noe,aoe=Yl,ioe=1/0;function ooe(e){if(typeof e=="string"||aoe(e))return e;var t=e+"";return t=="0"&&1/e==-ioe?"-0":t}var nv=ooe,soe=bR,loe=nv;function coe(e,t){t=soe(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[loe(t[r++])];return r&&r==n?e:void 0}var gj=coe,uoe=gj;function doe(e,t,r){var n=e==null?void 0:uoe(e,t);return n===void 0?r:n}var wR=doe;const dn=pt(wR);function foe(e){return e==null}var moe=foe;const Ye=pt(moe);var hoe=ai,poe=Xr,voe=ii,goe="[object String]";function yoe(e){return typeof e=="string"||!poe(e)&&voe(e)&&hoe(e)==goe}var xoe=yoe;const Ud=pt(xoe);var jR={exports:{}},gt={};/** 554 * @license React 555 * react-is.production.min.js 556 * 557 * Copyright (c) Facebook, Inc. and its affiliates. 558 * 559 * This source code is licensed under the MIT license found in the 560 * LICENSE file in the root directory of this source tree. 561 */var yj=Symbol.for("react.element"),xj=Symbol.for("react.portal"),av=Symbol.for("react.fragment"),iv=Symbol.for("react.strict_mode"),ov=Symbol.for("react.profiler"),sv=Symbol.for("react.provider"),lv=Symbol.for("react.context"),boe=Symbol.for("react.server_context"),cv=Symbol.for("react.forward_ref"),uv=Symbol.for("react.suspense"),dv=Symbol.for("react.suspense_list"),fv=Symbol.for("react.memo"),mv=Symbol.for("react.lazy"),woe=Symbol.for("react.offscreen"),SR;SR=Symbol.for("react.module.reference");function Bn(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case yj:switch(e=e.type,e){case av:case ov:case iv:case uv:case dv:return e;default:switch(e=e&&e.$$typeof,e){case boe:case lv:case cv:case mv:case fv:case sv:return e;default:return t}}case xj:return t}}}gt.ContextConsumer=lv;gt.ContextProvider=sv;gt.Element=yj;gt.ForwardRef=cv;gt.Fragment=av;gt.Lazy=mv;gt.Memo=fv;gt.Portal=xj;gt.Profiler=ov;gt.StrictMode=iv;gt.Suspense=uv;gt.SuspenseList=dv;gt.isAsyncMode=function(){return!1};gt.isConcurrentMode=function(){return!1};gt.isContextConsumer=function(e){return Bn(e)===lv};gt.isContextProvider=function(e){return Bn(e)===sv};gt.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===yj};gt.isForwardRef=function(e){return Bn(e)===cv};gt.isFragment=function(e){return Bn(e)===av};gt.isLazy=function(e){return Bn(e)===mv};gt.isMemo=function(e){return Bn(e)===fv};gt.isPortal=function(e){return Bn(e)===xj};gt.isProfiler=function(e){return Bn(e)===ov};gt.isStrictMode=function(e){return Bn(e)===iv};gt.isSuspense=function(e){return Bn(e)===uv};gt.isSuspenseList=function(e){return Bn(e)===dv};gt.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===av||e===ov||e===iv||e===uv||e===dv||e===woe||typeof e=="object"&&e!==null&&(e.$$typeof===mv||e.$$typeof===fv||e.$$typeof===sv||e.$$typeof===lv||e.$$typeof===cv||e.$$typeof===SR||e.getModuleId!==void 0)};gt.typeOf=Bn;jR.exports=gt;var _R=jR.exports,joe=ai,Soe=ii,_oe="[object Number]";function Noe(e){return typeof e=="number"||Soe(e)&&joe(e)==_oe}var NR=Noe;const Eoe=pt(NR);var Coe=NR;function Ooe(e){return Coe(e)&&e!=+e}var Poe=Ooe;const Wd=pt(Poe);var $r=function(t){return t===0?0:t>0?1:-1},ho=function(t){return Ud(t)&&t.indexOf("%")===t.length-1},he=function(t){return Eoe(t)&&!Wd(t)},ir=function(t){return he(t)||Ud(t)},Aoe=0,ec=function(t){var r=++Aoe;return"".concat(t||"").concat(r)},kr=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!he(t)&&!Ud(t))return n;var i;if(ho(t)){var s=t.indexOf("%");i=r*parseFloat(t.slice(0,s))/100}
vendor: 5,129 bytes, line 561
561else i=+t;return Wd(i)&&(i=n),a&&i>r&&(i=r),i},xi=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},Toe=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},a=0;a<r;a++)if(!n[t[a]])n[t[a]]=!0;else return!0;return!1},an=function(t,r){return he(t)&&he(r)?function(n){return t+n*(r-t)}:function(){return r}};function Im(e,t,r){return!e||!e.length?null:e.find(function(n){return n&&(typeof t=="function"?t(n):dn(n,t))===r})}function $s(e,t){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(t,r)||e[r]!==t[r]))return!1;for(var n in t)if({}.hasOwnProperty.call(t,n)&&!{}.hasOwnProperty.call(e,n))return!1;return!0}function Ex(e){"@babel/helpers - typeof";return Ex=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ex(e)}var Doe=["viewBox","children"],$oe=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],xN=["points","pathLength"],Wg={svg:Doe,polygon:xN,polyline:xN},bj=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onF
561ocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],Rm=function(t,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(h.isValidElement(t)&&(n=t.props),!Xl(n))return null;var a={};return Object.keys(n).forEach(function(i){bj.includes(i)&&(a[i]=r||function(s){return n[i](n,s)})}),a},koe=function(t,r,n){return function(a){return t(r,n,a),null}},qo=function(t,r,n){if(!Xl(t)||Ex(t)!=="object")return null;var a=null;return Object.keys(t).forEach(function(i){var s=t[i];bj.includes(i)&&typeof s=="function"&&(a||(a={}),a[i]=koe(s,r,n))}),a},Moe=["children"],Ioe=["children"];function bN(e,t){if(e==null)return{};var r=Roe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Roe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Cx(e){"@babel/helpers - typeof";return Cx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cx(e)}var wN={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},Wa=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},jN=null,Vg=null,wj=function e(t){if(t===jN&&Array.isArray(Vg))return Vg;var r=[];
vendor: 4,058 bytes, line 561
561return h.Children.forEach(t,function(n){Ye(n)||(_R.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),Vg=r,jN=t,r};function fn(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(a){return Wa(a)}):n=[Wa(t)],wj(e).forEach(function(a){var i=dn(a,"type.displayName")||dn(a,"type.name");n.indexOf(i)!==-1&&r.push(a)}),r}function nn(e,t){var r=fn(e,t);return r&&r[0]}var SN=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,a=r.height;return!(!he(n)||n<=0||!he(a)||a<=0)},Loe=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Foe=function(t){return t&&t.type&&Ud(t.type)&&Loe.indexOf(t.type)>=0},Boe=function(t){return t&&Cx(t)==="object"&&"clipDot"in t},zoe=function(t,r,n,a){var i,s=(i=Wg==null?void 0:Wg[a])!==null&&i!==void 0?i:[];return!Ge(t)&&(a&&s.includes(r)||$oe.includes(r))||n&&bj.includes(r)},ze=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(h.isValidElement(t)&&(a=t.props),!Xl(a))return null;var i={};return Object.keys(a).forEach(function(s){var l;zoe((l=a)===null||l===void 0?void 0:l[s],s,r,n)&&(i[s]=a[s])}),i},Ox=function e(t,r){if(t===r)return!0;var n=h.Children.count(t);if(n!==h.Children.count(r))return!1;if(n===0)return!0;if(n===1)return _N(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var a=0;a<n;a++){var i=t[a],s=r[a];if(Array.isArray(i)||Array.isArray(s)){if(!e(i,s))return!1}else if(!_N(i,s))return!1}return!0},_N=function(t,r){if(Ye(t)&&Ye(r))return!0;if(!Ye(t)&&!Ye(r)){var n=t.props||{},a=n.children,i=bN(n,Moe),s=r.props||{},l=s.children,c=bN(s,Ioe);return a&&l?$s(i,c)&&Ox(a,l):!a&&!l?$s(i,c):!1}return!1},NN=function(t,r){var n=[],a={};return wj(t).forEach(function(i,s){if(Foe(i))n.push(i);else if(i){var l=Wa(i.type),c=r[l]||{},u=c.handler,d=c.once;if(u&&(!d||!a[l])){var f=u(i,l,s);n.push(f),a[l]=!0}}}),n},qoe=function(t){var r=t&&t.type;return r&&wN[r]?wN[r]:null},Uoe=function(t,r){return wj(r).indexOf(t)},Woe=["children","width","height","viewBox","className","style","title","desc"];function Px(){return Px=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Px.apply(this,arguments)}function Voe(e,t){if(e==null)return{};var r=Goe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Goe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Ax(e){var t=e.children,r=e.width,n=e.height,a=e.viewBox,i=e.className,s=e.style,l=e.title,c=e.desc,u=Voe(e,Woe),d=a||{width:r,height:n,x:0,y:0},f=Qe("recharts-surface",i);return $.createElement("svg",Px({},ze(u,!0,"svg"),{className:f,width:r,height:n,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),$.createElement("title",null,l),$.createElement("desc",null,c),t)}var Hoe=["children","className"];function Tx(){return Tx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
561for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Tx.apply(this,arguments)}function Koe(e,t){if(e==null)return{};var r=Yoe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Yoe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var ct=$.forwardRef(function(e,t){var r=e.children,n=e.className,a=Koe(e,Hoe),i=Qe("recharts-layer",n);return $.createElement("g",Tx({className:i},ze(a,!0),{ref:t}),r)}),ea=function(t,r){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i]};function Xoe(e,t,r){var n=-1,a=e.length;t<0&&(t=-t>a?0:a+t),r=r>a?a:r,r<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(a);++n<a;)i[n]=e[n+t];return i}var Zoe=Xoe,Qoe=Zoe;function Joe(e,t,r){var n=e.length;return r=r===void 0?n:r,!t&&r>=n?e:Qoe(e,t,r)}var ese=Joe,tse="\\ud800-\\udfff",rse="\\u0300-\\u036f",nse="\\ufe20-\\ufe2f",ase="\\u20d0-\\u20ff",ise=rse+nse+ase,ose="\\ufe0e\\ufe0f",sse="\\u200d",lse=RegExp("["+sse+tse+ise+ose+"]");function cse(e){return lse.test(e)}var ER=cse;function use(e){return e.split("")}var dse=use,CR="\\ud800-\\udfff",fse="\\u0300-\\u036f",mse="\\ufe20-\\ufe2f",hse="\\u20d0-\\u20ff",pse=fse+mse+hse,vse="\\ufe0e\\ufe0f",gse="["+CR+"]",Dx="["+pse+"]",$x="\\ud83c[\\udffb-\\udfff]",yse="(?:"+Dx+"|"+$x+")",OR="[^"+CR+"]",PR="(?:\\ud83c[\\udde6-\\uddff]){2}",AR="[\\ud800-\\udbff][\\udc00-\\udfff]",xse="\\u200d",TR=yse+"?",DR="["+vse+"]?",bse="(?:"+xse+"(?:"+[OR,PR,AR].join("|")+")"+DR+TR+")*",wse=DR+TR+bse,jse="(?:"+[OR+Dx+"?",Dx,PR,AR,gse].join("|")+")",Sse=RegExp($x+"(?="+$x+")|"+jse+wse,"g");function _se(e){return e.match(Sse)||[]}var Nse=_se,Ese=dse,Cse=ER,Ose=Nse;function Pse(e){return Cse(e)?Ose(e):Ese(e)}var Ase=Pse,Tse=ese,Dse=ER,$se=Ase,kse=xR;function Mse(e){return function(t){t=kse(t);var r=Dse(t)?$se(t):void 0,n=r?r[0]:t.charAt(0),a=r?Tse(r,1).join(""):t.slice(1);return n[e]()+a}}var Ise=Mse,Rse=Ise,Lse=Rse("toUpperCase"),Fse=Lse;const hv=pt(Fse);function Pt(e){return function(){return e}}const $R=Math.cos,Lm=Math.sin,aa=Math.sqrt,Fm=Math.PI,pv=2*Fm,kx=Math.PI,Mx=2*kx,so=1e-6,Bse=Mx-so;function kR(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function zse(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return kR;const r=10**t;return function(n){this._+=n[0];for(let a=1,i=n.length;a<i;++a)this._+=Math.round(arguments[a]*r)/r+n[a]}}class qse{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?kR:zse(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,a){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+a}`}bezierCurveTo(t,r,n,a,i,s){this._append`C${+t},${+r},${+n},${+a},${this._x1=+i},${this._y1=+s}`}arcTo(t,r,n,a,i){if(t=+t,r=+r,n=+n,a=+a,i=+i,i<0)throw new Error(`negative radius: ${i}`);let s=this._x1,l=this._y1,c=n-t,u=a-r,d=s-t,f=l-r,m=d*d+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(m>so)if(!(Math.abs(f*c-u*d)>so)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-s,y=a-l,v=c*c+u*u,g=p*p+y*y,x=Math.sqrt(v),b=Math.sqrt(m),j=i*Math.tan((kx-Math.acos((v+m-g)/(2*x*b)))/2),w=j/b,S=j/x;Math.abs(w-1)>so&&this._append`L${t+w*d},${r+w*f}`,this._append`A${i},${i},0,0,${+(f*p>d*y)},${this._x1=t+S*c},${this._y1=r+S*u}`}}arc(t,r,n,a,i,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(a),c=n*Math.sin(a),u=t+l,d=r+c,f=1^s,m=s?a-i:i-a;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>so||Math.abs(this._y1-d)>so)&&this._append`L${u},${d}`,n&&(m<0&&(m=m%Mx+Mx),m>Bse?this._append`A${n},${n},0,1,${f},${t-l},${r-c}A${n},${n},0,1,${f},${this._x1=u},${this._y1=d}`:m>so&&this._append`A${n},${n},0,${+(m>=kx)},${f},${this._x1=t+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(t,r,n,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+a}h${-n}Z`}toString(){return this._}}function jj(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new qse(t)}function Sj(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function MR(e){this._context=e}MR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function vv(e){return new MR(e)}function IR(e){return e[0]}function RR(e){return e[1]}
561function LR(e,t){var r=Pt(!0),n=null,a=vv,i=null,s=jj(l);e=typeof e=="function"?e:e===void 0?IR:Pt(e),t=typeof t=="function"?t:t===void 0?RR:Pt(t);function l(c){var u,d=(c=Sj(c)).length,f,m=!1,p;for(n==null&&(i=a(p=s())),u=0;u<=d;++u)!(u<d&&r(f=c[u],u,c))===m&&((m=!m)?i.lineStart():i.lineEnd()),m&&i.point(+e(f,u,c),+t(f,u,c));if(p)return i=null,p+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:Pt(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:Pt(+c),l):t},l.defined=function(c){return arguments.length?(r=typeof c=="function"?c:Pt(!!c),l):r},l.curve=function(c){return arguments.length?(a=c,n!=null&&(i=a(n)),l):a},l.context=function(c){return arguments.length?(c==null?n=i=null:i=a(n=c),l):n},l}function jf(e,t,r){var n=null,a=Pt(!0),i=null,s=vv,l=null,c=jj(u);e=typeof e=="function"?e:e===void 0?IR:Pt(+e),t=typeof t=="function"?t:Pt(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?RR:Pt(+r);function u(f){var m,p,y,v=(f=Sj(f)).length,g,x=!1,b,j=new Array(v),w=new Array(v);for(i==null&&(l=s(b=c())),m=0;m<=v;++m){if(!(m<v&&a(g=f[m],m,f))===x)if(x=!x)p=m,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),y=m-1;y>=p;--y)l.point(j[y],w[y]);l.lineEnd(),l.areaEnd()}x&&(j[m]=+e(g,m,f),w[m]=+t(g,m,f),l.point(n?+n(g,m,f):j[m],r?+r(g,m,f):w[m]))}if(b)return l=null,b+""||null}function d(){return LR().defined(a).curve(s).context(i)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Pt(+f),n=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Pt(+f),u):e},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Pt(+f),u):n},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Pt(+f),r=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Pt(+f),u):t},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Pt(+f),u):r},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(r)},u.lineX1=function(){return d().x(n).y(t)},u.defined=function(f){return arguments.length?(a=typeof f=="function"?f:Pt(!!f),u):a},u.curve=function(f){return arguments.length?(s=f,i!=null&&(l=s(i)),u):s},u.context=function(f){return arguments.length?(f==null?i=l=null:l=s(i=f),u):i},u}class FR{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function Use(e){return new FR(e,!0)}function Wse(e){return new FR(e,!1)}const _j={draw(e,t){const r=aa(t/Fm);e.moveTo(r,0),e.arc(0,0,r,0,pv)}},Vse={draw(e,t){const r=aa(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},BR=aa(1/3),Gse=BR*2,Hse={draw(e,t){const r=aa(t/Gse),n=r*BR;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},Kse={draw(e,t){const r=aa(t),n=-r/2;e.rect(n,n,r,r)}},Yse=.8908130915292852,zR=Lm(Fm/10)/Lm(7*Fm/10),Xse=Lm(pv/10)*zR,Zse=-$R(pv/10)*zR,Qse={draw(e,t){const r=aa(t*Yse),n=Xse*r,a=Zse*r;e.moveTo(0,-r),e.lineTo(n,a);for(let i=1;i<5;++i){const s=pv*i/5,l=$R(s),c=Lm(s);e.lineTo(c*r,-l*r),e.lineTo(l*n-c*a,c*n+l*a)}e.closePath()}},Gg=aa(3),Jse={draw(e,t){const r=-aa(t/(Gg*3));e.moveTo(0,r*2),e.lineTo(-Gg*r,-r),e.lineTo(Gg*r,-r),e.closePath()}},Sn=-.5,_n=aa(3)/2,Ix=1/aa(12),ele=(Ix/2+1)*3,tle={draw(e,t){const r=aa(t/ele),n=r/2,a=r*Ix,i=n,s=r*Ix+r,l=-i,c=s;e.moveTo(n,a),e.lineTo(i,s),e.lineTo(l,c),e.lineTo(Sn*n-_n*a,_n*n+Sn*a),e.lineTo(Sn*i-_n*s,_n*i+Sn*s),e.lineTo(Sn*l-_n*c,_n*l+Sn*c),e.lineTo(Sn*n+_n*a,Sn*a-_n*n),e.lineTo(Sn*i+_n*s,Sn*s-_
vendor: 6,252 bytes, line 561
561n*i),e.lineTo(Sn*l+_n*c,Sn*c-_n*l),e.closePath()}};function rle(e,t){let r=null,n=jj(a);e=typeof e=="function"?e:Pt(e||_j),t=typeof t=="function"?t:Pt(t===void 0?64:+t);function a(){let i;if(r||(r=i=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),i)return r=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:Pt(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:Pt(+i),a):t},a.context=function(i){return arguments.length?(r=i??null,a):r},a}function Bm(){}function zm(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function qR(e){this._context=e}qR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:zm(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:zm(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function nle(e){return new qR(e)}function UR(e){this._context=e}UR.prototype={areaStart:Bm,areaEnd:Bm,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:zm(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function ale(e){return new UR(e)}function WR(e){this._context=e}WR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:zm(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function ile(e){return new WR(e)}function VR(e){this._context=e}VR.prototype={areaStart:Bm,areaEnd:Bm,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function ole(e){return new VR(e)}function EN(e){return e<0?-1:1}function CN(e,t,r){var n=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(n||a<0&&-0),s=(r-e._y1)/(a||n<0&&-0),l=(i*a+s*n)/(n+a);return(EN(i)+EN(s))*Math.min(Math.abs(i),Math.abs(s),.5*Math.abs(l))||0}function ON(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Hg(e,t,r){var n=e._x0,a=e._y0,i=e._x1,s=e._y1,l=(i-n)/3;e._context.bezierCurveTo(n+l,a+l*t,i-l,s-l*r,i,s)}function qm(e){this._context=e}qm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Hg(this,this._t0,ON(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Hg(this,ON(this,r=CN(this,e,t)),r);break;default:Hg(this,this._t0,r=CN(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function GR(e){this._context=new HR(e)}(GR.prototype=Object.create(qm.prototype)).point=function(e,t){qm.prototype.point.call(this,t,e)};function HR(e){this._context=e}HR.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,a,i){this._context.bezierCurveTo(t,e,n,r,i,a)}};function sle(e){return new qm(e)}function lle(e){return new GR(e)}function KR(e){this._context=e}KR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=PN(e),a=PN(t),i=0,s=1;s<r;++i,++s)this._context.bezierCurveTo(n[0][i],a[0][i],n[1][i],a[1][i],e[s],t[s]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function PN(e){var t,r=e.length-1,n,a=new Array(r),i=new Array(r),s=new Array(r);for(a[0]=0,i[0]=2,s[0]=e[0]+2*e[1],t=1;t<r-1;++t)a[t]=1,i[t]=4,s[t]=4*e[t]+2*e[t+1];for(a[r-1]=2,i[r-1]=7,s[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=a[t]/i[t-1],i[t]-=n,s[t]-=n*s[t-1];for(a[r-1]=s[r-1]/i[r-1],t=r-2;t>=0;--t)a[t]=(s[t]-a[t+1])/i[t];for(i[r-1]=(e[r]+a[r-1])/2,t=0;t<r-1;++t)i[t]=2*e[t+1]-a[t+1];return[a,i]}function cle(e){return new KR(e)}
561function gv(e,t){this._context=e,this._t=t}gv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function ule(e){return new gv(e,.5)}function dle(e){return new gv(e,0)}function fle(e){return new gv(e,1)}function ol(e,t){if((s=e.length)>1)for(var r=1,n,a,i=e[t[0]],s,l=i.length;r<s;++r)for(a=i,i=e[t[r]],n=0;n<l;++n)i[n][1]+=i[n][0]=isNaN(a[n][1])?a[n][0]:a[n][1]}function Rx(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function mle(e,t){return e[t]}function hle(e){const t=[];return t.key=e,t}function ple(){var e=Pt([]),t=Rx,r=ol,n=mle;function a(i){var s=Array.from(e.apply(this,arguments),hle),l,c=s.length,u=-1,d;for(const f of i)for(l=0,++u;l<c;++l)(s[l][u]=[0,+n(f,s[l].key,u,i)]).data=f;for(l=0,d=Sj(t(s));l<c;++l)s[d[l]].index=l;return r(s,d),s}return a.keys=function(i){return arguments.length?(e=typeof i=="function"?i:Pt(Array.from(i)),a):e},a.value=function(i){return arguments.length?(n=typeof i=="function"?i:Pt(+i),a):n},a.order=function(i){return arguments.length?(t=i==null?Rx:typeof i=="function"?i:Pt(Array.from(i)),a):t},a.offset=function(i){return arguments.length?(r=i??ol,a):r},a}function vle(e,t){if((n=e.length)>0){for(var r,n,a=0,i=e[0].length,s;a<i;++a){for(s=r=0;r<n;++r)s+=e[r][a][1]||0;if(s)for(r=0;r<n;++r)e[r][a][1]/=s}ol(e,t)}}function gle(e,t){if((a=e.length)>0){for(var r=0,n=e[t[0]],a,i=n.length;r<i;++r){for(var s=0,l=0;s<a;++s)l+=e[s][r][1]||0;n[r][1]+=n[r][0]=-l/2}ol(e,t)}}function yle(e,t){if(!(!((s=e.length)>0)||!((i=(a=e[t[0]]).length)>0))){for(var r=0,n=1,a,i,s;n<i;++n){for(var l=0,c=0,u=0;l<s;++l){for(var d=e[t[l]],f=d[n][1]||0,m=d[n-1][1]||0,p=(f-m)/2,y=0;y<l;++y){var v=e[t[y]],g=v[n][1]||0,x=v[n-1][1]||0;p+=g-x}c+=f,u+=p*f}a[n-1][1]+=a[n-1][0]=r,c&&(r-=u/c)}a[n-1][1]+=a[n-1][0]=r,ol(e,t)}}function Mu(e){"@babel/helpers - typeof";return Mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mu(e)}var xle=["type","size","sizeType"];function Lx(){return Lx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Lx.apply(this,arguments)}function AN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function TN(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?AN(Object(r),!0).forEach(function(n){ble(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ble(e,t,r){return t=wle(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wle(e){var t=jle(e,"string");return Mu(t)=="symbol"?t:t+""}function jle(e,t){if(Mu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Mu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sle(e,t){if(e==null)return{};var r=_le(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function _le(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var YR={symbolCircle:_j,symbolCross:Vse,symbolDiamond:Hse,symbolSquare:Kse,symbolStar:Qse,symbolTriangle:Jse,symbolWye:tle},Nle=Math.PI/180,Ele=function(t){var r="symbol".concat(hv(t));return YR[r]||_j},Cle=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*Nle;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},Ole=function(t,r){YR["symbol".concat(hv(t))]=r},Nj=function(t){var r=t.type,n=r===void 0?"circle":r,a=t.size,i=a===void 0?64:a,s=t.sizeType,l=s===void 0?"area":s,c=Sle(t,xle),u=TN(TN({},c),{},{type:n,size:i,sizeType:l}),d=function(){var g=Ele(n),x=rle().type(g).size(Cle(i,l,n));return x()},f=u.className,m=u.cx,p=u.cy,y=ze(u,!0);return m===+m&&p===+p&&i===+i?$.createElement("path",Lx({}
vendor: 4,414 bytes, lines 561-564
561,y,{className:Qe("recharts-symbols",f),transform:"translate(".concat(m,", ").concat(p,")"),d:d()})):null};Nj.registerSymbol=Ole;function sl(e){"@babel/helpers - typeof";return sl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sl(e)}function Fx(){return Fx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Fx.apply(this,arguments)}function DN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ple(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?DN(Object(r),!0).forEach(function(n){Iu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DN(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ale(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tle(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ZR(n.key),n)}}function Dle(e,t,r){return t&&Tle(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $le(e,t,r){return t=Um(t),kle(e,XR()?Reflect.construct(t,r||[],Um(e).constructor):t.apply(e,r))}function kle(e,t){if(t&&(sl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mle(e)}function Mle(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function XR(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(XR=function(){return!!e})()}function Um(e){return Um=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Um(e)}function Ile(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Bx(e,t)}function Bx(e,t){return Bx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Bx(e,t)}function Iu(e,t,r){return t=ZR(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ZR(e){var t=Rle(e,"string");return sl(t)=="symbol"?t:t+""}function Rle(e,t){if(sl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(sl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Nn=32,Ej=function(e){function t(){return Ale(this,t),$le(this,t,arguments)}return Ile(t,e),Dle(t,[{key:"renderIcon",value:function(n){var a=this.props.inactiveColor,i=Nn/2,s=Nn/6,l=Nn/3,c=n.inactive?a:n.color;if(n.type==="plainline")return $.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:i,x2:Nn,y2:i,className:"recharts-legend-icon"});if(n.type==="line")return $.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(i,"h").concat(l,` 562 A`).concat(s,",").concat(s,",0,1,1,").concat(2*l,",").concat(i,` 563 H`).concat(Nn,"M").concat(2*l,",").concat(i,` 564 A`).concat(s,",").concat(s,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(n.type==="rect")return $.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(Nn/8,"h").concat(Nn,"v").concat(Nn*3/4,"h").concat(-Nn,"z"),className:"recharts-legend-icon"});if($.isValidElement(n.legendIcon)){var u=Ple({},n);return delete u.legendIcon,$.cloneElement(n.legendIcon,u)}return $.createElement(Nj,{fill:c,cx:i,cy:i,size:Nn,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,a=this.props,i=a.payload,s=a.iconSize,l=a.layout,c=a.formatter,u=a.inactiveColor,d={x:0,y:0,width:Nn,height:Nn}
564,f={display:l==="horizontal"?"inline-block":"block",marginRight:10},m={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(p,y){var v=p.formatter||c,g=Qe(Iu(Iu({"recharts-legend-item":!0},"legend-item-".concat(y),!0),"inactive",p.inactive));if(p.type==="none")return null;var x=Ge(p.value)?null:p.value;ea(!Ge(p.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var b=p.inactive?u:p.color;return $.createElement("li",Fx({className:g,style:f,key:"legend-item-".concat(y)},qo(n.props,p,y)),$.createElement(Ax,{width:s,height:s,viewBox:d,style:m},n.renderIcon(p)),$.createElement("span",{className:"recharts-legend-item-text",style:{color:b}},v?v(x,p,y):x))})}},{key:"render",value:function(){var n=this.props,a=n.payload,i=n.layout,s=n.align;if(!a||!a.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?s:"left"};return $.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(h.PureComponent);Iu(Ej,"displayName","Legend");Iu(Ej,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Lle=tv;function Fle(){this.__data__=new Lle,this.size=0}var Ble=Fle;function zle(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var qle=zle;function Ule(e){return this.__data__.get(e)}var Wle=Ule;function Vle(e){return this.__data__.has(e)}var Gle=Vle,Hle=tv,Kle=mj,Yle=hj,Xle=200;function Zle(e,t){var r=this.__data__;if(r instanceof Hle){var n=r.__data__;if(!Kle||n.length<Xle-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Yle(n)}return r.set(e,t),this.size=r.size,this}var Qle=Zle,Jle=tv,ece=Ble,tce=qle,rce=Wle,nce=Gle,ace=Qle;function tc(e){var t=this.__data__=new Jle(e);this.size=t.size}tc.prototype.clear=ece;tc.prototype.delete=tce;tc.prototype.get=rce;tc.prototype.has=nce;tc.prototype.set=ace;var QR=tc,ice="__lodash_hash_undefined__";function oce(e){return this.__data__.set(e,ice),this}var sce=oce;function lce(e){return this.__data__.has(e)}var cce=lce,uce=hj,dce=sce,fce=cce;function Wm(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new uce;++t<r;)this.add(e[t])}Wm.prototype.add=Wm.prototype.push=dce;Wm.prototype.has=fce;var JR=Wm;function mce(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var eL=mce;function hce(e,t){return e.has(t)}var tL=hce,pce=JR,vce=eL,gce=tL,yce=1,xce=2;function bce(e,t,r,n,a,i){var s=r&yce,l=e.length,c=t.length;if(l!=c&&!(s&&c>l))return!1;var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var f=-1,m=!0,p=r&xce?new pce:void 0;for(i.set(e,t),i.set(t,e);++f<l;){var y=e[f],v=t[f];if(n)var g=s?n(v,y,f,t,e,i):n(y,v,f,e,t,i);if(g!==void 0){if(g)continue;m=!1;break}if(p){if(!vce(t,function(x,b){if(!gce(p,b)&&(y===x||a(y,x,r,n,i)))return p.push(b)})){m=!1;break}}else if(!(y===v||a(y,v,r,n,i))){m=!1;break}}return i.delete(e),i.delete(t),m}var rL=bce,wce=Pa,jce=wce.Uint8Array,Sce=jce;function _ce(e){var t=-1,r=Array(e.size);return e.forEach(function(n,a){r[++t]=[a,n]}),r}var Nce=_ce;function Ece(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Cj=Ece,$N=qd,kN=Sce,Cce=fj,Oce=rL,Pce=Nce,Ace=Cj,Tce=1,Dce=2,$ce="[object Boolean]",kce="[object Date]",Mce="[object Error]",Ice="[object Map]",Rce="[object Number]",Lce="[object RegExp]",Fce="[object Set]",Bce="[object String]",zce="[object Symbol]",qce="[object ArrayBuffer]",Uce="[object DataView]",MN=$N?$N.prototype:void 0,Kg=MN?MN.valueOf:void 0;function Wce(e,t,r,n,a,i,s){switch(r){case Uce:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case qce:return!(e.byteLength!=t.byteLength||!i(new kN(e),new kN(t)));case $ce:case kce:case Rce:return Cce(+e,+t);case Mce:return e.name==t.name&&e.message==t.message;case Lce:case Bce:return e==t+"";case Ice:var l=Pce;case Fce:var c=n&Tce;if(l||(l=Ace),e.size!=t.size&&!c)return!1;var u=s.get(e);if(u)return u==t;n|=Dce,s.set(e,t);var d=Oce(l(e),l(t),n,a,i,s);return s.delete(e),d;case zce:if(Kg)return Kg.call(e)==Kg.call(t)}return!1}var Vce=Wce;function Gce(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}var nL=Gce,Hce=nL,Kce=Xr;function Yce(e,t,r){var n=t(e);return Kce(e)?n:Hce(n,r(e))}var Xce=Yce;function Zce(e,t){for(var r=-1,n=e==null?0:e.length,a=0,i=[];++r<n;){var s=e[r];t(s,r,e)&&(i[a++]=s)}return i}var Qce=Zce;
vendor: 5,265 bytes, line 564
564function Jce(){return[]}var eue=Jce,tue=Qce,rue=eue,nue=Object.prototype,aue=nue.propertyIsEnumerable,IN=Object.getOwnPropertySymbols,iue=IN?function(e){return e==null?[]:(e=Object(e),tue(IN(e),function(t){return aue.call(e,t)}))}:rue,oue=iue;function sue(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var lue=sue,cue=ai,uue=ii,due="[object Arguments]";function fue(e){return uue(e)&&cue(e)==due}var mue=fue,RN=mue,hue=ii,aL=Object.prototype,pue=aL.hasOwnProperty,vue=aL.propertyIsEnumerable,gue=RN(function(){return arguments}())?RN:function(e){return hue(e)&&pue.call(e,"callee")&&!vue.call(e,"callee")},Oj=gue,Vm={exports:{}};function yue(){return!1}var xue=yue;Vm.exports;(function(e,t){var r=Pa,n=xue,a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===a,l=s?r.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||n;e.exports=u})(Vm,Vm.exports);var iL=Vm.exports,bue=9007199254740991,wue=/^(?:0|[1-9]\d*)$/;function jue(e,t){var r=typeof e;return t=t??bue,!!t&&(r=="number"||r!="symbol"&&wue.test(e))&&e>-1&&e%1==0&&e<t}var Pj=jue,Sue=9007199254740991;function _ue(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Sue}var Aj=_ue,Nue=ai,Eue=Aj,Cue=ii,Oue="[object Arguments]",Pue="[object Array]",Aue="[object Boolean]",Tue="[object Date]",Due="[object Error]",$ue="[object Function]",kue="[object Map]",Mue="[object Number]",Iue="[object Object]",Rue="[object RegExp]",Lue="[object Set]",Fue="[object String]",Bue="[object WeakMap]",zue="[object ArrayBuffer]",que="[object DataView]",Uue="[object Float32Array]",Wue="[object Float64Array]",Vue="[object Int8Array]",Gue="[object Int16Array]",Hue="[object Int32Array]",Kue="[object Uint8Array]",Yue="[object Uint8ClampedArray]",Xue="[object Uint16Array]",Zue="[object Uint32Array]",kt={};kt[Uue]=kt[Wue]=kt[Vue]=kt[Gue]=kt[Hue]=kt[Kue]=kt[Yue]=kt[Xue]=kt[Zue]=!0;kt[Oue]=kt[Pue]=kt[zue]=kt[Aue]=kt[que]=kt[Tue]=kt[Due]=kt[$ue]=kt[kue]=kt[Mue]=kt[Iue]=kt[Rue]=kt[Lue]=kt[Fue]=kt[Bue]=!1;function Que(e){return Cue(e)&&Eue(e.length)&&!!kt[Nue(e)]}var Jue=Que;function ede(e){return function(t){return e(t)}}var oL=ede,Gm={exports:{}};Gm.exports;(function(e,t){var r=mR,n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===n,s=i&&r.process,l=function(){try{var c=a&&a.require&&a.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}}();e.exports=l})(Gm,Gm.exports);var tde=Gm.exports,rde=Jue,nde=oL,LN=tde,FN=LN&&LN.isTypedArray,ade=FN?nde(FN):rde,sL=ade,ide=lue,ode=Oj,sde=Xr,lde=iL,cde=Pj,ude=sL,dde=Object.prototype,fde=dde.hasOwnProperty;function mde(e,t){var r=sde(e),n=!r&&ode(e),a=!r&&!n&&lde(e),i=!r&&!n&&!a&&ude(e),s=r||n||a||i,l=s?ide(e.length,String):[],c=l.length;for(var u in e)(t||fde.call(e,u))&&!(s&&(u=="length"||a&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||cde(u,c)))&&l.push(u);return l}var hde=mde,pde=Object.prototype;function vde(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||pde;return e===r}var gde=vde;function yde(e,t){return function(r){return e(t(r))}}var lL=yde,xde=lL,bde=xde(Object.keys,Object),wde=bde,jde=gde,Sde=wde,_de=Object.prototype,Nde=_de.hasOwnProperty;function Ede(e){if(!jde(e))return Sde(e);var t=[];for(var r in Object(e))Nde.call(e,r)&&r!="constructor"&&t.push(r);return t}var Cde=Ede,Ode=dj,Pde=Aj;function Ade(e){return e!=null&&Pde(e.length)&&!Ode(e)}var Vd=Ade,Tde=hde,Dde=Cde,$de=Vd;function kde(e){return $de(e)?Tde(e):Dde(e)}var yv=kde,Mde=Xce,Ide=oue,Rde=yv;function Lde(e){return Mde(e,Rde,Ide)}var Fde=Lde,BN=Fde,Bde=1,zde=Object.prototype,qde=zde.hasOwnProperty;function Ude(e,t,r,n,a,i){var s=r&Bde,l=BN(e),c=l.length,u=BN(t),d=u.length;if(c!=d&&!s)return!1;for(var f=c;f--;){var m=l[f];if(!(s?m in t:qde.call(t,m)))return!1}var p=i.get(e),y=i.get(t);if(p&&y)return p==t&&y==e;var v=!0;i.set(e,t),i.set(t,e);for(var g=s;++f<c;){m=l[f];var x=e[m],b=t[m];if(n)var j=s?n(b,x,m,t,e,i):n(x,b,m,e,t,i);if(!(j===void 0?x===b||a(x,b,r,n,i):j)){v=!1;break}g||(g=m=="constructor")}if(v&&!g){var w=e.constructor,S=t.constructor;w!=S&&"constructor"in e&&"constructor"in t&&!(typeof w=="function"&&w instanceof w&&typeof S=="function"&&S instanceof S)&&(v=!1)}return i.delete(e),i.delete(t),v}var Wde=Ude,Vde=ts,Gde=Pa,Hde=Vde(Gde,"DataView"),Kde=Hde,Yde=ts,Xde=Pa,Zde=Yde(Xde,"Promise"),Qde=Zde,Jde=ts,efe=Pa,tfe=Jde(efe,"Set"),cL=tfe,rfe=ts,nfe=Pa,afe=rfe(nfe,"WeakMap"),ife=afe,zx=Kde,qx=mj,Ux=Qde,Wx=cL,Vx=ife,uL=ai,rc=pR,zN="[object Map]",ofe="[object Object]",qN="[object Promise]",UN="[object Set]",WN="[object WeakMap]",VN="[object DataView]",sfe=rc(zx),lfe=rc(qx),cfe=rc(Ux),ufe=rc(Wx),dfe=rc(Vx),lo=uL;(zx&&lo(new zx(new ArrayBuffer(1)))!=VN||qx&&lo(new qx)!=zN||Ux&&lo(Ux.resolve())!=qN||Wx&&lo(new Wx)!=UN||Vx&&lo(new Vx)!=WN)&&(lo=function(e){var t=uL(e),r=t==ofe?e.constructor:void 0,n=r?rc(r):"";if(n)switch(n){case sfe:return VN;case lfe:return zN;case cfe:return qN;case ufe:return UN;case dfe:return WN}return t});var ffe=lo,Yg=QR,mfe=rL,hfe=Vce,pfe=Wde,GN=ffe,HN=Xr,KN=iL,vfe=sL,gfe=1,YN="[object Arguments]",XN="[object Array]",Sf="[object Object]",yfe=Object.prototype,ZN=yfe.hasOwnProperty;function xfe(e,t,r,n,a,i){var s=HN(e),l=HN(t),c=s?XN:GN(e),u=l?XN:GN(t);c=c==YN?Sf:c,u=u==YN?Sf:u;var d=c==Sf,f=u==Sf,m=c==u;if(m&&KN(e)){if(!KN(t))return!1;s=!0,d=!1}
vendor: 2,534 bytes, line 564
564if(m&&!d)return i||(i=new Yg),s||vfe(e)?mfe(e,t,r,n,a,i):hfe(e,t,c,r,n,a,i);if(!(r&gfe)){var p=d&&ZN.call(e,"__wrapped__"),y=f&&ZN.call(t,"__wrapped__");if(p||y){var v=p?e.value():e,g=y?t.value():t;return i||(i=new Yg),a(v,g,r,n,i)}}return m?(i||(i=new Yg),pfe(e,t,r,n,a,i)):!1}var bfe=xfe,wfe=bfe,QN=ii;function dL(e,t,r,n,a){return e===t?!0:e==null||t==null||!QN(e)&&!QN(t)?e!==e&&t!==t:wfe(e,t,r,n,dL,a)}var Tj=dL,jfe=QR,Sfe=Tj,_fe=1,Nfe=2;function Efe(e,t,r,n){var a=r.length,i=a,s=!n;if(e==null)return!i;for(e=Object(e);a--;){var l=r[a];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++a<i;){l=r[a];var c=l[0],u=e[c],d=l[1];if(s&&l[2]){if(u===void 0&&!(c in e))return!1}else{var f=new jfe;if(n)var m=n(u,d,c,e,t,f);if(!(m===void 0?Sfe(d,u,_fe|Nfe,n,f):m))return!1}}return!0}var Cfe=Efe,Ofe=Xi;function Pfe(e){return e===e&&!Ofe(e)}var fL=Pfe,Afe=fL,Tfe=yv;function Dfe(e){for(var t=Tfe(e),r=t.length;r--;){var n=t[r],a=e[n];t[r]=[n,a,Afe(a)]}return t}var $fe=Dfe;function kfe(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var mL=kfe,Mfe=Cfe,Ife=$fe,Rfe=mL;function Lfe(e){var t=Ife(e);return t.length==1&&t[0][2]?Rfe(t[0][0],t[0][1]):function(r){return r===e||Mfe(r,e,t)}}var Ffe=Lfe;function Bfe(e,t){return e!=null&&t in Object(e)}var zfe=Bfe,qfe=bR,Ufe=Oj,Wfe=Xr,Vfe=Pj,Gfe=Aj,Hfe=nv;function Kfe(e,t,r){t=qfe(t,e);for(var n=-1,a=t.length,i=!1;++n<a;){var s=Hfe(t[n]);if(!(i=e!=null&&r(e,s)))break;e=e[s]}return i||++n!=a?i:(a=e==null?0:e.length,!!a&&Gfe(a)&&Vfe(s,a)&&(Wfe(e)||Ufe(e)))}var Yfe=Kfe,Xfe=zfe,Zfe=Yfe;function Qfe(e,t){return e!=null&&Zfe(e,t,Xfe)}var Jfe=Qfe,eme=Tj,tme=wR,rme=Jfe,nme=uj,ame=fL,ime=mL,ome=nv,sme=1,lme=2;function cme(e,t){return nme(e)&&ame(t)?ime(ome(e),t):function(r){var n=tme(r,e);return n===void 0&&n===t?rme(r,e):eme(t,n,sme|lme)}}var ume=cme;function dme(e){return e}var nc=dme;function fme(e){return function(t){return t==null?void 0:t[e]}}var mme=fme,hme=gj;function pme(e){return function(t){return hme(t,e)}}var vme=pme,gme=mme,yme=vme,xme=uj,bme=nv;function wme(e){return xme(e)?gme(bme(e)):yme(e)}var jme=wme,Sme=Ffe,_me=ume,Nme=nc,Eme=Xr,Cme=jme;function Ome(e){return typeof e=="function"?e:e==null?Nme:typeof e=="object"?Eme(e)?_me(e[0],e[1]):Sme(e):Cme(e)}var Aa=Ome;function Pme(e,t,r,n){for(var a=e.length,i=r+(n?1:-1);n?i--:++i<a;)if(t(e[i],i,e))return i;return-1}var hL=Pme;function Ame(e){return e!==e}var Tme=Ame;function Dme(e,t,r){for(var n=r-1,a=e.length;++n<a;)if(e[n]===t)return n;return-1}var $me=Dme,kme=hL,Mme=Tme,Ime=$me;
564function Rme(e,t,r){return t===t?Ime(e,t,r):kme(e,Mme,r)}var Lme=Rme,Fme=Lme;function Bme(e,t){var r=e==null?0:e.length;return!!r&&Fme(e,t,0)>-1}var zme=Bme;function qme(e,t,r){for(var n=-1,a=e==null?0:e.length;++n<a;)if(r(t,e[n]))return!0;return!1}var Ume=qme;function Wme(){}var Vme=Wme,Xg=cL,Gme=Vme,Hme=Cj,Kme=1/0,Yme=Xg&&1/Hme(new Xg([,-0]))[1]==Kme?function(e){return new Xg(e)}:Gme,Xme=Yme,Zme=JR,Qme=zme,Jme=Ume,ehe=tL,the=Xme,rhe=Cj,nhe=200;function ahe(e,t,r){var n=-1,a=Qme,i=e.length,s=!0,l=[],c=l;if(r)s=!1,a=Jme;else if(i>=nhe){var u=t?null:the(e);if(u)return rhe(u);s=!1,a=ehe,c=new Zme}else c=t?[]:l;e:for(;++n<i;){var d=e[n],f=t?t(d):d;if(d=r||d!==0?d:0,s&&f===f){for(var m=c.length;m--;)if(c[m]===f)continue e;t&&c.push(f),l.push(d)}else a(c,f,r)||(c!==l&&c.push(f),l.push(d))}return l}var ihe=ahe,ohe=Aa,she=ihe;function lhe(e,t){return e&&e.length?she(e,ohe(t)):[]}var che=lhe;const JN=pt(che);function pL(e,t,r){return t===!0?JN(e,r):Ge(t)?JN(e,t):e}function ll(e){"@babel/helpers - typeof";return ll=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ll(e)}var uhe=["ref"];function eE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function $a(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?eE(Object(r),!0).forEach(function(n){xv(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):eE(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function dhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,gL(n.key),n)}}function fhe(e,t,r){return t&&tE(e.prototype,t),r&&tE(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function mhe(e,t,r){return t=Hm(t),hhe(e,vL()?Reflect.construct(t,r||[],Hm(e).constructor):t.apply(e,r))}function hhe(e,t){if(t&&(ll(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return phe(e)}function phe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vL(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(vL=function(){return!!e})()}function Hm(e){return Hm=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Hm(e)}function vhe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Gx(e,t)}function Gx(e,t){return Gx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Gx(e,t)}function xv(e,t,r){return t=gL(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function gL(e){var t=ghe(e,"string");return ll(t)=="symbol"?t:t+""}function ghe(e,t){if(ll(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ll(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yhe(e,t){if(e==null)return{};var r=xhe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function xhe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function bhe(e){return e.value}function whe(e,t){if($.isValidElement(e))return $.cloneElement(e,t);if(typeof e=="function")return $.createElement(e,t);t.ref;var r=yhe(t,uhe);return $.createElement(Ej,r)}var rE=1,Ri=function(e){function t(){var r;dhe(this,t);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=mhe(this,t,[].concat(a)),xv(r,"lastBoundingBox",{width:-1,height:-1}),r}
564return vhe(t,e),fhe(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();return n.height=this.wrapperNode.offsetHeight,n.width=this.wrapperNode.offsetWidth,n}return null}},{key:"updateBBox",value:function(){var n=this.props.onBBoxUpdate,a=this.getBBox();a?(Math.abs(a.width-this.lastBoundingBox.width)>rE||Math.abs(a.height-this.lastBoundingBox.height)>rE)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,n&&n(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?$a({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var a=this.props,i=a.layout,s=a.align,l=a.verticalAlign,c=a.margin,u=a.chartWidth,d=a.chartHeight,f,m;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(s==="center"&&i==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=s==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(l==="middle"){var y=this.getBBoxSnapshot();m={top:((d||0)-y.height)/2}}else m=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return $a($a({},f),m)}},{key:"render",value:function(){var n=this,a=this.props,i=a.content,s=a.width,l=a.height,c=a.wrapperStyle,u=a.payloadUniqBy,d=a.payload,f=$a($a({position:"absolute",width:s||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return $.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){n.wrapperNode=p}},whe(i,$a($a({},this.props),{},{payload:pL(d,u,bhe)})))}}],[{key:"getWithHeight",value:function(n,a){var i=$a($a({},this.defaultProps),n.props),s=i.layout;return s==="vertical"&&he(n.props.height)?{height:n.props.height}:s==="horizontal"?{width:n.props.width||a}:null}}])}(h.PureComponent);xv(Ri,"displayName","Legend");xv(Ri,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var nE=qd,jhe=Oj,She=Xr,aE=nE?nE.isConcatSpreadable:void 0;function _he(e){return She(e)||jhe(e)||!!(aE&&e&&e[aE])}var Nhe=_he,Ehe=nL,Che=Nhe;function yL(e,t,r,n,a){var i=-1,s=e.length;for(r||(r=Che),a||(a=[]);++i<s;){var l=e[i];t>0&&r(l)?t>1?yL(l,t-1,r,n,a):Ehe(a,l):n||(a[a.length]=l)}return a}var xL=yL;function Ohe(e){return function(t,r,n){for(var a=-1,i=Object(t),s=n(t),l=s.length;l--;){var c=s[e?l:++a];if(r(i[c],c,i)===!1)break}return t}}var Phe=Ohe,Ahe=Phe,The=Ahe(),Dhe=The,$he=Dhe,khe=yv;function Mhe(e,t){return e&&$he(e,t,khe)}var bL=Mhe,Ihe=Vd;function Rhe(e,t){return function(r,n){if(r==null)return r;if(!Ihe(r))return e(r,n);for(var a=r.length,i=t?a:-1,s=Object(r);(t?i--:++i<a)&&n(s[i],i,s)!==!1;);return r}}var Lhe=Rhe,Fhe=bL,Bhe=Lhe,zhe=Bhe(Fhe),Dj=zhe,qhe=Dj,Uhe=Vd;function Whe(e,t){var r=-1,n=Uhe(e)?Array(e.length):[];return qhe(e,function(a,i,s){n[++r]=t(a,i,s)}),n}var wL=Whe;function Vhe(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}var Ghe=Vhe,iE=Yl;function Hhe(e,t){if(e!==t){var r=e!==void 0,n=e===null,a=e===e,i=iE(e),s=t!==void 0,l=t===null,c=t===t,u=iE(t);if(!l&&!u&&!i&&e>t||i&&s&&c&&!l&&!u||n&&s&&c||!r&&c||!a)return 1;if(!n&&!i&&!u&&e<t||u&&r&&a&&!n&&!i||l&&r&&a||!s&&a||!c)return-1}return 0}var Khe=Hhe,Yhe=Khe;function Xhe(e,t,r){for(var n=-1,a=e.criteria,i=t.criteria,s=a.length,l=r.length;++n<s;){var c=Yhe(a[n],i[n]);if(c){if(n>=l)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return e.index-t.index}var Zhe=Xhe,Zg=vj,Qhe=gj,Jhe=Aa,epe=wL,tpe=Ghe,rpe=oL,npe=Zhe,ape=nc,ipe=Xr;function ope(e,t,r){t.length?t=Zg(t,function(i){return ipe(i)?function(s){return Qhe(s,i.length===1?i[0]:i)}:i}):t=[ape];var n=-1;t=Zg(t,rpe(Jhe));var a=epe(e,function(i,s,l){var c=Zg(t,function(u){return u(i)});return{criteria:c,index:++n,value:i}});return tpe(a,function(i,s){return npe(i,s,r)})}var spe=ope;function lpe(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var cpe=lpe,upe=cpe,oE=Math.max;function dpe(e,t,r){return t=oE(t===void 0?e.length-1:t,0),function(){for(var n=arguments,a=-1,i=oE(n.length-t,0),s=Array(i);++a<i;)s[a]=n[t+a];a=-1;for(var l=Array(t+1);++a<t;)l[a]=n[a];return l[t]=r(s),upe(e,this,l)}}var fpe=dpe;function mpe(e){return function(){return e}}var hpe=mpe,ppe=ts,vpe=function(){try{var e=ppe(Object,"defineProperty");return e({},"",{}),e}catch{}}(),jL=vpe,gpe=hpe,sE=jL,ype=nc,xpe=sE?function(e,t){return sE(e,"toString",{configurable:!0,enumerable:!1,value:gpe(t),writable:!0})}:ype,bpe=xpe,wpe=800,jpe=16,Spe=Date.now;function _pe(e){var t=0,r=0;return function(){var n=Spe(),a=jpe-(n-r);if(r=n,a>0){if(++t>=wpe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Npe=_pe,Epe=bpe,Cpe=Npe,Ope=Cpe(Epe),Ppe=Ope,Ape=nc,Tpe=fpe,Dpe=Ppe;function $pe(e,t){return Dpe(Tpe(e,t,Ape),e+"")}var kpe=$pe,Mpe=fj,Ipe=Vd,Rpe=Pj,Lpe=Xi;function Fpe(e,t,r){if(!Lpe(r))return!1;var n=typeof t;return(n=="number"?Ipe(r)&&Rpe(t,r.length):n=="string"&&t in r)?Mpe(r[t],e):!1}var bv=Fpe,Bpe=xL,zpe=spe,qpe=kpe,lE=bv,Upe=qpe(function(e,t){if(e==null)return[];var r=t.length;return r>1&&lE(e,t[0],t[1])?t=[]:r>2&&lE(t[0],t[1],t[2])&&(t=[t[0]]),zpe(e,Bpe(t,1),[])}),Wpe=Upe;const $j=pt(Wpe);function Ru(e){"@babel/helpers - typeof";return Ru=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ru(e)}function Hx(){return Hx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 8,297 bytes, lines 564-565
564for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Hx.apply(this,arguments)}function Vpe(e,t){return Ype(e)||Kpe(e,t)||Hpe(e,t)||Gpe()}function Gpe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 565In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hpe(e,t){if(e){if(typeof e=="string")return cE(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return cE(e,t)}}function cE(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Kpe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function Ype(e){if(Array.isArray(e))return e}function uE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Qg(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uE(Object(r),!0).forEach(function(n){Xpe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uE(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Xpe(e,t,r){return t=Zpe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zpe(e){var t=Qpe(e,"string");return Ru(t)=="symbol"?t:t+""}function Qpe(e,t){if(Ru(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ru(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jpe(e){return Array.isArray(e)&&ir(e[0])&&ir(e[1])?e.join(" ~ "):e}var eve=function(t){var r=t.separator,n=r===void 0?" : ":r,a=t.contentStyle,i=a===void 0?{}:a,s=t.itemStyle,l=s===void 0?{}:s,c=t.labelStyle,u=c===void 0?{}:c,d=t.payload,f=t.formatter,m=t.itemSorter,p=t.wrapperClassName,y=t.labelClassName,v=t.label,g=t.labelFormatter,x=t.accessibilityLayer,b=x===void 0?!1:x,j=function(){if(d&&d.length){var A={padding:0,margin:0},T=(m?$j(d,m):d).map(function(k,D){if(k.type==="none")return null;var M=Qg({display:"block",paddingTop:4,paddingBottom:4,color:k.color||"#000"},l),F=k.formatter||f||Jpe,q=k.value,I=k.name,K=q,W=I;if(F&&K!=null&&W!=null){var R=F(q,I,k,D,d);if(Array.isArray(R)){var V=Vpe(R,2);K=V[0],W=V[1]}else K=R}return $.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(D),style:M},ir(W)?$.createElement("span",{className:"recharts-tooltip-item-name"},W):null,ir(W)?$.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,$.createElement("span",{className:"recharts-tooltip-item-value"},K),$.createElement("span",{className:"recharts-tooltip-item-unit"},k.unit||""))});return $.createElement("ul",{className:"recharts-tooltip-item-list",style:A},T)}return null},w=Qg({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),S=Qg({margin:0},u),_=!Ye(v),N=_?v:"",E=Qe("recharts-default-tooltip",p),O=Qe("recharts-tooltip-label",y);_&&g&&d!==void 0&&d!==null&&(N=g(v,d));var P=b?{role:"status","aria-live":"assertive"}:{};return $.createElement("div",Hx({className:E,style:w},P),$.createElement("p",{className:O,style:S},$.isValidElement(N)?N:"".concat(N)),j())};function Lu(e){"@babel/helpers - typeof";return Lu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lu(e)}function _f(e,t,r){return t=tve(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tve(e){var t=rve(e,"string");return Lu(t)=="symbol"?t:t+""}function rve(e,t){if(Lu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Lu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Sc="recharts-tooltip-wrapper",nve={visibility:"hidden"};function ave(e){var t=e.coordinate,r=e.translateX,n=e.translateY;return Qe(Sc,_f(_f(_f(_f({},"".concat(Sc,"-right"),he(r)&&t&&he(t.x)&&r>=t.x),"".concat(Sc,"-left"),he(r)&&t&&he(t.x)&&r<t.x),"".concat(Sc,"-bottom"),he(n)&&t&&he(t.y)&&n>=t.y),"".concat(Sc,"-top"),he(n)&&t&&he(t.y)&&n<t.y))}function dE(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.key,a=e.offsetTopLeft,i=e.position,s=e.reverseDirection,l=e.tooltipDimension,c=e.viewBox,u=e.viewBoxDimension;if(i&&he(i[n]))return i[n];var d=r[n]-l-a,f=r[n]+a;if(t[n])return s[n]?d:f;if(s[n]){var m=d,p=c[n];return m<p?Math.max(f,c[n]):Math.max(d,c[n])}var y=f+l,v=c[n]+u;return y>v?Math.max(d,c[n]):Math.max(f,c[n])}function ive(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function ove(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,a=e.position,i=e.reverseDirection,s=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,d,f;return s.height>0&&s.width>0&&r?(d=dE({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:s.width,viewBox:c,viewBoxDimension:c.width}),f=dE({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:s.height,viewBox:c,viewBoxDimension:c.height}),u=ive({translateX:d,translateY:f,useTranslate3d:l})):u=nve,{cssProperties:u,cssClasses:ave({translateX:d,translateY:f,coordinate:r})}}function cl(e){"@babel/helpers - typeof";return cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cl(e)}function fE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function mE(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fE(Object(r),!0).forEach(function(n){Yx(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fE(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function sve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lve(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_L(n.key),n)}}function cve(e,t,r){return t&&lve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function uve(e,t,r){return t=Km(t),dve(e,SL()?Reflect.construct(t,r||[],Km(e).constructor):t.apply(e,r))}function dve(e,t){if(t&&(cl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fve(e)}function fve(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function SL(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(SL=function(){return!!e})()}function Km(e){return Km=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Km(e)}function mve(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Kx(e,t)}
565function Kx(e,t){return Kx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Kx(e,t)}function Yx(e,t,r){return t=_L(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _L(e){var t=hve(e,"string");return cl(t)=="symbol"?t:t+""}function hve(e,t){if(cl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(cl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var hE=1,pve=function(e){function t(){var r;sve(this,t);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=uve(this,t,[].concat(a)),Yx(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),Yx(r,"handleKeyDown",function(s){if(s.key==="Escape"){var l,c,u,d;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=r.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(u=(d=r.props.coordinate)===null||d===void 0?void 0:d.y)!==null&&u!==void 0?u:0}})}}),r}return mve(t,e),cve(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();(Math.abs(n.width-this.state.lastBoundingBox.width)>hE||Math.abs(n.height-this.state.lastBoundingBox.height)>hE)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,a=this.props,i=a.active,s=a.allowEscapeViewBox,l=a.animationDuration,c=a.animationEasing,u=a.children,d=a.coordinate,f=a.hasPayload,m=a.isAnimationActive,p=a.offset,y=a.position,v=a.reverseDirection,g=a.useTranslate3d,x=a.viewBox,b=a.wrapperStyle,j=ove({allowEscapeViewBox:s,coordinate:d,offsetTopLeft:p,position:y,reverseDirection:v,tooltipBox:this.state.lastBoundingBox,useTranslate3d:g,viewBox:x}),w=j.cssClasses,S=j.cssProperties,_=mE(mE({transition:m&&i?"transform ".concat(l,"ms ").concat(c):void 0},S),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&f?"visible":"hidden",position:"absolute",top:0,left:0},b);return $.createElement("div",{tabIndex:-1,className:w,style:_,ref:function(E){n.wrapperNode=E}},u)}}])}(h.PureComponent),vve=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ya={isSsr:vve(),get:function(t){return ya[t]},set:function(t,r){if(typeof t=="string")ya[t]=r;else{var n=Object.keys(t);n&&n.length&&n.forEach(function(a){ya[a]=t[a]})}}};function ul(e){"@babel/helpers - typeof";return ul=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ul(e)}function pE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function vE(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pE(Object(r),!0).forEach(function(n){kj(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pE(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yve(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,EL(n.key),n)}}function xve(e,t,r){return t&&yve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function bve(e,t,r){return t=Ym(t),wve(e,NL()?Reflect.construct(t,r||[],Ym(e).constructor):t.apply(e,r))}function wve(e,t){if(t&&(ul(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jve(e)}function jve(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function NL(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(NL=function(){return!!e})()}function Ym(e){return Ym=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ym(e)}function Sve(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Xx(e,t)}
565function Xx(e,t){return Xx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Xx(e,t)}function kj(e,t,r){return t=EL(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function EL(e){var t=_ve(e,"string");return ul(t)=="symbol"?t:t+""}function _ve(e,t){if(ul(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ul(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nve(e){return e.dataKey}function Eve(e,t){return $.isValidElement(e)?$.cloneElement(e,t):typeof e=="function"?$.createElement(e,t):$.createElement(eve,t)}var An=function(e){function t(){return gve(this,t),bve(this,t,arguments)}return Sve(t,e),xve(t,[{key:"render",value:function(){var n=this,a=this.props,i=a.active,s=a.allowEscapeViewBox,l=a.animationDuration,c=a.animationEasing,u=a.content,d=a.coordinate,f=a.filterNull,m=a.isAnimationActive,p=a.offset,y=a.payload,v=a.payloadUniqBy,g=a.position,x=a.reverseDirection,b=a.useTranslate3d,j=a.viewBox,w=a.wrapperStyle,S=y??[];f&&S.length&&(S=pL(y.filter(function(N){return N.value!=null&&(N.hide!==!0||n.props.includeHidden)}),v,Nve));var _=S.length>0;return $.createElement(pve,{allowEscapeViewBox:s,animationDuration:l,animationEasing:c,isAnimationActive:m,active:i,coordinate:d,hasPayload:_,offset:p,position:g,reverseDirection:x,useTranslate3d:b,viewBox:j,wrapperStyle:w},Eve(u,vE(vE({},this.props),{},{payload:S})))}}])}(h.PureComponent);kj(An,"displayName","Tooltip");kj(An,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ya.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var Cve=Pa,Ove=function(){return Cve.Date.now()},Pve=Ove,Ave=/\s/;function Tve(e){for(var t=e.length;t--&&Ave.test(e.charAt(t)););return t}var Dve=Tve,$ve=Dve,kve=/^\s+/;function Mve(e){return e&&e.slice(0,$ve(e)+1).replace(kve,"")}var Ive=Mve,Rve=Ive,gE=Xi,Lve=Yl,yE=NaN,Fve=/^[-+]0x[0-9a-f]+$/i,Bve=/^0b[01]+$/i,zve=/^0o[0-7]+$/i,qve=parseInt;function Uve(e){if(typeof e=="number")return e;if(Lve(e))return yE;if(gE(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=gE(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Rve(e);var r=Bve.test(e);return r||zve.test(e)?qve(e.slice(2),r?2:8):Fve.test(e)?yE:+e}var CL=Uve,Wve=Xi,Jg=Pve,xE=CL,Vve="Expected a function",Gve=Math.max,Hve=Math.min;function Kve(e,t,r){var n,a,i,s,l,c,u=0,d=!1,f=!1,m=!0;if(typeof e!="function")throw new TypeError(Vve);t=xE(t)||0,Wve(r)&&(d=!!r.leading,f="maxWait"in r,i=f?Gve(xE(r.maxWait)||0,t):i,m="trailing"in r?!!r.trailing:m);function p(_){var N=n,E=a;return n=a=void 0,u=_,s=e.apply(E,N),s}function y(_){return u=_,l=setTimeout(x,t),d?p(_):s}function v(_){var N=_-c,E=_-u,O=t-N;return f?Hve(O,i-E):O}function g(_){var N=_-c,E=_-u;return c===void 0||N>=t||N<0||f&&E>=i}function x(){var _=Jg();if(g(_))return b(_);l=setTimeout(x,v(_))}function b(_){return l=void 0,m&&n?p(_):(n=a=void 0,s)}function j(){l!==void 0&&clearTimeout(l),u=0,n=c=a=l=void 0}function w(){return l===void 0?s:b(Jg())}function S(){var _=Jg(),N=g(_);if(n=arguments,a=this,c=_,N){if(l===void 0)return y(c);if(f)return clearTimeout(l),l=setTimeout(x,t),p(c)}return l===void 0&&(l=setTimeout(x,t)),s}return S.cancel=j,S.flush=w,S}var Yve=Kve,Xve=Yve,Zve=Xi,Qve="Expected a function";function Jve(e,t,r){var n=!0,a=!0;if(typeof e!="function")throw new TypeError(Qve);return Zve(r)&&(n="leading"in r?!!r.leading:n,a="trailing"in r?!!r.trailing:a),Xve(e,t,{leading:n,maxWait:t,trailing:a})}var ege=Jve;const OL=pt(ege);function Fu(e){"@babel/helpers - typeof";return Fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fu(e)}function bE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Nf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};
vendor: 14,951 bytes, lines 565-572
565t%2?bE(Object(r),!0).forEach(function(n){tge(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bE(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tge(e,t,r){return t=rge(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rge(e){var t=nge(e,"string");return Fu(t)=="symbol"?t:t+""}function nge(e,t){if(Fu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Fu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function age(e,t){return lge(e)||sge(e,t)||oge(e,t)||ige()}function ige(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 566In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oge(e,t){if(e){if(typeof e=="string")return wE(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wE(e,t)}}function wE(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function sge(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function lge(e){if(Array.isArray(e))return e}var ey=h.forwardRef(function(e,t){var r=e.aspect,n=e.initialDimension,a=n===void 0?{width:-1,height:-1}:n,i=e.width,s=i===void 0?"100%":i,l=e.height,c=l===void 0?"100%":l,u=e.minWidth,d=u===void 0?0:u,f=e.minHeight,m=e.maxHeight,p=e.children,y=e.debounce,v=y===void 0?0:y,g=e.id,x=e.className,b=e.onResize,j=e.style,w=j===void 0?{}:j,S=h.useRef(null),_=h.useRef();_.current=b,h.useImperativeHandle(t,function(){return Object.defineProperty(S.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),S.current},configurable:!0})});var N=h.useState({containerWidth:a.width,containerHeight:a.height}),E=age(N,2),O=E[0],P=E[1],C=h.useCallback(function(T,k){P(function(D){var M=Math.round(T),F=Math.round(k);return D.containerWidth===M&&D.containerHeight===F?D:{containerWidth:M,containerHeight:F}})},[]);h.useEffect(function(){var T=function(I){var K,W=I[0].contentRect,R=W.width,V=W.height;C(R,V),(K=_.current)===null||K===void 0||K.call(_,R,V)};v>0&&(T=OL(T,v,{trailing:!0,leading:!1}));var k=new ResizeObserver(T),D=S.current.getBoundingClientRect(),M=D.width,F=D.height;return C(M,F),k.observe(S.current),function(){k.disconnect()}},[C,v]);var A=h.useMemo(function(){var T=O.containerWidth,k=O.containerHeight;if(T<0||k<0)return null;ea(ho(s)||ho(c),`The width(%s) and height(%s) are both fixed numbers, 567 maybe you don't need to use a ResponsiveContainer.`,s,c),ea(!r||r>0,"The aspect(%s) must be greater than zero.",r);var D=ho(s)?T:s,M=ho(c)?k:c;r&&r>0&&(D?M=D/r:M&&(D=M*r),m&&M>m&&(M=m)),ea(D>0||M>0,`The width(%s) and height(%s) of chart should be greater than 0, 568 please check the style of container, or the props width(%s) and height(%s), 569 or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the 570 height and width.`,D,M,s,c,d,f,r);var F=!Array.isArray(p)&&Wa(p.type).endsWith("Chart");return $.Children.map(p,function(q){return _R.isElement(q)?h.cloneElement(q,Nf({width:D,height:M},F?{style:Nf({height:"100%",width:"100%",maxHeight:M,maxWidth:D},q.props.style)}:{})):q})},[r,p,c,m,f,d,O,s]);return $.createElement("div",{id:g?"".concat(g):void 0,className:Qe("recharts-responsive-container",x),style:Nf(Nf({},w),{},{width:s,height:c,minWidth:d,minHeight:f,maxHeight:m}),ref:S},A)}),wv=function(t){return null};wv.displayName="Cell";function Bu(e){"@babel/helpers - typeof";return Bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bu(e)}function jE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Zx(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jE(Object(r),!0).forEach(function(n){cge(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jE(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cge(e,t,r){return t=uge(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uge(e){var t=dge(e,"string");return Bu(t)=="symbol"?t:t+""}function dge(e,t){if(Bu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Bu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var vs={widthCache:{},cacheCount:0},fge=2e3,mge={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},SE="recharts_measurement_span";function hge(e){var t=Zx({},e);return Object.keys(t).forEach(function(r){t[r]||delete t[r]}),t}var Yc=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||ya.isSsr)return{width:0,height:0};var n=hge(r),a=JSON.stringify({text:t,copyStyle:n});if(vs.widthCache[a])return vs.widthCache[a];try{var i=document.getElementById(SE);i||(i=document.createElement("span"),i.setAttribute("id",SE),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var s=Zx(Zx({},mge),n);Object.assign(i.style,s),i.textContent="".concat(t);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return vs.widthCache[a]=c,++vs.cacheCount>fge&&(vs.cacheCount=0,vs.widthCache={}),c}catch{return{width:0,height:0}}},pge=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function zu(e){"@babel/helpers - typeof";return zu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zu(e)}function Xm(e,t){return xge(e)||yge(e,t)||gge(e,t)||vge()}function vge(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 571In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gge(e,t){if(e){if(typeof e=="string")return _E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _E(e,t)}}function _E(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function yge(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function xge(e){if(Array.isArray(e))return e}function bge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function NE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,jge(n.key),n)}}function wge(e,t,r){return t&&NE(e.prototype,t),r&&NE(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function jge(e){var t=Sge(e,"string");return zu(t)=="symbol"?t:t+""}function Sge(e,t){if(zu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(zu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var EE=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,CE=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,_ge=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Nge=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,PL={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},Ege=Object.keys(PL),Ss="NaN";function Cge(e,t){return e*PL[t]}var Ef=function(){function e(t,r){bge(this,e),this.num=t,this.unit=r,this.num=t,this.unit=r,Number.isNaN(t)&&(this.unit=""),r!==""&&!_ge.test(r)&&(this.num=NaN,this.unit=""),Ege.includes(r)&&(this.num=Cge(t,r),this.unit="px")}return wge(e,[{key:"add",value:function(r){return this.unit!==r.unit?new e(NaN,""):new e(this.num+r.num,this.unit)}},{key:"subtract",value:function(r){return this.unit!==r.unit?new e(NaN,""):new e(this.num-r.num,this.unit)}},{key:"multiply",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new e(NaN,""):new e(this.num*r.num,this.unit||r.unit)}},{key:"divide",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new e(NaN,""):new e(this.num/r.num,this.unit||r.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(r){var n,a=(n=Nge.exec(r))!==null&&n!==void 0?n:[],i=Xm(a,3),s=i[1],l=i[2];return new e(parseFloat(s),l??"")}}])}();function AL(e){if(e.includes(Ss))return Ss;for(var t=e;t.includes("*")||t.includes("/");){var r,n=(r=EE.exec(t))!==null&&r!==void 0?r:[],a=Xm(n,4),i=a[1],s=a[2],l=a[3],c=Ef.parse(i??""),u=Ef.parse(l??""),d=s==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return Ss;t=t.replace(EE,d.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var f,m=(f=CE.exec(t))!==null&&f!==void 0?f:[],p=Xm(m,4),y=p[1],v=p[2],g=p[3],x=Ef.parse(y??""),b=Ef.parse(g??""),j=v==="+"?x.add(b):x.subtract(b);if(j.isNaN())return Ss;t=t.replace(CE,j.toString())}return t}var OE=/\(([^()]*)\)/;function Oge(e){for(var t=e;t.includes("(");){var r=OE.exec(t),n=Xm(r,2),a=n[1];t=t.replace(OE,AL(a))}return t}function Pge(e){var t=e.replace(/\s+/g,"");return t=Oge(t),t=AL(t),t}function Age(e){try{return Pge(e)}catch{return Ss}}function ty(e){var t=Age(e.slice(5,-1));return t===Ss?"":t}var Tge=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],Dge=["dx","dy","angle","className","breakAll"];function Qx(){return Qx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qx.apply(this,arguments)}function PE(e,t){if(e==null)return{};var r=$ge(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function $ge(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function AE(e,t){return Rge(e)||Ige(e,t)||Mge(e,t)||kge()}function kge(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 572In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mge(e,t){if(e){if(typeof e=="string")return TE(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return TE(e,t)}}function TE(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ige(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function Rge(e){if(Array.isArray(e))return e}var TL=/[ \f\n\r\t\v\u2028\u2029]+/,DL=function(t){var r=t.children,n=t.breakAll,a=t.style;try{var i=[];Ye(r)||(n?i=r.toString().split(""):i=r.toString().split(TL));var s=i.map(function(c){return{word:c,width:Yc(c,a).width}}),l=n?0:Yc(" ",a).width;return{wordsWithComputedWidth:s,spaceWidth:l}}catch{return null}},Lge=function(t,r,n,a,i){var s=t.maxLines,l=t.children,c=t.style,u=t.breakAll,d=he(s),f=l,m=function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return D.reduce(function(M,F){var q=F.word,I=F.width,K=M[M.length-1];if(K&&(a==null||i||K.width+I+n<Number(a)))K.words.push(q),K.width+=I+n;else{var W={words:[q],width:I};M.push(W)}return M},[])},p=m(r),y=function(D){return D.reduce(function(M,F){return M.width>F.width?M:F})};if(!d)return p;for(var v="â¦",g=function(D){var M=f.slice(0,D),F=DL({breakAll:u,style:c,children:M+v}).wordsWithComputedWidth,q=m(F),I=q.length>s||y(q).width>Number(a);return[I,q]},x=0,b=f.length-1,j=0,w;x<=b&&j<=f.length-1;){var S=Math.floor((x+b)/2),_=S-1,N=g(_),E=AE(N,2),O=E[0],P=E[1],C=g(S),A=AE(C,1),T=A[0];if(!O&&!T&&(x=S+1),O&&T&&(b=S-1),!O&&T){w=P;break}j++}return w||p},DE=function(t){var r=Ye(t)?[]:t.toString().split(TL);return[{words:r}]},Fge=function(t){var r=t.width,n=t.scaleToFit,a=t.children,i=t.style,s=t.breakAll,l=t.maxLines;if((r||n)&&!ya.isSsr){var c,u,d=DL({breakAll:s,children:a,style:i});if(d){var f=d.wordsWithComputedWidth,m=d.spaceWidth;c=f,u=m}else return DE(a);return Lge({breakAll:s,children:a,maxLines:l,style:i},c,u,r,n)}return DE(a)},$E="#808080",Uo=function(t){var r=t.x,n=r===void 0?0:r,a=t.y,i=a===void 0?0:a,s=t.lineHeight,l=s===void 0?"1em":s,c=t.capHeight,u=c===void 0?"0.71em":c,d=t.scaleToFit,f=d===void 0?!1:d,m=t.textAnchor,p=m===void 0?"start":m,y=t.verticalAnchor,v=y===void 0?"end":y,g=t.fill,x=g===void 0?$E:g,b=PE(t,Tge),j=h.useMemo(function(){return Fge({breakAll:b.breakAll,children:b.children,maxLines:b.maxLines,scaleToFit:f,style:b.style,width:b.width})},[b.breakAll,b.children,b.maxLines,f,b.style,b.width]),w=b.dx,S=b.dy,_=b.angle,N=b.className,E=b.breakAll,O=PE(b,Dge);if(!ir(n)||!ir(i))return null;var P=n+(he(w)?w:0),C=i+(he(S)?S:0),A;switch(v){case"start":A=ty("calc(".concat(u,")"));break;case"middle":A=ty("calc(".concat((j.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:A=ty("calc(".concat(j.length-1," * -").concat(l,")"));break}var T=[];
572if(f){var k=j[0].width,D=b.width;T.push("scale(".concat((he(D)?D/k:1)/k,")"))}return _&&T.push("rotate(".concat(_,", ").concat(P,", ").concat(C,")")),T.length&&(O.transform=T.join(" ")),$.createElement("text",Qx({},ze(O,!0),{x:P,y:C,className:Qe("recharts-text",N),textAnchor:p,fill:x.includes("url")?$E:x}),j.map(function(M,F){var q=M.words.join(E?"":" ");return $.createElement("tspan",{x:P,dy:F===0?A:l,key:"".concat(q,"-").concat(F)},q)}))};function Li(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Bge(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Mj(e){let t,r,n;e.length!==2?(t=Li,r=(l,c)=>Li(e(l),c),n=(l,c)=>e(l)-c):(t=e===Li||e===Bge?e:zge,r=e,n=e);function a(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;r(l[f],c)<0?u=f+1:d=f}while(u<d)}return u}function i(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;r(l[f],c)<=0?u=f+1:d=f}while(u<d)}return u}function s(l,c,u=0,d=l.length){const f=a(l,c,u,d-1);return f>u&&n(l[f-1],c)>-n(l[f],c)?f-1:f}return{left:a,center:s,right:i}}function zge(){return 0}function $L(e){return e===null?NaN:+e}function*qge(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const Uge=Mj(Li),Gd=Uge.right;Mj($L).center;class kE extends Map{constructor(t,r=Gge){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,a]of t)this.set(n,a)}get(t){return super.get(ME(this,t))}has(t){return super.has(ME(this,t))}set(t,r){return super.set(Wge(this,t),r)}delete(t){return super.delete(Vge(this,t))}}function ME({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function Wge({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function Vge({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function Gge(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Hge(e=Li){if(e===Li)return kL;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function kL(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Kge=Math.sqrt(50),Yge=Math.sqrt(10),Xge=Math.sqrt(2);function Zm(e,t,r){const n=(t-e)/Math.max(0,r),a=Math.floor(Math.log10(n)),i=n/Math.pow(10,a),s=i>=Kge?10:i>=Yge?5:i>=Xge?2:1;let l,c,u;return a<0?(u=Math.pow(10,-a)/s,l=Math.round(e*u),c=Math.round(t*u),l/u<e&&++l,c/u>t&&--c,u=-u):(u=Math.pow(10,a)*s,l=Math.round(e/u),c=Math.round(t/u),l*u<e&&++l,c*u>t&&--c),c<l&&.5<=r&&r<2?Zm(e,t,r*2):[l,c,u]}function Jx(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];const n=t<e,[a,i,s]=n?Zm(t,e,r):Zm(e,t,r);if(!(i>=a))return[];const l=i-a+1,c=new Array(l);if(n)if(s<0)for(let u=0;u<l;++u)c[u]=(i-u)/-s;else for(let u=0;u<l;++u)c[u]=(i-u)*s;else if(s<0)for(let u=0;u<l;++u)c[u]=(a+u)/-s;else for(let u=0;u<l;++u)c[u]=(a+u)*s;return c}function eb(e,t,r){return t=+t,e=+e,r=+r,Zm(e,t,r)[2]}function tb(e,t,r){t=+t,e=+e,r=+r;const n=t<e,a=n?eb(t,e,r):eb(e,t,r);return(n?-1:1)*(a<0?1/-a:a)}function IE(e,t){let r;for(const n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function RE(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function ML(e,t,r=0,n=1/0,a){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(a=a===void 0?kL:Hge(a);n>r;){if(n-r>600){const c=n-r+1,u=t-r+1,d=Math.log(c),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),p=Math.max(r,Math.floor(t-u*f/c+m)),y=Math.min(n,Math.floor(t+(c-u)*f/c+m));ML(e,t,p,y,a)}const i=e[t];let s=r,l=n;for(_c(e,r,t),a(e[n],i)>0&&_c(e,r,n);s<l;){for(_c(e,s,l),++s,--l;a(e[s],i)<0;)++s;for(;a(e[l],i)>0;)--l}a(e[r],i)===0?_c(e,r,l):(++l,_c(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function _c(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function Zge(e,t,r){if(e=Float64Array.from(qge(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return RE(e);if(t>=1)return IE(e);var n,a=(n-1)*t,i=Math.floor(a),s=IE(ML(e,i).subarray(0,i+1)),l=RE(e.subarray(i+1));return s+(l-s)*(a-i)}}
572function Qge(e,t,r=$L){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,a=(n-1)*t,i=Math.floor(a),s=+r(e[i],i,e),l=+r(e[i+1],i+1,e);return s+(l-s)*(a-i)}}function Jge(e,t,r){e=+e,t=+t,r=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+r;for(var n=-1,a=Math.max(0,Math.ceil((t-e)/r))|0,i=new Array(a);++n<a;)i[n]=e+n*r;return i}function zn(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function oi(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const rb=Symbol("implicit");function Ij(){var e=new kE,t=[],r=[],n=rb;function a(i){let s=e.get(i);if(s===void 0){if(n!==rb)return n;e.set(i,s=t.push(i)-1)}return r[s%r.length]}return a.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new kE;for(const s of i)e.has(s)||e.set(s,t.push(s)-1);return a},a.range=function(i){return arguments.length?(r=Array.from(i),a):r.slice()},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return Ij(t,r).unknown(n)},zn.apply(a,arguments),a}function qu(){var e=Ij().unknown(void 0),t=e.domain,r=e.range,n=0,a=1,i,s,l=!1,c=0,u=0,d=.5;delete e.unknown;function f(){var m=t().length,p=a<n,y=p?a:n,v=p?n:a;i=(v-y)/Math.max(1,m-c+u*2),l&&(i=Math.floor(i)),y+=(v-y-i*(m-c))*d,s=i*(1-c),l&&(y=Math.round(y),s=Math.round(s));var g=Jge(m).map(function(x){return y+i*x});return r(p?g.reverse():g)}return e.domain=function(m){return arguments.length?(t(m),f()):t()},e.range=function(m){return arguments.length?([n,a]=m,n=+n,a=+a,f()):[n,a]},e.rangeRound=function(m){return[n,a]=m,n=+n,a=+a,l=!0,f()},e.bandwidth=function(){return s},e.step=function(){return i},e.round=function(m){return arguments.length?(l=!!m,f()):l},e.padding=function(m){return arguments.length?(c=Math.min(1,u=+m),f()):c},e.paddingInner=function(m){return arguments.length?(c=Math.min(1,m),f()):c},e.paddingOuter=function(m){return arguments.length?(u=+m,f()):u},e.align=function(m){return arguments.length?(d=Math.max(0,Math.min(1,m)),f()):d},e.copy=function(){return qu(t(),[n,a]).round(l).paddingInner(c).paddingOuter(u).align(d)},zn.apply(f(),arguments)}function IL(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return IL(t())},e}function Xc(){return IL(qu.apply(null,arguments).paddingInner(1))}function Rj(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function RL(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function Hd(){}var Uu=.7,Qm=1/Uu,ks="\\s*([+-]?\\d+)\\s*",Wu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",eye=/^#([0-9a-f]{3,8})$/,tye=new RegExp(`^rgb\\(${ks},${ks},${ks}\\)$`),rye=new RegExp(`^rgb\\(${xa},${xa},${xa}\\)$`),nye=new RegExp(`^rgba\\(${ks},${ks},${ks},${Wu}\\)$`),aye=new RegExp(`^rgba\\(${xa},${xa},${xa},${Wu}\\)$`),iye=new RegExp(`^hsl\\(${Wu},${xa},${xa}\\)$`),oye=new RegExp(`^hsla\\(${Wu},${xa},${xa},${Wu}\\)$`),LE={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Rj(Hd,Vu,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:FE,formatHex:FE,formatHex8:sye,formatHsl:lye,formatRgb:BE,toString:BE});function FE(){return this.rgb().formatHex()}function sye(){return this.rgb().formatHex8()}function lye(){return LL(this).formatHsl()}function BE(){return this.rgb().formatRgb()}function Vu(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=eye.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?zE(t):r===3?new Hr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Cf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Cf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=tye.exec(e))?new Hr(t[1],t[2],t[3],1):(t=rye.exec(e))?new Hr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=nye.exec(e))?Cf(t[1],t[2],t[3],t[4]):(t=aye.exec(e))?Cf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=iye.exec(e))?WE(t[1],t[2]/100,t[3]/100,1):(t=oye.exec(e))?WE(t[1],t[2]/100,t[3]/100,t[4]):LE.hasOwnProperty(e)?zE(LE[e]):e==="transparent"?new Hr(NaN,NaN,NaN,0):null}function zE(e){return new Hr(e>>16&255,e>>8&255,e&255,1)}function Cf(e,t,r,n){return n<=0&&(e=t=r=NaN),new Hr(e,t,r,n)}function cye(e){return e instanceof Hd||(e=Vu(e)),e?(e=e.rgb(),new Hr(e.r,e.g,e.b,e.opacity)):new Hr}function nb(e,t,r,n){return arguments.length===1?cye(e):new Hr(e,t,r,n??1)}function Hr(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Rj(Hr,nb,RL(Hd,{brighter(e){return e=e==null?Qm:Math.pow(Qm,e),new Hr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Uu:Math.pow(Uu,e),new Hr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Hr(Co(this.r),Co(this.g),Co(this.b),Jm(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:qE,formatHex:qE,formatHex8:uye,formatRgb:UE,toString:UE}
vendor: 5,903 bytes, line 572
572));function qE(){return`#${po(this.r)}${po(this.g)}${po(this.b)}`}function uye(){return`#${po(this.r)}${po(this.g)}${po(this.b)}${po((isNaN(this.opacity)?1:this.opacity)*255)}`}function UE(){const e=Jm(this.opacity);return`${e===1?"rgb(":"rgba("}${Co(this.r)}, ${Co(this.g)}, ${Co(this.b)}${e===1?")":`, ${e})`}`}function Jm(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Co(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function po(e){return e=Co(e),(e<16?"0":"")+e.toString(16)}function WE(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Yn(e,t,r,n)}function LL(e){if(e instanceof Yn)return new Yn(e.h,e.s,e.l,e.opacity);if(e instanceof Hd||(e=Vu(e)),!e)return new Yn;if(e instanceof Yn)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,a=Math.min(t,r,n),i=Math.max(t,r,n),s=NaN,l=i-a,c=(i+a)/2;return l?(t===i?s=(r-n)/l+(r<n)*6:r===i?s=(n-t)/l+2:s=(t-r)/l+4,l/=c<.5?i+a:2-i-a,s*=60):l=c>0&&c<1?0:s,new Yn(s,l,c,e.opacity)}function dye(e,t,r,n){return arguments.length===1?LL(e):new Yn(e,t,r,n??1)}function Yn(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Rj(Yn,dye,RL(Hd,{brighter(e){return e=e==null?Qm:Math.pow(Qm,e),new Yn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Uu:Math.pow(Uu,e),new Yn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,a=2*r-n;return new Hr(ry(e>=240?e-240:e+120,a,n),ry(e,a,n),ry(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new Yn(VE(this.h),Of(this.s),Of(this.l),Jm(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Jm(this.opacity);return`${e===1?"hsl(":"hsla("}${VE(this.h)}, ${Of(this.s)*100}%, ${Of(this.l)*100}%${e===1?")":`, ${e})`}`}}));function VE(e){return e=(e||0)%360,e<0?e+360:e}function Of(e){return Math.max(0,Math.min(1,e||0))}function ry(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const Lj=e=>()=>e;function fye(e,t){return function(r){return e+r*t}}function mye(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function hye(e){return(e=+e)==1?FL:function(t,r){return r-t?mye(t,r,e):Lj(isNaN(t)?r:t)}}function FL(e,t){var r=t-e;return r?fye(e,r):Lj(isNaN(e)?t:e)}const GE=function e(t){var r=hye(t);function n(a,i){var s=r((a=nb(a)).r,(i=nb(i)).r),l=r(a.g,i.g),c=r(a.b,i.b),u=FL(a.opacity,i.opacity);return function(d){return a.r=s(d),a.g=l(d),a.b=c(d),a.opacity=u(d),a+""}}return n.gamma=e,n}(1);function pye(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),a;return function(i){for(a=0;a<r;++a)n[a]=e[a]*(1-i)+t[a]*i;return n}}function vye(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gye(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,a=new Array(n),i=new Array(r),s;for(s=0;s<n;++s)a[s]=ac(e[s],t[s]);for(;s<r;++s)i[s]=t[s];return function(l){for(s=0;s<n;++s)i[s]=a[s](l);return i}}function yye(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function eh(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function xye(e,t){var r={},n={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?r[a]=ac(e[a],t[a]):n[a]=t[a];return function(i){for(a in r)n[a]=r[a](i);return n}}var ab=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ny=new RegExp(ab.source,"g");function bye(e){return function(){return e}}function wye(e){return function(t){return e(t)+""}}function jye(e,t){var r=ab.lastIndex=ny.lastIndex=0,n,a,i,s=-1,l=[],c=[];for(e=e+"",t=t+"";(n=ab.exec(e))&&(a=ny.exec(t));)(i=a.index)>r&&(i=t.slice(r,i),l[s]?l[s]+=i:l[++s]=i),(n=n[0])===(a=a[0])?l[s]?l[s]+=a:l[++s]=a:(l[++s]=null,c.push({i:s,x:eh(n,a)})),r=ny.lastIndex;return r<t.length&&(i=t.slice(r),l[s]?l[s]+=i:l[++s]=i),l.length<2?c[0]?wye(c[0].x):bye(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function ac(e,t){var r=typeof t,n;return t==null||r==="boolean"?Lj(t):(r==="number"?eh:r==="string"?(n=Vu(t))?(t=n,GE):jye:t instanceof Vu?GE:t instanceof Date?yye:vye(t)?pye:Array.isArray(t)?gye:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?xye:eh)(e,t)}function Fj(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function Sye(e,t){t===void 0&&(t=e,e=ac);for(var r=0,n=t.length-1,a=t[0],i=new Array(n<0?0:n);r<n;)i[r]=e(a,a=t[++r]);return function(s){var l=Math.max(0,Math.min(n-1,Math.floor(s*=n)));return i[l](s-l)}}function _ye(e){return function(){return e}}function th(e){return+e}var HE=[0,1];function Mr(e){return e}function ib(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:_ye(isNaN(t)?NaN:.5)}function Nye(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function Eye(e,t,r){var n=e[0],a=e[1],i=t[0],s=t[1];return a<n?(n=ib(a,n),i=r(s,i)):(n=ib(n,a),i=r(i,s)),function(l){return i(n(l))}}function Cye(e,t,r){var n=Math.min(e.length,t.length)-1,a=new Array(n),i=new Array(n),s=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<n;)a[s]=ib(e[s],e[s+1]),i[s]=r(t[s],t[s+1]);return function(l){var c=Gd(e,l,1,n)-1;return i[c](a[c](l))}}function Kd(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function jv(){var e=HE,t=HE,r=ac,n,a,i,s=Mr,l,c,u;function d(){var m=Math.min(e.length,t.length);return s!==Mr&&(s=Nye(e[0],e[m-1])),l=m>2?Cye:Eye,c=u=null,f}function f(m){return m==null||isNaN(m=+m)?i:(c||(c=l(e.map(n),t,r)))(n(s(m)))}return f.invert=function(m){return s(a((u||(u=l(t,e.map(n),eh)))(m)))},f.domain=function(m){return arguments.length?(e=Array.from(m,th),d()):e.slice()},f.range=function(m){return arguments.length?(t=Array.from(m),d()):t.slice()},f.rangeRound=function(m){return t=Array.from(m),r=Fj,d()}
vendor: 4,712 bytes, line 572
572,f.clamp=function(m){return arguments.length?(s=m?!0:Mr,d()):s!==Mr},f.interpolate=function(m){return arguments.length?(r=m,d()):r},f.unknown=function(m){return arguments.length?(i=m,f):i},function(m,p){return n=m,a=p,d()}}function Bj(){return jv()(Mr,Mr)}function Oye(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function rh(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function dl(e){return e=rh(Math.abs(e)),e?e[1]:NaN}function Pye(e,t){return function(r,n){for(var a=r.length,i=[],s=0,l=e[0],c=0;a>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),i.push(r.substring(a-=l,a+l)),!((c+=l+1)>n));)l=e[s=(s+1)%e.length];return i.reverse().join(t)}}function Aye(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var Tye=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Gu(e){if(!(t=Tye.exec(e)))throw new Error("invalid format: "+e);var t;return new zj({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Gu.prototype=zj.prototype;function zj(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}zj.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Dye(e){e:for(var t=e.length,r=1,n=-1,a;r<t;++r)switch(e[r]){case".":n=a=r;break;case"0":n===0&&(n=r),a=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(a+1):e}var BL;function $ye(e,t){var r=rh(e,t);if(!r)return e+"";var n=r[0],a=r[1],i=a-(BL=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,s=n.length;return i===s?n:i>s?n+new Array(i-s+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+rh(e,Math.max(0,t+i-1))[0]}function KE(e,t){var r=rh(e,t);if(!r)return e+"";var n=r[0],a=r[1];return a<0?"0."+new Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+new Array(a-n.length+2).join("0")}const YE={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Oye,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>KE(e*100,t),r:KE,s:$ye,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function XE(e){return e}var ZE=Array.prototype.map,QE=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function kye(e){var t=e.grouping===void 0||e.thousands===void 0?XE:Pye(ZE.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?XE:Aye(ZE.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"â":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f){f=Gu(f);var m=f.fill,p=f.align,y=f.sign,v=f.symbol,g=f.zero,x=f.width,b=f.comma,j=f.precision,w=f.trim,S=f.type;S==="n"?(b=!0,S="g"):YE[S]||(j===void 0&&(j=12),w=!0,S="g"),(g||m==="0"&&p==="=")&&(g=!0,m="0",p="=");var _=v==="$"?r:v==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",N=v==="$"?n:/[%p]/.test(S)?s:"",E=YE[S],O=/[defgprs%]/.test(S);j=j===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function P(C){var A=_,T=N,k,D,M;if(S==="c")T=E(C)+T,C="";else{C=+C;var F=C<0||1/C<0;if(C=isNaN(C)?c:E(Math.abs(C),j),w&&(C=Dye(C)),F&&+C==0&&y!=="+"&&(F=!1),A=(F?y==="("?y:l:y==="-"||y==="("?"":y)+A,T=(S==="s"?QE[8+BL/3]:"")+T+(F&&y==="("?")":""),O){for(k=-1,D=C.length;++k<D;)if(M=C.charCodeAt(k),48>M||M>57){T=(M===46?a+C.slice(k+1):C.slice(k))+T,C=C.slice(0,k);break}}}b&&!g&&(C=t(C,1/0));var q=A.length+C.length+T.length,I=q<x?new Array(x-q+1).join(m):"";switch(b&&g&&(C=t(I+C,I.length?x-T.length:1/0),I=""),p){case"<":C=A+C+T+I;break;case"=":C=A+I+C+T;break;case"^":C=I.slice(0,q=I.length>>1)+A+C+T+I.slice(q);break;default:C=I+A+C+T;break}return i(C)}return P.toString=function(){return f+""},P}function d(f,m){var p=u((f=Gu(f),f.type="f",f)),y=Math.max(-8,Math.min(8,Math.floor(dl(m)/3)))*3,v=Math.pow(10,-y),g=QE[8+y/3];return function(x){return p(v*x)+g}}return{format:u,formatPrefix:d}}var Pf,qj,zL;
572Mye({thousands:",",grouping:[3],currency:["$",""]});function Mye(e){return Pf=kye(e),qj=Pf.format,zL=Pf.formatPrefix,Pf}function Iye(e){return Math.max(0,-dl(Math.abs(e)))}function Rye(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(dl(t)/3)))*3-dl(Math.abs(e)))}function Lye(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,dl(t)-dl(e))+1}function qL(e,t,r,n){var a=tb(e,t,r),i;switch(n=Gu(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=Rye(a,s))&&(n.precision=i),zL(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=Lye(a,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=Iye(a))&&(n.precision=i-(n.type==="%")*2);break}}return qj(n)}function Zi(e){var t=e.domain;return e.ticks=function(r){var n=t();return Jx(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var a=t();return qL(a[0],a[a.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),a=0,i=n.length-1,s=n[a],l=n[i],c,u,d=10;for(l<s&&(u=s,s=l,l=u,u=a,a=i,i=u);d-- >0;){if(u=eb(s,l,r),u===c)return n[a]=s,n[i]=l,t(n);if(u>0)s=Math.floor(s/u)*u,l=Math.ceil(l/u)*u;else if(u<0)s=Math.ceil(s*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function nh(){var e=Bj();return e.copy=function(){return Kd(e,nh())},zn.apply(e,arguments),Zi(e)}function UL(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,th),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return UL(e).unknown(t)},e=arguments.length?Array.from(e,th):[0,1],Zi(r)}function WL(e,t){e=e.slice();var r=0,n=e.length-1,a=e[r],i=e[n],s;return i<a&&(s=r,r=n,n=s,s=a,a=i,i=s),e[r]=t.floor(a),e[n]=t.ceil(i),e}function JE(e){return Math.log(e)}function eC(e){return Math.exp(e)}function Fye(e){return-Math.log(-e)}function Bye(e){return-Math.exp(-e)}function zye(e){return isFinite(e)?+("1e"+e):e<0?0:e}function qye(e){return e===10?zye:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Uye(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function tC(e){return(t,r)=>-e(-t,r)}function Uj(e){const t=e(JE,eC),r=t.domain;let n=10,a,i;function s(){return a=Uye(n),i=qye(n),r()[0]<0?(a=tC(a),i=tC(i),e(Fye,Bye)):e(JE,eC),t}return t.base=function(l){return arguments.length?(n=+l,s()):n},t.domain=function(l){return arguments.length?(r(l),s()):r()},t.ticks=l=>{const c=r();let u=c[0],d=c[c.length-1];const f=d<u;f&&([u,d]=[d,u]);let m=a(u),p=a(d),y,v;const g=l==null?10:+l;let x=[];if(!(n%1)&&p-m<g){if(m=Math.floor(m),p=Math.ceil(p),u>0){for(;m<=p;++m)for(y=1;y<n;++y)if(v=m<0?y/i(-m):y*i(m),!(v<u)){if(v>d)break;x.push(v)}}else for(;m<=p;++m)for(y=n-1;y>=1;--y)if(v=m>0?y/i(-m):y*i(m),!(v<u)){if(v>d)break;x.push(v)}x.length*2<g&&(x=Jx(u,d,g))}else x=Jx(m,p,Math.min(p-m,g)).map(i);return f?x.reverse():x},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Gu(c)).precision==null&&(c.trim=!0),c=qj(c)),l===1/0)return c;const u=Math.max(1,n*l/t.ticks().length);return d=>{let f=d/i(Math.round(a(d)));return f*n<n-.5&&(f*=n),f<=u?c(d):""}},t.nice=()=>r(WL(r(),{floor:l=>i(Math.floor(a(l))),ceil:l=>i(Math.ceil(a(l)))})),t}function VL(){const e=Uj(jv()).domain([1,10]);return e.copy=()=>Kd(e,VL()).base(e.base()),zn.apply(e,arguments),e}function rC(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function nC(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Wj(e){var t=1,r=e(rC(t),nC(t));return r.constant=function(n){return arguments.length?e(rC(t=+n),nC(t)):t},Zi(r)}function GL(){var e=Wj(jv());return e.copy=function(){return Kd(e,GL()).constant(e.constant())},zn.apply(e,arguments)}function aC(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Wye(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Vye(e){return e<0?-e*e:e*e}function Vj(e){var t=e(Mr,Mr),r=1;function n(){return r===1?e(Mr,Mr):r===.5?e(Wye,Vye):e(aC(r),aC(1/r))}return t.exponent=function(a){return arguments.length?(r=+a,n()):r},Zi(t)}function Gj(){var e=Vj(jv());return e.copy=function(){return Kd(e,Gj()).exponent(e.exponent())},zn.apply(e,arguments),e}function Gye(){return Gj.apply(null,arguments).exponent(.5)}function iC(e){return Math.sign(e)*e*e}function Hye(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function HL(){var e=Bj(),t=[0,1],r=!1,n;function a(i){var s=Hye(e(i));return isNaN(s)?n:r?Math.round(s):s}return a.invert=function(i){return e.invert(iC(i))},a.domain=function(i){return arguments.length?(e.domain(i),a):e.domain()},a.range=function(i){return arguments.length?(e.range((t=Array.from(i,th)).map(iC)),a):t.slice()}
572,a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(r=!!i,a):r},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return HL(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},zn.apply(a,arguments),Zi(a)}function KL(){var e=[],t=[],r=[],n;function a(){var s=0,l=Math.max(1,t.length);for(r=new Array(l-1);++s<l;)r[s-1]=Qge(e,s/l);return i}function i(s){return s==null||isNaN(s=+s)?n:t[Gd(r,s)]}return i.invertExtent=function(s){var l=t.indexOf(s);return l<0?[NaN,NaN]:[l>0?r[l-1]:e[0],l<r.length?r[l]:e[e.length-1]]},i.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let l of s)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(Li),a()},i.range=function(s){return arguments.length?(t=Array.from(s),a()):t.slice()},i.unknown=function(s){return arguments.length?(n=s,i):n},i.quantiles=function(){return r.slice()},i.copy=function(){return KL().domain(e).range(t).unknown(n)},zn.apply(i,arguments)}function YL(){var e=0,t=1,r=1,n=[.5],a=[0,1],i;function s(c){return c!=null&&c<=c?a[Gd(n,c,0,r)]:i}function l(){var c=-1;for(n=new Array(r);++c<r;)n[c]=((c+1)*t-(c-r)*e)/(r+1);return s}return s.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},s.range=function(c){return arguments.length?(r=(a=Array.from(c)).length-1,l()):a.slice()},s.invertExtent=function(c){var u=a.indexOf(c);return u<0?[NaN,NaN]:u<1?[e,n[0]]:u>=r?[n[r-1],t]:[n[u-1],n[u]]},s.unknown=function(c){return arguments.length&&(i=c),s},s.thresholds=function(){return n.slice()},s.copy=function(){return YL().domain([e,t]).range(a).unknown(i)},zn.apply(Zi(s),arguments)}function XL(){var e=[.5],t=[0,1],r,n=1;function a(i){return i!=null&&i<=i?t[Gd(e,i,0,n)]:r}return a.domain=function(i){return arguments.length?(e=Array.from(i),n=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),n=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(i){var s=t.indexOf(i);return[e[s-1],e[s]]},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return XL().domain(e).range(t).unknown(r)},zn.apply(a,arguments)}const ay=new Date,iy=new Date;function sr(e,t,r,n){function a(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(e(i=new Date(+i)),i),a.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),a.round=i=>{const s=a(i),l=a.ceil(i);return i-s<l-i?s:l},a.offset=(i,s)=>(t(i=new Date(+i),s==null?1:Math.floor(s)),i),a.range=(i,s,l)=>{const c=[];if(i=a.ceil(i),l=l==null?1:Math.floor(l),!(i<s)||!(l>0))return c;let u;do c.push(u=new Date(+i)),t(i,l),e(i);while(u<i&&i<s);return c},a.filter=i=>sr(s=>{if(s>=s)for(;e(s),!i(s);)s.setTime(s-1)},(s,l)=>{if(s>=s)if(l<0)for(;++l<=0;)for(;t(s,-1),!i(s););else for(;--l>=0;)for(;t(s,1),!i(s););}),r&&(a.count=(i,s)=>(ay.setTime(+i),iy.setTime(+s),e(ay),e(iy),Math.floor(r(ay,iy))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(n?s=>n(s)%i===0:s=>a.count(0,s)%i===0):a)),a}const ah=sr(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ah.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?sr(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):ah);ah.range;const Ba=1e3,$n=Ba*60,za=$n*60,Qa=za*24,Hj=Qa*7,oC=Qa*30,oy=Qa*365,vo=sr(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Ba)},(e,t)=>(t-e)/Ba,e=>e.getUTCSeconds());vo.range;const Kj=sr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ba)},(e,t)=>{e.setTime(+e+t*$n)},(e,t)=>(t-e)/$n,e=>e.getMinutes());Kj.range;const Yj=sr(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*$n)},(e,t)=>(t-e)/$n,e=>e.getUTCMinutes());Yj.range;const Xj=sr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ba-e.getMinutes()*$n)},(e,t)=>{e.setTime(+e+t*za)},(e,t)=>(t-e)/za,e=>e.getHours());Xj.range;const Zj=sr(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*za)},(e,t)=>(t-e)/za,e=>e.getUTCHours());Zj.range;const Yd=sr(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*$n)/Qa,e=>e.getDate()-1);Yd.range;const Sv=sr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Qa,e=>e.getUTCDate()-1);Sv.range;const ZL=sr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Qa,e=>
vendor: 11,365 bytes, line 572
572Math.floor(e/Qa));ZL.range;function rs(e){return sr(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*$n)/Hj)}const _v=rs(0),ih=rs(1),Kye=rs(2),Yye=rs(3),fl=rs(4),Xye=rs(5),Zye=rs(6);_v.range;ih.range;Kye.range;Yye.range;fl.range;Xye.range;Zye.range;function ns(e){return sr(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/Hj)}const Nv=ns(0),oh=ns(1),Qye=ns(2),Jye=ns(3),ml=ns(4),exe=ns(5),txe=ns(6);Nv.range;oh.range;Qye.range;Jye.range;ml.range;exe.range;txe.range;const Qj=sr(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Qj.range;const Jj=sr(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Jj.range;const Ja=sr(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Ja.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:sr(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});Ja.range;const ei=sr(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ei.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:sr(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});ei.range;function QL(e,t,r,n,a,i){const s=[[vo,1,Ba],[vo,5,5*Ba],[vo,15,15*Ba],[vo,30,30*Ba],[i,1,$n],[i,5,5*$n],[i,15,15*$n],[i,30,30*$n],[a,1,za],[a,3,3*za],[a,6,6*za],[a,12,12*za],[n,1,Qa],[n,2,2*Qa],[r,1,Hj],[t,1,oC],[t,3,3*oC],[e,1,oy]];function l(u,d,f){const m=d<u;m&&([u,d]=[d,u]);const p=f&&typeof f.range=="function"?f:c(u,d,f),y=p?p.range(u,+d+1):[];return m?y.reverse():y}function c(u,d,f){const m=Math.abs(d-u)/f,p=Mj(([,,g])=>g).right(s,m);if(p===s.length)return e.every(tb(u/oy,d/oy,f));if(p===0)return ah.every(Math.max(tb(u,d,f),1));const[y,v]=s[m/s[p-1][2]<s[p][2]/m?p-1:p];return y.every(v)}return[l,c]}const[rxe,nxe]=QL(ei,Jj,Nv,ZL,Zj,Yj),[axe,ixe]=QL(Ja,Qj,_v,Yd,Xj,Kj);function sy(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function ly(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Nc(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function oxe(e){var t=e.dateTime,r=e.date,n=e.time,a=e.periods,i=e.days,s=e.shortDays,l=e.months,c=e.shortMonths,u=Ec(a),d=Cc(a),f=Ec(i),m=Cc(i),p=Ec(s),y=Cc(s),v=Ec(l),g=Cc(l),x=Ec(c),b=Cc(c),j={a:F,A:q,b:I,B:K,c:null,d:fC,e:fC,f:Pxe,g:Fxe,G:zxe,H:Exe,I:Cxe,j:Oxe,L:JL,m:Axe,M:Txe,p:W,q:R,Q:pC,s:vC,S:Dxe,u:$xe,U:kxe,V:Mxe,w:Ixe,W:Rxe,x:null,X:null,y:Lxe,Y:Bxe,Z:qxe,"%":hC},w={a:V,A:re,b:H,B:te,c:null,d:mC,e:mC,f:Gxe,g:rbe,G:abe,H:Uxe,I:Wxe,j:Vxe,L:tF,m:Hxe,M:Kxe,p:ce,q:je,Q:pC,s:vC,S:Yxe,u:Xxe,U:Zxe,V:Qxe,w:Jxe,W:ebe,x:null,X:null,y:tbe,Y:nbe,Z:ibe,"%":hC},S={a:P,A:C,b:A,B:T,c:k,d:uC,e:uC,f:jxe,g:cC,G:lC,H:dC,I:dC,j:yxe,L:wxe,m:gxe,M:xxe,p:O,q:vxe,Q:_xe,s:Nxe,S:bxe,u:dxe,U:fxe,V:mxe,w:uxe,W:hxe,x:D,X:M,y:cC,Y:lC,Z:pxe,"%":Sxe};j.x=_(r,j),j.X=_(n,j),j.c=_(t,j),w.x=_(r,w),w.X=_(n,w),w.c=_(t,w);function _(X,ae){return function(_e){var J=[],Ke=-1,Ne=0,Re=X.length,pe,De,L;for(_e instanceof Date||(_e=new Date(+_e));++Ke<Re;)X.charCodeAt(Ke)===37&&(J.push(X.slice(Ne,Ke)),(De=sC[pe=X.charAt(++Ke)])!=null?pe=X.charAt(++Ke):De=pe==="e"?" ":"0",(L=ae[pe])&&(pe=L(_e,De)),J.push(pe),Ne=Ke+1);return J.push(X.slice(Ne,Ke)),J.join("")}}function N(X,ae){return function(_e){var J=Nc(1900,void 0,1),Ke=E(J,X,_e+="",0),Ne,Re;if(Ke!=_e.length)return null;if("Q"in J)return new Date(J.Q);if("s"in J)return new Date(J.s*1e3+("L"in J?J.L:0));if(ae&&!("Z"in J)&&(J.Z=0),"p"in J&&(J.H=J.H%12+J.p*12),J.m===void 0&&(J.m="q"in J?J.q:0),"V"in J){if(J.V<1||J.V>53)return null;"w"in J||(J.w=1),"Z"in J?(Ne=ly(Nc(J.y,0,1)),Re=Ne.getUTCDay(),Ne=Re>4||Re===0?oh.ceil(Ne):oh(Ne),Ne=Sv.offset(Ne,(J.V-1)*7),J.y=Ne.getUTCFullYear(),J.m=Ne.getUTCMonth(),J.d=Ne.getUTCDate()+(J.w+6)%7):(Ne=sy(Nc(J.y,0,1)),Re=Ne.getDay(),Ne=Re>4||Re===0?ih.ceil(Ne):ih(Ne),Ne=Yd.offset(Ne,(J.V-1)*7),J.y=Ne.getFullYear(),J.m=Ne.getMonth(),J.d=Ne.getDate()+(J.w+6)%7)}else("W"in J||"U"in J)&&("w"in J||(J.w="u"in J?J.u%7:"W"in J?1:0),Re="Z"in J?ly(Nc(J.y,0,1)).getUTCDay():sy(Nc(J.y,0,1)).getDay(),J.m=0,J.d="W"in J?(J.w+6)%7+J.W*7-(Re+5)%7:J.w+J.U*7-(Re+6)%7);return"Z"in J?(J.H+=J.Z/100|0,J.M+=J.Z%100,ly(J)):sy(J)}}function E(X,ae,_e,J){for(var Ke=0,Ne=ae.length,Re=_e.length,pe,De;Ke<Ne;){if(J>=Re)return-1;if(pe=ae.charCodeAt(Ke++),pe===37){if(pe=ae.charAt(Ke++),De=S[pe in sC?ae.charAt(Ke++):pe],!De||(J=De(X,_e,J))<0)return-1}else if(pe!=_e.charCodeAt(J++))return-1}return J}function O(X,ae,_e){var J=u.exec(ae.slice(_e));return J?(X.p=d.get(J[0].toLowerCase()),_e+J[0].length):-1}function P(X,ae,_e){var J=p.exec(ae.slice(_e));return J?(X.w=y.get(J[0].toLowerCase()),_e+J[0].length):-1}function C(X,ae,_e){var J=f.exec(ae.slice(_e));return J?(X.w=m.get(J[0].toLowerCase()),_e+J[0].length):-1}function A(X,ae,_e){var J=x.exec(ae.slice(_e));return J?(X.m=b.get(J[0].toLowerCase()),_e+J[0].length):-1}function T(X,ae,_e){var J=v.exec(ae.slice(_e));return J?(X.m=g.get(J[0].toLowerCase()),_e+J[0].length):-1}function k(X,ae,_e){return E(X,t,ae,_e)}function D(X,ae,_e){return E(X,r,ae,_e)}function M(X,ae,_e){return E(X,n,ae,_e)}function F(X){return s[X.getDay()]}function q(X){return i[X.getDay()]}function I(X){return c[X.getMonth()]}function K(X){return l[X.getMonth()]}function W(X){return a[+(X.getHours()>=12)]}function R(X){return 1+~~(X.getMonth()/3)}function V(X){return s[X.getUTCDay()]}function re(X){return i[X.getUTCDay()]}function H(X){return c[X.getUTCMonth()]}function te(X){return l[X.getUTCMonth()]}function ce(X){return a[+(X.getUTCHours()>=12)]}function je(X){return 1+~~(X.getUTCMonth()/3)}return{format:function(X){var ae=_(X+="",j);return ae.toString=function(){return X},ae},parse:function(X){var ae=N(X+="",!1);return ae.toString=function(){return X},ae},utcFormat:function(X){var ae=_(X+="",w);return ae.toString=function(){return X},ae},utcParse:function(X){var ae=N(X+="",!0);return ae.toString=function(){return X},ae}}}var sC={"-":"",_:" ",0:"0"},pr=/^\s*\d+/,sxe=/^%/,lxe=/[\\^$*+?|[\]().{}]/g;function ut(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i<r?new Array(r-i+1).join(t)+a:a)}function cxe(e){return e.replace(lxe,"\\$&")}function Ec(e){return new RegExp("^(?:"+e.map(cxe).join("|")+")","i")}function Cc(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function uxe(e,t,r){var n=pr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function dxe(e,t,r){var n=pr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function fxe(e,t,r){var n=pr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function mxe(e,t,r){var n=pr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function hxe(e,t,r){var n=pr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function lC(e,t,r){var n=pr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function cC(e,t,r){var n=pr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function pxe(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function vxe(e,t,r){var n=pr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function gxe(e,t,r){var n=pr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function uC(e,t,r){var n=pr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function yxe(e,t,r){var n=pr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function dC(e,t,r){var n=pr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function xxe(e,t,r){var n=pr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function bxe(e,t,r){var n=pr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function wxe(e,t,r){var n=pr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function jxe(e,t,r){var n=pr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function Sxe(e,t,r){var n=sxe.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function _xe(e,t,r){var n=pr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Nxe(e,t,r){var n=pr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function fC(e,t){return ut(e.getDate(),t,2)}function Exe(e,t){return ut(e.getHours(),t,2)}function Cxe(e,t){return ut(e.getHours()%12||12,t,2)}function Oxe(e,t){return ut(1+Yd.count(Ja(e),e),t,3)}function JL(e,t){return ut(e.getMilliseconds(),t,3)}function Pxe(e,t){return JL(e,t)+"000"}function Axe(e,t){return ut(e.getMonth()+1,t,2)}function Txe(e,t){return ut(e.getMinutes(),t,2)}function Dxe(e,t){return ut(e.getSeconds(),t,2)}function $xe(e){var t=e.getDay();return t===0?7:t}function kxe(e,t){return ut(_v.count(Ja(e)-1,e),t,2)}function eF(e){var t=e.getDay();return t>=4||t===0?fl(e):fl.ceil(e)}function Mxe(e,t){return e=eF(e),ut(fl.count(Ja(e),e)+(Ja(e).getDay()===4),t,2)}function Ixe(e){return e.getDay()}function Rxe(e,t){return ut(ih.count(Ja(e)-1,e),t,2)}function Lxe(e,t){return ut(e.getFullYear()%100,t,2)}function Fxe(e,t){return e=eF(e),ut(e.getFullYear()%100,t,2)}function Bxe(e,t){return ut(e.getFullYear()%1e4,t,4)}function zxe(e,t){var r=e.getDay();return e=r>=4||r===0?fl(e):fl.ceil(e),ut(e.getFullYear()%1e4,t,4)}function qxe(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ut(t/60|0,"0",2)+ut(t%60,"0",2)}function mC(e,t){return ut(e.getUTCDate(),t,2)}function Uxe(e,t){return ut(e.getUTCHours(),t,2)}function Wxe(e,t){return ut(e.getUTCHours()%12||12,t,2)}function Vxe(e,t){return ut(1+Sv.count(ei(e),e),t,3)}function tF(e,t){return ut(e.getUTCMilliseconds(),t,3)}function Gxe(e,t){return tF(e,t)+"000"}function Hxe(e,t){return ut(e.getUTCMonth()+1,t,2)}function Kxe(e,t){return ut(e.getUTCMinutes(),t,2)}function Yxe(e,t){return ut(e.getUTCSeconds(),t,2)}function Xxe(e){var t=e.getUTCDay();return t===0?7:t}function Zxe(e,t){return ut(Nv.count(ei(e)-1,e),t,2)}function rF(e){var t=e.getUTCDay();return t>=4||t===0?ml(e):ml.ceil(e)}function Qxe(e,t){return e=rF(e),ut(ml.count(ei(e),e)+(ei(e).getUTCDay()===4),t,2)}function Jxe(e){return e.getUTCDay()}function ebe(e,t){return ut(oh.count(ei(e)-1,e),t,2)}function tbe(e,t){return ut(e.getUTCFullYear()%100,t,2)}function rbe(e,t){return e=rF(e),ut(e.getUTCFullYear()%100,t,2)}function nbe(e,t){return ut(e.getUTCFullYear()%1e4,t,4)}function abe(e,t){var r=e.getUTCDay();return e=r>=4||r===0?ml(e):ml.ceil(e),ut(e.getUTCFullYear()%1e4,t,4)}function ibe(){return"+0000"}function hC(){return"%"}function pC(e){return+e}function vC(e){return Math.floor(+e/1e3)}var gs,nF,aF;obe({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
572ay","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function obe(e){return gs=oxe(e),nF=gs.format,gs.parse,aF=gs.utcFormat,gs.utcParse,gs}function sbe(e){return new Date(e)}function lbe(e){return e instanceof Date?+e:+new Date(+e)}function e1(e,t,r,n,a,i,s,l,c,u){var d=Bj(),f=d.invert,m=d.domain,p=u(".%L"),y=u(":%S"),v=u("%I:%M"),g=u("%I %p"),x=u("%a %d"),b=u("%b %d"),j=u("%B"),w=u("%Y");function S(_){return(c(_)<_?p:l(_)<_?y:s(_)<_?v:i(_)<_?g:n(_)<_?a(_)<_?x:b:r(_)<_?j:w)(_)}return d.invert=function(_){return new Date(f(_))},d.domain=function(_){return arguments.length?m(Array.from(_,lbe)):m().map(sbe)},d.ticks=function(_){var N=m();return e(N[0],N[N.length-1],_??10)},d.tickFormat=function(_,N){return N==null?S:u(N)},d.nice=function(_){var N=m();return(!_||typeof _.range!="function")&&(_=t(N[0],N[N.length-1],_??10)),_?m(WL(N,_)):d},d.copy=function(){return Kd(d,e1(e,t,r,n,a,i,s,l,c,u))},d}function cbe(){return zn.apply(e1(axe,ixe,Ja,Qj,_v,Yd,Xj,Kj,vo,nF).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function ube(){return zn.apply(e1(rxe,nxe,ei,Jj,Nv,Sv,Zj,Yj,vo,aF).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Ev(){var e=0,t=1,r,n,a,i,s=Mr,l=!1,c;function u(f){return f==null||isNaN(f=+f)?c:s(a===0?.5:(f=(i(f)-r)*a,l?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([e,t]=f,r=i(e=+e),n=i(t=+t),a=r===n?0:1/(n-r),u):[e,t]},u.clamp=function(f){return arguments.length?(l=!!f,u):l},u.interpolator=function(f){return arguments.length?(s=f,u):s};function d(f){return function(m){var p,y;return arguments.length?([p,y]=m,s=f(p,y),u):[s(0),s(1)]}}return u.range=d(ac),u.rangeRound=d(Fj),u.unknown=function(f){return arguments.length?(c=f,u):c},function(f){return i=f,r=f(e),n=f(t),a=r===n?0:1/(n-r),u}}function Qi(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function iF(){var e=Zi(Ev()(Mr));return e.copy=function(){return Qi(e,iF())},oi.apply(e,arguments)}function oF(){var e=Uj(Ev()).domain([1,10]);return e.copy=function(){return Qi(e,oF()).base(e.base())},oi.apply(e,arguments)}function sF(){var e=Wj(Ev());return e.copy=function(){return Qi(e,sF()).constant(e.constant())},oi.apply(e,arguments)}function t1(){var e=Vj(Ev());return e.copy=function(){return Qi(e,t1()).exponent(e.exponent())},oi.apply(e,arguments)}function dbe(){return t1.apply(null,arguments).exponent(.5)}function lF(){var e=[],t=Mr;function r(n){if(n!=null&&!isNaN(n=+n))return t((Gd(e,n,1)-1)/(e.length-1))}return r.domain=function(n){if(!arguments.length)return e.slice();e=[];for(let a of n)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Li),r},r.interpolator=function(n){return arguments.length?(t=n,r):t},r.range=function(){return e.map((n,a)=>t(a/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(a,i)=>Zge(e,i/n))},r.copy=function(){return lF(t).domain(e)},oi.apply(r,arguments)}function Cv(){var e=0,t=.5,r=1,n=1,a,i,s,l,c,u=Mr,d,f=!1,m;function p(v){return isNaN(v=+v)?m:(v=.5+((v=+d(v))-i)*(n*v<n*i?l:c),u(f?Math.max(0,Math.min(1,v)):v))}p.domain=function(v){return arguments.length?([e,t,r]=v,a=d(e=+e),i=d(t=+t),s=d(r=+r),l=a===i?0:.5/(i-a),c=i===s?0:.5/(s-i),n=i<a?-1:1,p):[e,t,r]},p.clamp=function(v){return arguments.length?(f=!!v,p):f},p.interpolator=function(v){return arguments.length?(u=v,p):u};function y(v){return function(g){var x,b,j;return arguments.length?([x,b,j]=g,u=Sye(v,[x,b,j]),p):[u(0),u(.5),u(1)]}}return p.range=y(ac),p.rangeRound=y(Fj),p.unknown=function(v){return arguments.length?(m=v,p):m},function(v){return d=v,a=v(e),i=v(t),s=v(r),l=a===i?0:.5/(i-a),c=i===s?0:.5/(s-i),n=i<a?-1:1,p}}function cF(){var e=Zi(Cv()(Mr));return e.copy=function(){return Qi(e,cF())},oi.apply(e,arguments)}function uF(){var e=Uj(Cv()).domain([.1,1,10]);return e.copy=function(){return Qi(e,uF()).base(e.base())},oi.apply(e,arguments)}function dF(){var e=Wj(Cv());return e.copy=function(){return Qi(e,dF()).constant(e.constant())},oi.apply(e,arguments)}function r1(){var e=Vj(Cv());return e.copy=function(){return Qi(e,r1()).exponent(e.exponent())},oi.apply(e,arguments)}function fbe(){return r1.apply(null,arguments).exponent(.5)}const gC=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:qu,scaleDiverging:cF,scaleDivergingLog:uF,scaleDivergingPow:r1,scaleDivergingSqrt:fbe,scaleDivergingSymlog:dF,scaleIdentity:UL,scaleImplicit:rb,scaleLinear:nh,scaleLog:VL,scaleOrdinal:Ij,scalePoint:Xc,scalePow:Gj,scaleQuantile:KL,scaleQuantize:YL,scaleRadial:HL,scaleSequential:iF,scaleSequentialLog:oF,scaleSequentialPow:t1,scaleSequentialQuantile:lF,scaleSequentialSqrt:dbe,scaleSequentialSymlog:sF,scaleSqrt:Gye,scaleSymlog:GL,scaleThreshold:XL,scaleTime:cbe,scaleUtc:ube,tickFormat:qL},Symbol.toStringTag,{value:"Module"}));var mbe=Yl;function hbe(e,t,r){for(var n=-1,a=e.length;++n<a;){var i=e[n],s=t(i);if(s!=null&&(l===void 0?s===s&&!mbe(s):r(s,l)))var l=s,c=i}return c}var Ov=hbe;function pbe(e,t){return e>t}var fF=pbe,vbe=Ov,gbe=fF,ybe=nc;function xbe(e){return e&&e.length?vbe(e,ybe,gbe):void 0}var bbe=xbe;const Pv=pt(bbe);function wbe(e,t){return e<t}var mF=wbe,jbe=Ov,Sbe=mF,_be=nc;function Nbe(e){return e&&e.length?jbe(e,_be,Sbe):void 0}var Ebe=Nbe;const Av=pt(Ebe);var Cbe=vj,Obe=Aa,Pbe=wL,Abe=Xr;function Tbe(e,t){var r=Abe(e)?Cbe:Pbe;return r(e,Obe(t))}var Dbe=Tbe,$be=xL,kbe=Dbe;function Mbe(e,t){return $be(kbe(e,t),1)}var Ibe=Mbe;const Rbe=pt(Ibe);var Lbe=Tj;function Fbe(e,t){return Lbe(e,t)}var Bbe=Fbe;const Xd=pt(Bbe);
vendor: 62,835 bytes, lines 572-599
572var ic=1e9,zbe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},a1,Lt=!0,In="[DecimalError] ",Oo=In+"Invalid argument: ",n1=In+"Exponent out of range: ",oc=Math.floor,co=Math.pow,qbe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,on,lr=1e7,Mt=7,hF=9007199254740991,sh=oc(hF/Mt),Te={};Te.absoluteValue=Te.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};Te.comparedTo=Te.cmp=function(e){var t,r,n,a,i=this;if(e=new i.constructor(e),i.s!==e.s)return i.s||-e.s;if(i.e!==e.e)return i.e>e.e^i.s<0?1:-1;for(n=i.d.length,a=e.d.length,t=0,r=n<a?n:a;t<r;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return n===a?0:n>a^i.s<0?1:-1};Te.decimalPlaces=Te.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*Mt;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};Te.dividedBy=Te.div=function(e){return Va(this,new this.constructor(e))};Te.dividedToIntegerBy=Te.idiv=function(e){var t=this,r=t.constructor;return _t(Va(t,new r(e),0,1),r.precision)};Te.equals=Te.eq=function(e){return!this.cmp(e)};Te.exponent=function(){return Jt(this)};Te.greaterThan=Te.gt=function(e){return this.cmp(e)>0};Te.greaterThanOrEqualTo=Te.gte=function(e){return this.cmp(e)>=0};Te.isInteger=Te.isint=function(){return this.e>this.d.length-2};Te.isNegative=Te.isneg=function(){return this.s<0};Te.isPositive=Te.ispos=function(){return this.s>0};Te.isZero=function(){return this.s===0};Te.lessThan=Te.lt=function(e){return this.cmp(e)<0};Te.lessThanOrEqualTo=Te.lte=function(e){return this.cmp(e)<1};Te.logarithm=Te.log=function(e){var t,r=this,n=r.constructor,a=n.precision,i=a+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(on))throw Error(In+"NaN");if(r.s<1)throw Error(In+(r.s?"NaN":"-Infinity"));return r.eq(on)?new n(0):(Lt=!1,t=Va(Hu(r,i),Hu(e,i),i),Lt=!0,_t(t,a))};Te.minus=Te.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?gF(t,e):pF(t,(e.s=-e.s,e))};Te.modulo=Te.mod=function(e){var t,r=this,n=r.constructor,a=n.precision;if(e=new n(e),!e.s)throw Error(In+"NaN");return r.s?(Lt=!1,t=Va(r,e,0,1).times(e),Lt=!0,r.minus(t)):_t(new n(r),a)};Te.naturalExponential=Te.exp=function(){return vF(this)};Te.naturalLogarithm=Te.ln=function(){return Hu(this)};Te.negated=Te.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Te.plus=Te.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?pF(t,e):gF(t,(e.s=-e.s,e))};Te.precision=Te.sd=function(e){var t,r,n,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Oo+e);if(t=Jt(a)+1,n=a.d.length-1,r=n*Mt+1,n=a.d[n],n){for(;n%10==0;n/=10)r--;for(n=a.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};Te.squareRoot=Te.sqrt=function(){var e,t,r,n,a,i,s,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(In+"NaN")}for(e=Jt(l),Lt=!1,a=Math.sqrt(+l),a==0||a==1/0?(t=ha(l.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=oc((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(a.toString()),r=c.precision,a=s=r+3;;)if(i=n,n=i.plus(Va(l,i,s+2)).times(.5),ha(i.d).slice(0,s)===(t=ha(n.d)).slice(0,s)){if(t=t.slice(s-3,s+1),a==s&&t=="4999"){if(_t(i,r+1,0),i.times(i).eq(l)){n=i;break}}else if(t!="9999")break;s+=4}return Lt=!0,_t(n,r)};Te.times=Te.mul=function(e){var t,r,n,a,i,s,l,c,u,d=this,f=d.constructor,m=d.d,p=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,r=d.e+e.e,c=m.length,u=p.length,c<u&&(i=m,m=p,p=i,s=c,c=u,u=s),i=[],s=c+u,n=s;n--;)i.push(0);for(n=u;--n>=0;){for(t=0,a=c+n;a>n;)l=i[a]+p[n]*m[a-n-1]+t,i[a--]=l%lr|0,t=l/lr|0;i[a]=(i[a]+t)%lr|0}for(;!i[--s];)i.pop();return t?++r:i.shift(),e.d=i,e.e=r,Lt?_t(e,f.precision):e};Te.toDecimalPlaces=Te.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Na(e,0,ic),t===void 0?t=n.rounding:Na(t,0,8),_t(r,e+Jt(r)+1,t))};Te.toExponential=function(e,t){var r,n=this,a=n.constructor;return e===void 0?r=Wo(n,!0):(Na(e,0,ic),t===void 0?t=a.rounding:Na(t,0,8),n=_t(new a(n),e+1,t),r=Wo(n,!0,e+1)),r};Te.toFixed=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?Wo(a):(Na(e,0,ic),t===void 0?t=i.rounding:Na(t,0,8),n=_t(new i(a),e+Jt(a)+1,t),r=Wo(n.abs(),!1,e+Jt(n)+1),a.isneg()&&!a.isZero()?"-"+r:r)};Te.toInteger=Te.toint=function(){var e=this,t=e.constructor;return _t(new t(e),Jt(e)+1,t.rounding)};Te.toNumber=function(){return+this};Te.toPower=Te.pow=function(e){var t,r,n,a,i,s,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(on);if(l=new c(l),!l.s){if(e.s<1)throw Error(In+"Infinity");return l}if(l.eq(on))return l;if(n=c.precision,e.eq(on))return _t(l,n);if(t=e.e,r=e.d.length-1,s=t>=r,i=l.s,s){if((r=d<0?-d:d)<=hF){for(a=new c(on),t=Math.ceil(n/Mt+4),Lt=!1;r%2&&(a=a.times(l),xC(a.d,t)),r=oc(r/2),r!==0;)l=l.times(l),xC(l.d,t);return Lt=!0,e.s<0?new c(on).div(a):_t(a,n)}}else if(i<0)throw Error(In+"NaN");return i=i<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,Lt=!1,a=e.times(Hu(l,n+u)),Lt=!0,a=vF(a),a.s=i,a};Te.toPrecision=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?(r=Jt(a),n=Wo(a,r<=i.toExpNeg||r>=i.toExpPos)):(Na(e,1,ic),t===void 0?t=i.rounding:Na(t,0,8),a=_t(new i(a),e,t),r=Jt(a),n=Wo(a,e<=r||r<=i.toExpNeg,e)),n};Te.toSignificantDigits=Te.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Na(e,1,ic),t===void 0?t=n.rounding:Na(t,0,8)),_t(new n(r),e,t)};Te.toString=Te.valueOf=Te.val=Te.toJSON=Te[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Jt(e),r=e.constructor;return Wo(e,t<=r.toExpNeg||t>=r.toExpPos)};function pF(e,t){var r,n,a,i,s,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),Lt?_t(t,f):t;if(c=e.d,u=t.d,s=e.e,a=t.e,c=c.slice(),i=s-a,i){for(i<0?(n=c,i=-i,l=u.length):(n=u,a=s,l=c.length),s=Math.ceil(f/Mt),l=s>l?s+1:l+1,i>l&&(i=l,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(l=c.length,i=u.length,l-i<0&&(i=l,n=u,u=c,c=n),r=0;i;)r=(c[--i]=c[i]+u[i]+r)/lr|0,c[i]%=lr;for(r&&(c.unshift(r),++a),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=a,Lt?_t(t,f):t}function Na(e,t,r){if(e!==~~e||e<t||e>r)throw Error(Oo+e)}function ha(e){var t,r,n,a=e.length-1,i="",s=e[0];if(a>0){for(i+=s,t=1;t<a;t++)n=e[t]+"",r=Mt-n.length,r&&(i+=vi(r)),i+=n;s=e[t],n=s+"",r=Mt-n.length,r&&(i+=vi(r))}else if(s===0)return"0";for(;s%10===0;)s/=10;return i+s}var Va=function(){function e(n,a){var i,s=0,l=n.length;for(n=n.slice();l--;)i=n[l]*a+s,n[l]=i%lr|0,s=i/lr|0;return s&&n.unshift(s),n}function t(n,a,i,s){var l,c;if(i!=s)c=i>s?1:-1;else for(l=c=0;l<i;l++)if(n[l]!=a[l]){c=n[l]>a[l]?1:-1;break}return c}function r(n,a,i){for(var s=0;i--;)n[i]-=s,s=n[i]<a[i]?1:0,n[i]=s*lr+n[i]-a[i];for(;!n[0]&&n.length>1;)n.shift()}return function(n,a,i,s){var l,c,u,d,f,m,p,y,v,g,x,b,j,w,S,_,N,E,O=n.constructor,P=n.s==a.s?1:-1,C=n.d,A=a.d;if(!n.s)return new O(n);if(!a.s)throw Error(In+"Division by zero");for(c=n.e-a.e,N=A.length,S=C.length,p=new O(P),y=p.d=[],u=0;A[u]==(C[u]||0);)++u;if(A[u]>(C[u]||0)&&--c,i==null?b=i=O.precision:s?b=i+(Jt(n)-Jt(a))+1:b=i,b<0)return new O(0);if(b=b/Mt+2|0,u=0,N==1)for(d=0,A=A[0],b++;(u<S||d)&&b--;u++)j=d*lr+(C[u]||0),y[u]=j/A|0,d=j%A|0;else{for(d=lr/(A[0]+1)|0,d>1&&(A=e(A,d),C=e(C,d),N=A.length,S=C.length),w=N,v=C.slice(0,N),g=v.length;g<N;)v[g++]=0;E=A.slice(),E.unshift(0),_=A[0],A[1]>=lr/2&&++_;do d=0,l=t(A,v,N,g),l<0?(x=v[0],N!=g&&(x=x*lr+(v[1]||0)),d=x/_|0,d>1?(d>=lr&&(d=lr-1),f=e(A,d),m=f.length,g=v.length,l=t(f,v,m,g),l==1&&(d--,r(f,N<m?E:A,m))):(d==0&&(l=d=1),f=A.slice()),m=f.length,m<g&&f.unshift(0),r(v,f,g),l==-1&&(g=v.length,l=t(A,v,N,g),l<1&&(d++,r(v,N<g?E:A,g))),g=v.length):l===0&&(d++,v=[0]),y[u++]=d,l&&v[0]?v[g++]=C[w]||0:(v=[C[w]],g=1);while((w++<S||v[0]!==void 0)&&b--)}return y[0]||y.shift(),p.e=c,_t(p,s?i+Jt(p)+1:i)}}();function vF(e,t){var r,n,a,i,s,l,c=0,u=0,d=e.constructor,f=d.precision;if(Jt(e)>16)throw Error(n1+Jt(e));if(!e.s)return new d(on);for(t==null?(Lt=!1,l=f):l=t,s=new d(.03125);e.abs().gte(.1);)e=e.times(s),u+=5;for(n=Math.log(co(2,u))/Math.LN10*2+5|0,l+=n,r=a=i=new d(on),d.precision=l;;){if(a=_t(a.times(e),l),r=r.times(++c),s=i.plus(Va(a,r,l)),ha(s.d).slice(0,l)===ha(i.d).slice(0,l)){for(;u--;)i=_t(i.times(i),l);return d.precision=f,t==null?(Lt=!0,_t(i,f)):i}i=s}}function Jt(e){for(var t=e.e*Mt,r=e.d[0];r>=10;r/=10)t++;return t}function cy(e,t,r){if(t>e.LN10.sd())throw Lt=!0,r&&(e.precision=r),Error(In+"LN10 precision limit exceeded");return _t(new e(e.LN10),t)}function vi(e){for(var t="";e--;)t+="0";return t}function Hu(e,t){var r,n,a,i,s,l,c,u,d,f=1,m=10,p=e,y=p.d,v=p.constructor,g=v.precision;if(p.s<1)throw Error(In+(p.s?"NaN":"-Infinity"));if(p.eq(on))return new v(0);if(t==null?(Lt=!1,u=g):u=t,p.eq(10))return t==null&&(Lt=!0),cy(v,u);if(u+=m,v.precision=u,r=ha(y),n=r.charAt(0),i=Jt(p),Math.abs(i)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(e),r=ha(p.d),n=r.charAt(0),f++;i=Jt(p),n>1?(p=new v("0."+r),i++):p=new v(n+"."+r.slice(1))}else return c=cy(v,u+2,g).times(i+""),p=Hu(new v(n+"."+r.slice(1)),u-m).plus(c),v.precision=g,t==null?(Lt=!0,_t(p,g)):p;for(l=s=p=Va(p.minus(on),p.plus(on),u),d=_t(p.times(p),u),a=3;;){if(s=_t(s.times(d),u),c=l.plus(Va(s,new v(a),u)),ha(c.d).slice(0,u)===ha(l.d).slice(0,u))return l=l.times(2),i!==0&&(l=l.plus(cy(v,u+2,g).times(i+""))),l=Va(l,new v(f),u),v.precision=g,t==null?(Lt=!0,_t(l,g)):l;l=c,a+=2}}function yC(e,t){var r,n,a;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(n,a),t){if(a-=n,r=r-n-1,e.e=oc(r/Mt),e.d=[],n=(r+1)%Mt,r<0&&(n+=Mt),n<a){for(n&&e.d.push(+t.slice(0,n)),a-=Mt;n<a;)e.d.push(+t.slice(n,n+=Mt));t=t.slice(n),n=Mt-t.length}else n-=a;for(;n--;)t+="0";if(e.d.push(+t),Lt&&(e.e>sh||e.e<-sh))throw Error(n1+r)}else e.s=0,e.e=0,e.d=[0];return e}function _t(e,t,r){var n,a,i,s,l,c,u,d,f=e.d;for(s=1,i=f[0];i>=10;i/=10)s++;if(n=t-s,n<0)n+=Mt,a=t,u=f[d=0];else{if(d=Math.ceil((n+1)/Mt),i=f.length,d>=i)return e;for(u=i=f[d],s=1;i>=10;i/=10)s++;n%=Mt,a=n-Mt+s}if(r!==void 0&&(i=co(10,s-a-1),l=u/i%10|0,c=t<0||f[d+1]!==void 0||u%i,c=r<4?(l||c)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?a>0?u/co(10,s-a):0:f[d-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(i=Jt(e),f.length=1,t=t-i-1,f[0]=co(10,(Mt-t%Mt)%Mt),e.e=oc(-t/Mt)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=d,i=1,d--):(f.length=d+1,i=co(10,Mt-n),f[d]=a>0?(u/co(10,s-a)%co(10,a)|0)*i:0),c)for(;;)if(d==0){(f[0]+=i)==lr&&(f[0]=1,++e.e);break}else{if(f[d]+=i,f[d]!=lr)break;f[d--]=0,i=1}for(n=f.length;f[--n]===0;)f.pop();if(Lt&&(e.e>sh||e.e<-sh))throw Error(n1+Jt(e));return e}function gF(e,t){var r,n,a,i,s,l,c,u,d,f,m=e.constructor,p=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),Lt?_t(t,p):t;if(c=e.d,f=t.d,n=t.e,u=e.e,c=c.slice(),s=u-n,s){for(d=s<0,d?(r=c,s=-s,l=f.length):(r=f,n=u,l=c.length),a=Math.max(Math.ceil(p/Mt),l)+2,s>a&&(s=a,r.length=1),r.reverse(),a=s;a--;)r.push(0);r.reverse()}else{for(a=c.length,l=f.length,d=a<l,d&&(l=a),a=0;a<l;a++)if(c[a]!=f[a]){d=c[a]<f[a];break}s=0}for(d&&(r=c,c=f,f=r,t.s=-t.s),l=c.length,a=f.length-l;a>0;--a)c[l++]=0;for(a=f.length;a>s;){if(c[--a]<f[a]){for(i=a;i&&c[--i]===0;)c[i]=lr-1;--c[i],c[a]+=lr}c[a]-=f[a]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(t.d=c,t.e=n,Lt?_t(t,p):t):new m(0)}function Wo(e,t,r){var n,a=Jt(e),i=ha(e.d),s=i.length;return t?(r&&(n=r-s)>0?i=i.charAt(0)+"."+i.slice(1)+vi(n):s>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+vi(-a-1)+i,r&&(n=r-s)>0&&(i+=vi(n))):a>=s?(i+=vi(a+1-s),r&&(n=r-a-1)>0&&(i=i+"."+vi(n))):((n=a+1)<s&&(i=i.slice(0,n)+"."+i.slice(n)),r&&(n=r-s)>0&&(a+1===s&&(i+="."),i+=vi(n))),e.s<0?"-"+i:i}function xC(e,t){if(e.length>t)return e.length=t,!0}function yF(e){var t,r,n;function a(i){var s=this;if(!(s instanceof a))return new a(i);if(s.constructor=a,i instanceof a){s.s=i.s,s.e=i.e,s.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(Oo+i);if(i>0)s.s=1;else if(i<0)i=-i,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(i===~~i&&i<1e7){s.e=0,s.d=[i];return}return yC(s,i.toString())}else if(typeof i!="string")throw Error(Oo+i);if(i.charCodeAt(0)===45?(i=i.slice(1),s.s=-1):s.s=1,qbe.test(i))yC(s,i);else throw Error(Oo+i)}if(a.prototype=Te,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=yF,a.config=a.set=Ube,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return a.config(e),a}function Ube(e){if(!e||typeof e!="object")throw Error(In+"Object expected");var t,r,n,a=["precision",1,ic,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if((n=e[r=a[t]])!==void 0)if(oc(n)===n&&n>=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(Oo+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(Oo+r+": "+n);return this}var a1=yF(zbe);on=new a1(1);const yt=a1;function Wbe(e){return Kbe(e)||Hbe(e)||Gbe(e)||Vbe()}function Vbe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 573In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gbe(e,t){if(e){if(typeof e=="string")return ob(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ob(e,t)}}function Hbe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Kbe(e){if(Array.isArray(e))return ob(e)}function ob(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Ybe=function(t){return t},xF={"@@functional/placeholder":!0},bF=function(t){return t===xF},bC=function(t){return function r(){return arguments.length===0||arguments.length===1&&bF(arguments.length<=0?void 0:arguments[0])?r:t.apply(void 0,arguments)}},Xbe=function e(t,r){return t===1?r:bC(function(){for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];var s=a.filter(function(l){return l!==xF}).length;return s>=t?r.apply(void 0,a):e(t-s,bC(function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var d=a.map(function(f){return bF(f)?c.shift():f});return r.apply(void 0,Wbe(d).concat(c))}))})},Tv=function(t){return Xbe(t.length,t)},sb=function(t,r){for(var n=[],a=t;a<r;++a)n[a-t]=a;return n},Zbe=Tv(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(r){return t[r]}).map(e)}),Qbe=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r.length)return Ybe;var a=r.reverse(),i=a[0],s=a.slice(1);return function(){return s.reduce(function(l,c){return c(l)},i.apply(void 0,arguments))}},lb=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},wF=function(t){var r=null,n=null;return function(){for(var a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return r&&i.every(function(l,c){return l===r[c]})||(r=i,n=t.apply(void 0,i)),n}};function Jbe(e){var t;return e===0?t=1:t=Math.floor(new yt(e).abs().log(10).toNumber())+1,t}function e0e(e,t,r){for(var n=new yt(e),a=0,i=[];n.lt(t)&&a<1e5;)i.push(n.toNumber()),n=n.add(r),a++;return i}var t0e=Tv(function(e,t,r){var n=+e,a=+t;return n+r*(a-n)}),r0e=Tv(function(e,t,r){var n=t-+e;return n=n||1/0,(r-e)/n}),n0e=Tv(function(e,t,r){var n=t-+e;return n=n||1/0,Math.max(0,Math.min(1,(r-e)/n))});const Dv={rangeStep:e0e,getDigitCount:Jbe,interpolateNumber:t0e,uninterpolateNumber:r0e,uninterpolateTruncation:n0e};function cb(e){return o0e(e)||i0e(e)||jF(e)||a0e()}function a0e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 574In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i0e(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function o0e(e){if(Array.isArray(e))return ub(e)}function Ku(e,t){return c0e(e)||l0e(e,t)||jF(e,t)||s0e()}function s0e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 575In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jF(e,t){if(e){if(typeof e=="string")return ub(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ub(e,t)}}function ub(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l0e(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,a=!1,i=void 0;try{for(var s=e[Symbol.iterator](),l;!(n=(l=s.next()).done)&&(r.push(l.value),!(t&&r.length===t));n=!0);}catch(c){a=!0,i=c}finally{try{!n&&s.return!=null&&s.return()}finally{if(a)throw i}}return r}}function c0e(e){if(Array.isArray(e))return e}function SF(e){var t=Ku(e,2),r=t[0],n=t[1],a=r,i=n;return r>n&&(a=n,i=r),[a,i]}function _F(e,t,r){if(e.lte(0))return new yt(0);var n=Dv.getDigitCount(e.toNumber()),a=new yt(10).pow(n),i=e.div(a),s=n!==1?.05:.1,l=new yt(Math.ceil(i.div(s).toNumber())).add(r).mul(s),c=l.mul(a);return t?c:new yt(Math.ceil(c))}function u0e(e,t,r){var n=1,a=new yt(e);if(!a.isint()&&r){var i=Math.abs(e);i<1?(n=new yt(10).pow(Dv.getDigitCount(e)-1),a=new yt(Math.floor(a.div(n).toNumber())).mul(n)):i>1&&(a=new yt(Math.floor(e)))}else e===0?a=new yt(Math.floor((t-1)/2)):r||(a=new yt(Math.floor(e)));var s=Math.floor((t-1)/2),l=Qbe(Zbe(function(c){return a.add(new yt(c-s).mul(n)).toNumber()}),sb);return l(0,t)}function NF(e,t,r,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new yt(0),tickMin:new yt(0),tickMax:new yt(0)};var i=_F(new yt(t).sub(e).div(r-1),n,a),s;e<=0&&t>=0?s=new yt(0):(s=new yt(e).add(t).div(2),s=s.sub(new yt(s).mod(i)));var l=Math.ceil(s.sub(e).div(i).toNumber()),c=Math.ceil(new yt(t).sub(s).div(i).toNumber()),u=l+c+1;return u>r?NF(e,t,r,n,a+1):(u<r&&(c=t>0?c+(r-u):c,l=t>0?l:l+(r-u)),{step:i,tickMin:s.sub(new yt(l).mul(i)),tickMax:s.add(new yt(c).mul(i))})}function d0e(e){var t=Ku(e,2),r=t[0],n=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(a,2),l=SF([r,n]),c=Ku(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(cb(sb(0,a-1).map(function(){return 1/0}))):[].concat(cb(sb(0,a-1).map(function(){return-1/0})),[d]);return r>n?lb(f):f}if(u===d)return u0e(u,a,i);var m=NF(u,d,s,i),p=m.step,y=m.tickMin,v=m.tickMax,g=Dv.rangeStep(y,v.add(new yt(.1).mul(p)),p);return r>n?lb(g):g}function f0e(e,t){var r=Ku(e,2),n=r[0],a=r[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=SF([n,a]),l=Ku(s,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[n,a];if(c===u)return[c];var d=Math.max(t,2),f=_F(new yt(u).sub(c).div(d-1),i,0),m=[].concat(cb(Dv.rangeStep(new yt(c),new yt(u).sub(new yt(.99).mul(f)),f)),[u]);return n>a?lb(m):m}var m0e=wF(d0e),h0e=wF(f0e),p0e=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function hl(e){"@babel/helpers - typeof";return hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hl(e)}function lh(){return lh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},lh.apply(this,arguments)}function v0e(e,t){return b0e(e)||x0e(e,t)||y0e(e,t)||g0e()}function g0e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 576In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y0e(e,t){if(e){if(typeof e=="string")return wC(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wC(e,t)}}function wC(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function x0e(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function b0e(e){if(Array.isArray(e))return e}function w0e(e,t){if(e==null)return{};var r=j0e(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function j0e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function S0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _0e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,OF(n.key),n)}}function N0e(e,t,r){return t&&_0e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function E0e(e,t,r){return t=ch(t),C0e(e,EF()?Reflect.construct(t,r||[],ch(e).constructor):t.apply(e,r))}function C0e(e,t){if(t&&(hl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return O0e(e)}function O0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function EF(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(EF=function(){return!!e})()}function ch(e){return ch=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ch(e)}function P0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&db(e,t)}function db(e,t){return db=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},db(e,t)}function CF(e,t,r){return t=OF(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function OF(e){var t=A0e(e,"string");return hl(t)=="symbol"?t:t+""}function A0e(e,t){if(hl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(hl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Zd=function(e){function t(){return S0e(this,t),E0e(this,t,arguments)}return P0e(t,e),N0e(t,[{key:"render",value:function(){var n=this.props,a=n.offset,i=n.layout,s=n.width,l=n.dataKey,c=n.data,u=n.dataPointFormatter,d=n.xAxis,f=n.yAxis,m=w0e(n,p0e),p=ze(m,!1);this.props.direction==="x"&&d.type!=="number"&&Bi();var y=c.map(function(v){var g=u(v,l),x=g.x,b=g.y,j=g.value,w=g.errorVal;if(!w)return null;var S=[],_,N;if(Array.isArray(w)){var E=v0e(w,2);_=E[0],N=E[1]}else _=N=w;if(i==="vertical"){var O=d.scale,P=b+a,C=P+s,A=P-s,T=O(j-_),k=O(j+N);S.push({x1:k,y1:C,x2:k,y2:A}),S.push({x1:T,y1:P,x2:k,y2:P}),S.push({x1:T,y1:C,x2:T,y2:A})}else if(i==="horizontal"){var D=f.scale,M=x+a,F=M-s,q=M+s,I=D(j-_),K=D(j+N);S.push({x1:F,y1:K,x2:q,y2:K}),S.push({x1:M,y1:I,x2:M,y2:K}),S.push({x1:F,y1:I,x2:q,y2:I})}return $.createElement(ct,lh({className:"recharts-errorBar",key:"bar-".concat(S.map(function(W){return"".concat(W.x1,"-").concat(W.x2,"-").concat(W.y1,"-").concat(W.y2)}))},p),S.map(function(W){return $.createElement("line",lh({},W,{key:"line-".concat(W.x1,"-").concat(W.x2,"-").concat(W.y1,"-").concat(W.y2)}))}))});return $.createElement(ct,{className:"recharts-errorBars"},y)}}])}($.Component);CF(Zd,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});CF(Zd,"displayName","ErrorBar");function Yu(e){"@babel/helpers - typeof";return Yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yu(e)}function jC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function to(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jC(Object(r),!0).forEach(function(n){T0e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jC(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function T0e(e,t,r){return t=D0e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D0e(e){var t=$0e(e,"string");return Yu(t)=="symbol"?t:t+""}function $0e(e,t){if(Yu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Yu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var PF=function(t){var r=t.children,n=t.formattedGraphicalItems,a=t.legendWidth,i=t.legendContent,s=nn(r,Ri);if(!s)return null;var l=Ri.defaultProps,c=l!==void 0?to(to({},l),s.props):{},u;return s.props&&s.props.payload?u=s.props&&s.props.payload:i==="children"?u=(n||[]).reduce(function(d,f){var m=f.item,p=f.props,y=p.sectors||p.data||[];return d.concat(y.map(function(v){return{type:s.props.iconType||m.props.legendType,value:v.name,color:v.fill,payload:v}}))},[]):u=(n||[]).map(function(d){var f=d.item,m=f.type.defaultProps,p=m!==void 0?to(to({},m),f.props):{},y=p.dataKey,v=p.name,g=p.legendType,x=p.hide;return{inactive:x,dataKey:y,type:c.iconType||g||"square",color:i1(f),value:v||y,payload:p}}),to(to(to({},c),Ri.getWithHeight(s,a)),{},{payload:u,item:s})};function Xu(e){"@babel/helpers - typeof";return Xu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xu(e)}function SC(e){return R0e(e)||I0e(e)||M0e(e)||k0e()}function k0e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 577In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function M0e(e,t){if(e){if(typeof e=="string")return fb(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fb(e,t)}}function I0e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function R0e(e){if(Array.isArray(e))return fb(e)}function fb(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ht(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_C(Object(r),!0).forEach(function(n){Ms(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_C(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ms(e,t,r){return t=L0e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L0e(e){var t=F0e(e,"string");return Xu(t)=="symbol"?t:t+""}function F0e(e,t){if(Xu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Xu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ar(e,t,r){return Ye(e)||Ye(t)?r:ir(t)?dn(e,t,r):Ge(t)?t(e):r}function Zc(e,t,r,n){var a=Rbe(e,function(l){return ar(l,t)});if(r==="number"){var i=a.filter(function(l){return he(l)||parseFloat(l)});return i.length?[Av(i),Pv(i)]:[1/0,-1/0]}var s=n?a.filter(function(l){return!Ye(l)}):a;return s.map(function(l){return ir(l)||l instanceof Date?l:""})}var B0e=function(t){var r,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,s=-1,l=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,u=0;u<l;u++){var d=u>0?a[u-1].coordinate:a[l-1].coordinate,f=a[u].coordinate,m=u>=l-1?a[0].coordinate:a[u+1].coordinate,p=void 0;if($r(f-d)!==$r(m-f)){var y=[];if($r(m-f)===$r(c[1]-c[0])){p=m;var v=f+c[1]-c[0];y[0]=Math.min(v,(v+d)/2),y[1]=Math.max(v,(v+d)/2)}else{p=d;var g=m+c[1]-c[0];y[0]=Math.min(f,(g+f)/2),y[1]=Math.max(f,(g+f)/2)}var x=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(t>x[0]&&t<=x[1]||t>=y[0]&&t<=y[1]){s=a[u].index;break}}else{var b=Math.min(d,m),j=Math.max(d,m);if(t>(b+f)/2&&t<=(j+f)/2){s=a[u].index;break}}}else for(var w=0;w<l;w++)if(w===0&&t<=(n[w].coordinate+n[w+1].coordinate)/2||w>0&&w<l-1&&t>(n[w].coordinate+n[w-1].coordinate)/2&&t<=(n[w].coordinate+n[w+1].coordinate)/2||w===l-1&&t>(n[w].coordinate+n[w-1].coordinate)/2){s=n[w].index;break}return s},i1=function(t){var r,n=t,a=n.type.displayName,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Ht(Ht({},t.type.defaultProps),t.props):t.props,s=i.stroke,l=i.fill,c;switch(a){case"Line":c=s;break;case"Area":case"Radar":c=s&&s!=="none"?s:l;break;default:c=l;break}return c},z0e=function(t){var r=t.barSize,n=t.totalSize,a=t.stackGroups,i=a===void 0?{}:a;if(!i)return{};for(var s={},l=Object.keys(i),c=0,u=l.length;c<u;c++)for(var d=i[l[c]].stackGroups,f=Object.keys(d),m=0,p=f.length;m<p;m++){var y=d[f[m]],v=y.items,g=y.cateAxisId,x=v.filter(function(N){return Wa(N.type).indexOf("Bar")>=0});if(x&&x.length){var b=x[0].type.defaultProps,j=b!==void 0?Ht(Ht({},b),x[0].props):x[0].props,w=j.barSize,S=j[g];s[S]||(s[S]=[]);var _=Ye(w)?r:w;s[S].push({item:x[0],stackList:x.slice(1),barSize:Ye(_)?void 0:kr(_,n,0)})}}return s},q0e=function(t){var r=t.barGap,n=t.barCategoryGap,a=t.bandSize,i=t.sizeList,s=i===void 0?[]:i,l=t.maxBarSize,c=s.length;if(c<1)return null;var u=kr(r,a,0,!0),d,f=[];if(s[0].barSize===+s[0].barSize){var m=!1,p=a/c,y=s.reduce(function(w,S){return w+S.barSize||0},0);y+=(c-1)*u,y>=a&&(y-=(c-1)*u,u=0),y>=a&&p>0&&(m=!0,p*=.9,y=c*p);var v=(a-y)/2>>0,g={offset:v-u,size:0};d=s.reduce(function(w,S){var _={item:S.item,position:{offset:g.offset+g.size+u,size:m?p:S.barSize}},N=[].concat(SC(w),[_]);return g=N[N.length-1].position,S.stackList&&S.stackList.length&&S.stackList.forEach(function(E){N.push({item:E,position:g})}),N},f)}else{var x=kr(n,a,0,!0);a-2*x-(c-1)*u<=0&&(u=0);var b=(a-2*x-(c-1)*u)/c;b>1&&(b>>=0);var j=l===+l?Math.min(b,l):b;d=s.reduce(function(w,S,_){var N=[].concat(SC(w),[{item:S.item,position:{offset:x+(b+u)*_+(b-j)/2,size:j}}]);return S.stackList&&S.stackList.length&&S.stackList.forEach(function(E){N.push({item:E,position:N[N.length-1].position})}),N},f)}return d},U0e=function(t,r,n,a){var i=n.children,s=n.width,l=n.margin,c=s-(l.left||0)-(l.right||0),u=PF({children:i,legendWidth:c});if(u){var d=a||{},f=d.width,m=d.height,p=u.align,y=u.verticalAlign,v=u.layout;if((v==="vertical"||v==="horizontal"&&y==="middle")&&p!=="center"&&he(t[p]))return Ht(Ht({},t),{},Ms({},p,t[p]+(f||0)));if((v==="horizontal"||v==="vertical"&&p==="center")&&y!=="middle"&&he(t[y]))return Ht(Ht({},t),{},Ms({},y,t[y]+(m||0)))}return t},W0e=function(t,r,n){return Ye(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},AF=function(t,r,n,a,i){var s=r.props.children,l=fn(s,Zd).filter(function(u){return W0e(a,i,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return t.reduce(function(u,d){var f=ar(d,n);if(Ye(f))return u;var m=Array.isArray(f)?[Av(f),Pv(f)]:[f,f],p=c.reduce(function(y,v){var g=ar(d,v,0),x=m[0]-Math.abs(Array.isArray(g)?g[0]:g),b=m[1]+Math.abs(Array.isArray(g)?g[1]:g);return[Math.min(x,y[0]),Math.max(b,y[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},V0e=function(t,r,n,a,i){var s=r.map(function(l){return AF(t,l,n,i,a)}).filter(function(l){return!Ye(l)});return s&&s.length?s.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},TF=function(t,r,n,a,i){var s=r.map(function(c){var u=c.props.dataKey;return n==="number"&&u&&AF(t,c,u,a)||Zc(t,u,n,i)});if(n==="number")return s.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return s.reduce(function(c,u){for(var d=0,f=u.length;d<f;d++)l[u[d]]||(l[u[d]]=!0,c.push(u[d]));return c},[])},DF=function(t,r){return t==="horizontal"&&r==="xAxis"||t==="vertical"&&r==="yAxis"||t==="centric"&&r==="angleAxis"||t==="radial"&&r==="radiusAxis"},$F=function(t,r,n,a){if(a)return t.map(function(c){return c.coordinate});var i,s,l=t.map(function(c){return c.coordinate===r&&(i=!0),c.coordinate===n&&(s=!0),c.coordinate});return i||l.push(r),s||l.push(n),l},qa=function(t,r,n){if(!t)return null;var a=t.scale,i=t.duplicateDomain,s=t.type,l=t.range,c=t.realScaleType==="scaleBand"?a.bandwidth()/2:2,u=(r||n)&&s==="category"&&a.bandwidth?a.bandwidth()/c:0;if(u=t.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?$r(l[0]-l[1])*2*u:u,r&&(t.ticks||t.niceTicks)){var d=(t.ticks||t.niceTicks).map(function(f){var m=i?i.indexOf(f):f;return{coordinate:a(m)+u,value:f,offset:u}});return d.filter(function(f){return!Wd(f.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(f,m){return{coordinate:a(f)+u,value:f,index:m,offset:u}}):a.ticks&&!n?a.ticks(t.tickCount).map(function(f){return{coordinate:a(f)+u,value:f,offset:u}}):a.domain().map(function(f,m){return{coordinate:a(f)+u,value:i?i[f]:f,index:m,offset:u}})},uy=new WeakMap,Af=function(t,r){if(typeof r!="function")return t;uy.has(t)||uy.set(t,new WeakMap);var n=uy.get(t);if(n.has(r))return n.get(r);var a=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,a),a},kF=function(t,r,n){var a=t.scale,i=t.type,s=t.layout,l=t.axisType;if(a==="auto")return s==="radial"&&l==="radiusAxis"?{scale:qu(),realScaleType:"band"}:s==="radial"&&l==="angleAxis"?{scale:nh(),realScaleType:"linear"}:i==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:Xc(),realScaleType:"point"}:i==="category"?{scale:qu(),realScaleType:"band"}:{scale:nh(),realScaleType:"linear"};if(Ud(a)){var c="scale".concat(hv(a));return{scale:(gC[c]||Xc)(),realScaleType:gC[c]?c:"point"}}return Ge(a)?{scale:a}:{scale:Xc(),realScaleType:"point"}},NC=1e-4,MF=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,a=t.range(),i=Math.min(a[0],a[1])-NC,s=Math.max(a[0],a[1])+NC,l=t(r[0]),c=t(r[n-1]);(l<i||l>s||c<i||c>s)&&t.domain([r[0],r[n-1]])}},G0e=function(t,r){if(!t)return null;for(var n=0,a=t.length;n<a;n++)if(t[n].item===r)return t[n].position;return null},H0e=function(t,r){if(!r||r.length!==2||!he(r[0])||!he(r[1]))return t;var n=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]),i=[t[0],t[1]];return(!he(t[0])||t[0]<n)&&(i[0]=n),(!he(t[1])||t[1]>a)&&(i[1]=a),i[0]>a&&(i[0]=a),i[1]<n&&(i[1]=n),i},K0e=function(t){var r=t.length;if(!(r<=0))for(var n=0,a=t[0].length;n<a;++n)for(var i=0,s=0,l=0;l<r;++l){var c=Wd(t[l][n][1])?t[l][n][0]:t[l][n][1];c>=0?(t[l][n][0]=i,t[l][n][1]=i+c,i=t[l][n][1]):(t[l][n][0]=s,t[l][n][1]=s+c,s=t[l][n][1])}},Y0e=function(t){var r=t.length;if(!(r<=0))for(var n=0,a=t[0].length;n<a;++n)for(var i=0,s=0;s<r;++s){var l=Wd(t[s][n][1])?t[s][n][0]:t[s][n][1];l>=0?(t[s][n][0]=i,t[s][n][1]=i+l,i=t[s][n][1]):(t[s][n][0]=0,t[s][n][1]=0)}},X0e={sign:K0e,expand:vle,none:ol,silhouette:gle,wiggle:yle,positive:Y0e},Z0e=function(t,r,n){var a=r.map(function(l){return l.props.dataKey}),i=X0e[n],s=ple().keys(a).value(function(l,c){return+ar(l,c,0)}).order(Rx).offset(i);return s(t)},Q0e=function(t,r,n,a,i,s){if(!t)return null;var l=s?r.reverse():r,c={},u=l.reduce(function(f,m){var p,y=(p=m.type)!==null&&p!==void 0&&p.defaultProps?Ht(Ht({},m.type.defaultProps),m.props):m.props,v=y.stackId,g=y.hide;if(g)return f;var x=y[n],b=f[x]||{hasStack:!1,stackGroups:{}};if(ir(v)){var j=b.stackGroups[v]||{numericAxisId:n,cateAxisId:a,items:[]};j.items.push(m),b.hasStack=!0,b.stackGroups[v]=j}else b.stackGroups[ec("_stackId_")]={numericAxisId:n,cateAxisId:a,items:[m]};return Ht(Ht({},f),{},Ms({},x,b))},c),d={};return Object.keys(u).reduce(function(f,m){var p=u[m];if(p.hasStack){var y={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(v,g){var x=p.stackGroups[g];return Ht(Ht({},v),{},Ms({},g,{numericAxisId:n,cateAxisId:a,items:x.items,stackedData:Z0e(t,x.items,i)}))},y)}return Ht(Ht({},f),{},Ms({},m,p))},d)},IF=function(t,r){var n=r.realScaleType,a=r.type,i=r.tickCount,s=r.originalDomain,l=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&a==="number"&&s&&(s[0]==="auto"||s[1]==="auto")){var u=t.domain();if(!u.length)return null;var d=m0e(u,i,l);return t.domain([Av(d),Pv(d)]),{niceTicks:d}}if(i&&a==="number"){var f=t.domain(),m=h0e(f,i,l);return{niceTicks:m}}return null};function EC(e){var t=e.axis,r=e.ticks,n=e.bandSize,a=e.entry,i=e.index,s=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Ye(a[t.dataKey])){var l=Im(r,"value",a[t.dataKey]);if(l)return l.coordinate+n/2}return r[i]?r[i].coordinate+n/2:null}var c=ar(a,Ye(s)?t.dataKey:s);return Ye(c)?null:t.scale(c)}var CC=function(t){var r=t.axis,n=t.ticks,a=t.offset,i=t.bandSize,s=t.entry,l=t.index;if(r.type==="category")return n[l]?n[l].coordinate+a:null;var c=ar(s,r.dataKey,r.domain[l]);return Ye(c)?null:r.scale(c)-i/2+a},J0e=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var a=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return a<=0&&i>=0?0:i<0?i:a}return n[0]},ewe=function(t,r){var n,a=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Ht(Ht({},t.type.defaultProps),t.props):t.props,i=a.stackId;if(ir(i)){var s=r[i];if(s){var l=s.items.indexOf(t);return l>=0?s.stackedData[l]:null}}return null},twe=function(t){return t.reduce(function(r,n){return[Av(n.concat([r[0]]).filter(he)),Pv(n.concat([r[1]]).filter(he))]},[1/0,-1/0])},RF=function(t,r,n){return Object.keys(t).reduce(function(a,i){var s=t[i],l=s.stackedData,c=l.reduce(function(u,d){var f=twe(d.slice(r,n+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(c[0],a[0]),Math.max(c[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},OC=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,PC=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,mb=function(t,r,n){if(Ge(t))return t(r,n);if(!Array.isArray(t))return r;var a=[];if(he(t[0]))a[0]=n?t[0]:Math.min(t[0],r[0]);else if(OC.test(t[0])){var i=+OC.exec(t[0])[1];a[0]=r[0]-i}else Ge(t[0])?a[0]=t[0](r[0]):a[0]=r[0];if(he(t[1]))a[1]=n?t[1]:Math.max(t[1],r[1]);else if(PC.test(t[1])){var s=+PC.exec(t[1])[1];a[1]=r[1]+s}else Ge(t[1])?a[1]=t[1](r[1]):a[1]=r[1];return a},uh=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!n||a>0)return a}if(t&&r&&r.length>=2){for(var i=$j(r,function(f){return f.coordinate}),s=1/0,l=1,c=i.length;l<c;l++){var u=i[l],d=i[l-1];s=Math.min((u.coordinate||0)-(d.coordinate||0),s)}return s===1/0?0:s}return n?void 0:0},AC=function(t,r,n){return!t||!t.length||Xd(t,dn(n,"type.defaultProps.domain"))?r:t},LF=function(t,r){var n=t.type.defaultProps?Ht(Ht({},t.type.defaultProps),t.props):t.props,a=n.dataKey,i=n.name,s=n.unit,l=n.formatter,c=n.tooltipType,u=n.chartType,d=n.hide;return Ht(Ht({},ze(t,!1)),{},{dataKey:a,unit:s,formatter:l,name:i||a,color:i1(t),value:ar(r,a),type:c,payload:r,chartType:u,hide:d})};function Zu(e){"@babel/helpers - typeof";return Zu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zu(e)}function TC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ra(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?TC(Object(r),!0).forEach(function(n){FF(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):TC(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function FF(e,t,r){return t=rwe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rwe(e){var t=nwe(e,"string");return Zu(t)=="symbol"?t:t+""}function nwe(e,t){if(Zu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Zu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function awe(e,t){return lwe(e)||swe(e,t)||owe(e,t)||iwe()}function iwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 578In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function owe(e,t){if(e){if(typeof e=="string")return DC(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return DC(e,t)}}function DC(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function swe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function lwe(e){if(Array.isArray(e))return e}var dh=Math.PI/180,cwe=function(t){return t*180/Math.PI},At=function(t,r,n,a){return{x:t+Math.cos(-dh*a)*n,y:r+Math.sin(-dh*a)*n}},BF=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},uwe=function(t,r,n,a,i){var s=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=kr(t.cx,s,s/2),f=kr(t.cy,l,l/2),m=BF(s,l,n),p=kr(t.innerRadius,m,0),y=kr(t.outerRadius,m,m*.8),v=Object.keys(r);return v.reduce(function(g,x){var b=r[x],j=b.domain,w=b.reversed,S;if(Ye(b.range))a==="angleAxis"?S=[c,u]:a==="radiusAxis"&&(S=[p,y]),w&&(S=[S[1],S[0]]);else{S=b.range;var _=S,N=awe(_,2);c=N[0],u=N[1]}var E=kF(b,i),O=E.realScaleType,P=E.scale;P.domain(j).range(S),MF(P);var C=IF(P,Ra(Ra({},b),{},{realScaleType:O})),A=Ra(Ra(Ra({},b),C),{},{range:S,radius:y,realScaleType:O,scale:P,cx:d,cy:f,innerRadius:p,outerRadius:y,startAngle:c,endAngle:u});return Ra(Ra({},g),{},FF({},x,A))},{})},dwe=function(t,r){var n=t.x,a=t.y,i=r.x,s=r.y;return Math.sqrt(Math.pow(n-i,2)+Math.pow(a-s,2))},fwe=function(t,r){var n=t.x,a=t.y,i=r.cx,s=r.cy,l=dwe({x:n,y:a},{x:i,y:s});if(l<=0)return{radius:l};var c=(n-i)/l,u=Math.acos(c);return a>s&&(u=2*Math.PI-u),{radius:l,angle:cwe(u),angleInRadian:u}},mwe=function(t){var r=t.startAngle,n=t.endAngle,a=Math.floor(r/360),i=Math.floor(n/360),s=Math.min(a,i);return{startAngle:r-s*360,endAngle:n-s*360}},hwe=function(t,r){var n=r.startAngle,a=r.endAngle,i=Math.floor(n/360),s=Math.floor(a/360),l=Math.min(i,s);return t+l*360},$C=function(t,r){var n=t.x,a=t.y,i=fwe({x:n,y:a},r),s=i.radius,l=i.angle,c=r.innerRadius,u=r.outerRadius;if(s<c||s>u)return!1;if(s===0)return!0;var d=mwe(r),f=d.startAngle,m=d.endAngle,p=l,y;if(f<=m){for(;p>m;)p-=360;for(;p<f;)p+=360;y=p>=f&&p<=m}else{for(;p>f;)p-=360;for(;p<m;)p+=360;y=p>=m&&p<=f}return y?Ra(Ra({},r),{},{radius:s,angle:hwe(p,r)}):null},zF=function(t){return!h.isValidElement(t)&&!Ge(t)&&typeof t!="boolean"?t.className:""};function Qu(e){"@babel/helpers - typeof";return Qu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qu(e)}var pwe=["offset"];function vwe(e){return bwe(e)||xwe(e)||ywe(e)||gwe()}function gwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 579In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ywe(e,t){if(e){if(typeof e=="string")return hb(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return hb(e,t)}}function xwe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function bwe(e){if(Array.isArray(e))return hb(e)}function hb(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function wwe(e,t){if(e==null)return{};var r=jwe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function jwe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function kC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function tr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?kC(Object(r),!0).forEach(function(n){Swe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kC(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Swe(e,t,r){return t=_we(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _we(e){var t=Nwe(e,"string");return Qu(t)=="symbol"?t:t+""}function Nwe(e,t){if(Qu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Qu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ju(){return Ju=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ju.apply(this,arguments)}var Ewe=function(t){var r=t.value,n=t.formatter,a=Ye(t.children)?r:t.children;return Ge(n)?n(a):a},Cwe=function(t,r){var n=$r(r-t),a=Math.min(Math.abs(r-t),360);return n*a},Owe=function(t,r,n){var a=t.position,i=t.viewBox,s=t.offset,l=t.className,c=i,u=c.cx,d=c.cy,f=c.innerRadius,m=c.outerRadius,p=c.startAngle,y=c.endAngle,v=c.clockWise,g=(f+m)/2,x=Cwe(p,y),b=x>=0?1:-1,j,w;a==="insideStart"?(j=p+b*s,w=v):a==="insideEnd"?(j=y-b*s,w=!v):a==="end"&&(j=y+b*s,w=v),w=x<=0?w:!w;var S=At(u,d,g,j),_=At(u,d,g,j+(w?1:-1)*359),N="M".concat(S.x,",").concat(S.y,` 580 A`).concat(g,",").concat(g,",0,1,").concat(w?0:1,`, 581 `).concat(_.x,",").concat(_.y),E=Ye(t.id)?ec("recharts-radial-line-"):t.id;return $.createElement("text",Ju({},n,{dominantBaseline:"central",className:Qe("recharts-radial-bar-label",l)}),$.createElement("defs",null,$.createElement("path",{id:E,d:N})),$.createElement("textPath",{xlinkHref:"#".concat(E)},r))},Pwe=function(t){var r=t.viewBox,n=t.offset,a=t.position,i=r,s=i.cx,l=i.cy,c=i.innerRadius,u=i.outerRadius,d=i.startAngle,f=i.endAngle,m=(d+f)/2;if(a==="outside"){var p=At(s,l,u+n,m),y=p.x,v=p.y;return{x:y,y:v,textAnchor:y>=s?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"end"};var g=(c+u)/2,x=At(s,l,g,m),b=x.x,j=x.y;return{x:b,y:j,textAnchor:"middle",verticalAnchor:"middle"}},Awe=function(t){var r=t.viewBox,n=t.parentViewBox,a=t.offset,i=t.position,s=r,l=s.x,c=s.y,u=s.width,d=s.height,f=d>=0?1:-1,m=f*a,p=f>0?"end":"start",y=f>0?"start":"end",v=u>=0?1:-1,g=v*a,x=v>0?"end":"start",b=v>0?"start":"end";if(i==="top"){var j={x:l+u/2,y:c-f*a,textAnchor:"middle",verticalAnchor:p};return tr(tr({},j),n?{height:Math.max(c-n.y,0),width:u}:{})}if(i==="bottom"){var w={x:l+u/2,y:c+d+m,textAnchor:"middle",verticalAnchor:y};return tr(tr({},w),n?{height:Math.max(n.y+n.height-(c+d),0),width:u}:{})}if(i==="left"){var S={x:l-g,y:c+d/2,textAnchor:x,verticalAnchor:"middle"};return tr(tr({},S),n?{width:Math.max(S.x-n.x,0),height:d}:{})}if(i==="right"){var _={x:l+u+g,y:c+d/2,textAnchor:b,verticalAnchor:"middle"};return tr(tr({},_),n?{width:Math.max(n.x+n.width-_.x,0),height:d}:{})}var N=n?{width:u,height:d}:{};return i==="insideLeft"?tr({x:l+g,y:c+d/2,textAnchor:b,verticalAnchor:"middle"},N):i==="insideRight"?tr({x:l+u-g,y:c+d/2,textAnchor:x,verticalAnchor:"middle"},N):i==="insideTop"?tr({x:l+u/2,y:c+m,textAnchor:"middle",verticalAnchor:y},N):i==="insideBottom"?tr({x:l+u/2,y:c+d-m,textAnchor:"middle",verticalAnchor:p},N):i==="insideTopLeft"?tr({x:l+g,y:c+m,textAnchor:b,verticalAnchor:y},N):i==="insideTopRight"?tr({x:l+u-g,y:c+m,textAnchor:x,verticalAnchor:y},N):i==="insideBottomLeft"?tr({x:l+g,y:c+d-m,textAnchor:b,verticalAnchor:p},N):i==="insideBottomRight"?tr({x:l+u-g,y:c+d-m,textAnchor:x,verticalAnchor:p},N):Xl(i)&&(he(i.x)||ho(i.x))&&(he(i.y)||ho(i.y))?tr({x:l+kr(i.x,u),y:c+kr(i.y,d),textAnchor:"end",verticalAnchor:"end"},N):tr({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},N)},Twe=function(t){return"cx"in t&&he(t.cx)};function cr(e){var t=e.offset,r=t===void 0?5:t,n=wwe(e,pwe),a=tr({offset:r},n),i=a.viewBox,s=a.position,l=a.value,c=a.children,u=a.content,d=a.className,f=d===void 0?"":d,m=a.textBreakAll;if(!i||Ye(l)&&Ye(c)&&!h.isValidElement(u)&&!Ge(u))return null;if(h.isValidElement(u))return h.cloneElement(u,a);var p;if(Ge(u)){if(p=h.createElement(u,a),h.isValidElement(p))return p}else p=Ewe(a);var y=Twe(i),v=ze(a,!0);if(y&&(s==="insideStart"||s==="insideEnd"||s==="end"))return Owe(a,p,v);var g=y?Pwe(a):Awe(a);return $.createElement(Uo,Ju({className:Qe("recharts-label",f)},v,g,{breakAll:m}),p)}cr.displayName="Label";var qF=function(t){var r=t.cx,n=t.cy,a=t.angle,i=t.startAngle,s=t.endAngle,l=t.r,c=t.radius,u=t.innerRadius,d=t.outerRadius,f=t.x,m=t.y,p=t.top,y=t.left,v=t.width,g=t.height,x=t.clockWise,b=t.labelViewBox;if(b)return b;if(he(v)&&he(g)){if(he(f)&&he(m))return{x:f,y:m,width:v,height:g};if(he(p)&&he(y))return{x:p,y,width:v,height:g}}return he(f)&&he(m)?{x:f,y:m,width:0,height:0}:he(r)&&he(n)?{cx:r,cy:n,startAngle:i||a||0,endAngle:s||a||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:x}:t.viewBox?t.viewBox:{}},Dwe=function(t,r){return t?t===!0?$.createElement(cr,{key:"label-implicit",viewBox:r}):ir(t)?$.createElement(cr,{key:"label-implicit",viewBox:r,value:t}):h.isValidElement(t)?t.type===cr?h.cloneElement(t,{key:"label-implicit",viewBox:r}):$.createElement(cr,{key:"label-implicit",content:t,viewBox:r}):Ge(t)?$.createElement(cr,{key:"label-implicit",content:t,viewBox:r}):Xl(t)?$.createElement(cr,Ju({viewBox:r},t,{key:"label-implicit"})):null:null},$we=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var a=t.children,i=qF(t),s=fn(a,cr).map(function(c,u){return h.cloneElement(c,{viewBox:r||i,key:"label-".concat(u)})});if(!n)return s;var l=Dwe(t.label,r||i);return[l].concat(vwe(s))};cr.parseViewBox=qF;cr.renderCallByParent=$we;function kwe(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Mwe=kwe;const Iwe=pt(Mwe);function ed(e){"@babel/helpers - typeof";return ed=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ed(e)}var Rwe=["valueAccessor"],Lwe=["data","dataKey","clockWise","id","textBreakAll"];function Fwe(e){return Uwe(e)||qwe(e)||zwe(e)||Bwe()}function Bwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 582In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zwe(e,t){if(e){if(typeof e=="string")return pb(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return pb(e,t)}}function qwe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Uwe(e){if(Array.isArray(e))return pb(e)}function pb(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function fh(){return fh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fh.apply(this,arguments)}function MC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function IC(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?MC(Object(r),!0).forEach(function(n){Wwe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MC(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wwe(e,t,r){return t=Vwe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vwe(e){var t=Gwe(e,"string");return ed(t)=="symbol"?t:t+""}function Gwe(e,t){if(ed(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ed(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function RC(e,t){if(e==null)return{};var r=Hwe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Hwe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Kwe=function(t){return Array.isArray(t.value)?Iwe(t.value):t.value};function Ga(e){var t=e.valueAccessor,r=t===void 0?Kwe:t,n=RC(e,Rwe),a=n.data,i=n.dataKey,s=n.clockWise,l=n.id,c=n.textBreakAll,u=RC(n,Lwe);return!a||!a.length?null:$.createElement(ct,{className:"recharts-label-list"},a.map(function(d,f){var m=Ye(i)?r(d,f):ar(d&&d.payload,i),p=Ye(l)?{}:{id:"".concat(l,"-").concat(f)};return $.createElement(cr,fh({},ze(d,!0),u,p,{parentViewBox:d.parentViewBox,value:m,textBreakAll:c,viewBox:cr.parseViewBox(Ye(s)?d:IC(IC({},d),{},{clockWise:s})),key:"label-".concat(f),index:f}))}))}Ga.displayName="LabelList";function Ywe(e,t){return e?e===!0?$.createElement(Ga,{key:"labelList-implicit",data:t}):$.isValidElement(e)||Ge(e)?$.createElement(Ga,{key:"labelList-implicit",data:t,content:e}):Xl(e)?$.createElement(Ga,fh({data:t},e,{key:"labelList-implicit"})):null:null}function Xwe(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,a=fn(n,Ga).map(function(s,l){return h.cloneElement(s,{data:t,key:"labelList-".concat(l)})});if(!r)return a;var i=Ywe(e.label,t);return[i].concat(Fwe(a))}Ga.renderCallByParent=Xwe;function td(e){"@babel/helpers - typeof";return td=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},td(e)}function vb(){return vb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vb.apply(this,arguments)}function LC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function FC(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?LC(Object(r),!0).forEach(function(n){Zwe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LC(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Zwe(e,t,r){return t=Qwe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qwe(e){var t=Jwe(e,"string");return td(t)=="symbol"?t:t+""}function Jwe(e,t){if(td(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(td(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var eje=function(t,r){var n=$r(r-t),a=Math.min(Math.abs(r-t),359.999);return n*a},Tf=function(t){var r=t.cx,n=t.cy,a=t.radius,i=t.angle,s=t.sign,l=t.isExternal,c=t.cornerRadius,u=t.cornerIsExternal,d=c*(l?1:-1)+a,f=Math.asin(c/d)/dh,m=u?i:i+s*f,p=At(r,n,d,m),y=At(r,n,a,m),v=u?i-s*f:i,g=At(r,n,d*Math.cos(f*dh),v);return{center:p,circleTangency:y,lineTangency:g,theta:f}},UF=function(t){var r=t.cx,n=t.cy,a=t.innerRadius,i=t.outerRadius,s=t.startAngle,l=t.endAngle,c=eje(s,l),u=s+c,d=At(r,n,i,s),f=At(r,n,i,u),m="M ".concat(d.x,",").concat(d.y,` 583 A `).concat(i,",").concat(i,`,0, 584 `).concat(+(Math.abs(c)>180),",").concat(+(s>u),`, 585 `).concat(f.x,",").concat(f.y,` 586 `);if(a>0){var p=At(r,n,a,s),y=At(r,n,a,u);m+="L ".concat(y.x,",").concat(y.y,` 587 A `).concat(a,",").concat(a,`,0, 588 `).concat(+(Math.abs(c)>180),",").concat(+(s<=u),`, 589 `).concat(p.x,",").concat(p.y," Z")}else m+="L ".concat(r,",").concat(n," Z");return m},tje=function(t){var r=t.cx,n=t.cy,a=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=$r(d-u),m=Tf({cx:r,cy:n,radius:i,angle:u,sign:f,cornerRadius:s,cornerIsExternal:c}),p=m.circleTangency,y=m.lineTangency,v=m.theta,g=Tf({cx:r,cy:n,radius:i,angle:d,sign:-f,cornerRadius:s,cornerIsExternal:c}),x=g.circleTangency,b=g.lineTangency,j=g.theta,w=c?Math.abs(u-d):Math.abs(u-d)-v-j;if(w<0)return l?"M ".concat(y.x,",").concat(y.y,` 590 a`).concat(s,",").concat(s,",0,0,1,").concat(s*2,`,0 591 a`).concat(s,",").concat(s,",0,0,1,").concat(-s*2,`,0 592 `):UF({cx:r,cy:n,innerRadius:a,outerRadius:i,startAngle:u,endAngle:d});var S="M ".concat(y.x,",").concat(y.y,` 593 A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` 594 A`).concat(i,",").concat(i,",0,").concat(+(w>180),",").concat(+(f<0),",").concat(x.x,",").concat(x.y,` 595 A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(b.x,",").concat(b.y,` 596 `);if(a>0){var _=Tf({cx:r,cy:n,radius:a,angle:u,sign:f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),N=_.circleTangency,E=_.lineTangency,O=_.theta,P=Tf({cx:r,cy:n,radius:a,angle:d,sign:-f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),C=P.circleTangency,A=P.lineTangency,T=P.theta,k=c?Math.abs(u-d):Math.abs(u-d)-O-T;if(k<0&&s===0)return"".concat(S,"L").concat(r,",").concat(n,"Z");S+="L".concat(A.x,",").concat(A.y,` 597 A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(C.x,",").concat(C.y,` 598 A`).concat(a,",").concat(a,",0,").concat(+(k>180),",").concat(+(f>0),",").concat(N.x,",").concat(N.y,` 599 A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(E.x,",").concat(E.y,"Z")}else S+="L".concat(r,",").concat(n,"Z");return S},rje={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},WF=function(t){var r=FC(FC({},rje),t),n=r.cx,a=r.cy,i=r.innerRadius,s=r.outerRadius,l=r.cornerRadius,c=r.forceCornerRadius,u=r.cornerIsExternal,d=r.startAngle,f=r.endAngle,m=r.className;if(s<i||d===f)return null;var p=Qe("recharts-sector",m),y=s-i,v=kr(l,y,0,!0),g;return v>0&&Math.abs(d-f)<360?g=tje({cx:n,cy:a,innerRadius:i,outerRadius:s,cornerRadius:Math.min(v,y/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):g=UF({cx:n,cy:a,innerRadius:i,outerRadius:s,startAngle:d,endAngle:f}),$.createElement("path",vb({},ze(r,!0),{className:p,d:g,role:"img"}))};function rd(e){"@babel/helpers - typeof";return rd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rd(e)}function gb(){return gb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},gb.apply(this,arguments)}function BC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function zC(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?BC(Object(r),!0).forEach(function(n){nje(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):BC(Object(r)).forEac
599h(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function nje(e,t,r){return t=aje(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aje(e){var t=ije(e,"string");return rd(t)=="symbol"?t:t+""}function ije(e,t){if(rd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(rd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var qC={curveBasisClosed:ale,curveBasisOpen:ile,curveBasis:nle,curveBumpX:Use,curveBumpY:Wse,curveLinearClosed:ole,curveLinear:vv,curveMonotoneX:sle,curveMonotoneY:lle,curveNatural:cle,curveStep:ule,curveStepAfter:fle,curveStepBefore:dle},Df=function(t){return t.x===+t.x&&t.y===+t.y},Oc=function(t){return t.x},Pc=function(t){return t.y},oje=function(t,r){if(Ge(t))return t;var n="curve".concat(hv(t));return(n==="curveMonotone"||n==="curveBump")&&r?qC["".concat(n).concat(r==="vertical"?"Y":"X")]:qC[n]||vv},sje=function(t){var r=t.type,n=r===void 0?"linear":r,a=t.points,i=a===void 0?[]:a,s=t.baseLine,l=t.layout,c=t.connectNulls,u=c===void 0?!1:c,d=oje(n,l),f=u?i.filter(function(v){return Df(v)}):i,m;if(Array.isArray(s)){var p=u?s.filter(function(v){return Df(v)}):s,y=f.map(function(v,g){return zC(zC({},v),{},{base:p[g]})});return l==="vertical"?m=jf().y(Pc).x1(Oc).x0(function(v){return v.base.x}):m=jf().x(Oc).y1(Pc).y0(function(v){return v.base.y}),m.defined(Df).curve(d),m(y)}return l==="vertical"&&he(s)?m=jf().y(Pc).x1(Oc).x0(s):he(s)?m=jf().x(Oc).y1(Pc).y0(s):m=LR().x(Oc).y(Pc),m.defined(Df).curve(d),m(f)},mh=function(t){var r=t.className,n=t.points,a=t.path,i=t.pathRef;if((!n||!n.length)&&!a)return null;var s=n&&n.length?sje(t):a;return $.createElement("path",gb({},ze(t,!1),Rm(t),{className:Qe("recharts-curve",r),d:s,ref:i}))},lje=Object.getOwnPropertyNames,cje=Object.getOwnPropertySymbols,uje=Object.prototype.hasOwnProperty;function UC(e,t){return function(n,a,i){return e(n,a,i)&&t(n,a,i)}}function $f(e){return function(r,n,a){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,a);var i=a.cache,s=i.get(r),l=i.get(n);if(s&&l)return s===n&&l===r;i.set(r,n),i.set(n,r);var c=e(r,n,a);return i.delete(r),i.delete(n),c}}function WC(e){return lje(e).concat(cje(e))}var VF=Object.hasOwn||function(e,t){return uje.call(e,t)};function sc(e,t){return e||t?e===t:e===t||e!==e&&t!==t}var GF="_owner",VC=Object.getOwnPropertyDescriptor,GC=Object.keys;function dje(e,t,r){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function fje(e,t){return sc(e.getTime(),t.getTime())}function HC(e,t,r){if(e.size!==t.size)return!1;for(var n={},a=e.entries(),i=0,s,l;(s=a.next())&&!s.done;){for(var c=t.entries(),u=!1,d=0;(l=c.next())&&!l.done;){var f=s.value,m=f[0],p=f[1],y=l.value,v=y[0],g=y[1];!u&&!n[d]&&(u=r.equals(m,v,i,d,e,t,r)&&r.equals(p,g,m,v,e,t,r))&&(n[d]=!0),d++}if(!u)return!1;i++}return!0}function mje(e,t,r){var n=GC(e),a=n.length;if(GC(t).length!==a)return!1;for(var i;a-- >0;)if(i=n[a],i===GF&&(e.$$typeof||t.$$typeof)&&e.$$typeof!==t.$$typeof||!VF(t,i)||!r.equals(e[i],t[i],i,i,e,t,r))return!1;return!0}function Ac(e,t,r){var n=WC(e),a=n.length;if(WC(t).length!==a)return!1;for(var i,s,l;a-- >0;)if(i=n[a],i===GF&&(e.$$typeof||t.$$typeof)&&e.$$typeof!==t.$$typeof||!VF(t,i)||!r.equals(e[i],t[i],i,i,e,t,r)||(s=VC(e,i),l=VC(t,i),(s||l)&&(!s||!l||s.configurable!==l.configurable||s.enumerable!==l.enumerable||s.writable!==l.writable)))return!1;return!0}function hje(e,t){return sc(e.valueOf(),t.valueOf())}function pje(e,t){return e.source===t.source&&e.flags===t.flags}function KC(e,t,r){if(e.size!==t.size)return!1;for(var n={},a=e.values(),i,s;(i=a.next())&&!i.done;){for(var l=t.values(),c=!1,u=0;(s=l.next())&&!s.done;)!c&&!n[u]&&(c=r.equals(i.value,s.value,i.value,s.value,e,t,r))&&(n[u]=!0),u++;if(!c)return!1}return!0}function vje(e,t){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}var gje="[object Arguments]",yje="[object Boolean]",xje="[object Date]",bje="[object Map]",wje="[object Number]",jje="[object Object]",Sje="[object RegExp]",_je="[object Set]",Nje="[object String]",Eje=Array.isArray,YC=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,XC=Object.assign,Cje=Object.prototype.toString.call.bind(Object.prototype.toString);function Oje(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areMapsEqual,a=e.areObjectsEqual,i=e.arePrimitiveWrappersEqual,s=e.areRegExpsEqual,l=e.areSetsEqual,c=e.areTypedArraysEqual;return function(d,f,m){if(d===f)return!0;
599if(d==null||f==null||typeof d!="object"||typeof f!="object")return d!==d&&f!==f;var p=d.constructor;if(p!==f.constructor)return!1;if(p===Object)return a(d,f,m);if(Eje(d))return t(d,f,m);if(YC!=null&&YC(d))return c(d,f,m);if(p===Date)return r(d,f,m);if(p===RegExp)return s(d,f,m);if(p===Map)return n(d,f,m);if(p===Set)return l(d,f,m);var y=Cje(d);return y===xje?r(d,f,m):y===Sje?s(d,f,m):y===bje?n(d,f,m):y===_je?l(d,f,m):y===jje?typeof d.then!="function"&&typeof f.then!="function"&&a(d,f,m):y===gje?a(d,f,m):y===yje||y===wje||y===Nje?i(d,f,m):!1}}function Pje(e){var t=e.circular,r=e.createCustomConfig,n=e.strict,a={areArraysEqual:n?Ac:dje,areDatesEqual:fje,areMapsEqual:n?UC(HC,Ac):HC,areObjectsEqual:n?Ac:mje,arePrimitiveWrappersEqual:hje,areRegExpsEqual:pje,areSetsEqual:n?UC(KC,Ac):KC,areTypedArraysEqual:n?Ac:vje};if(r&&(a=XC({},a,r(a))),t){var i=$f(a.areArraysEqual),s=$f(a.areMapsEqual),l=$f(a.areObjectsEqual),c=$f(a.areSetsEqual);a=XC({},a,{areArraysEqual:i,areMapsEqual:s,areObjectsEqual:l,areSetsEqual:c})}return a}function Aje(e){return function(t,r,n,a,i,s,l){return e(t,r,l)}}function Tje(e){var t=e.circular,r=e.comparator,n=e.createState,a=e.equals,i=e.strict;if(n)return function(c,u){var d=n(),f=d.cache,m=f===void 0?t?new WeakMap:void 0:f,p=d.meta;return r(c,u,{cache:m,equals:a,meta:p,strict:i})};if(t)return function(c,u){return r(c,u,{cache:new WeakMap,equals:a,meta:void 0,strict:i})};var s={cache:void 0,equals:a,meta:void 0,strict:i};return function(c,u){return r(c,u,s)}}var Dje=Ji();Ji({strict:!0});Ji({circular:!0});Ji({circular:!0,strict:!0});Ji({createInternalComparator:function(){return sc}});Ji({strict:!0,createInternalComparator:function(){return sc}});Ji({circular:!0,createInternalComparator:function(){return sc}});Ji({circular:!0,createInternalComparator:function(){return sc},strict:!0});function Ji(e){e===void 0&&(e={});var t=e.circular,r=t===void 0?!1:t,n=e.createInternalComparator,a=e.createState,i=e.strict,s=i===void 0?!1:i,l=Pje(e),c=Oje(l),u=n?n(c):Aje(c);return Tje({circular:r,comparator:c,createState:a,equals:u,strict:s})}function $je(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function ZC(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function a(i){r<0&&(r=i),i-r>t?(e(i),r=-1):$je(a)};requestAnimationFrame(n)}function yb(e){"@babel/helpers - typeof";return yb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yb(e)}function kje(e){return Lje(e)||Rje(e)||Ije(e)||Mje()}function Mje(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 600In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ije(e,t){if(e){if(typeof e=="string")return QC(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return QC(e,t)}}function QC(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Rje(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Lje(e){if(Array.isArray(e))return e}function Fje(){var e={},t=function(){return null},r=!1,n=function a(i){if(!r){if(Array.isArray(i)){if(!i.length)return;var s=i,l=kje(s),c=l[0],u=l.slice(1);if(typeof c=="number"){ZC(a.bind(null,u),c);return}a(c),ZC(a.bind(null,u));return}yb(i)==="object"&&(e=i,t(e)),typeof i=="function"&&i()}};return{stop:function(){r=!0},start:function(i){r=!1,n(i)},subscribe:function(i){return t=i,function(){t=function(){return null}}}}}function nd(e){"@babel/helpers - typeof";return nd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nd(e)}function JC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function eO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};
vendor: 58,816 bytes, lines 600-618
600t%2?JC(Object(r),!0).forEach(function(n){HF(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):JC(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function HF(e,t,r){return t=Bje(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bje(e){var t=zje(e,"string");return nd(t)==="symbol"?t:String(t)}function zje(e,t){if(nd(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(nd(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var qje=function(t,r){return[Object.keys(t),Object.keys(r)].reduce(function(n,a){return n.filter(function(i){return a.includes(i)})})},Uje=function(t){return t},Wje=function(t){return t.replace(/([A-Z])/g,function(r){return"-".concat(r.toLowerCase())})},Qc=function(t,r){return Object.keys(r).reduce(function(n,a){return eO(eO({},n),{},HF({},a,t(a,r[a])))},{})},tO=function(t,r,n){return t.map(function(a){return"".concat(Wje(a)," ").concat(r,"ms ").concat(n)}).join(",")};function Vje(e,t){return Kje(e)||Hje(e,t)||KF(e,t)||Gje()}function Gje(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 601In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hje(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function Kje(e){if(Array.isArray(e))return e}function Yje(e){return Qje(e)||Zje(e)||KF(e)||Xje()}function Xje(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 602In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KF(e,t){if(e){if(typeof e=="string")return xb(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xb(e,t)}}function Zje(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Qje(e){if(Array.isArray(e))return xb(e)}function xb(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var hh=1e-4,YF=function(t,r){return[0,3*t,3*r-6*t,3*t-3*r+1]},XF=function(t,r){return t.map(function(n,a){return n*Math.pow(r,a)}).reduce(function(n,a){return n+a})},rO=function(t,r){return function(n){var a=YF(t,r);return XF(a,n)}},Jje=function(t,r){return function(n){var a=YF(t,r),i=[].concat(Yje(a.map(function(s,l){return s*l}).slice(1)),[0]);return XF(i,n)}},nO=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var a=r[0],i=r[1],s=r[2],l=r[3];if(r.length===1)switch(r[0]){case"linear":a=0,i=0,s=1,l=1;break;case"ease":a=.25,i=.1,s=.25,l=1;break;case"ease-in":a=.42,i=0,s=1,l=1;break;case"ease-out":a=.42,i=0,s=.58,l=1;break;case"ease-in-out":a=0,i=0,s=.58,l=1;break;default:{var c=r[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var u=c[1].split(")")[0].split(",").map(function(g){return parseFloat(g)}),d=Vje(u,4);a=d[0],i=d[1],s=d[2],l=d[3]}}}var f=rO(a,s),m=rO(i,l),p=Jje(a,s),y=function(x){return x>1?1:x<0?0:x},v=function(x){for(var b=x>1?1:x,j=b,w=0;w<8;++w){var S=f(j)-b,_=p(j);if(Math.abs(S-b)<hh||_<hh)return m(j);j=y(j-S/_)}return m(j)};return v.isStepper=!1,v},e1e=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,a=t.damping,i=a===void 0?8:a,s=t.dt,l=s===void 0?17:s,c=function(d,f,m){var p=-(d-f)*n,y=m*i,v=m+(p-y)*l/1e3,g=m*l/1e3+d;return Math.abs(g-f)<hh&&Math.abs(v)<hh?[f,0]:[g,v]};return c.isStepper=!0,c.dt=l,c},t1e=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var a=r[0];if(typeof a=="string")switch(a){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return nO(a);case"spring":return e1e();default:if(a.split("(")[0]==="cubic-bezier")return nO(a)}return typeof a=="function"?a:null};function ad(e){"@babel/helpers - typeof";return ad=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ad(e)}function aO(e){return a1e(e)||n1e(e)||ZF(e)||r1e()}function r1e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 603In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n1e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a1e(e){if(Array.isArray(e))return wb(e)}function iO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function xr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?iO(Object(r),!0).forEach(function(n){bb(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bb(e,t,r){return t=i1e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i1e(e){var t=o1e(e,"string");return ad(t)==="symbol"?t:String(t)}function o1e(e,t){if(ad(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ad(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function s1e(e,t){return u1e(e)||c1e(e,t)||ZF(e,t)||l1e()}function l1e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 604In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZF(e,t){if(e){if(typeof e=="string")return wb(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wb(e,t)}}function wb(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function c1e(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function u1e(e){if(Array.isArray(e))return e}var ph=function(t,r,n){return t+(r-t)*n},jb=function(t){var r=t.from,n=t.to;return r!==n},d1e=function e(t,r,n){var a=Qc(function(i,s){if(jb(s)){var l=t(s.from,s.to,s.velocity),c=s1e(l,2),u=c[0],d=c[1];return xr(xr({},s),{},{from:u,velocity:d})}return s},r);return n<1?Qc(function(i,s){return jb(s)?xr(xr({},s),{},{velocity:ph(s.velocity,a[i].velocity,n),from:ph(s.from,a[i].from,n)}):s},r):e(t,a,n-1)};const f1e=function(e,t,r,n,a){var i=qje(e,t),s=i.reduce(function(g,x){return xr(xr({},g),{},bb({},x,[e[x],t[x]]))},{}),l=i.reduce(function(g,x){return xr(xr({},g),{},bb({},x,{from:e[x],velocity:0,to:t[x]}))},{}),c=-1,u,d,f=function(){return null},m=function(){return Qc(function(x,b){return b.from},l)},p=function(){return!Object.values(l).filter(jb).length},y=function(x){u||(u=x);var b=x-u,j=b/r.dt;l=d1e(r,l,j),a(xr(xr(xr({},e),t),m())),u=x,p()||(c=requestAnimationFrame(f))},v=function(x){d||(d=x);var b=(x-d)/n,j=Qc(function(S,_){return ph.apply(void 0,aO(_).concat([r(b)]))},s);if(a(xr(xr(xr({},e),t),j)),b<1)c=requestAnimationFrame(f);else{var w=Qc(function(S,_){return ph.apply(void 0,aO(_).concat([r(1)]))},s);a(xr(xr(xr({},e),t),w))}};return f=r.isStepper?y:v,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(c)}}};function pl(e){"@babel/helpers - typeof";return pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pl(e)}var m1e=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function h1e(e,t){if(e==null)return{};var r=p1e(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function p1e(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,i;for(i=0;i<n.length;i++)a=n[i],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}function dy(e){return x1e(e)||y1e(e)||g1e(e)||v1e()}function v1e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 605In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g1e(e,t){if(e){if(typeof e=="string")return Sb(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Sb(e,t)}}function y1e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function x1e(e){if(Array.isArray(e))return Sb(e)}function Sb(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function oO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Un(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?oO(Object(r),!0).forEach(function(n){qc(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qc(e,t,r){return t=QF(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b1e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w1e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,QF(n.key),n)}}function j1e(e,t,r){return t&&w1e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function QF(e){var t=S1e(e,"string");return pl(t)==="symbol"?t:String(t)}function S1e(e,t){if(pl(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(pl(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _1e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_b(e,t)}function _b(e,t){return _b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},_b(e,t)}function N1e(e){var t=E1e();return function(){var n=vh(e),a;if(t){var i=vh(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return Nb(this,a)}}function Nb(e,t){if(t&&(pl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Eb(e)}function Eb(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E1e(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function vh(e){return vh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vh(e)}var Ea=function(e){_1e(r,e);var t=N1e(r);function r(n,a){var i;b1e(this,r),i=t.call(this,n,a);var s=i.props,l=s.isActive,c=s.attributeName,u=s.from,d=s.to,f=s.steps,m=s.children,p=s.duration;if(i.handleStyleChange=i.handleStyleChange.bind(Eb(i)),i.changeStyle=i.changeStyle.bind(Eb(i)),!l||p<=0)return i.state={style:{}},typeof m=="function"&&(i.state={style:d}),Nb(i);if(f&&f.length)i.state={style:f[0].style};else if(u){if(typeof m=="function")return i.state={style:u},Nb(i);i.state={style:c?qc({},c,u):u}}else i.state={style:{}};return i}return j1e(r,[{key:"componentDidMount",value:function(){var a=this.props,i=a.isActive,s=a.canBegin;this.mounted=!0,!(!i||!s)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var i=this.props,s=i.isActive,l=i.canBegin,c=i.attributeName,u=i.shouldReAnimate,d=i.to,f=i.from,m=this.state.style;if(l){if(!s){var p={style:c?qc({},c,d):d};this.state&&m&&(c&&m[c]!==d||!c&&m!==d)&&this.setState(p);return}if(!(Dje(a.to,d)&&a.canBegin&&a.isActive)){var y=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var v=y||u?f:a.to;if(this.state&&m){var g={style:c?qc({},c,v):v};(c&&m[c]!==v||!c&&m!==v)&&this.setState(g)}this.runAnimation(Un(Un({},this.props),{},{from:v,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var i=this,s=a.from,l=a.to,c=a.duration,u=a.easing,d=a.begin,f=a.onAnimationEnd,m=a.onAnimationStart,p=f1e(s,l,t1e(u),c,this.changeStyle),y=function(){i.stopJSAnimation=p()};this.manager.start([m,d,y,c,f])}},{key:"runStepAnimation",value:function(a){var i=this,s=a.steps,l=a.begin,c=a.onAnimationStart,u=s[0],d=u.style,f=u.duration,m=f===void 0?0:f,p=function(v,g,x){if(x===0)return v;var b=g.duration,j=g.easing,w=j===void 0?"ease":j,S=g.style,_=g.properties,N=g.onAnimationEnd,E=x>0?s[x-1]:g,O=_||Object.keys(S);if(typeof w=="function"||w==="spring")return[].concat(dy(v),[i.runJSAnimation.bind(i,{from:E.style,to:S,duration:b,easing:w}),b]);var P=tO(O,b,w),C=Un(Un(Un({},E.style),S),{},{transition:P});return[].concat(dy(v),[C,b,N]).filter(Uje)};return this.manager.start([c].concat(dy(s.reduce(p,[d,Math.max(m,l)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=Fje());var i=a.begin,s=a.duration,l=a.attributeName,c=a.to,u=a.easing,d=a.onAnimationStart,f=a.onAnimationEnd,m=a.steps,p=a.children,y=this.manager;if(this.unSubscribe=y.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(a);return}if(m.length>1){this.runStepAnimation(a);return}var v=l?qc({},l,c):c,g=tO(Object.keys(v),s,u);y.start([d,i,Un(Un({},v),{},{transition:g}),s,f])}},{key:"render",value:function(){var a=this.props,i=a.children;a.begin;var s=a.duration;a.attributeName,a.easing;var l=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var c=h1e(a,m1e),u=h.Children.count(i),d=this.state.style;if(typeof i=="function")return i(d);if(!l||u===0||s<=0)return i;var f=function(p){var y=p.props,v=y.style,g=v===void 0?{}:v,x=y.className,b=h.cloneElement(p,Un(Un({},c),{},{style:Un(Un({},g),d),className:x}));return b};return u===1?f(h.Children.only(i)):$.createElement("div",null,h.Children.map(i,function(m){return f(m)}))}}]),r}(h.PureComponent);Ea.displayName="Animate";Ea.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Ea.propTypes={from:tt.oneOfType([tt.object,tt.string]),to:tt.oneOfType([tt.object,tt.string]),attributeName:tt.string,duration:tt.number,begin:tt.number,easing:tt.oneOfType([tt.string,tt.func]),steps:tt.arrayOf(tt.shape({duration:tt.number.isRequired,style:tt.object.isRequired,easing:tt.oneOfType([tt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),tt.func]),properties:tt.arrayOf("string"),onAnimationEnd:tt.func})),children:tt.oneOfType([tt.node,tt.func]),isActive:tt.bool,canBegin:tt.bool,onAnimationEnd:tt.func,shouldReAnimate:tt.bool,onAnimationStart:tt.func,onAnimationReStart:tt.func};tt.object,tt.object,tt.object,tt.element;tt.object,tt.object,tt.object,tt.oneOfType([tt.array,tt.element]),tt.any;function id(e){"@babel/helpers - typeof";return id=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},id(e)}function gh(){return gh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},gh.apply(this,arguments)}function C1e(e,t){return T1e(e)||A1e(e,t)||P1e(e,t)||O1e()}function O1e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 606In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P1e(e,t){if(e){if(typeof e=="string")return sO(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return sO(e,t)}}function sO(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function A1e(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function T1e(e){if(Array.isArray(e))return e}function lO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function cO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lO(Object(r),!0).forEach(function(n){D1e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function D1e(e,t,r){return t=$1e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $1e(e){var t=k1e(e,"string");return id(t)=="symbol"?t:t+""}function k1e(e,t){if(id(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(id(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var uO=function(t,r,n,a,i){var s=Math.min(Math.abs(n)/2,Math.abs(a)/2),l=a>=0?1:-1,c=n>=0?1:-1,u=a>=0&&n>=0||a<0&&n<0?1:0,d;if(s>0&&i instanceof Array){for(var f=[0,0,0,0],m=0,p=4;m<p;m++)f[m]=i[m]>s?s:i[m];d="M".concat(t,",").concat(r+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+c*f[0],",").concat(r)),d+="L ".concat(t+n-c*f[1],",").concat(r),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, 607 `).concat(t+n,",").concat(r+l*f[1])),d+="L ".concat(t+n,",").concat(r+a-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, 608 `).concat(t+n-c*f[2],",").concat(r+a)),d+="L ".concat(t+c*f[3],",").concat(r+a),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, 609 `).concat(t,",").concat(r+a-l*f[3])),d+="Z"}else if(s>0&&i===+i&&i>0){var y=Math.min(s,i);d="M ".concat(t,",").concat(r+l*y,` 610 A `).concat(y,",").concat(y,",0,0,").concat(u,",").concat(t+c*y,",").concat(r,` 611 L `).concat(t+n-c*y,",").concat(r,` 612 A `).concat(y,",").concat(y,",0,0,").concat(u,",").concat(t+n,",").concat(r+l*y,` 613 L `).concat(t+n,",").concat(r+a-l*y,` 614 A `).concat(y,",").concat(y,",0,0,").concat(u,",").concat(t+n-c*y,",").concat(r+a,` 615 L `).concat(t+c*y,",").concat(r+a,` 616 A `).concat(y,",").concat(y,",0,0,").concat(u,",").concat(t,",").concat(r+a-l*y," Z")}else d="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(a," h ").concat(-n," Z");return d},M1e=function(t,r){if(!t||!r)return!1;var n=t.x,a=t.y,i=r.x,s=r.y,l=r.width,c=r.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(i,i+l),d=Math.max(i,i+l),f=Math.min(s,s+c),m=Math.max(s,s+c);return n>=u&&n<=d&&a>=f&&a<=m}return!1},I1e={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},o1=function(t){var r=cO(cO({},I1e),t),n=h.useRef(),a=h.useState(-1),i=C1e(a,2),s=i[0],l=i[1];h.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var w=n.current.getTotalLength();w&&l(w)}catch{}},[]);var c=r.x,u=r.y,d=r.width,f=r.height,m=r.radius,p=r.className,y=r.animationEasing,v=r.animationDuration,g=r.animationBegin,x=r.isAnimationActive,b=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var j=Qe("recharts-rectangle",p);return b?$.createElement(Ea,{canBegin:s>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:v,animationEasing:y,isActive:b},function(w){var S=w.width,_=w.height,N=w.x,E=w.y;return $.createElement(Ea,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:g,duration:v,isActive:x,easing:y},$.createElement("path",gh({},ze(r,!0),{className:j,d:uO(N,E,S,_,m),ref:n})))}):$.createElement("path",gh({},ze(r,!0),{className:j,d:uO(c,u,d,f,m)}))},R1e=["points","className","baseLinePoints","connectNulls"];function _s(){return _s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_s.apply(this,arguments)}function L1e(e,t){if(e==null)return{};var r=F1e(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function F1e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function dO(e){return U1e(e)||q1e(e)||z1e(e)||B1e()}function B1e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 617In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function z1e(e,t){if(e){if(typeof e=="string")return Cb(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Cb(e,t)}}function q1e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function U1e(e){if(Array.isArray(e))return Cb(e)}function Cb(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var fO=function(t){return t&&t.x===+t.x&&t.y===+t.y},W1e=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){fO(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),fO(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},Jc=function(t,r){var n=W1e(t);r&&(n=[n.reduce(function(i,s){return[].concat(dO(i),dO(s))},[])]);var a=n.map(function(i){return i.reduce(function(s,l,c){return"".concat(s).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return n.length===1?"".concat(a,"Z"):a},V1e=function(t,r,n){var a=Jc(t,n);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(Jc(r.reverse(),n).slice(1))},G1e=function(t){var r=t.points,n=t.className,a=t.baseLinePoints,i=t.connectNulls,s=L1e(t,R1e);if(!r||!r.length)return null;var l=Qe("recharts-polygon",n);if(a&&a.length){var c=s.stroke&&s.stroke!=="none",u=V1e(r,a,i);return $.createElement("g",{className:l},$.createElement("path",_s({},ze(s,!0),{fill:u.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:u})),c?$.createElement("path",_s({},ze(s,!0),{fill:"none",d:Jc(r,i)})):null,c?$.createElement("path",_s({},ze(s,!0),{fill:"none",d:Jc(a,i)})):null)}var d=Jc(r,i);return $.createElement("path",_s({},ze(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:l,d}))};function Ob(){return Ob=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ob.apply(this,arguments)}var $v=function(t){var r=t.cx,n=t.cy,a=t.r,i=t.className,s=Qe("recharts-dot",i);return r===+r&&n===+n&&a===+a?$.createElement("circle",Ob({},ze(t,!1),Rm(t),{className:s,cx:r,cy:n,r:a})):null};function od(e){"@babel/helpers - typeof";return od=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},od(e)}var H1e=["x","y","top","left","width","height","className"];function Pb(){return Pb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Pb.apply(this,arguments)}function mO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function K1e(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?mO(Object(r),!0).forEach(function(n){Y1e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Y1e(e,t,r){return t=X1e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function X1e(e){var t=Z1e(e,"string");return od(t)=="symbol"?t:t+""}function Z1e(e,t){if(od(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(od(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Q1e(e,t){if(e==null)return{};var r=J1e(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function J1e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var eSe=function(t,r,n,a,i,s){return"M".concat(t,",").concat(i,"v").concat(a,"M").concat(s,",").concat(r,"h").concat(n)},tSe=function(t){var r=t.x,n=r===void 0?0:r,a=t.y,i=a===void 0?0:a,s=t.top,l=s===void 0?0:s,c=t.left,u=c===void 0?0:c,d=t.width,f=d===void 0?0:d,m=t.height,p=m===void 0?0:m,y=t.className,v=Q1e(t,H1e),g=K1e({x:n,y:i,top:l,left:u,width:f,height:p},v);return!he(n)||!he(i)||!he(f)||!he(p)||!he(l)||!he(u)?null:$.createElement("path",Pb({},ze(g,!0),{className:Qe("recharts-cross",y),d:eSe(n,i,f,p,l,u)}))},rSe=Ov,nSe=fF,aSe=Aa;function iSe(e,t){return e&&e.length?rSe(e,aSe(t),nSe):void 0}var oSe=iSe;const sSe=pt(oSe);var lSe=Ov,cSe=Aa,uSe=mF;function dSe(e,t){return e&&e.length?lSe(e,cSe(t),uSe):void 0}var fSe=dSe;const mSe=pt(fSe);var hSe=["cx","cy","angle","ticks","axisLine"],pSe=["ticks","tick","angle","tickFormatter","stroke"];function vl(e){"@babel/helpers - typeof";return vl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vl(e)}function eu(){return eu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},eu.apply(this,arguments)}function hO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ro(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hO(Object(r),!0).forEach(function(n){kv(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function pO(e,t){if(e==null)return{};var r=vSe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function vSe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function gSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,e4(n.key),n)}}function ySe(e,t,r){return t&&vO(e.prototype,t),r&&vO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function xSe(e,t,r){return t=yh(t),bSe(e,JF()?Reflect.construct(t,r||[],yh(e).constructor):t.apply(e,r))}function bSe(e,t){if(t&&(vl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wSe(e)}function wSe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function JF(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(JF=function(){return!!e})()}function yh(e){return yh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},yh(e)}function jSe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ab(e,t)}function Ab(e,t){return Ab=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Ab(e,t)}function kv(e,t,r){return t=e4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function e4(e){var t=SSe(e,"string");return vl(t)=="symbol"?t:t+""}function SSe(e,t){if(vl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(vl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Mv=function(e){function t(){return gSe(this,t),xSe(this,t,arguments)}return jSe(t,e),ySe(t,[{key:"getTickValueCoord",value:function(n){var a=n.coordinate,i=this.props,s=i.angle,l=i.cx,c=i.cy;return At(l,c,a,s)}},{key:"getTickTextAnchor",value:function(){var n=this.props.orientation,a;switch(n){case"left":a="end";break;case"right":a="start";break;default:a="middle";break}return a}},{key:"getViewBox",value:function(){var n=this.props,a=n.cx,i=n.cy,s=n.angle,l=n.ticks,c=sSe(l,function(d){return d.coordinate||0}),u=mSe(l,function(d){return d.coordinate||0});return{cx:a,cy:i,startAngle:s,endAngle:s,innerRadius:u.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var n=this.props,a=n.cx,i=n.cy,s=n.angle,l=n.ticks,c=n.axisLine,u=pO(n,hSe),d=l.reduce(function(y,v){return[Math.min(y[0],v.coordinate),Math.max(y[1],v.coordinate)]},[1/0,-1/0]),f=At(a,i,d[0],s),m=At(a,i,d[1],s),p=ro(ro(ro({},ze(u,!1)),{},{fill:"none"},ze(c,!1)),{},{x1:f.x,y1:f.y,x2:m.x,y2:m.y});return $.createElement("line",eu({className:"recharts-polar-radius-axis-line"},p))}},{key:"renderTicks",value:function(){var n=this,a=this.props,i=a.ticks,s=a.tick,l=a.angle,c=a.tickFormatter,u=a.stroke,d=pO(a,pSe),f=this.getTickTextAnchor(),m=ze(d,!1),p=ze(s,!1),y=i.map(function(v,g){var x=n.getTickValueCoord(v),b=ro(ro(ro(ro({textAnchor:f,transform:"rotate(".concat(90-l,", ").concat(x.x,", ").concat(x.y,")")},m),{},{stroke:"none",fill:u},p),{},{index:g},x),{},{payload:v});return $.createElement(ct,eu({className:Qe("recharts-polar-radius-axis-tick",zF(s)),key:"tick-".concat(v.coordinate)},qo(n.props,v,g)),t.renderTickItem(s,b,c?c(v.value,g):v.value))});return $.createElement(ct,{className:"recharts-polar-radius-axis-ticks"},y)}},{key:"render",value:function(){var n=this.props,a=n.ticks,i=n.axisLine,s=n.tick;return!a||!a.length?null:$.createElement(ct,{className:Qe("recharts-polar-radius-axis",this.props.className)},i&&this.renderAxisLine(),s&&this.renderTicks(),cr.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(n,a,i){var s;return $.isValidElement(n)?s=$.cloneElement(n,a):Ge(n)?s=n(a):s=$.createElement(Uo,eu({},a,{className:"recharts-polar-radius-axis-tick-value"}),i),s}}])}(h.PureComponent);kv(Mv,"displayName","PolarRadiusAxis");kv(Mv,"axisType","radiusAxis");kv(Mv,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function gl(e){"@babel/helpers - typeof";return gl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gl(e)}function fo(){return fo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},fo.apply(this,arguments)}function gO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function no(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gO(Object(r),!0).forEach(function(n){Iv(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _Se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,r4(n.key),n)}}function NSe(e,t,r){return t&&yO(e.prototype,t),r&&yO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ESe(e,t,r){return t=xh(t),CSe(e,t4()?Reflect.construct(t,r||[],xh(e).constructor):t.apply(e,r))}function CSe(e,t){if(t&&(gl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return OSe(e)}function OSe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function t4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(t4=function(){return!!e})()}function xh(e){return xh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},xh(e)}function PSe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Tb(e,t)}function Tb(e,t){return Tb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Tb(e,t)}function Iv(e,t,r){return t=r4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r4(e){var t=ASe(e,"string");return gl(t)=="symbol"?t:t+""}function ASe(e,t){if(gl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(gl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var TSe=Math.PI/180,xO=1e-5,Rv=function(e){function t(){return _Se(this,t),ESe(this,t,arguments)}return PSe(t,e),NSe(t,[{key:"getTickLineCoord",value:function(n){var a=this.props,i=a.cx,s=a.cy,l=a.radius,c=a.orientation,u=a.tickSize,d=u||8,f=At(i,s,l,n.coordinate),m=At(i,s,l+(c==="inner"?-1:1)*d,n.coordinate);return{x1:f.x,y1:f.y,x2:m.x,y2:m.y}}},{key:"getTickTextAnchor",value:function(n){var a=this.props.orientation,i=Math.cos(-n.coordinate*TSe),s;return i>xO?s=a==="outer"?"start":"end":i<-xO?s=a==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var n=this.props,a=n.cx,i=n.cy,s=n.radius,l=n.axisLine,c=n.axisLineType,u=no(no({},ze(this.props,!1)),{},{fill:"none"},ze(l,!1));if(c==="circle")return $.createElement($v,fo({className:"recharts-polar-angle-axis-line"},u,{cx:a,cy:i,r:s}));var d=this.props.ticks,f=d.map(function(m){return At(a,i,s,m.coordinate)});return $.createElement(G1e,fo({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var n=this,a=this.props,i=a.ticks,s=a.tick,l=a.tickLine,c=a.tickFormatter,u=a.stroke,d=ze(this.props,!1),f=ze(s,!1),m=no(no({},d),{},{fill:"none"},ze(l,!1)),p=i.map(function(y,v){var g=n.getTickLineCoord(y),x=n.getTickTextAnchor(y),b=no(no(no({textAnchor:x},d),{},{stroke:"none",fill:u},f),{},{index:v,payload:y,x:g.x2,y:g.y2});return $.createElement(ct,fo({className:Qe("recharts-polar-angle-axis-tick",zF(s)),key:"tick-".concat(y.coordinate)},qo(n.props,y,v)),l&&$.createElement("line",fo({className:"recharts-polar-angle-axis-tick-line"},m,g)),s&&t.renderTickItem(s,b,c?c(y.value,v):y.value))});return $.createElement(ct,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var n=this.props,a=n.ticks,i=n.radius,s=n.axisLine;return i<=0||!a||!a.length?null:$.createElement(ct,{className:Qe("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,a,i){var s;return $.isValidElement(n)?s=$.cloneElement(n,a):Ge(n)?s=n(a):s=$.createElement(Uo,fo({},a,{className:"recharts-polar-angle-axis-tick-value"}),i),s}}])}(h.PureComponent);Iv(Rv,"displayName","PolarAngleAxis");Iv(Rv,"axisType","angleAxis");Iv(Rv,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var DSe=lL,$Se=DSe(Object.getPrototypeOf,Object),kSe=$Se,MSe=ai,ISe=kSe,RSe=ii,LSe="[object Object]",FSe=Function.prototype,BSe=Object.prototype,n4=FSe.toString,zSe=BSe.hasOwnProperty,qSe=n4.call(Object);function USe(e){if(!RSe(e)||MSe(e)!=LSe)return!1;var t=ISe(e);if(t===null)return!0;var r=zSe.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&n4.call(r)==qSe}var WSe=USe;const VSe=pt(WSe);var GSe=ai,HSe=ii,KSe="[object Boolean]";function YSe(e){return e===!0||e===!1||HSe(e)&&GSe(e)==KSe}var XSe=YSe;const ZSe=pt(XSe);function sd(e){"@babel/helpers - typeof";return sd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sd(e)}function bh(){return bh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bh.apply(this,arguments)}function QSe(e,t){return r_e(e)||t_e(e,t)||e_e(e,t)||JSe()}function JSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 618In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e_e(e,t){if(e){if(typeof e=="string")return bO(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bO(e,t)}}function bO(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t_e(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function r_e(e){if(Array.isArray(e))return e}function wO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function jO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wO(Object(r),!0).forEach(function(n){n_e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function n_e(e,t,r){return t=a_e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a_e(e){var t=i_e(e,"string");return sd(t)=="symbol"?t:t+""}function i_e(e,t){if(sd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(sd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var SO=function(t,r,n,a,i){var s=n-a,l;return l="M ".concat(t,",").concat(r),l+="L ".concat(t+n,",").concat(r),l+="L ".concat(t+n-s/2,",").concat(r+i),l+="L ".concat(t+n-s/2-a,",").concat(r+i),l+="L ".concat(t,",").concat(r," Z"),l},o_e={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},s_e=function(t){var r=jO(jO({},o_e),t),n=h.useRef(),a=h.useState(-1),i=QSe(a,2),s=i[0],l=i[1];h.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var j=n.current.getTotalLength();j&&l(j)}catch{}},[]);var c=r.x,u=r.y,d=r.upperWidth,f=r.lowerWidth,m=r.height,p=r.className,y=r.animationEasing,v=r.animationDuration,g=r.animationBegin,x=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||m!==+m||d===0&&f===0||m===0)return null;var b=Qe("recharts-trapezoid",p);return x?$.createElement(Ea,{canBegin:s>0,from:{upperWidth:0,lowerWidth:0,height:m,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:m,x:c,y:u},duration:v,animationEasing:y,isActive:x},function(j){var w=j.upperWidth,S=j.lowerWidth,_=j.height,N=j.x,E=j.y;return $.createElement(Ea,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:g,duration:v,easing:y},$.createElement("path",bh({},ze(r,!0),{className:b,d:SO(N,E,w,S,_),ref:n})))}):$.createElement("g",null,$.createElement("path",bh({},ze(r,!0),{className:b,d:SO(c,u,d,f,m)})))},l_e=["option","shapeType","propTransformer","activeClassName","isActive"];function ld(e){"@babel/helpers - typeof";return ld=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ld(e)}function c_e(e,t){if(e==null)return{};var r=u_e(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function u_e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function _O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function wh(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_O(Object(r),!0).forEach(function(n){d_e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_O(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function d_e(e,t,r){return t=f_e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f_e(e){var t=m_e(e,"string");return ld(t)=="symbol"?t:t+""}function m_e(e,t){if(ld(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ld(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function h_e(e,t){return wh(wh({},t),e)}function p_e(e,t){return e==="symbols"}function NO(e){var t=e.shapeType,r=e.elementProps;switch(t){case"rectangle":return $.createElement(o1,r);case"trapezoid":return $.createElement(s_e,r);case"sector":return $.createElement(WF,r);case"symbols":if(p_e(t))return $.createElement(Nj,r);break;default:return null}}function v_e(e){return h.isValidElement(e)?e.props:e}function a4(e){var t=e.option,r=e.shapeType,n=e.propTransformer,a=n===void 0?h_e:n,i=e.activeClassName,s=i===void 0?"recharts-active-shape":i,l=e.isActive,c=c_e(e,l_e),u;if(h.isValidElement(t))u=h.cloneElement(t,wh(wh({},c),v_e(t)));else if(Ge(t))u=t(c);else if(VSe(t)&&!ZSe(t)){var d=a(t,c);u=$.createElement(NO,{shapeType:r,elementProps:d})}else{var f=c;u=$.createElement(NO,{shapeType:r,elementProps:f})}return l?$.createElement(ct,{className:s},u):u}function Lv(e,t){return t!=null&&"trapezoids"in e.props}function Fv(e,t){return t!=null&&"sectors"in e.props}function cd(e,t){return t!=null&&"points"in e.props}function g_e(e,t){var r,n,a=e.x===(t==null||(r=t.labelViewBox)===null||r===void 0?void 0:r.x)||e.x===t.x,i=e.y===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.y)||e.y===t.y;return a&&i}function y_e(e,t){var r=e.endAngle===t.endAngle,n=e.startAngle===t.startAngle;return r&&n}function x_e(e,t){var r=e.x===t.x,n=e.y===t.y,a=e.z===t.z;return r&&n&&a}function b_e(e,t){var r;return Lv(e,t)?r=g_e:Fv(e,t)?r=y_e:cd(e,t)&&(r=x_e),r}function w_e(e,t){var r;return Lv(e,t)?r="trapezoids":Fv(e,t)?r="sectors":cd(e,t)&&(r="points"),r}function j_e(e,t){if(Lv(e,t)){var r;return(r=t.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if(Fv(e,t)){var n;return(n=t.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}return cd(e,t)?t.payload:{}}function S_e(e){var t=e.activeTooltipItem,r=e.graphicalItem,n=e.itemData,a=w_e(r,t),i=j_e(r,t),s=n.filter(function(c,u){var d=Xd(i,c),f=r.props[a].filter(function(y){var v=b_e(r,t);return v(y,t)}),m=r.props[a].indexOf(f[f.length-1]),p=u===m;return d&&p}),l=n.indexOf(s[s.length-1]);return l}var Hf;function yl(e){"@babel/helpers - typeof";return yl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yl(e)}function Ns(){return Ns=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ns.apply(this,arguments)}function EO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ot(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?EO(Object(r),!0).forEach(function(n){Tn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function __e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function CO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o4(n.key),n)}}function N_e(e,t,r){return t&&CO(e.prototype,t),r&&CO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function E_e(e,t,r){return t=jh(t),C_e(e,i4()?Reflect.construct(t,r||[],jh(e).constructor):t.apply(e,r))}function C_e(e,t){if(t&&(yl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return O_e(e)}function O_e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function i4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(i4=function(){return!!e})()}function jh(e){return jh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},jh(e)}function P_e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Db(e,t)}function Db(e,t){return Db=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Db(e,t)}function Tn(e,t,r){return t=o4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o4(e){var t=A_e(e,"string");return yl(t)=="symbol"?t:t+""}function A_e(e,t){if(yl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(yl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var si=function(e){function t(r){var n;return __e(this,t),n=E_e(this,t,[r]),Tn(n,"pieRef",null),Tn(n,"sectorRefs",[]),Tn(n,"id",ec("recharts-pie-")),Tn(n,"handleAnimationEnd",function(){var a=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),Ge(a)&&a()}),Tn(n,"handleAnimationStart",function(){var a=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),Ge(a)&&a()}),n.state={isAnimationFinished:!r.isAnimationActive,prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,sectorToFocus:0},n}return P_e(t,e),N_e(t,[{key:"isActiveIndex",value:function(n){var a=this.props.activeIndex;return Array.isArray(a)?a.indexOf(n)!==-1:n===a}},{key:"hasActiveIndex",value:function(){var n=this.props.activeIndex;return Array.isArray(n)?n.length!==0:n||n===0}},{key:"renderLabels",value:function(n){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var i=this.props,s=i.label,l=i.labelLine,c=i.dataKey,u=i.valueKey,d=ze(this.props,!1),f=ze(s,!1),m=ze(l,!1),p=s&&s.offsetRadius||20,y=n.map(function(v,g){var x=(v.startAngle+v.endAngle)/2,b=At(v.cx,v.cy,v.outerRadius+p,x),j=Ot(Ot(Ot(Ot({},d),v),{},{stroke:"none"},f),{},{index:g,textAnchor:t.getTextAnchor(b.x,v.cx)},b),w=Ot(Ot(Ot(Ot({},d),v),{},{fill:"none",stroke:v.fill},m),{},{index:g,points:[At(v.cx,v.cy,v.outerRadius,x),b]}),S=c;return Ye(c)&&Ye(u)?S="value":Ye(c)&&(S=u),$.createElement(ct,{key:"label-".concat(v.startAngle,"-").concat(v.endAngle,"-").concat(v.midAngle,"-").concat(g)},l&&t.renderLabelLineItem(l,w,"line"),t.renderLabelItem(s,j,ar(v,S)))});return $.createElement(ct,{className:"recharts-pie-labels"},y)}},{key:"renderSectorsStatically",value:function(n){var a=this,i=this.props,s=i.activeShape,l=i.blendStroke,c=i.inactiveShape;return n.map(function(u,d){if((u==null?void 0:u.startAngle)===0&&(u==null?void 0:u.endAngle)===0&&n.length!==1)return null;var f=a.isActiveIndex(d),m=c&&a.hasActiveIndex()?c:null,p=f?s:m,y=Ot(Ot({},u),{},{stroke:l?u.fill:u.stroke,tabIndex:-1});return $.createElement(ct,Ns({ref:function(g){g&&!a.sectorRefs.includes(g)&&a.sectorRefs.push(g)},tabIndex:-1,className:"recharts-pie-sector"},qo(a.props,u,d),{key:"sector-".concat(u==null?void 0:u.startAngle,"-").concat(u==null?void 0:u.endAngle,"-").concat(u.midAngle,"-").concat(d)}),$.createElement(a4,Ns({option:p,isActive:f,shapeType:"sector"},y)))})}},{key:"renderSectorsWithAnimation",value:function(){var n=this,a=this.props,i=a.sectors,s=a.isAnimationActive,l=a.animationBegin,c=a.animationDuration,u=a.animationEasing,d=a.animationId,f=this.state,m=f.prevSectors,p=f.prevIsAnimationActive;return $.createElement(Ea,{begin:l,duration:c,isActive:s,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(d,"-").concat(p),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(y){var v=y.t,g=[],x=i&&i[0],b=x.startAngle;return i.forEach(function(j,w){var S=m&&m[w],_=w>0?dn(j,"paddingAngle",0):0;if(S){var N=an(S.endAngle-S.startAngle,j.endAngle-j.startAngle),E=Ot(Ot({},j),{},{startAngle:b+_,endAngle:b+N(v)+_});g.push(E),b=E.endAngle}else{var O=j.endAngle,P=j.startAngle,C=an(0,O-P),A=C(v),T=Ot(Ot({},j),{},{startAngle:b+_,endAngle:b+A+_});g.push(T),b=T.endAngle}}),$.createElement(ct,null,n.renderSectorsStatically(g))})}},{key:"attachKeyboardHandlers",value:function(n){var a=this;n.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var s=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[s].focus(),a.setState({sectorToFocus:s});break}case"ArrowRight":{var l=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[l].focus(),a.setState({sectorToFocus:l});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,a=n.sectors,i=n.isAnimationActive,s=this.state.prevSectors;return i&&a&&a.length&&(!s||!Xd(s,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,a=this.props,i=a.hide,s=a.sectors,l=a.className,c=a.label,u=a.cx,d=a.cy,f=a.innerRadius,m=a.outerRadius,p=a.isAnimationActive,y=this.state.isAnimationFinished;if(i||!s||!s.length||!he(u)||!he(d)||!he(f)||!he(m))return null;var v=Qe("recharts-pie",l);return $.createElement(ct,{tabIndex:this.props.rootTabIndex,className:v,ref:function(x){n.pieRef=x}},this.renderSectors(),c&&this.renderLabels(s),cr.renderCallByParent(this.props,null,!1),(!p||y)&&Ga.renderCallByParent(this.props,s,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return a.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:n.sectors!==a.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,a){return n>a?"start":n<a?"end":"middle"}},{key:"renderLabelLineItem",value:function(n,a,i){if($.isValidElement(n))return $.cloneElement(n,a);if(Ge(n))return n(a);var s=Qe("recharts-pie-label-line",typeof n!="boolean"?n.className:"");return $.createElement(mh,Ns({},a,{key:i,type:"linear",className:s}))}},{key:"renderLabelItem",value:function(n,a,i){if($.isValidElement(n))return $.cloneElement(n,a);var s=i;if(Ge(n)&&(s=n(a),$.isValidElement(s)))return s;var l=Qe("recharts-pie-label-text",typeof n!="boolean"&&!Ge(n)?n.className:"");return $.createElement(Uo,Ns({},a,{alignmentBaseline:"middle",className:l}),s)}}])}(h.PureComponent);Hf=si;Tn(si,"displayName","Pie");Tn(si,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!ya.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});Tn(si,"parseDeltaAngle",function(e,t){var r=$r(t-e),n=Math.min(Math.abs(t-e),360);return r*n});Tn(si,"getRealPieData",function(e){var t=e.data,r=e.children,n=ze(e,!1),a=fn(r,wv);return t&&t.length?t.map(function(i,s){return Ot(Ot(Ot({payload:i},n),i),a&&a[s]&&a[s].props)}):a&&a.length?a.map(function(i){return Ot(Ot({},n),i.props)}):[]});Tn(si,"parseCoordinateOfPie",function(e,t){var r=t.top,n=t.left,a=t.width,i=t.height,s=BF(a,i),l=n+kr(e.cx,a,a/2),c=r+kr(e.cy,i,i/2),u=kr(e.innerRadius,s,0),d=kr(e.outerRadius,s,s*.8),f=e.maxRadius||Math.sqrt(a*a+i*i)/2;return{cx:l,cy:c,innerRadius:u,outerRadius:d,maxRadius:f}});Tn(si,"getComposedData",function(e){var t=e.item,r=e.offset,n=t.type.defaultProps!==void 0?Ot(Ot({},t.type.defaultProps),t.props):t.props,a=Hf.getRealPieData(n);if(!a||!a.length)return null;var i=n.cornerRadius,s=n.startAngle,l=n.endAngle,c=n.paddingAngle,u=n.dataKey,d=n.nameKey,f=n.valueKey,m=n.tooltipType,p=Math.abs(n.minAngle),y=Hf.parseCoordinateOfPie(n,r),v=Hf.parseDeltaAngle(s,l),g=Math.abs(v),x=u;Ye(u)&&Ye(f)?(ea(!1,`Use "dataKey" to specify the value of pie,
619 the props "valueKey" will be deprecated in 1.1.0`),x="value"):Ye(u)&&(ea(!1,`Use "dataKey" to specify the value of pie, 620 the props "valueKey" will be deprecated in 1.1.0`),x=f);var b=a.filter(function(E){return ar(E,x,0)!==0}).length,j=(g>=360?b:b-1)*c,w=g-b*p-j,S=a.reduce(function(E,O){var P=ar(O,x,0);return E+(he(P)?P:0)},0),_;if(S>0){var N;_=a.map(function(E,O){var P=ar(E,x,0),C=ar(E,d,O),A=(he(P)?P:0)/S,T;O?T=N.endAngle+$r(v)*c*(P!==0?1:0):T=s;var k=T+$r(v)*((P!==0?p:0)+A*w),D=(T+k)/2,M=(y.innerRadius+y.outerRadius)/2,F=[{name:C,value:P,payload:E,dataKey:x,type:m}],q=At(y.cx,y.cy,M,D);return N=Ot(Ot(Ot({percent:A,cornerRadius:i,name:C,tooltipPayload:F,midAngle:D,middleRadius:M,tooltipPosition:q},E),y),{},{value:ar(E,x),startAngle:T,endAngle:k,payload:E,paddingAngle:$r(v)*c}),N})}return Ot(Ot({},y),{},{sectors:_,data:a})});var T_e=Math.ceil,D_e=Math.max;function $_e(e,t,r,n){for(var a=-1,i=D_e(T_e((t-e)/(r||1)),0),s=Array(i);i--;)s[n?i:++a]=e,e+=r;return s}var k_e=$_e,M_e=CL,OO=1/0,I_e=17976931348623157e292;function R_e(e){if(!e)return e===0?e:0;if(e=M_e(e),e===OO||e===-OO){var t=e<0?-1:1;return t*I_e}return e===e?e:0}var s4=R_e,L_e=k_e,F_e=bv,fy=s4;function B_e(e){return function(t,r,n){return n&&typeof n!="number"&&F_e(t,r,n)&&(r=n=void 0),t=fy(t),r===void 0?(r=t,t=0):r=fy(r),n=n===void 0?t<r?1:-1:fy(n),L_e(t,r,n,e)}}var z_e=B_e,q_e=z_e,U_e=q_e(),W_e=U_e;const Sh=pt(W_e);function ud(e){"@babel/helpers - typeof";return ud=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ud(e)}function PO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function AO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?PO(Object(r),!0).forEach(function(n){l4(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function l4(e,t,r){return t=V_e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function V_e(e){var t=G_e(e,"string");return ud(t)=="symbol"?t:t+""}function G_e(e,t){if(ud(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ud(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var H_e=["Webkit","Moz","O","ms"],K_e=function(t,r){var n=t.replace(/(\w)/,function(i){return i.toUpperCase()}),a=H_e.reduce(function(i,s){return AO(AO({},i),{},l4({},s+n,r))},{});return a[t]=r,a};function xl(e){"@babel/helpers - typeof";return xl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xl(e)}function _h(){return _h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_h.apply(this,arguments)}function TO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function my(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?TO(Object(r),!0).forEach(function(n){en(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):TO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Y_e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function DO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,u4(n.key),n)}}function X_e(e,t,r){return t&&DO(e.prototype,t),r&&DO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Z_e(e,t,r){return t=Nh(t),Q_e(e,c4()?Reflect.construct(t,r||[],Nh(e).constructor):t.apply(e,r))}function Q_e(e,t){if(t&&(xl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return J_e(e)}function J_e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(c4=function(){return!!e})()}
vendor: 9,387 bytes, line 620
620function Nh(e){return Nh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Nh(e)}function eNe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$b(e,t)}function $b(e,t){return $b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},$b(e,t)}function en(e,t,r){return t=u4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u4(e){var t=tNe(e,"string");return xl(t)=="symbol"?t:t+""}function tNe(e,t){if(xl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(xl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var rNe=function(t){var r=t.data,n=t.startIndex,a=t.endIndex,i=t.x,s=t.width,l=t.travellerWidth;if(!r||!r.length)return{};var c=r.length,u=Xc().domain(Sh(0,c)).range([i,i+s-l]),d=u.domain().map(function(f){return u(f)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(n),endX:u(a),scale:u,scaleValues:d}},$O=function(t){return t.changedTouches&&!!t.changedTouches.length},bl=function(e){function t(r){var n;return Y_e(this,t),n=Z_e(this,t,[r]),en(n,"handleDrag",function(a){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(a):n.state.isSlideMoving&&n.handleSlideDrag(a)}),en(n,"handleTouchMove",function(a){a.changedTouches!=null&&a.changedTouches.length>0&&n.handleDrag(a.changedTouches[0])}),en(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=n.props,i=a.endIndex,s=a.onDragEnd,l=a.startIndex;s==null||s({endIndex:i,startIndex:l})}),n.detachDragEndListener()}),en(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),en(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),en(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),en(n,"handleSlideDragStart",function(a){var i=$O(a)?a.changedTouches[0]:a;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return eNe(t,e),X_e(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var a=n.startX,i=n.endX,s=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(a,i),m=Math.max(a,i),p=t.getIndexInRange(s,f),y=t.getIndexInRange(s,m);return{startIndex:p-p%c,endIndex:y===d?d:y-y%c}}},{key:"getTextOfTick",value:function(n){var a=this.props,i=a.data,s=a.tickFormatter,l=a.dataKey,c=ar(i[n],l,n);return Ge(s)?s(c,n):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var a=this.state,i=a.slideMoveStartX,s=a.startX,l=a.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,m=c.startIndex,p=c.endIndex,y=c.onChange,v=n.pageX-i;v>0?v=Math.min(v,u+d-f-l,u+d-f-s):v<0&&(v=Math.max(v,u-s,u-l));var g=this.getIndex({startX:s+v,endX:l+v});(g.startIndex!==m||g.endIndex!==p)&&y&&y(g),this.setState({startX:s+v,endX:l+v,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,a){var i=$O(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var a=this.state,i=a.brushMoveStartX,s=a.movingTravellerId,l=a.endX,c=a.startX,u=this.state[s],d=this.props,f=d.x,m=d.width,p=d.travellerWidth,y=d.onChange,v=d.gap,g=d.data,x={startX:this.state.startX,endX:this.state.endX},b=n.pageX-i;b>0?b=Math.min(b,f+m-p-u):b<0&&(b=Math.max(b,f-u)),x[s]=u+b;var j=this.getIndex(x),w=j.startIndex,S=j.endIndex,_=function(){var E=g.length-1;return s==="startX"&&(l>c?w%v===0:S%v===0)||l<c&&S===E||s==="endX"&&(l>c?S%v===0:w%v===0)||l>c&&S===E};this.setState(en(en({},s,u+b),"brushMoveStartX",n.pageX),function(){y&&_()&&y(j)})}},{key:"handleTravellerMoveKeyboard",value:function(n,a){var i=this,s=this.state,l=s.scaleValues,c=s.startX,u=s.endX,d=this.state[a],f=l.indexOf(d);if(f!==-1){var m=f+n;if(!(m===-1||m>=l.length)){var p=l[m];a==="startX"&&p>=u||a==="endX"&&p<=c||this.setState(en({},a,p),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,a=n.x,i=n.y,s=n.width,l=n.height,c=n.fill,u=n.stroke;return $.createElement("rect",{stroke:u,fill:c,x:a,y:i,width:s,height:l})}},{key:"renderPanorama",value:function(){var n=this.props,a=n.x,i=n.y,s=n.width,l=n.height,c=n.data,u=n.children,d=n.padding,f=h.Children.only(u);return f?$.cloneElement(f,{x:a,y:i,width:s,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,a){var i,s,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,m=c.traveller,p=c.ariaLabel,y=c.data,v=c.startIndex,g=c.endIndex,x=Math.max(n,this.props.x),b=my(my({},ze(this.props,!1)),{},{x,y:u,width:d,height:f}),j=p||"Min value: ".concat((i=y[v])===null||i===void 0?void 0:i.name,", Max value: ").concat((s=y[g])===null||s===void 0?void 0:s.name);return $.createElement(ct,{tabIndex:0,role:"slider","aria-label":j,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(S){["ArrowLeft","ArrowRight"].includes(S.key)&&(S.preventDefault(),S.stopPropagation(),l.handleTravellerMoveKeyboard(S.key==="ArrowRight"?1:-1,a))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(m,b))}},{key:"renderSlide",value:function(n,a){var i=this.props,s=i.y,l=i.height,c=i.stroke,u=i.travellerWidth,d=Math.min(n,a)+u,f=Math.max(Math.abs(a-n)-u,0);return $.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:s,width:f,height:l})}},{key:"renderText",value:function(){var n=this.props,a=n.startIndex,i=n.endIndex,s=n.y,l=n.height,c=n.travellerWidth,u=n.stroke,d=this.state,f=d.startX,m=d.endX,p=5,y={pointerEvents:"none",fill:u};return $.createElement(ct,{className:"recharts-brush-texts"},$.createElement(Uo,_h({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,m)-p,y:s+l/2},y),this.getTextOfTick(a)),$.createElement(Uo,_h({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,m)+c+p,y:s+l/2},y),this.getTextOfTick(i)))}},{key:"render",value:function(){var n=this.props,a=n.data,i=n.className,s=n.children,l=n.x,c=n.y,u=n.width,d=n.height,f=n.alwaysShowText,m=this.state,p=m.startX,y=m.endX,v=m.isTextActive,g=m.isSlideMoving,x=m.isTravellerMoving,b=m.isTravellerFocused;if(!a||!a.length||!he(l)||!he(c)||!he(u)||!he(d)||u<=0||d<=0)return null;var j=Qe("recharts-brush",i),w=$.Children.count(s)===1,S=K_e("userSelect","none");return $.createElement(ct,{className:j,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:S},this.renderBackground(),w&&this.renderPanorama(),this.renderSlide(p,y),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(y,"endX"),(v||g||x||b||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var a=n.x,i=n.y,s=n.width,l=n.height,c=n.stroke,u=Math.floor(i+l/2)-1;return $.createElement($.Fragment,null,$.createElement("rect",{x:a,y:i,width:s,height:l,fill:c,stroke:"none"}),$.createElement("line",{x1:a+1,y1:u,x2:a+s-1,y2:u,fill:"none",stroke:"#fff"}),$.createElement("line",{x1:a+1,y1:u+2,x2:a+s-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,a){var i;return $.isValidElement(n)?i=$.cloneElement(n,a):Ge(n)?i=n(a):i=t.renderDefaultTraveller(a),i}},{key:"getDerivedStateFromProps",value:function(n,a){var i=n.data,s=n.width,l=n.x,c=n.travellerWidth,u=n.updateId,d=n.startIndex,f=n.endIndex;if(i!==a.prevData||u!==a.prevUpdateId)return my({prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:s},i&&i.length?rNe({data:i,width:s,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(a.scale&&(s!==a.prevWidth||l!==a.prevX||c!==a.prevTravellerWidth)){a.scale.range([l,l+s-c]
620);var m=a.scale.domain().map(function(p){return a.scale(p)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:s,startX:a.scale(n.startIndex),endX:a.scale(n.endIndex),scaleValues:m}}return null}},{key:"getIndexInRange",value:function(n,a){for(var i=n.length,s=0,l=i-1;l-s>1;){var c=Math.floor((s+l)/2);n[c]>a?l=c:s=c}return a>=n[l]?l:s}}])}(h.PureComponent);en(bl,"displayName","Brush");en(bl,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var nNe=Dj;function aNe(e,t){var r;return nNe(e,function(n,a,i){return r=t(n,a,i),!r}),!!r}var iNe=aNe,oNe=eL,sNe=Aa,lNe=iNe,cNe=Xr,uNe=bv;function dNe(e,t,r){var n=cNe(e)?oNe:lNe;return r&&uNe(e,t,r)&&(t=void 0),n(e,sNe(t))}var fNe=dNe;const mNe=pt(fNe);var ba=function(t,r){var n=t.alwaysShow,a=t.ifOverflow;return n&&(a="extendDomain"),a===r},kO=jL;function hNe(e,t,r){t=="__proto__"&&kO?kO(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var pNe=hNe,vNe=pNe,gNe=bL,yNe=Aa;function xNe(e,t){var r={};return t=yNe(t),gNe(e,function(n,a,i){vNe(r,a,t(n,a,i))}),r}var bNe=xNe;const wNe=pt(bNe);function jNe(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}var SNe=jNe,_Ne=Dj;function NNe(e,t){var r=!0;return _Ne(e,function(n,a,i){return r=!!t(n,a,i),r}),r}var ENe=NNe,CNe=SNe,ONe=ENe,PNe=Aa,ANe=Xr,TNe=bv;function DNe(e,t,r){var n=ANe(e)?CNe:ONe;return r&&TNe(e,t,r)&&(t=void 0),n(e,PNe(t))}var $Ne=DNe;const d4=pt($Ne);var kNe=["x","y"];function dd(e){"@babel/helpers - typeof";return dd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dd(e)}function kb(){return kb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},kb.apply(this,arguments)}function MO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Tc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?MO(Object(r),!0).forEach(function(n){MNe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function MNe(e,t,r){return t=INe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function INe(e){var t=RNe(e,"string");return dd(t)=="symbol"?t:t+""}function RNe(e,t){if(dd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(dd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function LNe(e,t){if(e==null)return{};var r=FNe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function FNe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function BNe(e,t){var r=e.x,n=e.y,a=LNe(e,kNe),i="".concat(r),s=parseInt(i,10),l="".concat(n),c=parseInt(l,10),u="".concat(t.height||a.height),d=parseInt(u,10),f="".concat(t.width||a.width),m=parseInt(f,10);return Tc(Tc(Tc(Tc(Tc({},t),a),s?{x:s}:{}),c?{y:c}:{}),{},{height:d,width:m,name:t.name,radius:t.radius})}function IO(e){return $.createElement(a4,kb({shapeType:"rectangle",propTransformer:BNe,activeClassName:"recharts-active-bar"},e))}var zNe=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,a){if(typeof t=="number")return t;var i=typeof n=="number";return i?t(n,a):(i||Bi(),r)}},qNe=["value","background"],f4;function wl(e){"@babel/helpers - typeof";return wl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wl(e)}function UNe(e,t){if(e==null)return{};var r=WNe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function WNe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Eh(){return Eh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];
vendor: 13,921 bytes, line 620
620for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Eh.apply(this,arguments)}function RO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Zt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?RO(Object(r),!0).forEach(function(n){Ai(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):RO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function VNe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function LO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,h4(n.key),n)}}function GNe(e,t,r){return t&&LO(e.prototype,t),r&&LO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function HNe(e,t,r){return t=Ch(t),KNe(e,m4()?Reflect.construct(t,r||[],Ch(e).constructor):t.apply(e,r))}function KNe(e,t){if(t&&(wl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return YNe(e)}function YNe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(m4=function(){return!!e})()}function Ch(e){return Ch=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ch(e)}function XNe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Mb(e,t)}function Mb(e,t){return Mb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Mb(e,t)}function Ai(e,t,r){return t=h4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h4(e){var t=ZNe(e,"string");return wl(t)=="symbol"?t:t+""}function ZNe(e,t){if(wl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(wl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var as=function(e){function t(){var r;VNe(this,t);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=HNe(this,t,[].concat(a)),Ai(r,"state",{isAnimationFinished:!1}),Ai(r,"id",ec("recharts-bar-")),Ai(r,"handleAnimationEnd",function(){var s=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),s&&s()}),Ai(r,"handleAnimationStart",function(){var s=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),s&&s()}),r}return XNe(t,e),GNe(t,[{key:"renderRectanglesStatically",value:function(n){var a=this,i=this.props,s=i.shape,l=i.dataKey,c=i.activeIndex,u=i.activeBar,d=ze(this.props,!1);return n&&n.map(function(f,m){var p=m===c,y=p?u:s,v=Zt(Zt(Zt({},d),f),{},{isActive:p,option:y,index:m,dataKey:l,onAnimationStart:a.handleAnimationStart,onAnimationEnd:a.handleAnimationEnd});return $.createElement(ct,Eh({className:"recharts-bar-rectangle"},qo(a.props,f,m),{key:"rectangle-".concat(f==null?void 0:f.x,"-").concat(f==null?void 0:f.y,"-").concat(f==null?void 0:f.value)}),$.createElement(IO,v))})}},{key:"renderRectanglesWithAnimation",value:function(){var n=this,a=this.props,i=a.data,s=a.layout,l=a.isAnimationActive,c=a.animationBegin,u=a.animationDuration,d=a.animationEasing,f=a.animationId,m=this.state.prevData;return $.createElement(Ea,{begin:c,duration:u,isActive:l,easing:d,from:{t:0},to:{t:1},key:"bar-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(p){var y=p.t,v=i.map(function(g,x){var b=m&&m[x];if(b){var j=an(b.x,g.x),w=an(b.y,g.y),S=an(b.width,g.width),_=an(b.height,g.height);return Zt(Zt({},g),{},{x:j(y),y:w(y),width:S(y),height:_(y)})}if(s==="horizontal"){var N=an(0,g.height),E=N(y);return Zt(Zt({},g),{},{y:g.y+g.height-E,height:E})}var O=an(0,g.width),P=O(y);return Zt(Zt({},g),{},{width:P})});return $.createElement(ct,null,n.renderRectanglesStatically(v))})}},{key:"renderRectangles",value:function(){var n=this.props,a=n.data,i=n.isAnimationActive,s=this.state.prevData;return i&&a&&a.length&&(!s||!Xd(s,a))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(a)}},{key:"renderBackground",value:function(){var n=this,a=this.props,i=a.data,s=a.dataKey,l=a.activeIndex,c=ze(this.props.background,!1);return i.map(function(u,d){u.value;var f=u.background,m=UNe(u,qNe);if(!f)return null;var p=Zt(Zt(Zt(Zt(Zt({},m),{},{fill:"#eee"},f),c),qo(n.props,u,d)),{},{onAnimationStart:n.handleAnimationStart,onAnimationEnd:n.handleAnimationEnd,dataKey:s,index:d,className:"recharts-bar-background-rectangle"});return $.createElement(IO,Eh({key:"background-bar-".concat(d),option:n.props.background,isActive:d===l},p))})}},{key:"renderErrorBar",value:function(n,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,s=i.data,l=i.xAxis,c=i.yAxis,u=i.layout,d=i.children,f=fn(d,Zd);if(!f)return null;var m=u==="vertical"?s[0].height/2:s[0].width/2,p=function(g,x){var b=Array.isArray(g.value)?g.value[1]:g.value;return{x:g.x,y:g.y,value:b,errorVal:ar(g,x)}},y={clipPath:n?"url(#clipPath-".concat(a,")"):null};return $.createElement(ct,y,f.map(function(v){return $.cloneElement(v,{key:"error-bar-".concat(a,"-").concat(v.props.dataKey),data:s,xAxis:l,yAxis:c,layout:u,offset:m,dataPointFormatter:p})}))}},{key:"render",value:function(){var n=this.props,a=n.hide,i=n.data,s=n.className,l=n.xAxis,c=n.yAxis,u=n.left,d=n.top,f=n.width,m=n.height,p=n.isAnimationActive,y=n.background,v=n.id;if(a||!i||!i.length)return null;var g=this.state.isAnimationFinished,x=Qe("recharts-bar",s),b=l&&l.allowDataOverflow,j=c&&c.allowDataOverflow,w=b||j,S=Ye(v)?this.id:v;return $.createElement(ct,{className:x},b||j?$.createElement("defs",null,$.createElement("clipPath",{id:"clipPath-".concat(S)},$.createElement("rect",{x:b?u:u-f/2,y:j?d:d-m/2,width:b?f:f*2,height:j?m:m*2}))):null,$.createElement(ct,{className:"recharts-bar-rectangles",clipPath:w?"url(#clipPath-".concat(S,")"):null},y?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(w,S),(!p||g)&&Ga.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curData:n.data,prevData:a.curData}:n.data!==a.curData?{curData:n.data}:null}}])}(h.PureComponent);f4=as;Ai(as,"displayName","Bar");Ai(as,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!ya.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Ai(as,"getComposedData",function(e){var t=e.props,r=e.item,n=e.barPosition,a=e.bandSize,i=e.xAxis,s=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,m=e.offset,p=G0e(n,r);if(!p)return null;var y=t.layout,v=r.type.defaultProps,g=v!==void 0?Zt(Zt({},v),r.props):r.props,x=g.dataKey,b=g.children,j=g.minPointSize,w=y==="horizontal"?s:i,S=u?w.scale.domain():null,_=J0e({numericAxis:w}),N=fn(b,wv),E=f.map(function(O,P){var C,A,T,k,D,M;u?C=H0e(u[d+P],S):(C=ar(O,x),Array.isArray(C)||(C=[_,C]));var F=zNe(j,f4.defaultProps.minPointSize)(C[1],P);if(y==="horizontal"){var q,I=[s.scale(C[0]),s.scale(C[1])],K=I[0],W=I[1];A=CC({axis:i,ticks:l,bandSize:a,offset:p.offset,entry:O,index:P}),T=(q=W??K)!==null&&q!==void 0?q:void 0,k=p.size;var R=K-W;if(D=Number.isNaN(R)?0:R,M={x:A,y:s.y,width:k,height:s.height},Math.abs(F)>0&&Math.abs(D)<Math.abs(F)){var V=$r(D||F)*(Math.abs(F)-Math.abs(D));T-=V,D+=V}}else{var re=[i.scale(C[0]),i.scale(C[1])],H=re[0],te=re[1];if(A=H,T=CC({axis:s,ticks:c,bandSize:a,offset:p.offset,entry:O,index:P}),k=te-H,D=p.size,M={x:i.x,y:T,width:i.width,height:D},Math.abs(F)>0&&Math.abs(k)<Math.abs(F)){var ce=$r(k||F)*(Math.abs(F)-Math.abs(k));k+=ce}}return Zt(Zt(Zt({},O),{},{x:A,y:T,width:k,height:D,value:u?C:C[1],payload:O,background:M},N&&N[P]&&N[P].props),{},{tooltipPayload:[LF(r,O)],tooltipPosition:{x:A+k/2,y:T+D/2}})});return Zt({data:E,layout:y},m)});function fd(e){"@babel/helpers - typeof";return fd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fd(e)}function QNe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p4(n.key),n)}}function JNe(e,t,r){return t&&FO(e.prototype,t),r&&FO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function BO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Vn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?BO(Object(r),!0).forEach(function(n){Bv(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):BO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Bv(e,t,r){return t=p4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p4(e){var t=eEe(e,"string");return fd(t)=="symbol"?t:t+""}function eEe(e,t){if(fd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(fd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var v4=function(t,r,n,a,i){var s=t.width,l=t.height,c=t.layout,u=t.children,d=Object.keys(r),f={left:n.left,leftMirror:n.left,right:s-n.right,rightMirror:s-n.right,top:n.top,topMirror:n.top,bottom:l-n.bottom,bottomMirror:l-n.bottom},m=!!nn(u,as);return d.reduce(function(p,y){var v=r[y],g=v.orientation,x=v.domain,b=v.padding,j=b===void 0?{}:b,w=v.mirror,S=v.reversed,_="".concat(g).concat(w?"Mirror":""),N,E,O,P,C;if(v.type==="number"&&(v.padding==="gap"||v.padding==="no-gap")){var A=x[1]-x[0],T=1/0,k=v.categoricalDomain.sort();if(k.forEach(function(re,H){H>0&&(T=Math.min((re||0)-(k[H-1]||0),T))}),Number.isFinite(T)){var D=T/A,M=v.layout==="vertical"?n.height:n.width;if(v.padding==="gap"&&(N=D*M/2),v.padding==="no-gap"){var F=kr(t.barCategoryGap,D*M),q=D*M/2;N=q-F-(q-F)/M*F}}}a==="xAxis"?E=[n.left+(j.left||0)+(N||0),n.left+n.width-(j.right||0)-(N||0)]:a==="yAxis"?E=c==="horizontal"?[n.top+n.height-(j.bottom||0),n.top+(j.top||0)]:[n.top+(j.top||0)+(N||0),n.top+n.height-(j.bottom||0)-(N||0)]:E=v.range,S&&(E=[E[1],E[0]]);var I=kF(v,i,m),K=I.scale,W=I.realScaleType;K.domain(x).range(E),MF(K);var R=IF(K,Vn(Vn({},v),{},{realScaleType:W}));a==="xAxis"?(C=g==="top"&&!w||g==="bottom"&&w,O=n.left,P=f[_]-C*v.height):a==="yAxis"&&(C=g==="left"&&!w||g==="right"&&w,O=f[_]-C*v.width,P=n.top);var V=Vn(Vn(Vn({},v),R),{},{realScaleType:W,x:O,y:P,scale:K,width:a==="xAxis"?n.width:v.width,height:a==="yAxis"?n.height:v.height});return V.bandSize=uh(V,R),!v.hide&&a==="xAxis"?f[_]+=(C?-1:1)*V.height:v.hide||(f[_]+=(C?-1:1)*V.width),Vn(Vn({},p),{},Bv({},y,V))},{})},g4=function(t,r){var n=t.x,a=t.y,i=r.x,s=r.y;return{x:Math.min(n,i),y:Math.min(a,s),width:Math.abs(i-n),height:Math.abs(s-a)}},tEe=function(t){var r=t.x1,n=t.y1,a=t.x2,i=t.y2;return g4({x:r,y:n},{x:a,y:i})},y4=function(){function e(t){QNe(this,e),this.scale=t}return JNe(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.bandAware,i=n.position;if(r!==void 0){if(i)switch(i){case"start":return this.scale(r);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+s}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(r)+l}default:return this.scale(r)}if(a){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),a=n[0],i=n[n.length-1];return a<=i?r>=a&&r<=i:r>=i&&r<=a}}],[{key:"create",value:function(r){return new e(r)}}])}();Bv(y4,"EPS",1e-4);var s1=function(t){var r=Object.keys(t).reduce(function(n,a){return Vn(Vn({},n),{},Bv({},a,y4.create(t[a])))},{});return Vn(Vn({},r),{},{apply:function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=i.bandAware,l=i.position;return wNe(a,function(c,u){return r[u].apply(c,{bandAware:s,position:l})})},isInRange:function(a){return d4(a,function(i,s){return r[s].isInRange(i)})}})};function rEe(e){return(e%180+180)%180}var nEe=function(t){var r=t.width,n=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=rEe(a),s=i*Math.PI/180,l=Math.atan(n/r),c=s>l&&s<Math.PI-l?n/Math.sin(s):r/Math.cos(s);return Math.abs(c)},aEe=Aa,iEe=Vd,oEe=yv;function sEe(e){return function(t,r,n){var a=Object(t);if(!iEe(t)){var i=aEe(r);t=oEe(t),r=function(l){return i(a[l],l,a)}}var s=e(t,r,n);return s>-1?a[i?t[s]:s]:void 0}}var lEe=sEe,cEe=s4;function uEe(e){var t=cEe(e),r=t%1;return t===t?r?t-r:t:0}
620var dEe=uEe,fEe=hL,mEe=Aa,hEe=dEe,pEe=Math.max;function vEe(e,t,r){var n=e==null?0:e.length;if(!n)return-1;var a=r==null?0:hEe(r);return a<0&&(a=pEe(n+a,0)),fEe(e,mEe(t),a)}var gEe=vEe,yEe=lEe,xEe=gEe,bEe=yEe(xEe),wEe=bEe;const jEe=pt(wEe);var SEe=Mie(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),l1=h.createContext(void 0),c1=h.createContext(void 0),x4=h.createContext(void 0),b4=h.createContext({}),w4=h.createContext(void 0),j4=h.createContext(0),S4=h.createContext(0),zO=function(t){var r=t.state,n=r.xAxisMap,a=r.yAxisMap,i=r.offset,s=t.clipPathId,l=t.children,c=t.width,u=t.height,d=SEe(i);return $.createElement(l1.Provider,{value:n},$.createElement(c1.Provider,{value:a},$.createElement(b4.Provider,{value:i},$.createElement(x4.Provider,{value:d},$.createElement(w4.Provider,{value:s},$.createElement(j4.Provider,{value:u},$.createElement(S4.Provider,{value:c},l)))))))},_Ee=function(){return h.useContext(w4)},_4=function(t){var r=h.useContext(l1);r==null&&Bi();var n=r[t];return n==null&&Bi(),n},NEe=function(){var t=h.useContext(l1);return xi(t)},EEe=function(){var t=h.useContext(c1),r=jEe(t,function(n){return d4(n.domain,Number.isFinite)});return r||xi(t)},N4=function(t){var r=h.useContext(c1);r==null&&Bi();var n=r[t];return n==null&&Bi(),n},CEe=function(){var t=h.useContext(x4);return t},OEe=function(){return h.useContext(b4)},u1=function(){return h.useContext(S4)},d1=function(){return h.useContext(j4)};function jl(e){"@babel/helpers - typeof";return jl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jl(e)}function PEe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function AEe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,C4(n.key),n)}}function TEe(e,t,r){return t&&AEe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function DEe(e,t,r){return t=Oh(t),$Ee(e,E4()?Reflect.construct(t,r||[],Oh(e).constructor):t.apply(e,r))}function $Ee(e,t){if(t&&(jl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kEe(e)}function kEe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(E4=function(){return!!e})()}function Oh(e){return Oh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Oh(e)}function MEe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ib(e,t)}function Ib(e,t){return Ib=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Ib(e,t)}function qO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function UO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qO(Object(r),!0).forEach(function(n){f1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function f1(e,t,r){return t=C4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function C4(e){var t=IEe(e,"string");return jl(t)=="symbol"?t:t+""}function IEe(e,t){if(jl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(jl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function REe(e,t){return zEe(e)||BEe(e,t)||FEe(e,t)||LEe()}
vendor: 1,908 bytes, lines 620-621
620function LEe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 621In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FEe(e,t){if(e){if(typeof e=="string")return WO(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return WO(e,t)}}function WO(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function BEe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function zEe(e){if(Array.isArray(e))return e}function Rb(){return Rb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Rb.apply(this,arguments)}var qEe=function(t,r){var n;return $.isValidElement(t)?n=$.cloneElement(t,r):Ge(t)?n=t(r):n=$.createElement("line",Rb({},r,{className:"recharts-reference-line-line"})),n},UEe=function(t,r,n,a,i,s,l,c,u){var d=i.x,f=i.y,m=i.width,p=i.height;if(n){var y=u.y,v=t.y.apply(y,{position:s});if(ba(u,"discard")&&!t.y.isInRange(v))return null;var g=[{x:d+m,y:v},{x:d,y:v}];return c==="left"?g.reverse():g}if(r){var x=u.x,b=t.x.apply(x,{position:s});if(ba(u,"discard")&&!t.x.isInRange(b))return null;var j=[{x:b,y:f+p},{x:b,y:f}];return l==="top"?j.reverse():j}if(a){var w=u.segment,S=w.map(function(_){return t.apply(_,{position:s})});return ba(u,"discard")&&mNe(S,function(_){return!t.isInRange(_)})?null:S}
621return null};function WEe(e){var t=e.x,r=e.y,n=e.segment,a=e.xAxisId,i=e.yAxisId,s=e.shape,l=e.className,c=e.alwaysShow,u=_Ee(),d=_4(a),f=N4(i),m=CEe();if(!u||!m)return null;ea(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var p=s1({x:d.scale,y:f.scale}),y=ir(t),v=ir(r),g=n&&n.length===2,x=UEe(p,y,v,g,m,e.position,d.orientation,f.orientation,e);if(!x)return null;var b=REe(x,2),j=b[0],w=j.x,S=j.y,_=b[1],N=_.x,E=_.y,O=ba(e,"hidden")?"url(#".concat(u,")"):void 0,P=UO(UO({clipPath:O},ze(e,!0)),{},{x1:w,y1:S,x2:N,y2:E});return $.createElement(ct,{className:Qe("recharts-reference-line",l)},qEe(s,P),cr.renderCallByParent(e,tEe({x1:w,y1:S,x2:N,y2:E})))}var m1=function(e){function t(){return PEe(this,t),DEe(this,t,arguments)}return MEe(t,e),TEe(t,[{key:"render",value:function(){return $.createElement(WEe,this.props)}}])}($.Component);f1(m1,"displayName","ReferenceLine");f1(m1,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});
vendor: 84,890 bytes, lines 621-625
621function Lb(){return Lb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Lb.apply(this,arguments)}function Sl(e){"@babel/helpers - typeof";return Sl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sl(e)}function VO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function GO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?VO(Object(r),!0).forEach(function(n){zv(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):VO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function VEe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function GEe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,P4(n.key),n)}}function HEe(e,t,r){return t&&GEe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function KEe(e,t,r){return t=Ph(t),YEe(e,O4()?Reflect.construct(t,r||[],Ph(e).constructor):t.apply(e,r))}function YEe(e,t){if(t&&(Sl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return XEe(e)}function XEe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function O4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(O4=function(){return!!e})()}function Ph(e){return Ph=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ph(e)}function ZEe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Fb(e,t)}function Fb(e,t){return Fb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Fb(e,t)}function zv(e,t,r){return t=P4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function P4(e){var t=QEe(e,"string");return Sl(t)=="symbol"?t:t+""}function QEe(e,t){if(Sl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Sl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var JEe=function(t){var r=t.x,n=t.y,a=t.xAxis,i=t.yAxis,s=s1({x:a.scale,y:i.scale}),l=s.apply({x:r,y:n},{bandAware:!0});return ba(t,"discard")&&!s.isInRange(l)?null:l},qv=function(e){function t(){return VEe(this,t),KEe(this,t,arguments)}return ZEe(t,e),HEe(t,[{key:"render",value:function(){var n=this.props,a=n.x,i=n.y,s=n.r,l=n.alwaysShow,c=n.clipPathId,u=ir(a),d=ir(i);if(ea(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var f=JEe(this.props);if(!f)return null;var m=f.x,p=f.y,y=this.props,v=y.shape,g=y.className,x=ba(this.props,"hidden")?"url(#".concat(c,")"):void 0,b=GO(GO({clipPath:x},ze(this.props,!0)),{},{cx:m,cy:p});return $.createElement(ct,{className:Qe("recharts-reference-dot",g)},t.renderDot(v,b),cr.renderCallByParent(this.props,{x:m-s,y:p-s,width:2*s,height:2*s}))}}])}($.Component);zv(qv,"displayName","ReferenceDot");zv(qv,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});zv(qv,"renderDot",function(e,t){var r;return $.isValidElement(e)?r=$.cloneElement(e,t):Ge(e)?r=e(t):r=$.createElement($v,Lb({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),r});function Bb(){return Bb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Bb.apply(this,arguments)}function _l(e){"@babel/helpers - typeof";return _l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_l(e)}function HO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function KO(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?HO(Object(r),!0).forEach(function(n){Uv(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):HO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function eCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tCe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,T4(n.key),n)}}function rCe(e,t,r){return t&&tCe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function nCe(e,t,r){return t=Ah(t),aCe(e,A4()?Reflect.construct(t,r||[],Ah(e).constructor):t.apply(e,r))}function aCe(e,t){if(t&&(_l(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iCe(e)}function iCe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(A4=function(){return!!e})()}function Ah(e){return Ah=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ah(e)}function oCe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&zb(e,t)}function zb(e,t){return zb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},zb(e,t)}function Uv(e,t,r){return t=T4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function T4(e){var t=sCe(e,"string");return _l(t)=="symbol"?t:t+""}function sCe(e,t){if(_l(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(_l(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var lCe=function(t,r,n,a,i){var s=i.x1,l=i.x2,c=i.y1,u=i.y2,d=i.xAxis,f=i.yAxis;if(!d||!f)return null;var m=s1({x:d.scale,y:f.scale}),p={x:t?m.x.apply(s,{position:"start"}):m.x.rangeMin,y:n?m.y.apply(c,{position:"start"}):m.y.rangeMin},y={x:r?m.x.apply(l,{position:"end"}):m.x.rangeMax,y:a?m.y.apply(u,{position:"end"}):m.y.rangeMax};return ba(i,"discard")&&(!m.isInRange(p)||!m.isInRange(y))?null:g4(p,y)},Wv=function(e){function t(){return eCe(this,t),nCe(this,t,arguments)}return oCe(t,e),rCe(t,[{key:"render",value:function(){var n=this.props,a=n.x1,i=n.x2,s=n.y1,l=n.y2,c=n.className,u=n.alwaysShow,d=n.clipPathId;ea(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=ir(a),m=ir(i),p=ir(s),y=ir(l),v=this.props.shape;if(!f&&!m&&!p&&!y&&!v)return null;var g=lCe(f,m,p,y,this.props);if(!g&&!v)return null;var x=ba(this.props,"hidden")?"url(#".concat(d,")"):void 0;return $.createElement(ct,{className:Qe("recharts-reference-area",c)},t.renderRect(v,KO(KO({clipPath:x},ze(this.props,!0)),g)),cr.renderCallByParent(this.props,g))}}])}($.Component);Uv(Wv,"displayName","ReferenceArea");Uv(Wv,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});Uv(Wv,"renderRect",function(e,t){var r;return $.isValidElement(e)?r=$.cloneElement(e,t):Ge(e)?r=e(t):r=$.createElement(o1,Bb({},t,{className:"recharts-reference-area-rect"})),r});function D4(e,t,r){if(t<1)return[];if(t===1&&r===void 0)return e;for(var n=[],a=0;a<e.length;a+=t)n.push(e[a]);return n}function cCe(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return nEe(n,r)}function uCe(e,t,r){var n=r==="width",a=e.x,i=e.y,s=e.width,l=e.height;return t===1?{start:n?a:i,end:n?a+s:i+l}:{start:n?a+s:i+l,end:n?a:i}}function Th(e,t,r,n,a){if(e*t<e*n||e*t>e*a)return!1;var i=r();return e*(t-e*i/2-n)>=0&&e*(t+e*i/2-a)<=0}function dCe(e,t){return D4(e,t+1)}function fCe(e,t,r,n,a){for(var i=(n||[]).slice(),s=t.start,l=t.end,c=0,u=1,d=s,f=function(){var y=n==null?void 0:n[c];if(y===void 0)return{v:D4(n,u)};var v=c,g,x=function(){return g===void 0&&(g=r(y,v)),g},b=y.coordinate,j=c===0||Th(e,b,x,d,l);j||(c=0,d=s,u+=1),j&&(d=b+e*(x()/2+a),c+=u)},m;u<=i.length;)if(m=f(),m)return m.v;return[]}function md(e){"@babel/helpers - typeof";return md=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},md(e)}function YO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function jr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?YO(Object(r),!0).forEach(function(n){mCe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mCe(e,t,r){return t=hCe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hCe(e){var t=pCe(e,"string");return md(t)=="symbol"?t:t+""}function pCe(e,t){if(md(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(md(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vCe(e,t,r,n,a){for(var i=(n||[]).slice(),s=i.length,l=t.start,c=t.end,u=function(m){var p=i[m],y,v=function(){return y===void 0&&(y=r(p,m)),y};if(m===s-1){var g=e*(p.coordinate+e*v()/2-c);i[m]=p=jr(jr({},p),{},{tickCoord:g>0?p.coordinate-g*e:p.coordinate})}else i[m]=p=jr(jr({},p),{},{tickCoord:p.coordinate});var x=Th(e,p.tickCoord,v,l,c);x&&(c=p.tickCoord-e*(v()/2+a),i[m]=jr(jr({},p),{},{isShow:!0}))},d=s-1;d>=0;d--)u(d);return i}function gCe(e,t,r,n,a,i){var s=(n||[]).slice(),l=s.length,c=t.start,u=t.end;if(i){var d=n[l-1],f=r(d,l-1),m=e*(d.coordinate+e*f/2-u);s[l-1]=d=jr(jr({},d),{},{tickCoord:m>0?d.coordinate-m*e:d.coordinate});var p=Th(e,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-e*(f/2+a),s[l-1]=jr(jr({},d),{},{isShow:!0}))}for(var y=i?l-1:l,v=function(b){var j=s[b],w,S=function(){return w===void 0&&(w=r(j,b)),w};if(b===0){var _=e*(j.coordinate-e*S()/2-c);s[b]=j=jr(jr({},j),{},{tickCoord:_<0?j.coordinate-_*e:j.coordinate})}else s[b]=j=jr(jr({},j),{},{tickCoord:j.coordinate});var N=Th(e,j.tickCoord,S,c,u);N&&(c=j.tickCoord+e*(S()/2+a),s[b]=jr(jr({},j),{},{isShow:!0}))},g=0;g<y;g++)v(g);return s}function h1(e,t,r){var n=e.tick,a=e.ticks,i=e.viewBox,s=e.minTickGap,l=e.orientation,c=e.interval,u=e.tickFormatter,d=e.unit,f=e.angle;if(!a||!a.length||!n)return[];if(he(c)||ya.isSsr)return dCe(a,typeof c=="number"&&he(c)?c:0);var m=[],p=l==="top"||l==="bottom"?"width":"height",y=d&&p==="width"?Yc(d,{fontSize:t,letterSpacing:r}):{width:0,height:0},v=function(j,w){var S=Ge(u)?u(j.value,w):j.value;return p==="width"?cCe(Yc(S,{fontSize:t,letterSpacing:r}),y,f):Yc(S,{fontSize:t,letterSpacing:r})[p]},g=a.length>=2?$r(a[1].coordinate-a[0].coordinate):1,x=uCe(i,g,p);return c==="equidistantPreserveStart"?fCe(g,x,v,a,s):(c==="preserveStart"||c==="preserveStartEnd"?m=gCe(g,x,v,a,s,c==="preserveStartEnd"):m=vCe(g,x,v,a,s),m.filter(function(b){return b.isShow}))}var yCe=["viewBox"],xCe=["viewBox"],bCe=["ticks"];function Nl(e){"@babel/helpers - typeof";return Nl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nl(e)}function Es(){return Es=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Es.apply(this,arguments)}function XO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Or(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?XO(Object(r),!0).forEach(function(n){p1(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):XO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hy(e,t){if(e==null)return{};var r=wCe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function wCe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function jCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ZO(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,k4(n.key),n)}}function SCe(e,t,r){return t&&ZO(e.prototype,t),r&&ZO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _Ce(e,t,r){return t=Dh(t),NCe(e,$4()?Reflect.construct(t,r||[],Dh(e).constructor):t.apply(e,r))}function NCe(e,t){if(t&&(Nl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ECe(e)}function ECe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($4=function(){return!!e})()}function Dh(e){return Dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Dh(e)}function CCe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&qb(e,t)}function qb(e,t){return qb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},qb(e,t)}function p1(e,t,r){return t=k4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k4(e){var t=OCe(e,"string");return Nl(t)=="symbol"?t:t+""}function OCe(e,t){if(Nl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Nl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var lc=function(e){function t(r){var n;return jCe(this,t),n=_Ce(this,t,[r]),n.state={fontSize:"",letterSpacing:""},n}return CCe(t,e),SCe(t,[{key:"shouldComponentUpdate",value:function(n,a){var i=n.viewBox,s=hy(n,yCe),l=this.props,c=l.viewBox,u=hy(l,xCe);return!$s(i,c)||!$s(s,u)||!$s(a,this.state)}},{key:"componentDidMount",value:function(){var n=this.layerReference;if(n){var a=n.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];a&&this.setState({fontSize:window.getComputedStyle(a).fontSize,letterSpacing:window.getComputedStyle(a).letterSpacing})}}},{key:"getTickLineCoord",value:function(n){var a=this.props,i=a.x,s=a.y,l=a.width,c=a.height,u=a.orientation,d=a.tickSize,f=a.mirror,m=a.tickMargin,p,y,v,g,x,b,j=f?-1:1,w=n.tickSize||d,S=he(n.tickCoord)?n.tickCoord:n.coordinate;switch(u){case"top":p=y=n.coordinate,g=s+ +!f*c,v=g-j*w,b=v-j*m,x=S;break;case"left":v=g=n.coordinate,y=i+ +!f*l,p=y-j*w,x=p-j*m,b=S;break;case"right":v=g=n.coordinate,y=i+ +f*l,p=y+j*w,x=p+j*m,b=S;break;default:p=y=n.coordinate,g=s+ +f*c,v=g+j*w,b=v+j*m,x=S;break}return{line:{x1:p,y1:v,x2:y,y2:g},tick:{x,y:b}}}},{key:"getTickTextAnchor",value:function(){var n=this.props,a=n.orientation,i=n.mirror,s;switch(a){case"left":s=i?"start":"end";break;case"right":s=i?"end":"start";break;default:s="middle";break}return s}},{key:"getTickVerticalAnchor",value:function(){var n=this.props,a=n.orientation,i=n.mirror,s="end";switch(a){case"left":case"right":s="middle";break;case"top":s=i?"start":"end";break;default:s=i?"end":"start";break}return s}},{key:"renderAxisLine",value:function(){var n=this.props,a=n.x,i=n.y,s=n.width,l=n.height,c=n.orientation,u=n.mirror,d=n.axisLine,f=Or(Or(Or({},ze(this.props,!1)),ze(d,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var m=+(c==="top"&&!u||c==="bottom"&&u);f=Or(Or({},f),{},{x1:a,y1:i+m*l,x2:a+s,y2:i+m*l})}else{var p=+(c==="left"&&!u||c==="right"&&u);f=Or(Or({},f),{},{x1:a+p*s,y1:i,x2:a+p*s,y2:i+l})}return $.createElement("line",Es({},f,{className:Qe("recharts-cartesian-axis-line",dn(d,"className"))}))}},{key:"renderTicks",value:function(n,a,i){var s=this,l=this.props,c=l.tickLine,u=l.stroke,d=l.tick,f=l.tickFormatter,m=l.unit,p=h1(Or(Or({},this.props),{},{ticks:n}),a,i),y=this.getTickTextAnchor(),v=this.getTickVerticalAnchor(),g=ze(this.props,!1),x=ze(d,!1),b=Or(Or({},g),{},{fill:"none"},ze(c,!1)),j=p.map(function(w,S){var _=s.getTickLineCoord(w),N=_.line,E=_.tick,O=Or(Or(Or(Or({textAnchor:y,verticalAnchor:v},g),{},{stroke:"none",fill:u},x),E),{},{index:S,payload:w,visibleTicksCount:p.length,tickFormatter:f});return $.createElement(ct,Es({className:"recharts-cartesian-axis-tick",key:"tick-".concat(w.value,"-").concat(w.coordinate,"-").concat(w.tickCoord)},qo(s.props,w,S)),c&&$.createElement("line",Es({},b,N,{className:Qe("recharts-cartesian-axis-tick-line",dn(c,"className"))})),d&&t.renderTickItem(d,O,"".concat(Ge(f)?f(w.value,S):w.value).concat(m||"")))});return $.createElement("g",{className:"recharts-cartesian-axis-ticks"},j)}},{key:"render",value:function(){var n=this,a=this.props,i=a.axisLine,s=a.width,l=a.height,c=a.ticksGenerator,u=a.className,d=a.hide;if(d)return null;var f=this.props,m=f.ticks,p=hy(f,bCe),y=m;return Ge(c)&&(y=m&&m.length>0?c(this.props):c(p)),s<=0||l<=0||!y||!y.length?null:$.createElement(ct,{className:Qe("recharts-cartesian-axis",u),ref:function(g){n.layerReference=g}},i&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),cr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,a,i){var s;return $.isValidElement(n)?s=$.cloneElement(n,a):Ge(n)?s=n(a):s=$.createElement(Uo,Es({},a,{className:"recharts-cartesian-axis-tick-value"}),i),s}}])}(h.Component);p1(lc,"displayName","CartesianAxis");p1(lc,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var PCe=["x1","y1","x2","y2","key"],ACe=["offset"];function Vo(e){"@babel/helpers - typeof";return Vo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vo(e)}function QO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Sr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?QO(Object(r),!0).forEach(function(n){TCe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):QO(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function TCe(e,t,r){return t=DCe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function DCe(e){var t=$Ce(e,"string");return Vo(t)=="symbol"?t:t+""}function $Ce(e,t){if(Vo(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Vo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function go(){return go=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},go.apply(this,arguments)}function JO(e,t){if(e==null)return{};var r=kCe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function kCe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var MCe=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,a=t.x,i=t.y,s=t.width,l=t.height,c=t.ry;return $.createElement("rect",{x:a,y:i,ry:c,width:s,height:l,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function M4(e,t){var r;if($.isValidElement(e))r=$.cloneElement(e,t);else if(Ge(e))r=e(t);else{var n=t.x1,a=t.y1,i=t.x2,s=t.y2,l=t.key,c=JO(t,PCe),u=ze(c,!1);u.offset;var d=JO(u,ACe);r=$.createElement("line",go({},d,{x1:n,y1:a,x2:i,y2:s,fill:"none",key:l}))}return r}function ICe(e){var t=e.x,r=e.width,n=e.horizontal,a=n===void 0?!0:n,i=e.horizontalPoints;if(!a||!i||!i.length)return null;var s=i.map(function(l,c){var u=Sr(Sr({},e),{},{x1:t,y1:l,x2:t+r,y2:l,key:"line-".concat(c),index:c});return M4(a,u)});return $.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function RCe(e){var t=e.y,r=e.height,n=e.vertical,a=n===void 0?!0:n,i=e.verticalPoints;if(!a||!i||!i.length)return null;var s=i.map(function(l,c){var u=Sr(Sr({},e),{},{x1:l,y1:t,x2:l,y2:t+r,key:"line-".concat(c),index:c});return M4(a,u)});return $.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function LCe(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,a=e.y,i=e.width,s=e.height,l=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var d=l.map(function(m){return Math.round(m+a-a)}).sort(function(m,p){return m-p});a!==d[0]&&d.unshift(0);var f=d.map(function(m,p){var y=!d[p+1],v=y?a+s-m:d[p+1]-m;if(v<=0)return null;var g=p%t.length;return $.createElement("rect",{key:"react-".concat(p),y:m,x:n,height:v,width:i,stroke:"none",fill:t[g],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return $.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function FCe(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,a=e.fillOpacity,i=e.x,s=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!r||!n||!n.length)return null;var d=u.map(function(m){return Math.round(m+i-i)}).sort(function(m,p){return m-p});i!==d[0]&&d.unshift(0);var f=d.map(function(m,p){var y=!d[p+1],v=y?i+l-m:d[p+1]-m;if(v<=0)return null;var g=p%n.length;return $.createElement("rect",{key:"react-".concat(p),x:m,y:s,width:v,height:c,stroke:"none",fill:n[g],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return $.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var BCe=function(t,r){var n=t.xAxis,a=t.width,i=t.height,s=t.offset;return $F(h1(Sr(Sr(Sr({},lc.defaultProps),n),{},{ticks:qa(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),s.left,s.left+s.width,r)},zCe=function(t,r){var n=t.yAxis,a=t.width,i=t.height,s=t.offset;return $F(h1(Sr(Sr(Sr({},lc.defaultProps),n),{},{ticks:qa(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),s.top,s.top+s.height,r)},ys={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Ub(e){var t,r,n,a,i,s,l=u1(),c=d1(),u=OEe(),d=Sr(Sr({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:ys.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:ys.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:ys.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:ys.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:ys.vertical,verticalFill:(s=e.verticalFill)!==null&&s!==void 0?s:ys.verticalFill,x:he(e.x)?e.x:u.left,y:he(e.y)?e.y:u.top,width:he(e.width)?e.width:u.width,height:he(e.height)?e.height:u.height}),f=d.x,m=d.y,p=d.width,y=d.height,v=d.syncWithTicks,g=d.horizontalValues,x=d.verticalValues,b=NEe(),j=EEe();if(!he(p)||p<=0||!he(y)||y<=0||!he(f)||f!==+f||!he(m)||m!==+m)return null;var w=d.verticalCoordinatesGenerator||BCe,S=d.horizontalCoordinatesGenerator||zCe,_=d.horizontalPoints,N=d.verticalPoints;if((!_||!_.length)&&Ge(S)){var E=g&&g.length,O=S({yAxis:j?Sr(Sr({},j),{},{ticks:E?g:j.ticks}):void 0,width:l,height:c,offset:u},E?!0:v);ea(Array.isArray(O),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Vo(O),"]")),Array.isArray(O)&&(_=O)}if((!N||!N.length)&&Ge(w)){var P=x&&x.length,C=w({xAxis:b?Sr(Sr({},b),{},{ticks:P?x:b.ticks}):void 0,width:l,height:c,offset:u},P?!0:v);ea(Array.isArray(C),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Vo(C),"]")),Array.isArray(C)&&(N=C)}return $.createElement("g",{className:"recharts-cartesian-grid"},$.createElement(MCe,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),$.createElement(ICe,go({},d,{offset:u,horizontalPoints:_,xAxis:b,yAxis:j})),$.createElement(RCe,go({},d,{offset:u,verticalPoints:N,xAxis:b,yAxis:j})),$.createElement(LCe,go({},d,{horizontalPoints:_})),$.createElement(FCe,go({},d,{verticalPoints:N})))}Ub.displayName="CartesianGrid";var qCe=["type","layout","connectNulls","ref"],UCe=["key"];function El(e){"@babel/helpers - typeof";return El=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},El(e)}function eP(e,t){if(e==null)return{};var r=WCe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function WCe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function tu(){return tu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},tu.apply(this,arguments)}function tP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Jr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tP(Object(r),!0).forEach(function(n){Gn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xs(e){return KCe(e)||HCe(e)||GCe(e)||VCe()}function VCe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 622In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GCe(e,t){if(e){if(typeof e=="string")return Wb(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Wb(e,t)}}function HCe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function KCe(e){if(Array.isArray(e))return Wb(e)}function Wb(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function YCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,R4(n.key),n)}}function XCe(e,t,r){return t&&rP(e.prototype,t),r&&rP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ZCe(e,t,r){return t=$h(t),QCe(e,I4()?Reflect.construct(t,r||[],$h(e).constructor):t.apply(e,r))}function QCe(e,t){if(t&&(El(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return JCe(e)}function JCe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function I4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(I4=function(){return!!e})()}function $h(e){return $h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$h(e)}function eOe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Vb(e,t)}function Vb(e,t){return Vb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Vb(e,t)}function Gn(e,t,r){return t=R4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R4(e){var t=tOe(e,"string");return El(t)=="symbol"?t:t+""}function tOe(e,t){if(El(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(El(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Po=function(e){function t(){var r;YCe(this,t);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=ZCe(this,t,[].concat(a)),Gn(r,"state",{isAnimationFinished:!0,totalLength:0}),Gn(r,"generateSimpleStrokeDasharray",function(s,l){return"".concat(l,"px ").concat(s-l,"px")}),Gn(r,"getStrokeDasharray",function(s,l,c){var u=c.reduce(function(x,b){return x+b});if(!u)return r.generateSimpleStrokeDasharray(l,s);for(var d=Math.floor(s/u),f=s%u,m=l-s,p=[],y=0,v=0;y<c.length;v+=c[y],++y)if(v+c[y]>f){p=[].concat(xs(c.slice(0,y)),[f-v]);break}var g=p.length%2===0?[0,m]:[m];return[].concat(xs(t.repeat(c,d)),xs(p),g).map(function(x){return"".concat(x,"px")}).join(", ")}),Gn(r,"id",ec("recharts-line-")),Gn(r,"pathRef",function(s){r.mainCurve=s}),Gn(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Gn(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return eOe(t,e),XCe(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,s=i.points,l=i.xAxis,c=i.yAxis,u=i.layout,d=i.children,f=fn(d,Zd);if(!f)return null;var m=function(v,g){return{x:v.x,y:v.y,value:v.value,errorVal:ar(v.payload,g)}},p={clipPath:n?"url(#clipPath-".concat(a,")"):null};return $.createElement(ct,p,f.map(function(y){return $.cloneElement(y,{key:"bar-".concat(y.props.dataKey),data:s,xAxis:l,yAxis:c,layout:u,dataPointFormatter:m})}))}},{key:"renderDots",value:function(n,a,i){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,u=l.points,d=l.dataKey,f=ze(this.props,!1),m=ze(c,!0),p=u.map(function(v,g){var x=Jr(Jr(Jr({key:"dot-".concat(g),r:3},f),m),{},{value:v.value,dataKey:d,cx:v.x,cy:v.y,index:g,payload:v.payload});return t.renderDotItem(c,x)}),y={clipPath:n?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return $.createElement(ct,tu({className:"recharts-line-dots",key:"dots"},y),p)}},{key:"renderCurveStatically",value:function(n,a,i,s){var l=this.props,c=l.type,u=l.layout,d=l.connectNulls;l.ref;var f=eP(l,qCe),m=Jr(Jr(Jr({},ze(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(i,")"):null,points:n},s),{},{type:c,layout:u,connectNulls:d});return $.createElement(mh,tu({},m,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,a){var i=this,s=this.props,l=s.points,c=s.strokeDasharray,u=s.isAnimationActive,d=s.animationBegin,f=s.animationDuration,m=s.animationEasing,p=s.animationId,y=s.animateNewValues,v=s.width,g=s.height,x=this.state,b=x.prevPoints,j=x.totalLength;return $.createElement(Ea,{begin:d,duration:f,isActive:u,easing:m,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(w){var S=w.t;if(b){var _=b.length/l.length,N=l.map(function(A,T){var k=Math.floor(T*_);if(b[k]){var D=b[k],M=an(D.x,A.x),F=an(D.y,A.y);return Jr(Jr({},A),{},{x:M(S),y:F(S)})}if(y){var q=an(v*2,A.x),I=an(g/2,A.y);return Jr(Jr({},A),{},{x:q(S),y:I(S)})}return Jr(Jr({},A),{},{x:A.x,y:A.y})});return i.renderCurveStatically(N,n,a)}var E=an(0,j),O=E(S),P;if(c){var C="".concat(c).split(/[,\s]+/gim).map(function(A){return parseFloat(A)});P=i.getStrokeDasharray(O,j,C)}else P=i.generateSimpleStrokeDasharray(j,O);return i.renderCurveStatically(l,n,a,{strokeDasharray:P})})}},{key:"renderCurve",value:function(n,a){var i=this.props,s=i.points,l=i.isAnimationActive,c=this.state,u=c.prevPoints,d=c.totalLength;return l&&s&&s.length&&(!u&&d>0||!Xd(u,s))?this.renderCurveWithAnimation(n,a):this.renderCurveStatically(s,n,a)}},{key:"render",value:function(){var n,a=this.props,i=a.hide,s=a.dot,l=a.points,c=a.className,u=a.xAxis,d=a.yAxis,f=a.top,m=a.left,p=a.width,y=a.height,v=a.isAnimationActive,g=a.id;if(i||!l||!l.length)return null;var x=this.state.isAnimationFinished,b=l.length===1,j=Qe("recharts-line",c),w=u&&u.allowDataOverflow,S=d&&d.allowDataOverflow,_=w||S,N=Ye(g)?this.id:g,E=(n=ze(s,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},O=E.r,P=O===void 0?3:O,C=E.strokeWidth,A=C===void 0?2:C,T=Boe(s)?s:{},k=T.clipDot,D=k===void 0?!0:k,M=P*2+A;return $.createElement(ct,{className:j},w||S?$.createElement("defs",null,$.createElement("clipPath",{id:"clipPath-".concat(N)},$.createElement("rect",{x:w?m:m-p/2,y:S?f:f-y/2,width:w?p:p*2,height:S?y:y*2})),!D&&$.createElement("clipPath",{id:"clipPath-dots-".concat(N)},$.createElement("rect",{x:m-M/2,y:f-M/2,width:p+M,height:y+M}))):null,!b&&this.renderCurve(_,N),this.renderErrorBar(_,N),(b||s)&&this.renderDots(_,D,N),(!v||x)&&Ga.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:a.curPoints}:n.points!==a.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,a){for(var i=n.length%2!==0?[].concat(xs(n),[0]):n,s=[],l=0;l<a;++l)s=[].concat(xs(s),xs(i));return s}},{key:"renderDotItem",value:function(n,a){var i;if($.isValidElement(n))i=$.cloneElement(n,a);else if(Ge(n))i=n(a);else{var s=a.key,l=eP(a,UCe),c=Qe("recharts-line-dot",typeof n!="boolean"?n.className:"");i=$.createElement($v,tu({key:s},l,{className:c}))}return i}}])}(h.PureComponent);Gn(Po,"displayName","Line");Gn(Po,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!ya.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Gn(Po,"getComposedData",function(e){var t=e.props,r=e.xAxis,n=e.yAxis,a=e.xAxisTicks,i=e.yAxisTicks,s=e.dataKey,l=e.bandSize,c=e.displayedData,u=e.offset,d=t.layout,f=c.map(function(m,p){var y=ar(m,s);return d==="horizontal"?{x:EC({axis:r,ticks:a,bandSize:l,entry:m,index:p}),y:Ye(y)?null:n.scale(y),value:y,payload:m}:{x:Ye(y)?null:r.scale(y),y:EC({axis:n,ticks:i,bandSize:l,entry:m,index:p}),value:y,payload:m}});return Jr({points:f,layout:d},u)});function Cl(e){"@babel/helpers - typeof";return Cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cl(e)}function rOe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nOe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,B4(n.key),n)}}function aOe(e,t,r){return t&&nOe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function iOe(e,t,r){return t=kh(t),oOe(e,L4()?Reflect.construct(t,r||[],kh(e).constructor):t.apply(e,r))}function oOe(e,t){if(t&&(Cl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sOe(e)}function sOe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function L4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(L4=function(){return!!e})()}function kh(e){return kh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},kh(e)}function lOe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Gb(e,t)}function Gb(e,t){return Gb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Gb(e,t)}function F4(e,t,r){return t=B4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B4(e){var t=cOe(e,"string");return Cl(t)=="symbol"?t:t+""}function cOe(e,t){if(Cl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Cl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hb(){return Hb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Hb.apply(this,arguments)}function uOe(e){var t=e.xAxisId,r=u1(),n=d1(),a=_4(t);return a==null?null:$.createElement(lc,Hb({},a,{className:Qe("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(s){return qa(s,!0)}}))}var Ol=function(e){function t(){return rOe(this,t),iOe(this,t,arguments)}return lOe(t,e),aOe(t,[{key:"render",value:function(){return $.createElement(uOe,this.props)}}])}($.Component);F4(Ol,"displayName","XAxis");F4(Ol,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function Pl(e){"@babel/helpers - typeof";return Pl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pl(e)}function dOe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fOe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,U4(n.key),n)}}function mOe(e,t,r){return t&&fOe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function hOe(e,t,r){return t=Mh(t),pOe(e,z4()?Reflect.construct(t,r||[],Mh(e).constructor):t.apply(e,r))}function pOe(e,t){if(t&&(Pl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vOe(e)}function vOe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function z4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(z4=function(){return!!e})()}function Mh(e){return Mh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Mh(e)}function gOe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Kb(e,t)}function Kb(e,t){return Kb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Kb(e,t)}function q4(e,t,r){return t=U4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U4(e){var t=yOe(e,"string");return Pl(t)=="symbol"?t:t+""}function yOe(e,t){if(Pl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Pl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Yb(){return Yb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yb.apply(this,arguments)}var xOe=function(t){var r=t.yAxisId,n=u1(),a=d1(),i=N4(r);return i==null?null:$.createElement(lc,Yb({},i,{className:Qe("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:n,height:a},ticksGenerator:function(l){return qa(l,!0)}}))},Al=function(e){function t(){return dOe(this,t),hOe(this,t,arguments)}return gOe(t,e),mOe(t,[{key:"render",value:function(){return $.createElement(xOe,this.props)}}])}($.Component);q4(Al,"displayName","YAxis");q4(Al,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function nP(e){return SOe(e)||jOe(e)||wOe(e)||bOe()}function bOe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 623In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wOe(e,t){if(e){if(typeof e=="string")return Xb(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xb(e,t)}}function jOe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function SOe(e){if(Array.isArray(e))return Xb(e)}function Xb(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Zb=function(t,r,n,a,i){var s=fn(t,m1),l=fn(t,qv),c=[].concat(nP(s),nP(l)),u=fn(t,Wv),d="".concat(a,"Id"),f=a[0],m=r;if(c.length&&(m=c.reduce(function(v,g){if(g.props[d]===n&&ba(g.props,"extendDomain")&&he(g.props[f])){var x=g.props[f];return[Math.min(v[0],x),Math.max(v[1],x)]}return v},m)),u.length){var p="".concat(f,"1"),y="".concat(f,"2");m=u.reduce(function(v,g){if(g.props[d]===n&&ba(g.props,"extendDomain")&&he(g.props[p])&&he(g.props[y])){var x=g.props[p],b=g.props[y];return[Math.min(v[0],x,b),Math.max(v[1],x,b)]}return v},m)}return i&&i.length&&(m=i.reduce(function(v,g){return he(g)?[Math.min(v[0],g),Math.max(v[1],g)]:v},m)),m},W4={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function a(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function i(c,u,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new a(d,f||c,m),y=r?r+u:u;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],p]:c._events[y].push(p):(c._events[y]=p,c._eventsCount++),c}function s(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=r?r+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,p=f.length,y=new Array(p);m<p;m++)y[m]=f[m].fn;return y},l.prototype.listenerCount=function(u){var d=r?r+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,m,p,y){var v=r?r+u:u;if(!this._events[v])return!1;var g=this._events[v],x=arguments.length,b,j;if(g.fn){switch(g.once&&this.removeListener(u,g.fn,void 0,!0),x){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,d),!0;case 3:return g.fn.call(g.context,d,f),!0;case 4:return g.fn.call(g.context,d,f,m),!0;case 5:return g.fn.call(g.context,d,f,m,p),!0;case 6:return g.fn.call(g.context,d,f,m,p,y),!0}for(j=1,b=new Array(x-1);j<x;j++)b[j-1]=arguments[j];g.fn.apply(g.context,b)}else{var w=g.length,S;for(j=0;j<w;j++)switch(g[j].once&&this.removeListener(u,g[j].fn,void 0,!0),x){case 1:g[j].fn.call(g[j].context);break;case 2:g[j].fn.call(g[j].context,d);break;case 3:g[j].fn.call(g[j].context,d,f);break;case 4:g[j].fn.call(g[j].context,d,f,m);break;default:if(!b)for(S=1,b=new Array(x-1);S<x;S++)b[S-1]=arguments[S];g[j].fn.apply(g[j].context,b)}}return!0},l.prototype.on=function(u,d,f){return i(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return i(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,m){var p=r?r+u:u;if(!this._events[p])return this;if(!d)return s(this,p),this;var y=this._events[p];if(y.fn)y.fn===d&&(!m||y.once)&&(!f||y.context===f)&&s(this,p);else{for(var v=0,g=[],x=y.length;v<x;v++)(y[v].fn!==d||m&&!y[v].once||f&&y[v].context!==f)&&g.push(y[v]);g.length?this._events[p]=g.length===1?g[0]:g:s(this,p)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=r?r+u:u,this._events[d]&&s(this,d)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,e.exports=l})(W4);var _Oe=W4.exports;const NOe=pt(_Oe);var py=new NOe,vy="recharts.syncMouseEvents";function hd(e){"@babel/helpers - typeof";return hd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hd(e)}function EOe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function COe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,V4(n.key),n)}}function OOe(e,t,r){return t&&COe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function gy(e,t,r){return t=V4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function V4(e){var t=POe(e,"string");return hd(t)=="symbol"?t:t+""}function POe(e,t){if(hd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(hd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var AOe=function(){function e(){EOe(this,e),gy(this,"activeIndex",0),gy(this,"coordinateList",[]),gy(this,"layout","horizontal")}return OOe(e,[{key:"setDetails",value:function(r){var n,a=r.coordinateList,i=a===void 0?null:a,s=r.container,l=s===void 0?null:s,c=r.layout,u=c===void 0?null:c,d=r.offset,f=d===void 0?null:d,m=r.mouseHandlerCallback,p=m===void 0?null:m;this.coordinateList=(n=i??this.coordinateList)!==null&&n!==void 0?n:[],this.container=l??this.container,this.layout=u??this.layout,this.offset=f??this.offset,this.mouseHandlerCallback=p??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(r){if(this.coordinateList.length!==0)switch(r.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var a=this.container.getBoundingClientRect(),i=a.x,s=a.y,l=a.height,c=this.coordinateList[this.activeIndex].coordinate,u=((r=window)===null||r===void 0?void 0:r.scrollX)||0,d=((n=window)===null||n===void 0?void 0:n.scrollY)||0,f=i+c+u,m=s+this.offset.top+l/2+d;this.mouseHandlerCallback({pageX:f,pageY:m})}}}])}();function TOe(e,t,r){if(r==="number"&&t===!0&&Array.isArray(e)){var n=e==null?void 0:e[0],a=e==null?void 0:e[1];if(n&&a&&he(n)&&he(a))return!0}return!1}function DOe(e,t,r,n){var a=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-a:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-a,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function G4(e){var t=e.cx,r=e.cy,n=e.radius,a=e.startAngle,i=e.endAngle,s=At(t,r,n,a),l=At(t,r,n,i);return{points:[s,l],cx:t,cy:r,radius:n,startAngle:a,endAngle:i}}function $Oe(e,t,r){var n,a,i,s;if(e==="horizontal")n=t.x,i=n,a=r.top,s=r.top+r.height;else if(e==="vertical")a=t.y,s=a,n=r.left,i=r.left+r.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var l=t.cx,c=t.cy,u=t.innerRadius,d=t.outerRadius,f=t.angle,m=At(l,c,u,f),p=At(l,c,d,f);n=m.x,a=m.y,i=p.x,s=p.y}else return G4(t);return[{x:n,y:a},{x:i,y:s}]}function pd(e){"@babel/helpers - typeof";return pd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pd(e)}function aP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function kf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?aP(Object(r),!0).forEach(function(n){kOe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):aP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function kOe(e,t,r){return t=MOe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MOe(e){var t=IOe(e,"string");return pd(t)=="symbol"?t:t+""}function IOe(e,t){if(pd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(pd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ROe(e){var t,r,n=e.element,a=e.tooltipEventType,i=e.isActive,s=e.activeCoordinate,l=e.activePayload,c=e.offset,u=e.activeTooltipIndex,d=e.tooltipAxisBandSize,f=e.layout,m=e.chartName,p=(t=n.props.cursor)!==null&&t!==void 0?t:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!p||!i||!s||m!=="ScatterChart"&&a!=="axis")return null;var y,v=mh;if(m==="ScatterChart")y=s,v=tSe;else if(m==="BarChart")y=DOe(f,s,c,d),v=o1;else if(f==="radial"){var g=G4(s),x=g.cx,b=g.cy,j=g.radius,w=g.startAngle,S=g.endAngle;y={cx:x,cy:b,startAngle:w,endAngle:S,innerRadius:j,outerRadius:j},v=WF}else y={points:$Oe(f,s,c)},v=mh;var _=kf(kf(kf(kf({stroke:"#ccc",pointerEvents:"none"},c),y),ze(p,!1)),{},{payload:l,payloadIndex:u,className:Qe("recharts-tooltip-cursor",p.className)});return h.isValidElement(p)?h.cloneElement(p,_):h.createElement(v,_)}var LOe=["item"],FOe=["children","className","width","height","style","compact","title","desc"];function Tl(e){"@babel/helpers - typeof";return Tl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tl(e)}function ru(){return ru=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ru.apply(this,arguments)}function iP(e,t){return qOe(e)||zOe(e,t)||K4(e,t)||BOe()}function BOe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 624In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zOe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,s,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function qOe(e){if(Array.isArray(e))return e}function oP(e,t){if(e==null)return{};var r=UOe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function UOe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function WOe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VOe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Y4(n.key),n)}}function GOe(e,t,r){return t&&VOe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function HOe(e,t,r){return t=Ih(t),KOe(e,H4()?Reflect.construct(t,r||[],Ih(e).constructor):t.apply(e,r))}function KOe(e,t){if(t&&(Tl(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return YOe(e)}function YOe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function H4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(H4=function(){return!!e})()}function Ih(e){return Ih=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ih(e)}function XOe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Qb(e,t)}function Qb(e,t){return Qb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Qb(e,t)}function Dl(e){return JOe(e)||QOe(e)||K4(e)||ZOe()}function ZOe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 625In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K4(e,t){if(e){if(typeof e=="string")return Jb(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Jb(e,t)}}function QOe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function JOe(e){if(Array.isArray(e))return Jb(e)}function Jb(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function sP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Q(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sP(Object(r),!0).forEach(function(n){We(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function We(e,t,r){return t=Y4(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y4(e){var t=ePe(e,"string");return Tl(t)=="symbol"?t:t+""}function ePe(e,t){if(Tl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Tl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var tPe={xAxis:["bottom","top"],yAxis:["left","right"]},rPe={width:"100%",height:"100%"},X4={x:0,y:0};function Mf(e){return e}var nPe=function(t,r){return r==="horizontal"?t.x:r==="vertical"?t.y:r==="centric"?t.angle:t.radius},aPe=function(t,r,n,a){var i=r.find(function(d){return d&&d.index===n});if(i){if(t==="horizontal")return{x:i.coordinate,y:a.y};if(t==="vertical")return{x:a.x,y:i.coordinate};if(t==="centric"){var s=i.coordinate,l=a.radius;return Q(Q(Q({},a),At(a.cx,a.cy,l,s)),{},{angle:s,radius:l})}var c=i.coordinate,u=a.angle;return Q(Q(Q({},a),At(a.cx,a.cy,c,u)),{},{angle:u,radius:c})}return X4},Vv=function(t,r){var n=r.graphicalItems,a=r.dataStartIndex,i=r.dataEndIndex,s=(n??[]).reduce(function(l,c){var u=c.props.data;return u&&u.length?[].concat(Dl(l),Dl(u)):l},[]);return s.length>0?s:t&&t.length&&he(a)&&he(i)?t.slice(a,i+1):[]};function Z4(e){return e==="number"?[0,"auto"]:void 0}var e0=function(t,r,n,a){var i=t.graphicalItems,s=t.tooltipAxis,l=Vv(r,t);return n<0||!i||!i.length||n>=l.length?null:i.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:r;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var m;if(s.dataKey&&!s.allowDuplicatedCategory){var p=f===void 0?l:f;m=Im(p,s.dataKey,a)}else m=f&&f[n]||l[n];return m?[].concat(Dl(c),[LF(u,m)]):c},[])},lP=function(t,r,n,a){var i=a||{x:t.chartX,y:t.chartY},s=nPe(i,n),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=B0e(s,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,m=e0(t,r,d,f),p=aPe(n,l,d,i);return{activeTooltipIndex:d,activeLabel:f,activePayload:m,activeCoordinate:p}}return null},iPe=function(t,r){var n=r.axes,a=r.graphicalItems,i=r.axisType,s=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.layout,f=t.children,m=t.stackOffset,p=DF(d,i);return n.reduce(function(y,v){var g,x=v.type.defaultProps!==void 0?Q(Q({},v.type.defaultProps),v.props):v.props,b=x.type,j=x.dataKey,w=x.allowDataOverflow,S=x.allowDuplicatedCategory,_=x.scale,N=x.ticks,E=x.includeHidden,O=x[s];if(y[O])return y;var P=Vv(t.data,{graphicalItems:a.filter(function(R){var V,re=s in R.props?R.props[s]:(V=R.type.defaultProps)===null||V===void 0?void 0:V[s];return re===O}),dataStartIndex:c,dataEndIndex:u}),C=P.length,A,T,k;TOe(x.domain,w,b)&&(A=mb(x.domain,null,w),p&&(b==="number"||_!=="auto")&&(k=Zc(P,j,"category")));var D=Z4(b);if(!A||A.length===0){var M,F=(M=x.domain)!==null&&M!==void 0?M:D;if(j){if(A=Zc(P,j,b),b==="category"&&p){var q=Toe(A);S&&q?(T=A,A=Sh(0,C)):S||(A=AC(F,A,v).reduce(function(R,V){return R.indexOf(V)>=0?R:[].concat(Dl(R),[V])},[]))}else if(b==="category")S?A=A.filter(function(R){return R!==""&&!Ye(R)}):A=AC(F,A,v).reduce(function(R,V){return R.indexOf(V)>=0||V===""||Ye(V)?R:[].concat(Dl(R),[V])},[]);else if(b==="number"){var I=V0e(P,a.filter(function(R){var V,re,H=s in R.props?R.props[s]:(V=R.type.defaultProps)===null||V===void 0?void 0:V[s],te="hide"in R.props?R.props.hide:(re=R.type.defaultProps)===null||re===void 0?void 0:re.hide;return H===O&&(E||!te)}),j,i,d);I&&(A=I)}p&&(b==="number"||_!=="auto")&&(k=Zc(P,j,"category"))}else p?A=Sh(0,C):l&&l[O]&&l[O].hasStack&&b==="number"?A=m==="expand"?[0,1]:RF(l[O].stackGroups,c,u):A=TF(P,a.filter(function(R){var V=s in R.props?R.props[s]:R.type.defaultProps[s],re="hide"in R.props?R.props.hide:R.type.defaultProps.hide;return V===O&&(E||!re)}),b,d,!0);if(b==="number")A=Zb(f,A,O,i,N),F&&(A=mb(F,A,w));else if(b==="category"&&F){var K=F,W=A.every(function(R){return K.indexOf(R)>=0});W&&(A=K)}}return Q(Q({},y),{},We({},O,Q(Q({},x),{},{axisType:i,domain:A,categoricalDomain:k,duplicateDomain:T,originalDomain:(g=x.domain)!==null&&g!==void 0?g:D,isCategorical:p,layout:d})))},{})},oPe=function(t,r){var n=r.graphicalItems,a=r.Axis,i=r.axisType,s=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.layout,f=t.children,m=Vv(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:u}),p=m.length,y=DF(d,i),v=-1;return n.reduce(function(g,x){var b=x.type.defaultProps!==void 0?Q(Q({},x.type.defaultProps),x.props):x.props,j=b[s],w=Z4("number");if(!g[j]){v++;var S;return y?S=Sh(0,p):l&&l[j]&&l[j].hasStack?(S=RF(l[j].stackGroups,c,u),S=Zb(f,S,j,i)):(S=mb(w,TF(m,n.filter(function(_){var N,E,O=s in _.props?_.props[s]:(N=_.type.defaultProps)===null||N===void 0?void 0:N[s],P="hide"in _.props?_.props.hide:(E=_.type.defaultProps)===null||E===void 0?void 0:E.hide;return O===j&&!P}),"number",d),a.defaultProps.allowDataOverflow),S=Zb(f,S,j,i)),Q(Q({},g),{},We({},j,Q(Q({axisType:i},a.defaultProps),{},{hide:!0,orientation:dn(tPe,"".concat(i,".").concat(v%2),null),domain:S,originalDomain:w,isCategorical:y,layout:d})))}return g},{})},sPe=function(t,r){var n=r.axisType,a=n===void 0?"xAxis":n,i=r.AxisComp,s=r.graphicalItems,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.children,f="".concat(a,"Id"),m=fn(d,i),p={};return m&&m.length?p=iPe(t,{axes:m,graphicalItems:s,axisType:a,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):s&&s.length&&(p=oPe(t,{Axis:i,graphicalItems:s,axisType:a,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},lPe=function(t){var r=xi(t),n=qa(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:$j(n,function(a){return a.coordinate}),tooltipAxis:r,tooltipAxisBandSize:uh(r,n)}},cP=function(t){var r=t.children,n=t.defaultShowTooltip,a=nn(r,bl),i=0,s=0;return t.data&&t.data.length!==0&&(s=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(i=a.props.startIndex),a.props.endIndex>=0&&(s=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!n}},cPe=function(t){return!t||!t.length?!1:t.some(function(r){var n=Wa(r&&r.type);return n&&n.indexOf("Bar")>=0})},uP=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},uPe=function(t,r){var n=t.props,a=t.graphicalItems,i=t.xAxisMap,s=i===void 0?{}:i,l=t.yAxisMap,c=l===void 0?{}:l,u=n.width,d=n.height,f=n.children,m=n.margin||{},p=nn(f,bl),y=nn(f,Ri),v=Object.keys(c).reduce(function(S,_){var N=c[_],E=N.orientation;return!N.mirror&&!N.hide?Q(Q({},S),{},We({},E,S[E]+N.width)):S},{left:m.left||0,right:m.right||0}),g=Object.keys(s).reduce(function(S,_){var N=s[_],E=N.orientation;return!N.mirror&&!N.hide?Q(Q({},S),{},We({},E,dn(S,"".concat(E))+N.height)):S},{top:m.top||0,bottom:m.bottom||0}),x=Q(Q({},g),v),b=x.bottom;p&&(x.bottom+=p.props.height||bl.defaultProps.height),y&&r&&(x=U0e(x,a,n,r));var j=u-x.left-x.right,w=d-x.top-x.bottom;return Q(Q({brushBottom:b},x),{},{width:Math.max(j,0),height:Math.max(w,0)})},dPe=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},v1=function(t){var r=t.chartName,n=t.GraphicalChild,a=t.defaultTooltipEventType,i=a===void 0?"axis":a,s=t.validateTooltipEventTypes,l=s===void 0?["axis"]:s,c=t.axisComponents,u=t.legendContent,d=t.formatAxisMap,f=t.defaultProps,m=function(g,x){var b=x.graphicalItems,j=x.stackGroups,w=x.offset,S=x.updateId,_=x.dataStartIndex,N=x.dataEndIndex,E=g.barSize,O=g.layout,P=g.barGap,C=g.barCategoryGap,A=g.maxBarSize,T=uP(O),k=T.numericAxisName,D=T.cateAxisName,M=cPe(b),F=[];return b.forEach(function(q,I){var K=Vv(g.data,{graphicalItems:[q],dataStartIndex:_,dataEndIndex:N}),W=q.type.defaultProps!==void 0?Q(Q({},q.type.defaultProps),q.props):q.props,R=W.dataKey,V=W.maxBarSize,re=W["".concat(k,"Id")],H=W["".concat(D,"Id")],te={},ce=c.reduce(function(Y,ie){var se=x["".concat(ie.axisType,"Map")],ee=W["".concat(ie.axisType,"Id")];se&&se[ee]||ie.axisType==="zAxis"||Bi();var ge=se[ee];return Q(Q({},Y),{},We(We({},ie.axisType,ge),"".concat(ie.axisType,"Ticks"),qa(ge)))},te),je=ce[D],X=ce["".concat(D,"Ticks")],ae=j&&j[re]&&j[re].hasStack&&ewe(q,j[re].stackGroups),_e=Wa(q.type).indexOf("Bar")>=0,J=uh(je,X),Ke=[],Ne=M&&z0e({barSize:E,stackGroups:j,totalSize:dPe(ce,D)});if(_e){var Re,pe,De=Ye(V)?A:V,L=(Re=(pe=uh(je,X,!0))!==null&&pe!==void 0?pe:De)!==null&&Re!==void 0?Re:0;Ke=q0e({barGap:P,barCategoryGap:C,bandSize:L!==J?L:J,sizeList:Ne[H],maxBarSize:De}),L!==J&&(Ke=Ke.map(function(Y){return Q(Q({},Y),{},{position:Q(Q({},Y.position),{},{offset:Y.position.offset-L/2})})}))}var G=q&&q.type&&q.type.getComposedData;G&&F.push({props:Q(Q({},G(Q(Q({},ce),{},{displayedData:K,props:g,dataKey:R,item:q,bandSize:J,barPosition:Ke,offset:w,stackedData:ae,layout:O,dataStartIndex:_,dataEndIndex:N}))),{},We(We(We({key:q.key||"item-".concat(I)},k,ce[k]),D,ce[D]),"animationId",S)),childIndex:Uoe(q,g.children),item:q})}),F},p=function(g,x){var b=g.props,j=g.dataStartIndex,w=g.dataEndIndex,S=g.updateId;if(!SN({props:b}))return null;var _=b.children,N=b.layout,E=b.stackOffset,O=b.data,P=b.reverseStackOrder,C=uP(N),A=C.numericAxisName,T=C.cateAxisName,k=fn(_,n),D=Q0e(O,k,"".concat(A,"Id"),"".concat(T,"Id"),E,P),M=c.reduce(function(W,R){var V="".concat(R.axisType,"Map");return Q(Q({},W),{},We({},V,sPe(b,Q(Q({},R),{},{graphicalItems:k,stackGroups:R.axisType===A&&D,dataStartIndex:j,dataEndIndex:w}))))},{}),F=uPe(Q(Q({},M),{},{props:b,graphicalItems:k}),x==null?void 0:x.legendBBox);Object.keys(M).forEach(function(W){M[W]=d(b,M[W],F,W.replace("Map",""),r)});var q=M["".concat(T,"Map")],I=lPe(q),K=m(b,Q(Q({},M),{},{dataStartIndex:j,dataEndIndex:w,updateId:S,graphicalItems:k,stackGroups:D,offset:F}));return Q(Q({formattedGraphicalItems:K,graphicalItems:k,offset:F,stackGroups:D},I),M)},y=function(v){function g(x){var b,j,w;return WOe(this,g),w=HOe(this,g,[x]),We(w,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),We(w,"accessibilityManager",new AOe),We(w,"handleLegendBBoxUpdate",function(S){if(S){var _=w.state,N=_.dataStartIndex,E=_.dataEndIndex,O=_.updateId;w.setState(Q({legendBBox:S},p({props:w.props,dataStartIndex:N,dataEndIndex:E,updateId:O},Q(Q({},w.state),{},{legendBBox:S}))))}}),We(w,"handleReceiveSyncEvent",function(S,_,N){if(w.props.syncId===S){if(N===w.eventEmitterSymbol&&typeof w.props.syncMethod!="function")return;w.applySyncEvent(_)}}),We(w,"handleBrushChange",function(S){var _=S.startIndex,N=S.endIndex;if(_!==w.state.dataStartIndex||N!==w.state.dataEndIndex){var E=w.state.updateId;w.setState(function(){return Q({dataStartIndex:_,dataEndIndex:N},p({props:w.props,dataStartIndex:_,dataEndIndex:N,updateId:E},w.state))}),w.triggerSyncEvent({dataStartIndex:_,dataEndIndex:N})}}),We(w,"handleMouseEnter",function(S){var _=w.getMouseInfo(S);if(_){var N=Q(Q({},_),{},{isTooltipActive:!0});w.setState(N),w.triggerSyncEvent(N);var E=w.props.onMouseEnter;Ge(E)&&E(N,S)}}),We(w,"triggeredAfterMouseMove",function(S){var _=w.getMouseInfo(S),N=_?Q(Q({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};w.setState(N),w.triggerSyncEvent(N);var E=w.props.onMouseMove;Ge(E)&&E(N,S)}),We(w,"handleItemMouseEnter",function(S){w.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),We(w,"handleItemMouseLeave",function(){w.setState(function(){return{isTooltipActive:!1}})}),We(w,"handleMouseMove",function(S){S.persist(),w.throttleTriggeredAfterMouseMove(S)}),We(w,"handleMouseLeave",function(S){w.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};w.setState(_),w.triggerSyncEvent(_);var N=w.props.onMouseLeave;Ge(N)&&N(_,S)}),We(w,"handleOuterEvent",function(S){var _=qoe(S),N=dn(w.props,"".concat(_));if(_&&Ge(N)){var E,O;/.*touch.*/i.test(_)?O=w.getMouseInfo(S.changedTouches[0]):O=w.getMouseInfo(S),N((E=O)!==null&&E!==void 0?E:{},S)}}),We(w,"handleClick",function(S){var _=w.getMouseInfo(S);if(_){var N=Q(Q({},_),{},{isTooltipActive:!0});w.setState(N),w.triggerSyncEvent(N);var E=w.props.onClick;Ge(E)&&E(N,S)}}),We(w,"handleMouseDown",function(S){var _=w.props.onMouseDown;if(Ge(_)){var N=w.getMouseInfo(S);_(N,S)}}),We(w,"handleMouseUp",function(S){var _=w.props.onMouseUp;if(Ge(_)){var N=w.getMouseInfo(S);_(N,S)}}),We(w,"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&w.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),We(w,"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&w.handleMouseDown(S.changedTouches[0])}),We(w,"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&w.handleMouseUp(S.changedTouches[0])}),We(w,"triggerSyncEvent",function(S){w.props.syncId!==void 0&&py.emit(vy,w.props.syncId,S,w.eventEmitterSymbol)}),We(w,"applySyncEvent",function(S){var _=w.props,N=_.layout,E=_.syncMethod,O=w.state.updateId,P=S.dataStartIndex,C=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)w.setState(Q({dataStartIndex:P,dataEndIndex:C},p({props:w.props,dataStartIndex:P,dataEndIndex:C,updateId:O},w.state)));else if(S.activeTooltipIndex!==void 0){var A=S.chartX,T=S.chartY,k=S.activeTooltipIndex,D=w.state,M=D.offset,F=D.tooltipTicks;if(!M)return;if(typeof E=="function")k=E(F,S);else if(E==="value"){k=-1;for(var q=0;q<F.length;q++)if(F[q].value===S.activeLabel){k=q;break}}var I=Q(Q({},M),{},{x:M.left,y:M.top}),K=Math.min(A,I.x+I.width),W=Math.min(T,I.y+I.height),R=F[k]&&F[k].value,V=e0(w.state,w.props.data,k),re=F[k]?{x:N==="horizontal"?F[k].coordinate:K,y:N==="horizontal"?W:F[k].coordinate}:X4;w.setState(Q(Q({},S),{},{activeLabel:R,activeCoordinate:re,activePayload:V,activeTooltipIndex:k}))}else w.setState(S)}),We(w,"renderCursor",function(S){var _,N=w.state,E=N.isTooltipActive,O=N.activeCoordinate,P=N.activePayload,C=N.offset,A=N.activeTooltipIndex,T=N.tooltipAxisBandSize,k=w.getTooltipEventType(),D=(_=S.props.active)!==null&&_!==void 0?_:E,M=w.props.layout,F=S.key||"_recharts-cursor";return $.createElement(ROe,{key:F,activeCoordinate:O,activePayload:P,activeTooltipIndex:A,chartName:r,element:S,isActive:D,layout:M,offset:C,tooltipAxisBandSize:T,tooltipEventType:k})}),We(w,"renderPolarAxis",function(S,_,N){var E=dn(S,"type.axisType"),O=dn(w.state,"".concat(E,"Map")),P=S.type.defaultProps,C=P!==void 0?Q(Q({},P),S.props):S.props,A=O&&O[C["".concat(E,"Id")]];return h.cloneElement(S,Q(Q({},A),{},{className:Qe(E,A.className),key:S.key||"".concat(_,"-").concat(N),ticks:qa(A,!0)}))}),We(w,"renderPolarGrid",function(S){var _=S.props,N=_.radialLines,E=_.polarAngles,O=_.polarRadius,P=w.state,C=P.radiusAxisMap,A=P.angleAxisMap,T=xi(C),k=xi(A),D=k.cx,M=k.cy,F=k.innerRadius,q=k.outerRadius;return h.cloneElement(S,{polarAngles:Array.isArray(E)?E:qa(k,!0).map(function(I){return I.coordinate}),polarRadius:Array.isArray(O)?O:qa(T,!0).map(function(I){return I.coordinate}),cx:D,cy:M,innerRadius:F,outerRadius:q,key:S.key||"polar-grid",radialLines:N})}),We(w,"renderLegend",function(){var S=w.state.formattedGraphicalItems,_=w.props,N=_.children,E=_.width,O=_.height,P=w.props.margin||{},C=E-(P.left||0)-(P.right||0),A=PF({children:N,formattedGraphicalItems:S,legendWidth:C,legendContent:u});if(!A)return null;var T=A.item,k=oP(A,LOe);return h.cloneElement(T,Q(Q({},k),{},{chartWidth:E,chartHeight:O,margin:P,onBBoxUpdate:w.handleLegendBBoxUpdate}))}),We(w,"renderTooltip",function(){var S,_=w.props,N=_.children,E=_.accessibilityLayer,O=nn(N,An);if(!O)return null;var P=w.state,C=P.isTooltipActive,A=P.activeCoordinate,T=P.activePayload,k=P.activeLabel,D=P.offset,M=(S=O.props.active)!==null&&S!==void 0?S:C;return h.cloneElement(O,{viewBox:Q(Q({},D),{},{x:D.left,y:D.top}),active:M,label:k,payload:M?T:[],coordinate:A,accessibilityLayer:E})}),We(w,"renderBrush",function(S){var _=w.props,N=_.margin,E=_.data,O=w.state,P=O.offset,C=O.dataStartIndex,A=O.dataEndIndex,T=O.updateId;return h.cloneElement(S,{key:S.key||"_recharts-brush",onChange:Af(w.handleBrushChange,S.props.onChange),data:E,x:he(S.props.x)?S.props.x:P.left,y:he(S.props.y)?S.props.y:P.top+P.height+P.brushBottom-(N.bottom||0),width:he(S.props.width)?S.props.width:P.width,startIndex:C,endIndex:A,updateId:"brush-".concat(T)})}),We(w,"renderReferenceElement",function(S,_,N){if(!S)return null;var E=w,O=E.clipPathId,P=w.state,C=P.xAxisMap,A=P.yAxisMap,T=P.offset,k=S.type.defaultProps||{},D=S.props,M=D.xAxisId,F=M===void 0?k.xAxisId:M,q=D.yAxisId,I=q===void 0?k.yAxisId:q;return h.cloneElement(S,{key:S.key||"".concat(_,"-").concat(N),xAxis:C[F],yAxis:A[I],viewBox:{x:T.left,y:T.top,width:T.width,height:T.height},clipPathId:O})}),We(w,"renderActivePoints",function(S){var _=S.item,N=S.activePoint,E=S.basePoint,O=S.childIndex,P=S.isRange,C=[],A=_.props.key,T=_.item.type.defaultProps!==void 0?Q(Q({},_.item.type.defaultProps),_.item.props):_.item.props,k=T.activeDot,D=T.dataKey,M=Q(Q({index:O,dataKey:D,cx:N.x,cy:N.y,r:4,fill:i1(_.item),strokeWidth:2,stroke:"#fff",payload:N.payload,value:N.value},ze(k,!1)),Rm(k));return C.push(g.renderActiveDot(k,M,"".concat(A,"-activePoint-").concat(O))),E?C.push(g.renderActiveDot(k,Q(Q({},M),{},{cx:E.x,cy:E.y}),"".concat(A,"-basePoint-").concat(O))):P&&C.push(null),C}),We(w,"renderGraphicChild",function(S,_,N){var E=w.filterFormatItem(S,_,N);if(!E)return null;var O=w.getTooltipEventType(),P=w.state,C=P.isTooltipActive,A=P.tooltipAxis,T=P.activeTooltipIndex,k=P.activeLabel,D=w.props.children,M=nn(D,An),F=E.props,q=F.points,I=F.isRange,K=F.baseLine,W=E.item.type.defaultProps!==void 0?Q(Q({},E.item.type.defaultProps),E.item.props):E.item.props,R=W.activeDot,V=W.hide,re=W.activeBar,H=W.activeShape,te=!!(!V&&C&&M&&(R||re||H)),ce={};O!=="axis"&&M&&M.props.trigger==="click"?ce={onClick:Af(w.handleItemMouseEnter,S.props.onClick)}:O!=="axis"&&(ce={onMouseLeave:Af(w.handleItemMouseLeave,S.props.onMouseLeave),onMouseEnter:Af(w.handleItemMouseEnter,S.props.onMouseEnter)});var je=h.cloneElement(S,Q(Q({},E.props),ce));function X(ie){return typeof A.dataKey=="function"?A.dataKey(ie.payload):null}if(te)if(T>=0){var ae,_e;if(A.dataKey&&!A.allowDuplicatedCategory){var J=typeof A.dataKey=="function"?X:"payload.".concat(A.dataKey.toString());ae=Im(q,J,k),_e=I&&K&&Im(K,J,k)}else ae=q==null?void 0:q[T],_e=I&&K&&K[T];if(H||re){var Ke=S.props.activeIndex!==void 0?S.props.activeIndex:T;return[h.cloneElement(S,Q(Q(Q({},E.props),ce),{},{activeIndex:Ke})),null,null]}if(!Ye(ae))return[je].concat(Dl(w.renderActivePoints({item:E,activePoint:ae,basePoint:_e,childIndex:T,isRange:I})))}else{var Ne,Re=(Ne=w.getItemByXY(w.state.activeCoordinate))!==null&&Ne!==void 0?Ne:{graphicalItem:je},pe=Re.graphicalItem,De=pe.item,L=De===void 0?S:De,G=pe.childIndex,Y=Q(Q(Q({},E.props),ce),{},{activeIndex:G});return[h.cloneElement(L,Y),null,null]}return I?[je,null,null]:[je,null]}),We(w,"renderCustomized",function(S,_,N){return h.cloneElement(S,Q(Q({key:"recharts-customized-".concat(N)},w.props),w.state))}),We(w,"renderMap",{CartesianGrid:{handler:Mf,once:!0},ReferenceArea:{handler:w.renderReferenceElement},ReferenceLine:{handler:Mf},ReferenceDot:{handler:w.renderReferenceElement},XAxis:{handler:Mf},YAxis:{handler:Mf},Brush:{handler:w.renderBrush,once:!0},Bar:{handler:w.renderGraphicChild},Line:{handler:w.renderGraphicChild},Area:{handler:w.renderGraphicChild},Radar:{handler:w.renderGraphicChild},RadialBar:{handler:w.renderGraphicChild},Scatter:{handler:w.renderGraphicChild},Pie:{handler:w.renderGraphicChild},Funnel:{handler:w.renderGraphicChild},Tooltip:{handler:w.renderCursor,once:!0},PolarGrid:{handler:w.renderPolarGrid,once:!0},PolarAngleAxis:{handler:w.renderPolarAxis},PolarRadiusAxis:{handler:w.renderPolarAxis},Customized:{handler:w.renderCustomized}}),w.clipPathId="".concat((b=x.id)!==null&&b!==void 0?b:ec("recharts"),"-clip"),w.throttleTriggeredAfterMouseMove=OL(w.triggeredAfterMouseMove,(j=x.throttleDelay)!==null&&j!==void 0?j:1e3/60),w.state={},w}return XOe(g,v),GOe(g,[{key:"componentDidMount",value:function(){var b,j;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(b=this.props.margin.left)!==null&&b!==void 0?b:0,top:(j=this.props.margin.top)!==null&&j!==void 0?j:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var b=this.props,j=b.children,w=b.data,S=b.height,_=b.layout,N=nn(j,An);if(N){var E=N.props.defaultIndex;if(!(typeof E!="number"||E<0||E>this.state.tooltipTicks.length-1)){var O=this.state.tooltipTicks[E]&&this.state.tooltipTicks[E].value,P=e0(this.state,w,E,O),C=this.state.tooltipTicks[E].coordinate,A=(this.state.offset.top+S)/2,T=_==="horizontal",k=T?{x:C,y:A}:{y:C,x:A},D=this.state.formattedGraphicalItems.find(function(F){var q=F.item;return q.type.name==="Scatter"});D&&(k=Q(Q({},k),D.props.points[E].tooltipPosition),P=D.props.points[E].tooltipPayload);var M={activeTooltipIndex:E,isTooltipActive:!0,activeLabel:O,activePayload:P,activeCoordinate:k};this.setState(M),this.renderCursor(N),this.accessibilityManager.setIndex(E)}}}},{key:"getSnapshotBeforeUpdate",value:function(b,j){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==j.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==b.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==b.margin){var w,S;this.accessibilityManager.setDetails({offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(b){Ox([nn(b.children,An)],[nn(this.props.children,An)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var b=nn(this.props.children,An);if(b&&typeof b.props.shared=="boolean"){var j=b.props.shared?"axis":"item";return l.indexOf(j)>=0?j:i}return i}},{key:"getMouseInfo",value:function(b){if(!this.container)return null;var j=this.container,w=j.getBoundingClientRect(),S=pge(w),_={chartX:Math.round(b.pageX-S.left),chartY:Math.round(b.pageY-S.top)},N=w.width/j.offsetWidth||1,E=this.inRange(_.chartX,_.chartY,N);if(!E)return null;var O=this.state,P=O.xAxisMap,C=O.yAxisMap,A=this.getTooltipEventType();if(A!=="axis"&&P&&C){var T=xi(P).scale,k=xi(C).scale,D=T&&T.invert?T.invert(_.chartX):null,M=k&&k.invert?k.invert(_.chartY):null;return Q(Q({},_),{},{xValue:D,yValue:M})}var F=lP(this.state,this.props.data,this.props.layout,E);return F?Q(Q({},_),F):null}},{key:"inRange",value:function(b,j){var w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,_=b/w,N=j/w;if(S==="horizontal"||S==="vertical"){var E=this.state.offset,O=_>=E.left&&_<=E.left+E.width&&N>=E.top&&N<=E.top+E.height;return O?{x:_,y:N}:null}var P=this.state,C=P.angleAxisMap,A=P.radiusAxisMap;if(C&&A){var T=xi(C);return $C({x:_,y:N},T)}return null}},{key:"parseEventsOfWrapper",value:function(){var b=this.props.children,j=this.getTooltipEventType(),w=nn(b,An),S={};w&&j==="axis"&&(w.props.trigger==="click"?S={onClick:this.handleClick}:S={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var _=Rm(this.props,this.handleOuterEvent);return Q(Q({},_),S)}},{key:"addListener",value:function(){py.on(vy,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){py.removeListener(vy,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(b,j,w){for(var S=this.state.formattedGraphicalItems,_=0,N=S.length;_<N;_++){var E=S[_];if(E.item===b||E.props.key===b.key||j===Wa(E.item.type)&&w===E.childIndex)return E}return null}},{key:"renderClipPath",value:function(){var b=this.clipPathId,j=this.state.offset,w=j.left,S=j.top,_=j.height,N=j.width;return $.createElement("defs",null,$.createElement("clipPath",{id:b},$.createElement("rect",{x:w,y:S,height:_,width:N})))}},{key:"getXScales",value:function(){var b=this.state.xAxisMap;return b?Object.entries(b).reduce(function(j,w){var S=iP(w,2),_=S[0],N=S[1];return Q(Q({},j),{},We({},_,N.scale))},{}):null}},{key:"getYScales",value:function(){var b=this.state.yAxisMap;return b?Object.entries(b).reduce(function(j,w){var S=iP(w,2),_=S[0],N=S[1];return Q(Q({},j),{},We({},_,N.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(b){var j;return(j=this.state.xAxisMap)===null||j===void 0||(j=j[b])===null||j===void 0?void 0:j.scale}},{key:"getYScaleByAxisId",value:function(b){var j;return(j=this.state.yAxisMap)===null||j===void 0||(j=j[b])===null||j===void 0?void 0:j.scale}},{key:"getItemByXY",value:function(b){var j=this.state,w=j.formattedGraphicalItems,S=j.activeItem;if(w&&w.length)for(var _=0,N=w.length;_<N;_++){var E=w[_],O=E.props,P=E.item,C=P.type.defaultProps!==void 0?Q(Q({},P.type.defaultProps),P.props):P.props,A=Wa(P.type);if(A==="Bar"){var T=(O.data||[]).find(function(F){return M1e(b,F)});if(T)return{graphicalItem:E,payload:T}}else if(A==="RadialBar"){var k=(O.data||[]).find(function(F){return $C(b,F)});if(k)return{graphicalItem:E,payload:k}}else if(Lv(E,S)||Fv(E,S)||cd(E,S)){var D=S_e({graphicalItem:E,activeTooltipItem:S,itemData:C.data}),M=C.activeIndex===void 0?D:C.activeIndex;return{graphicalItem:Q(Q({},E),{},{childIndex:M}),payload:cd(E,S)?C.data[D]:E.props.data[D]}}}return null}},{key:"render",value:function(){var b=this;if(!SN(this))return null;var j=this.props,w=j.children,S=j.className,_=j.width,N=j.height,E=j.style,O=j.compact,P=j.title,C=j.desc,A=oP(j,FOe),T=ze(A,!1);if(O)return $.createElement(zO,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},$.createElement(Ax,ru({},T,{width:_,height:N,title:P,desc:C}),this.renderClipPath(),NN(w,this.renderMap)));if(this.props.accessibilityLayer){var k,D;T.tabIndex=(k=this.props.tabIndex)!==null&&k!==void 0?k:0,T.role=(D=this.props.role)!==null&&D!==void 0?D:"application",T.onKeyDown=function(F){b.accessibilityManager.keyboardEvent(F)},T.onFocus=function(){b.accessibilityManager.focus()}}var M=this.parseEventsOfWrapper();return $.createElement(zO,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},$.createElement("div",ru({className:Qe("recharts-wrapper",S),style:Q({position:"relative",curs
625or:"default",width:_,height:N},E)},M,{ref:function(q){b.container=q}}),$.createElement(Ax,ru({},T,{width:_,height:N,title:P,desc:C,style:rPe}),this.renderClipPath(),NN(w,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(h.Component);return We(y,"displayName",r),We(y,"defaultProps",Q({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),We(y,"getDerivedStateFromProps",function(v,g){var x=v.dataKey,b=v.data,j=v.children,w=v.width,S=v.height,_=v.layout,N=v.stackOffset,E=v.margin,O=g.dataStartIndex,P=g.dataEndIndex;if(g.updateId===void 0){var C=cP(v);return Q(Q(Q({},C),{},{updateId:0},p(Q(Q({props:v},C),{},{updateId:0}),g)),{},{prevDataKey:x,prevData:b,prevWidth:w,prevHeight:S,prevLayout:_,prevStackOffset:N,prevMargin:E,prevChildren:j})}if(x!==g.prevDataKey||b!==g.prevData||w!==g.prevWidth||S!==g.prevHeight||_!==g.prevLayout||N!==g.prevStackOffset||!$s(E,g.prevMargin)){var A=cP(v),T={chartX:g.chartX,chartY:g.chartY,isTooltipActive:g.isTooltipActive},k=Q(Q({},lP(g,b,_)),{},{updateId:g.updateId+1}),D=Q(Q(Q({},A),T),k);return Q(Q(Q({},D),p(Q({props:v},D),g)),{},{prevDataKey:x,prevData:b,prevWidth:w,prevHeight:S,prevLayout:_,prevStackOffset:N,prevMargin:E,prevChildren:j})}if(!Ox(j,g.prevChildren)){var M,F,q,I,K=nn(j,bl),W=K&&(M=(F=K.props)===null||F===void 0?void 0:F.startIndex)!==null&&M!==void 0?M:O,R=K&&(q=(I=K.props)===null||I===void 0?void 0:I.endIndex)!==null&&q!==void 0?q:P,V=W!==O||R!==P,re=!Ye(b),H=re&&!V?g.updateId:g.updateId+1;return Q(Q({updateId:H},p(Q(Q({props:v},g),{},{updateId:H,dataStartIndex:W,dataEndIndex:R}),g)),{},{prevChildren:j,dataStartIndex:W,dataEndIndex:R})}return null}),We(y,"renderActiveDot",function(v,g,x){var b;return h.isValidElement(v)?b=h.cloneElement(v,g):Ge(v)?b=v(g):b=$.createElement($v,g),$.createElement(ct,{className:"recharts-active-dot",key:x},b)}),function(g){return $.createElement(y,g)}},fPe=v1({chartName:"LineChart",GraphicalChild:Po,axisComponents:[{axisType:"xAxis",AxisComp:Ol},{axisType:"yAxis",AxisComp:Al}],formatAxisMap:v4}),mPe=v1({chartName:"BarChart",GraphicalChild:as,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Ol},{axisType:"yAxis",AxisComp:Al}],formatAxisMap:v4}),hPe=v1({chartName:"PieChart",GraphicalChild:si,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Rv},{axisType:"radiusAxis",AxisComp:Mv}],formatAxisMap:uwe,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const pPe={bajo:"#16a34a",medio:"#eab308",alto:"#f97316",critico:"#dc2626"};function vPe(){const[e,t]=h.useState(!0),[r,n]=h.useState([]),[a,i]=h.useState([]),[s,l]=h.useState([]);return h.useEffect(()=>{(async()=>{t(!0);try{const{data:c}=await B.from("auditoria_hallazgos").select("nivel_riesgo, score, asignacion:auditoria_asignaciones(nivel, periodo:auditoria_periodos(semana_iso, anio))"),u={bajo:0,medio:0,alto:0,critico:0},d={},f={analista:{nivel:"Analista",total:0,sumScore:0},jefe:{nivel:"Jefe",total:0,sumScore:0},gerencia:{nivel:"Gerencia",total:0,sumScore:0}};(c||[]).forEach(m=>{var v,g;u[m.nivel_riesgo]=(u[m.nivel_riesgo]||0)+1;const p=(v=m.asignacion)==null?void 0:v.nivel,y=(g=m.asignacion)==null?void 0:g.periodo;if(p&&f[p]&&(f[p].total++,f[p].sumScore+=Number(m.score||0)),y){const x=`${y.anio}-W${String(y.semana_iso).padStart(2,"0")}`;d[x]||(d[x]={semana:x,analista:[],jefe:[],gerencia:[]}),p&&d[x][p].push(Number(m.score||0))}}),n(Object.entries(u).map(([m,p])=>({name:m,value:p}))),l(Object.values(f).map(m=>({nivel:m.nivel,score_promedio:m.total>0?Math.round(m.sumScore/m.total*10)/10:0,total:m.total}))),i(Object.values(d).sort((m,p)=>m.semana.localeCompare(p.semana)).slice(-12).map(m=>({semana:m.semana,Analista:m.analista.length?Math.round(m.analista.reduce((p,y)=>p+y,0)/m.analista.length):null,Jefe:m.jefe.length?Math.round(m.jefe.reduce((p,y)=>p+y,0)/m.jefe.length):null,Gerencia:m.gerencia.length?Math.round(m.gerencia.reduce((p,y)=>p+y,0)/m.gerencia.length):null})))}finally{t(!1)}})()},[]),e?o.jsx("div",{className:"flex justify-center p-8",children:o.jsx(ye,{className:"h-6 w-6 animate-spin"})}):o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{className:"text-base",children:"Score promedio por nivel"})}),o.jsx(fe,{children:o.jsx(ey,{width:"100%",height:250,children:o.jsxs(mPe,{data:s,children:[o.jsx(Ub,{strokeDasharray:"3 3"}),o.jsx(Ol,{dataKey:"nivel"}),o.jsx(Al,{domain:[0,100]}),o.jsx(An,{}),o.jsx(as,{dataKey:"score_promedio",fill:"hsl(var(--primary))",radius:[8,8,0,0]})]})})})]}),o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{className:"text-base",children:"Distribución por nivel de riesgo"})}),o.jsx(fe,{children:o.jsx(ey,{width:"100%",height:250,children:o.jsxs(hPe,{children:[o.jsx(si,{data:r,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:!0,children:r.map(c=>o.jsx(wv,{fill:pPe[c.name]},c.name))}),o.jsx(An,{}),o.jsx(Ri,{})]})})})]}),o.jsxs(de,{className:"lg:col-span-2",children:[o.jsx(Le,{children:o.jsx(Ie,{className:"text-base",children:"Tendencia de cumplimiento (últimas 12 semanas)"})}),o.jsx(fe,{children:o.jsx(ey,{width:"100%",height:300,children:o.jsxs(fPe,{data:a,children:[o.jsx(Ub,{strokeDasharray:"3 3"}),o.jsx(Ol,{dataKey:"semana"}),o.jsx(Al,{domain:[0,100]}),o.jsx(An,{}),o.jsx(Ri,{}),o.jsx(Po,{type:"monotone",dataKey:"Analista",stroke:"#3b82f6",strokeWidth:2}),o.jsx(Po,{type:"monotone",dataKey:"Jefe",stroke:"#8b5cf6",strokeWidth:2}),o.jsx(Po,{type:"monotone",dataKey:"Gerencia",stroke:"#ec4899",strokeWidth:2})]})})})]})]})}function gPe({onChanged:e,onRegenerate:t}){return o.jsxs(Kl,{defaultValue:"auditores",children:[o.jsxs(Zo,{children:[o.jsx(Yt,{value:"auditores",children:"Auditores"}),o.jsx(Yt,{value:"periodo",children:"PerÃodo"})]}),o.jsx(Qt,{value:"auditores",children:o.jsx(yPe,{onChanged:e})}),o.jsx(Qt,{value:"periodo",children:o.jsx(xPe,{onRegenerate:t})})]})}function yPe({onChanged:e}){const[t,r]=h.useState([]),[n,a]=h.useState([]),[i,s]=h.useState(!0),[l,c]=h.useState({user_id:"",nivel:"analista",area:""}),u=async()=>{s(!0);const[{data:p},{data:y}]=await Promise.all([B.from("auditores").select("*"),B.from("profiles").select("id, full_name, username").order("full_name")]),v=Object.fromEntries((y||[]).map(g=>[g.id,g]));r((p||[]).map(g=>({...g,profile:v[g.user_id]}))),a(y||[]),s(!1)};h.useEffect(()=>{u()},[]);const d=async()=>
625{if(!l.user_id)return Z.error("Seleccione usuario");const{error:p}=await B.from("auditores").insert({user_id:l.user_id,nivel:l.nivel,area:l.area||null,activo:!0});if(p)return Z.error(p.message);c({user_id:"",nivel:"analista",area:""}),Z.success("Auditor agregado"),u(),e()},f=async(p,y)=>{await B.from("auditores").update({activo:y}).eq("id",p),u(),e()},m=async p=>{confirm("¿Eliminar auditor?")&&(await B.from("auditores").delete().eq("id",p),u(),e())};return o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{className:"text-base",children:"Gestión de auditores"})}),o.jsx(fe,{className:"space-y-4",children:i?o.jsx(ye,{className:"h-6 w-6 animate-spin"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"space-y-2",children:t.map(p=>{var y,v;return o.jsxs("div",{className:`flex items-center gap-2 p-3 border rounded ${p.activo?"":"opacity-50"}`,children:[o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"font-medium",children:((y=p.profile)==null?void 0:y.full_name)||((v=p.profile)==null?void 0:v.username)||p.user_id}),o.jsxs("div",{className:"flex gap-2 mt-1",children:[o.jsx(ke,{children:p.nivel}),p.area&&o.jsx(ke,{variant:"secondary",children:p.area})]})]}),o.jsx(On,{checked:p.activo,onCheckedChange:g=>f(p.id,g)}),o.jsx(z,{size:"sm",variant:"ghost",onClick:()=>m(p.id),children:o.jsx(Gi,{className:"h-4 w-4 text-destructive"})})]},p.id)})}),o.jsxs("div",{className:"border-t pt-4 space-y-3",children:[o.jsx(ne,{children:"Agregar auditor"}),o.jsxs(jt,{value:l.user_id,onValueChange:p=>c({...l,user_id:p}),children:[o.jsx(xt,{children:o.jsx(St,{placeholder:"Seleccionar usuario"})}),o.jsx(bt,{children:n.map(p=>o.jsx($e,{value:p.id,children:p.full_name||p.username},p.id))})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(jt,{value:l.nivel,onValueChange:p=>c({...l,nivel:p}),children:[o.jsx(xt,{className:"w-40",children:o.jsx(St,{})}),o.jsxs(bt,{children:[o.jsx($e,{value:"analista",children:"Analista"}),o.jsx($e,{value:"jefe",children:"Jefe"}),o.jsx($e,{value:"gerencia",children:"Gerencia"})]})]}),o.jsx(we,{placeholder:"Ãrea (opcional)",value:l.area,onChange:p=>c({...l,area:p.target.value})}),o.jsxs(z,{onClick:d,children:[o.jsx(wa,{className:"h-4 w-4 mr-1"})," Agregar"]})]})]})]})})]})}function xPe({onRegenerate:e}){return o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{className:"text-base",children:"Gestión del perÃodo actual"})}),o.jsxs(fe,{className:"space-y-4",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:'El perÃodo se genera automáticamente cada lunes (o manualmente desde el botón "Generar perÃodo" del header). Si necesita regenerar el muestreo aleatorio del perÃodo actual, use el botón siguiente â esto borrará todas las asignaciones no completadas del perÃodo actual y generará nuevas.'}),o.jsxs(z,{variant:"destructive",onClick:()=>{confirm("¿Regenerar muestreo del perÃodo actual? Se perderán las asignaciones existentes.")&&e()},children:[o.jsx($o,{className:"h-4 w-4 mr-2"})," Regenerar muestreo del perÃodo"]})]})]})}function bPe(){const[e,t]=h.useState([]),[r,n]=h.useState(!0);h.useEffect(()=>{(async()=>{n(!0);const{data:i}=await B.from("auditoria_novedades").select("*");t(i||[]),n(!1)})()},[]);const a=h.useMemo(()=>{const i=e.length,s=e.filter(j=>!["cerrada_eficaz","cerrada_no_eficaz","descartada","cerrada"].includes(j.estado)).length,l=new Date,c=e.filter(j=>j.fecha_compromiso&&new Date(j.fecha_compromiso)<l&&!["cerrada_eficaz","cerrada_no_eficaz","descartada","cerrada"].includes(j.estado)).length,u=e.filter(j=>j.severidad==="critica"&&!["cerrada_eficaz","descartada"].includes(j.estado)).length,d=e.filter(j=>j.estado==="cerrada_eficaz"||j.estado==="cerrada"),f=e.filter(j=>j.estado==="cerrada_eficaz").length,m=d.filter(j=>j.verificado_at).map(j=>(new Date(j.verificado_at).getTime()-new Date(j.created_at).getTime())/864e5),p=m.length?Math.round(m.reduce((j,w)=>j+w,0)/m.length):0,y={};e.forEach(j=>{const w=j.categoria||"Sin categorÃa";y[w]=(y[w]||0)+1});const v=Object.entries(y).sort((j,w)=>w[1]-j[1]).slice(0,5),g={leve:0,moderada:0,grave:0,critica:0};e.forEach(j=>
625{g[j.severidad]!==void 0&&g[j.severidad]++});const x=e.filter(j=>j.novedad_origen_id).length,b=i>0?Math.round(x/i*100):0;return{total:i,abiertas:s,vencidas:c,criticas:u,eficaces:f,tiempoMedio:p,topCategorias:v,sevCount:g,reincidencias:x,pctReinc:b}},[e]);return r?o.jsx("div",{className:"flex justify-center p-8",children:o.jsx(ye,{className:"h-6 w-6 animate-spin"})}):o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[o.jsx(If,{icon:o.jsx(Kr,{className:"h-5 w-5 text-red-500"}),label:"Abiertas",value:a.abiertas,sub:`${a.criticas} crÃticas`}),o.jsx(If,{icon:o.jsx(mn,{className:"h-5 w-5 text-orange-500"}),label:"Vencidas",value:a.vencidas,sub:"Fecha compromiso superada"}),o.jsx(If,{icon:o.jsx(Do,{className:"h-5 w-5 text-green-500"}),label:"Cierres eficaces",value:a.eficaces,sub:`${a.tiempoMedio} dÃas promedio`}),o.jsx(If,{icon:o.jsx(vA,{className:"h-5 w-5 text-blue-500"}),label:"Reincidencia",value:`${a.pctReinc}%`,sub:`${a.reincidencias} casos`})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{className:"text-base",children:"Distribución por severidad"})}),o.jsx(fe,{className:"space-y-2",children:["critica","grave","moderada","leve"].map(i=>{const s=Math.max(...Object.values(a.sevCount),1),l=a.sevCount[i]/s*100,c=i==="critica"?"bg-red-500":i==="grave"?"bg-orange-500":i==="moderada"?"bg-yellow-500":"bg-blue-500";return o.jsxs("div",{children:[o.jsxs("div",{className:"flex justify-between text-sm mb-1 capitalize",children:[o.jsx("span",{children:i}),o.jsx("span",{className:"font-semibold",children:a.sevCount[i]})]}),o.jsx("div",{className:"h-2 bg-muted rounded overflow-hidden",children:o.jsx("div",{className:`h-full ${c}`,style:{width:`${l}%`}})})]},i)})})]}),o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{className:"text-base",children:"Top 5 categorÃas"})}),o.jsx(fe,{children:a.topCategorias.length===0?o.jsx("p",{className:"text-sm text-muted-foreground",children:"Sin datos."}):o.jsx("ul",{className:"space-y-2",children:a.topCategorias.map(([i,s])=>o.jsxs("li",{className:"flex justify-between text-sm border-b pb-1",children:[o.jsx("span",{className:"truncate",children:i}),o.jsx("span",{className:"font-semibold",children:s})]},i))})})]})]})]})}function If({icon:e,label:t,value:r,sub:n}){return o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:t}),e]}),o.jsx("div",{className:"text-2xl font-bold",children:r}),n&&o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n})]})})}const wPe={leve:"bg-blue-100 text-blue-800",moderada:"bg-yellow-100 text-yellow-800",grave:"bg-orange-100 text-orange-800",critica:"bg-red-100 text-red-800"},jPe={abierta:"bg-red-100 text-red-700",analisis_causa:"bg-orange-100 text-orange-700",plan_accion:"bg-amber-100 text-amber-700",en_ejecucion:"bg-blue-100 text-blue-700",verificacion:"bg-indigo-100 text-indigo-700",cerrada_eficaz:"bg-green-100 text-green-700",cerrada_no_eficaz:"bg-rose-100 text-rose-700",descartada:"bg-gray-100 text-gray-700",en_revision:"bg-yellow-100 text-yellow-700",cerrada:"bg-green-100 text-green-700"},SPe={abierta:"Abierta",analisis_causa:"Análisis causa",plan_accion:"Plan acción",en_ejecucion:"En ejecución",verificacion:"Verificación",cerrada_eficaz:"Cerrada eficaz",cerrada_no_eficaz:"Cerrada no eficaz",descartada:"Descartada",en_revision:"En revisión",cerrada:"Cerrada"},_Pe={nc_mayor:"NC Mayor",nc_menor:"NC Menor",observacion:"Observación",oportunidad_mejora:"Oport. mejora"},Rf=e=>!["cerrada_eficaz","cerrada_no_eficaz","descartada","cerrada"].includes(e);function NPe(){const[e,t]=h.useState([]),[r,n]=h.useState({}),[a,i]=h.useState(!0),[s,l]=h.useState("todas"),[c,u]=h.useState("abiertas"),[d,f]=h.useState("todas"),[m,p]=h.useState("todas"),[y,v]=h.useState(!1),[g,x]=h.useState(""),[b,j]=h.useState(null),[w,S]=h.useState(null),_=async()=>{i(!0);const{data:{session:P}}=await B.auth.getSession();S((P==null?void 0:P.user.id)||null);const{data:C,error:A}=await B.from("auditoria_novedades").select("*").order("created_at",{ascending:!1});A&&Z.error(A.message);const T=C||[];t(T);const k=[...new Set(T.flatMap(D=>
625[D.responsable_id,D.creado_por]).filter(Boolean))];if(k.length){const{data:D}=await B.from("profiles").select("id, full_name").in("id",k);n(Object.fromEntries((D||[]).map(M=>[M.id,M.full_name||""])))}i(!1)};h.useEffect(()=>{_()},[]);const N=h.useMemo(()=>{const P=new Date;return e.filter(C=>{if(s==="mis"&&C.responsable_id!==w||c==="abiertas"&&!Rf(C.estado)||c!=="todas"&&c!=="abiertas"&&C.estado!==c||d!=="todas"&&C.severidad!==d||m!=="todas"&&(C.tipo||"nc_menor")!==m||y&&(!C.fecha_compromiso||new Date(C.fecha_compromiso)>=P||!Rf(C.estado)))return!1;if(g.trim()){const A=g.toLowerCase();if(![C.descripcion,C.field_label,C.categoria,String(C.ot_numero)].filter(Boolean).map(k=>String(k).toLowerCase()).some(k=>k.includes(A)))return!1}return!0})},[e,s,c,d,m,y,g,w]),E=h.useMemo(()=>e.filter(P=>P.responsable_id===w&&Rf(P.estado)).length,[e,w]),O=P=>P.fecha_compromiso&&new Date(P.fecha_compromiso)<new Date&&Rf(P.estado);return o.jsxs(o.Fragment,{children:[o.jsxs(Kl,{value:s,onValueChange:P=>l(P),children:[o.jsxs(Zo,{children:[o.jsxs(Yt,{value:"todas",className:"gap-2",children:[o.jsx(fA,{className:"h-4 w-4"})," Todas"]}),o.jsxs(Yt,{value:"mis",className:"gap-2",children:[o.jsx(v0,{className:"h-4 w-4"})," Mis novedades",E>0&&o.jsx(ke,{variant:"destructive",className:"ml-1",children:E})]}),o.jsxs(Yt,{value:"kpis",className:"gap-2",children:[o.jsx(au,{className:"h-4 w-4"})," Indicadores"]})]}),o.jsx(Qt,{value:"kpis",className:"mt-4",children:o.jsx(bPe,{})}),o.jsx(Qt,{value:s==="kpis"?"_":s,className:"mt-4",children:o.jsxs(de,{children:[o.jsx(Le,{children:o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsxs(Ie,{className:"text-base flex items-center gap-2",children:[o.jsx(Kr,{className:"h-5 w-5 text-destructive"}),"Novedades (",N.length,")"]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx(we,{placeholder:"Buscar por OT, descripción, categorÃa...",value:g,onChange:P=>x(P.target.value),className:"w-64"}),o.jsxs(jt,{value:c,onValueChange:u,children:[o.jsx(xt,{className:"w-44",children:o.jsx(St,{})}),o.jsxs(bt,{children:[o.jsx($e,{value:"abiertas",children:"Sólo abiertas"}),o.jsx($e,{value:"todas",children:"Todos los estados"}),o.jsx($e,{value:"abierta",children:"Abierta"}),o.jsx($e,{value:"analisis_causa",children:"Análisis causa"}),o.jsx($e,{value:"plan_accion",children:"Plan acción"}),o.jsx($e,{value:"en_ejecucion",children:"En ejecución"}),o.jsx($e,{value:"verificacion",children:"Verificación"}),o.jsx($e,{value:"cerrada_eficaz",children:"Cerrada eficaz"}),o.jsx($e,{value:"cerrada_no_eficaz",children:"Cerrada no eficaz"}),o.jsx($e,{value:"descartada",children:"Descartada"})]})]}),o.jsxs(jt,{value:d,onValueChange:f,children:[o.jsx(xt,{className:"w-36",children:o.jsx(St,{})}),o.jsxs(bt,{children:[o.jsx($e,{value:"todas",children:"Toda severidad"}),o.jsx($e,{value:"leve",children:"Leve"}),o.jsx($e,{value:"moderada",children:"Moderada"}),o.jsx($e,{value:"grave",children:"Grave"}),o.jsx($e,{value:"critica",children:"CrÃtica"})]})]}),o.jsxs(jt,{value:m,onValueChange:p,children:[o.jsx(xt,{className:"w-40",children:o.jsx(St,{})}),o.jsxs(bt,{children:[o.jsx($e,{value:"todas",children:"Todo tipo"}),o.jsx($e,{value:"nc_mayor",children:"NC Mayor"}),o.jsx($e,{value:"nc_menor",children:"NC Menor"}),o.jsx($e,{value:"observacion",children:"Observación"}),o.jsx($e,{value:"oportunidad_mejora",children:"Oport. mejora"})]})]}),o.jsx(z,{variant:y?"destructive":"outline",size:"sm",onClick:()=>v(P=>!P),children:"Vencidas"})]})]})}),o.jsx(fe,{children:a?o.jsx("div",{className:"flex justify-center p-8",children:o.jsx(ye,{className:"h-6 w-6 animate-spin"})}):N.length===0?o.jsx("p",{className:"text-center text-muted-foreground p-8",children:"No hay novedades con estos filtros."}):o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(yn,{children:[o.jsx(xn,{children:o.jsxs(Nt,{children:[o.jsx(Pe,{children:"OT"}),o.jsx(Pe,{children:"Tipo"}),o.jsx(Pe,{children:"Severidad"}),o.jsx(Pe,{children:"Hallazgo"}),o.jsx(Pe,{children:"Estado"}),o.jsx(Pe,{children:"Responsable"}),o.jsx(Pe,{children:"Compromiso"}),o.jsx(Pe,{className:"text-right",children:"Acción"})]})}),o.jsx(bn,{children:N.map(P=>{const C=O(P);return o.jsxs(Nt,{className:C?"bg-red-50":"",children:[o.jsx(Oe,{className:"font-mono font-semibold",children:P.ot_numero}),o.jsx(Oe,{children:o.jsx(ke,{variant:"outline",className:"text-xs",children:_Pe[P.tipo||"nc_menor"]})}),o.jsx(Oe,{children:o.jsx(ke,{className:wPe[P.severidad],children:P.severidad})}),o.jsxs(Oe,{className:"max-w-md",children:[P.field_label&&o.jsx("div",{className:"text-xs text-muted-foreground",children:P.field_label}),o.jsx("div",{className:"text-sm truncate",children:P.descripcion}),P.categoria&&o.jsx(ke,{variant:"secondary",className:"mt-1 text-xs",children:P.categoria})]}),o.jsx(Oe,{children:o.jsx(ke,{className:jPe[P.estado],children:SPe[P.estado]||P.estado})}),o.jsx(Oe,{className:"text-sm",children:P.responsable_id?r[P.responsable_id]||"â":o.jsx("span",{className:"text-muted-foreground italic",children:"Sin asignar"})}),o.jsx(Oe,{className:"text-xs",children:P.fecha_compromiso?o.jsxs("span",{className:C?"text-red-600 font-semibold":"",children:[P.fecha_compromiso,C?" â ":""]}):"â"}),o.jsx(Oe,{className:"text-right",children:o.jsxs(z,{size:"sm",variant:"outline",onClick:()=>j(P),children:[o.jsx(Fi,{className:"h-4 w-4 mr-1"})," Abrir"]})})]},P.id)})})]})})})]})})]}),b&&o.jsx(cj,{open:!!b,onOpenChange:P=>{P||(j(null),_())},asignacionId:b.asignacion_id,otNumero:b.ot_numero,nivel:b.nivel,muestraId:b.muestra_id,fieldId:b.field_id,fieldLabel:b.field_label,fieldValue:b.field_value_observado,revisionId:b.revision_
625id,existing:b,onSaved:_})]})}function Q4({fechaInicio:e,fechaFin:t}){const[r,n]=h.useState(!0),[a,i]=h.useState([]);h.useEffect(()=>{let c=!1;return(async()=>{n(!0);const{data:u,error:d}=await B.rpc("get_supervisor_sampling_kpis",{_fecha_inicio:e,_fecha_fin:t});if(d){console.error("get_supervisor_sampling_kpis:",d),c||(i([]),n(!1));return}const f=(u||[]).map(m=>({supervisor:m.supervisor,ots_asignadas:Number(m.ots_asignadas)||0,muestras_programadas:Number(m.muestras_programadas)||0,muestras_realizadas:Number(m.muestras_realizadas)||0,ots_con_muestras:Number(m.ots_con_muestras)||0}));c||(i(f),n(!1))})(),()=>{c=!0}},[e,t]);const s=h.useMemo(()=>a.reduce((c,u)=>({asignadas:c.asignadas+u.ots_asignadas,cumplidas:c.cumplidas+u.ots_con_muestras}),{asignadas:0,cumplidas:0}),[a]),l=s.asignadas>0?s.cumplidas/s.asignadas*100:0;return o.jsxs(de,{children:[o.jsxs(Le,{children:[o.jsxs(Ie,{className:"text-base flex items-center gap-2",children:[o.jsx(Rl,{className:"h-4 w-4"}),"Cumplimiento de muestreo por supervisor"]}),o.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:["OTs cumplidas vs asignadas entre ",e," y ",t,".",o.jsx(x0,{children:o.jsxs(LA,{children:[o.jsx(FA,{asChild:!0,children:o.jsx(Qf,{className:"h-3 w-3 cursor-help"})}),o.jsxs(b0,{className:"max-w-xs text-xs",children:["Una OT se considera cumplida cuando tiene al menos una muestra registrada en ",o.jsx("i",{children:"proceso_ot_muestra"}),". Se excluyen las OTs marcadas como exentas de muestreo."]})]})})]})]}),o.jsx(fe,{children:r?o.jsx("div",{className:"flex justify-center p-6",children:o.jsx(ye,{className:"h-5 w-5 animate-spin"})}):a.length===0?o.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Sin OTs en el perÃodo."}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mb-4 grid grid-cols-2 md:grid-cols-3 gap-3 text-sm",children:[o.jsxs("div",{className:"rounded-lg border p-3",children:[o.jsx("div",{className:"text-muted-foreground text-xs",children:"OTs asignadas"}),o.jsx("div",{className:"text-2xl font-bold",children:s.asignadas})]}),o.jsxs("div",{className:"rounded-lg border p-3",children:[o.jsx("div",{className:"text-muted-foreground text-xs",children:"OTs cumplidas"}),o.jsx("div",{className:"text-2xl font-bold",children:s.cumplidas})]}),o.jsxs("div",{className:"rounded-lg border p-3",children:[o.jsx("div",{className:"text-muted-foreground text-xs",children:"Cumplimiento"}),o.jsxs("div",{className:"text-2xl font-bold",children:[l.toFixed(0),"%"]})]})]}),o.jsxs(yn,{children:[o.jsx(xn,{children:o.jsxs(Nt,{children:[o.jsx(Pe,{children:"Supervisor"}),o.jsx(Pe,{className:"text-right",children:"Asignadas"}),o.jsx(Pe,{className:"text-right",children:"Cumplidas"}),o.jsx(Pe,{className:"text-right",children:"Pendientes"}),o.jsx(Pe,{className:"w-[35%]",children:"Cumplimiento"})]})}),o.jsx(bn,{children:a.map(c=>{const u=c.ots_asignadas-c.ots_con_muestras,d=c.ots_asignadas>0?c.ots_con_muestras/c.ots_asignadas*100:0;return o.jsxs(Nt,{children:[o.jsx(Oe,{className:"font-medium",children:c.supervisor}),o.jsx(Oe,{className:"text-right",children:c.ots_asignadas}),o.jsx(Oe,{className:"text-right text-emerald-600 font-medium",children:c.ots_con_muestras}),o.jsx(Oe,{className:`text-right font-medium ${u>0?"text-amber-600":"text-muted-foreground"}`,children:u}),o.jsx(Oe,{children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Hp,{value:d,className:"h-2 flex-1"}),o.jsxs("span",{className:"text-xs text-muted-foreground w-10 text-right",children:[d.toFixed(0),"%"]})]})})]},c.supervisor)})})]})]})})]})}const EPe={bajo:"bg-green-100 text-green-800 border-green-200",medio:"bg-yellow-100 text-yellow-800 border-yellow-200",alto:"bg-orange-100 text-orange-800 border-orange-200",critico:"bg-red-100 text-red-800 border-red-200"};function CPe({periodo:e,asignacionesJefe:t,onAuditOpen:r,onSaved:n}){const[a,i]=h.useState(null),s=t.filter(u=>u.estado==="completada"||u.estado==="no_conforme"),l=t.length-s.length,c=t.filter(u=>u.estado==="no_conforme").length;return o.jsxs("div",{className:"space-y-4",children:[o.jsx(Q4,{fechaInicio:e.fecha_inicio,fechaFin:e.fecha_fin}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"OTs auditadas por jefe"}),o.jsxs("div",{className:"text-3xl font-bold",children:[s.length,o.jsxs("span",{className:"text-base text-muted-foreground",children:["/",t.length]})]})]})}),o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Pendientes"}),o.jsx("div",{className:"text-3xl font-bold",children:l})]})}),o.jsx(de,{children:o.jsxs(fe,{className:"p-4",children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"No conformes"}),o.jsx("div",{className:"text-3xl font-bold text-red-600",children:c})]})})]}),o.jsxs(de,{children:[o.jsx(Le,{children:o.jsx(Ie,{className:"text-base",children:"OTs auditadas por Jefe â agregar observaciones / plan de mejora"})}),o.jsx(fe,{children:s.length===0?o.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Aún no hay OTs auditadas por el jefe en este perÃodo."}):o.jsxs(yn,{children:[o.jsx(xn,{children:o.jsxs(Nt,{children:[o.jsx(Pe,{children:"OT"}),o.jsx(Pe,{children:"Producto"}),o.jsx(Pe,{children:"Jefe Turno"}),o.jsx(Pe,{children:"Score"}),o.jsx(Pe,{children:"Riesgo"}),o.jsx(Pe,{children:"Estado"}),o.jsx(Pe,{className:"text-right",children:"Acción"})]})}),o.jsx(bn,{children:s.map(u=>{var d,f,m;return o.jsxs(Nt,{children:[o.jsx(Oe,{className:"font-mono font-semibold",children:u.ot_numero}),o.jsx(Oe,{children:((d=u.ot)==null?void 0:d.producto_resultante)||"â"}),o.jsx(Oe,{children:((f=u.ot)==null?void 0:f.jefe_turno)||"â"}),o.jsx(Oe,{className:"font-semibold",children:((m=u.hallazgo)==null?void 0:m.score)??"â"}),o.jsx(Oe,{children:u.hallazgo?o.jsx(ke,{className:EPe[u.hallazgo.nivel_riesgo],variant:"outline",children:u.hallazgo.nivel_riesgo}):"â"}),o.jsx(Oe,{children:u.estado==="no_conforme"?o.jsxs(ke,{variant:"destructive",className:"gap-1",children:[o.jsx(Kr,{className:"h-3 w-3"})," No conforme"]}):o.jsxs(ke,{variant:"outline",className:"gap-1 text-green-700 border-green-200 bg-green-50",children:[o.jsx(Do,{
625className:"h-3 w-3"})," Completada"]})}),o.jsx(Oe,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-1",children:[o.jsxs(z,{size:"sm",variant:"outline",onClick:()=>r(u),children:[o.jsx(Fi,{className:"h-3 w-3 mr-1"})," Ver"]}),o.jsxs(z,{size:"sm",onClick:()=>i(u),children:[o.jsx(f3,{className:"h-3 w-3 mr-1"})," Observación"]})]})})]},u.id)})})]})})]}),a&&o.jsx(cj,{open:!!a,onOpenChange:u=>!u&&i(null),asignacionId:a.id,otNumero:a.ot_numero,nivel:"gerencia",muestraId:null,fieldId:null,fieldLabel:null,fieldValue:null,revisionId:null,existing:null,onSaved:()=>{i(null),n()}})]})}function J4(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())),r=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-r);const n=new Date(Date.UTC(t.getUTCFullYear(),0,1)),a=Math.ceil(((t.getTime()-n.getTime())/864e5+1)/7);return{anio:t.getUTCFullYear(),semana:a}}function yy(e){const t=new Date(Date.UTC(e,11,31)),r=J4(t).semana;return r===1?52:r}function dP(e,t,r){let n=e,a=t+r;for(;a<1;)n-=1,a+=yy(n);for(;a>yy(n);)a-=yy(n),n+=1;return{anio:n,semana:a}}const t0={analista:"Analista",jefe:"Jefe",gerencia:"Gerencia"},Lf={analista:o.jsx(m0,{className:"h-4 w-4"}),jefe:o.jsx(hA,{className:"h-4 w-4"}),gerencia:o.jsx(u3,{className:"h-4 w-4"})},OPe={bajo:"bg-green-100 text-green-800 border-green-200",medio:"bg-yellow-100 text-yellow-800 border-yellow-200",alto:"bg-orange-100 text-orange-800 border-orange-200",critico:"bg-red-100 text-red-800 border-red-200"},PPe={pendiente:"bg-gray-100 text-gray-700",en_progreso:"bg-blue-100 text-blue-700",completada:"bg-green-100 text-green-700",no_conforme:"bg-red-100 text-red-700"};function APe(){const e=Cre(),t=J4(new Date),[r,n]=h.useState(t),[a,i]=h.useState(null),[s,l]=h.useState([]),[c,u]=h.useState(!0),[d,f]=h.useState(!1),[m,p]=h.useState(null),[y,v]=h.useState(""),g=async()=>{u(!0);try{const{data:_}=await B.from("auditoria_periodos").select("*").eq("anio",r.anio).eq("semana_iso",r.semana).maybeSingle(),N=_;if(i(N??null),!N)l([]);else{const{data:E}=await B.from("auditoria_asignaciones").select(` 626 id, ot_numero, nivel, estado, auditor_id, fecha_completada, 627 hallazgo:auditoria_hallazgos(score, nivel_riesgo) 628 `).eq("periodo_id",N.id),O=[...new Set((E||[]).map(A=>A.ot_numero))];let P={};if(O.length>0){const{data:A}=await B.from("ordenes_de_trabajo").select("ot_numero, producto_resultante, fecha, jefe_turno").in("ot_numero",O);P=Object.fromEntries((A||[]).map(T=>[T.ot_numero,T]))}const C=(E||[]).map(A=>({...A,hallazgo:Array.isArray(A.hallazgo)?A.hallazgo[0]??null:A.hallazgo,ot:P[A.ot_numero]??null}));l(C)}}catch(_){console.error(_),Z.error("Error cargando datos: "+_.message)}finally{u(!1)}};h.useEffect(()=>{e.isLoading||g()},[e.isLoading,r.anio,r.semana]),h.useEffect(()=>{!y&&e.nivel?v(e.nivel):!y&&e.isAdmin&&v("gerencia")},[e.nivel,e.isAdmin,y]);const x=async(_=!1)=>{f(!0);try{const{data:N,error:E}=await B.functions.invoke("auditoria-generar-periodo",{body:{anio:r.anio,semana_iso:r.semana,regenerate:_}});if(E)throw E;Z.success((N==null?void 0:N.message)||"PerÃodo generado"),await g()}catch(N){Z.error("Error: "+N.message)}finally{f(!1)}},b=h.useMemo(()=>{const _={analista:[],jefe:[],gerencia:[]};return s.forEach(N=>{var E;return(E=_[N.nivel])==null?void 0:E.push(N)}),_},[s]),j=h.useMemo(()=>{const _=new Map;return b.analista.forEach(N=>_.set(N.ot_numero,N.estado)),_},[b]),w=h.useMemo(()=>{const _=[];return e.canViewAnalista&&_.push({key:"analista",label:"Analista",icon:Lf.analista}),e.canViewJefe&&_.push({key:"jefe",label:"Jefe",icon:Lf.jefe}),e.canViewGerencia&&_.push({key:"gerencia",label:"Gerencia",icon:Lf.gerencia}),_},[e]);if(e.isLoading)return o.jsx("div",{className:"flex items-center justify-center h-96",children:o.jsx(ye,{className:"h-8 w-8 animate-spin text-primary"})});if(!e.isAuditor&&!e.isAdmin)return o.jsx("div",{className:"container mx-auto p-6",children:o.jsx(de,{children:o.jsxs(fe,{className:"p-8 text-center",children:[o.jsx(Kr,{className:"h-12 w-12 text-yellow-500 mx-auto mb-4"}),o.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Acceso restringido"}),o.jsx("p",{className:"text-muted-foreground",children:"No tiene permisos para acceder al módulo de AuditorÃa."})]})})});const S=a?Math.max(0,Math.ceil((new Date(a.fecha_fin).getTime()-Date.now())/864e5)):0;return o.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[o.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-2",children:[o.jsx(m0,{className:"h-8 w-8 text-primary"}),"AuditorÃa"]}),o.jsx("p",{className:"text-muted-foreground mt-1",children:"Modelo Layered Process Audit (LPA) â 3 lÃneas de defensa"})]}),o.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[e.nivel&&o.jsxs(ke,{variant:"secondary",className:"text-sm",children:["Tu nivel: ",t0[e.nivel]]}),o.jsxs("div",{className:"flex items-center gap-1 rounded-md border bg-card px-1 py-0.5",children:[o.jsx(z,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>n(dP(r.anio,r.semana,-1)),"aria-label":"Semana anterior",children:o.jsx(Ao,{className:"h-4 w-4"})}),o.jsxs("span",{className:"text-xs font-medium px-2 min-w-[110px] text-center",children:["Sem ",r.semana," / ",r.anio]}),o.jsx(z,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>n(dP(r.anio,r.semana,1)),"aria-label":"Semana siguiente",children:o.jsx(Il,{className:"h-4 w-4"})}),(r.anio!==t.anio||r.semana!==t.semana)&&o.jsx(z,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2",onClick:()=>n(t),children:"Hoy"})]}),e.isAdmin&&o.jsxs(z,{onClick:()=>x(!1),disabled:d,size:"sm",variant:"outline",children:[d?o.jsx(ye,{className:"h-4 w-4 animate-spin mr-2"}):o.jsx($o,{className:"h-4 w-4 mr-2"}),a?"Actualizar":"Generar perÃodo"]})]})]}),c?o.jsx("div",{className:"flex items-center justify-center h-48",children:o.jsx(ye,{className:"h-6 w-6 animate-spin text-primary"})}):a?o.jsxs(de,{children:[o.jsxs(Le,{className:"pb-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs(Ie,{className:"text-lg",children:["Semana ",a.semana_iso," / ",a.anio]}),o.jsxs(ke,{variant:S<=2?"destructive":"secondary",children:[o.jsx(mn,{className:"h-3 w-3 mr-1"}),S," dÃas restantes"]})]}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Del ",a.fecha_inicio," al ",a.fecha_fin," · ",a.total_ots_completadas," OTs completadas"]})]}),o.jsx(fe,{children:o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:["analista","jefe","gerencia"].map(_=>{const N=_==="analista"?a.cupo_analista:_==="jefe"?a.cupo_jefe:a.cupo_gerencia,E=b[_].filter(P=>P.estado==="completada"||P.estado==="no_conforme").length,O=N>0?E/N*100:0;return o.jsx(de,{className:"border-2",children:o.jsxs(fe,{className:"p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("div",{className:"flex items-center gap-2 font-semibold",children:[Lf[_]," ",t0[_]]}),o.jsxs("span",{className:"text-2xl font-bold",children:[E,"/",N]})]}),o.jsx(Hp,{value:O,className:"h-2"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:O===100?"â Cuota cumplida":`${O.toFixed(0)}% de avance`})]})},_)})})})]}):o.jsx(de,{children:o.jsxs(fe,{className:"p-8 text-center",children:[o.jsxs("p",{className:"text-muted-foreground",children:["No hay perÃodo de auditorÃa para la semana ",r.semana," / ",r.anio,"."]}),e.isAdmin&&o.jsxs(z,{onClick:()=>x(!1),className:"mt-4",disabled:d,children:[d&&o.jsx(ye,{className:"h-4 w-4 animate-spin mr-2"}),"Generar perÃodo de esta semana"]})]})}),a&&w.length>0&&o.jsxs(Kl,{value:y,onValueChange:v,children:[o.jsxs(Zo,{className:"grid w-full",style:{gridTemplateColumns:`repeat(${w.length+2+(e.isAdmin?1:0)+1}, 1fr)`},children:[w.map(_=>o.jsxs(Yt,{value:_.key,className:"gap-2",children:[_.icon," ",_.label]},_.key)),o.jsxs(Yt,{value:"novedades",className:"gap-2",children:[o.jsx(Kr,{className:"h-4 w-4"})," Novedades"]}),o.jsxs(Yt,{value:"stats",className:"gap-2",children:[o.jsx(vA,{className:"h-4 w-4"})," EstadÃsticas"]}),e.isAdmin&&o.jsxs(Yt,{value:"config",className:"gap-2",children:[o.jsx(No,{className:"h-4 w-4"})," Configuración"]})]}),w.map(_=>o.jsx(Qt,{value:_.key,className:"space-y-4",children:_.key==="gerencia"?o.jsx(CPe,{periodo:a,asignacionesJefe:b.jefe,onAuditOpen:p,onSaved:g}):o.jsxs(o.Fragment,{children:[_.key==="jefe"&&o.jsx(Q4,{fechaInicio:a.fecha_inicio,fechaFin:a.fecha_fin}),o.jsx(TPe,{nivel:_.key,asignaciones:b[_.key],canEdit:e.nivel===_.key||e.isAdmin,onSelect:p,auditorId:e.auditorId,analistaStatusByOt:_.key==="jefe"?j:void 0})]})},_.key)),o.jsx(Qt,{value:"novedades",children:o.jsx(NPe,{})}),o.jsx(Qt,{value:"stats",children:o.jsx(vPe,{})}),e.isAdmin&&o.jsx(Qt,{value:"config",children:o.jsx(gPe,{onChanged:g,onRegenerate:()=>x(!0)})})]}),m&&o.jsx(Qre,{asignacion:m,open:!!m,onOpenChange:_=>!_&&p(null),onSaved:()=>{p(null),g()},canEdit:e.nivel===m.nivel||e.isAdmin,auditorId:e.auditorId})]})}function TPe({nivel:e,asignaciones:t,canEdit:r,onSelect:n,auditorId:a,analistaStatusByOt:i}){return t.length===0?o.jsx(de,{children:o.jsx(fe,{className:"p-8 text-center text-muted-foreground",children:"No hay OTs asignadas para este nivel en el perÃodo actual."})}):o.jsxs(de,{children:[o.jsx(Le,{children:o.jsxs(Ie,{className:"text-base",children:["OTs asignadas â ",t0[e]," (",t.length,")"]})}),o.jsx(fe,{children:o.jsxs(yn,{children:[o.jsx(xn,{children:o.jsxs(Nt,{children:[o.jsx(Pe,{children:"OT"}),o.jsx(Pe,{children:"Producto"}),o.jsx(Pe,{children:"Fecha"}),o.jsx(Pe,{children:"Jefe Turno"}),o.jsx(Pe,{children:"Estado"}),o.jsx(Pe,{children:"Score"}),o.jsx(Pe,{children:"Riesgo"}),o.jsx(Pe,{className:"text-right",children:"Acción"})]})}),o.jsx(bn,{children:t.map(s=>{var f,m,p,y;const l=s.estado==="completada"||s.estado==="no_conforme",c=i==null?void 0:i.get(s.ot_numero),u=e==="jefe"&&!l&&i!==void 0&&c!=="completada"&&c!=="no_conforme",d=!r&&!l||u;return o.jsxs(Nt,{children:[o.jsx(Oe,{className:"font-mono font-semibold",children:s.ot_numero}),o.jsx(Oe,{children:((f=s.ot)==null?void 0:f.producto_resultante)||"â"}),o.jsx(Oe,{children:((p=(m=s.ot)==null?void 0:m.fecha)==null?void 0:p.slice(0,10))||"â"}),o.jsx(Oe,{children:((y=s.ot)==null?void 0:y.jefe_turno)||"â"}),o.jsx(Oe,{children:o.jsx(ke,{className:PPe[s.estado],variant:"outline",children:s.estado==="en_progreso"?"En progreso":s.estado.charAt(0).toUpperCase()+s.estado.slice(1)})}),o.jsx(Oe,{className:"font-semibold",children:s.hallazgo?`${s.hallazgo.score}`:"â"}),o.jsx(Oe,{children:s.hallazgo?o.jsx(ke,{className:OPe[s.hallazgo.nivel_riesgo],variant:"outline",children:s.hallazgo.nivel_riesgo}):"â"}),o.jsx(Oe,{className:"text-right",children:o.jsx(z,{size:"sm",variant:l?"outline":"default",onClick:()=>n(s),disabled:d,title:u?"Pendiente de auditorÃa del analista":void 0,children:l?o.jsxs(o.Fragment,{children:[o.jsx(Do,{
628className:"h-4 w-4 mr-1"})," Ver"]}):u?"Esperando analista":"Auditar"})})]},s.id)})})]})})]})}function fP(e){if(!e)return!1;const t=(e.message||"").toLowerCase();return t.includes("removechild")||t.includes("insertbefore")||t.includes("the node to be removed")||t.includes("the node before which the new node is to be inserted")||e.name==="NotFoundError"}class Dc extends $.Component{constructor(){super(...arguments);cc(this,"state",{hasError:!1,error:null,errorInfo:null});cc(this,"handleRetry",()=>{this.setState({hasError:!1,error:null,errorInfo:null})});cc(this,"handleGoDashboard",()=>{window.location.href="/dashboard"});cc(this,"handleReload",()=>{window.location.reload()})}static getDerivedStateFromError(r){return fP(r)?{}:{hasError:!0,error:r}}componentDidCatch(r,n){if(fP(r)){console.warn("â ï¸ ErrorBoundary ignoró un error benigno de DOM:",r.message);return}console.error("ð ErrorBoundary capturó un error:",r),console.error("Component stack:",n==null?void 0:n.componentStack),this.setState({errorInfo:n})}render(){var r;return this.state.hasError?o.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 bg-background",children:o.jsxs(de,{className:"max-w-lg w-full",children:[o.jsx(Le,{children:o.jsxs(Ie,{className:"flex items-center gap-2 text-destructive",children:[o.jsx(Kr,{className:"h-5 w-5"}),"Error de interfaz"]})}),o.jsxs(fe,{className:"space-y-4",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:'Ocurrió un problema al renderizar la pantalla. No es un error de permisos ni una validación del formulario: es una excepción de la interfaz. Intenta "Reintentar" para continuar sin perder lo que escribiste; si no funciona, recarga la página.'}),((r=this.state.error)==null?void 0:r.message)&&o.jsx("pre",{className:"text-xs bg-muted p-2 rounded overflow-auto max-h-40",children:this.state.error.message}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsx(z,{onClick:this.handleRetry,children:"Reintentar"}),o.jsx(z,{variant:"outline",onClick:this.handleReload,children:"Recargar página"}),o.jsx(z,{variant:"ghost",onClick:this.handleGoDashboard,children:"Ir al Dashboard"})]})]})]})}):this.props.children}}const Ff=({to:e})=>{const t=vn(),r=`${e}${t.search}`;return o.jsx(fp,{to:r,replace:!0})},DPe=new S6({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,refetchInterval:!1,refetchIntervalInBackground:!1,staleTime:1/0,retry:!1}}}),$Pe=()=>o.jsx(Dc,{children:o.jsx(O6,{client:DPe,children:o.jsxs(x0,{children:[o.jsx(s5,{}),o.jsx(I5,{}),o.jsx(Lz,{children:o.jsx(Hz,{children:o.jsxs(Pz,{children:[o.jsx(dt,{path:"/login",element:o.jsx(_q,{})}),o.jsxs(dt,{element:o.jsx(yq,{children:o.jsx(gq,{})}),children:[o.jsx(dt,{path:"/",element:o.jsx(fp,{to:"/dashboard",replace:!0})}),o.jsx(dt,{path:"/forms",element:o.jsx(Y8,{})}),o.jsx(dt,{path:"/settings",element:o.jsx(AY,{})}),o.jsx(dt,{path:"/builder/:id",element:o.jsx(Q9,{})}),o.jsx(dt,{path:"/preview/:id",element:o.jsx(Dc,{children:o.jsx(SY,{})})}),o.jsx(dt,{path:"/fill/:id",element:o.jsx(Dc,{children:o.jsx(EY,{})})}),o.jsx(dt,{path:"/dashboard",element:o.jsx(hQ,{})}),o.jsx(dt,{path:"/preview/validation",element:o.jsx(Dc,{children:o.jsx(pQ,{})})}),o.jsx(dt,{path:"/preview/technical",element:o.jsx(Dc,{children:o.jsx(SQ,{})})}),o.jsx(dt,{path:"/users",element:o.jsx($Q,{})}),o.jsx(dt,{path:"/profiles",element:o.jsx(lee,{})}),o.jsx(dt,{path:"/shifts",element:o.jsx(vee,{})}),o.jsx(dt,{path:"/shifts/my-shift",element:o.jsx(hee,{})}),o.jsx(dt,{path:"/shifts/management",element:o.jsx(Eee,{requireAdmin:!0,children:o.jsx(uee,{})})}),o.jsx(dt,{path:"/onedrive-config",element:o.jsx(see,{})}),o.jsx(dt,{path:"/database-maintenance",element:o.jsx(Iee,{})}),o.jsx(dt,{path:"/control-tiempos",element:o.jsx(jee,{})}),o.jsx(dt,{path:"/maquinas",element:o.jsx(See,{})}),o.jsx(dt,{path:"/generar-semanas",element:o.jsx(_ee,{})}),o.jsx(dt,{path:"/reportes",element:o.jsx(Ree,{})}),o.jsx(dt,{path:"/base-conocimiento",element:o.jsx(Ere,{})}),o.jsx(dt,{path:"/auditoria",element:o.jsx(APe,{})}),o.jsx(dt,{path:"/forms/:id",element:o.jsx(Ff,{to:"/fill/:id"})}),o.jsx(dt,{path:"/forms/technical",element:o.jsx(Ff,{to:"/preview/technical"})}),o.jsx(dt,{path:"/forms/validation",element:o.jsx(Ff,{to:"/preview/validation"})}),o.jsx(dt,{path:"/forms/galletas",element:o.jsx(Ff,{to:"/fill/galletas"})})]}),o.jsx(dt,{path:"*",element:o.jsx(TY,{})})]})})})]})})}),mP=document.getElementById("root");mP&&LP(mP).render(o.jsx($Pe,{}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.