bonsaif-ui 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(L,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("react-icons/hi2"),require("react-dom"),require("overlayscrollbars"),require("react-icons/md"),require("overlayscrollbars-react"),require("react-day-picker"),require("react-day-picker/dist/style.css"),require("react-icons/fi"),require("sonner")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-icons/hi2","react-dom","overlayscrollbars","react-icons/md","overlayscrollbars-react","react-day-picker","react-day-picker/dist/style.css","react-icons/fi","sonner"],e):(L=typeof globalThis<"u"?globalThis:L||self,e(L.BonsaifUI={},L.jsxRuntime,L.React,L.ReactIconsHi2,L.ReactDOM,L.OverlayScrollbarsGlobal,L.ReactIconsMd,L.OverlayScrollbarsReact,L.ReactDayPicker,L.ReactDayPickerStyles,L.ReactIconsFi,L.Sonner))})(this,(function(L,e,o,y,Le,er,jr,rr,tr,fa,_r,Fr){"use strict";"use client";function ar(...r){return r.filter(Boolean).join(" ")}function Wr({variant:r="primary",className:t,type:a="button",children:n,...i}){return e.jsx("button",{className:ar("bonsaif-ui-button",`bonsaif-ui-button--${r}`,t),type:a,...i,children:n})}function nr({value:r,onChange:t,placeholder:a,className:n="",autoFocus:i=!1,forceExpanded:u=!1,onEscape:p,size:h="default",inputTabIndex:d}){const b=o.useRef(null),[k,C]=o.useState(!1),m=u||k||r.trim().length>0,f=h==="sm"?"h-9 rounded-md":"h-11 rounded-lg";o.useEffect(()=>{var c;i&&(C(!0),(c=b.current)==null||c.focus())},[i]);const g=()=>{var c;C(!0),(c=b.current)==null||c.focus()};return e.jsxs("div",{className:`relative flex-shrink-0 overflow-visible transition-[width] duration-200 ease-out ${m?n||"w-full":"w-28"}`,onMouseDown:c=>{m||(c.preventDefault(),g())},children:[e.jsx(y.HiMagnifyingGlass,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 pointer-events-none transition-colors duration-200",style:{color:"var(--text-muted)"}}),e.jsx("input",{ref:b,type:"text",tabIndex:d,"aria-label":a,value:r,onChange:c=>t(c.target.value),onKeyDown:c=>{c.key==="Escape"&&(p==null||p())},placeholder:m?a:"Buscar",className:`${f} w-full py-0 text-sm placeholder:text-[var(--text-muted)] focus:outline-none transition-all duration-200 ${m?"pl-9 pr-9":"cursor-pointer pl-9 pr-3"}`,style:{background:"var(--bg-card)",border:"1px solid var(--border)",color:"var(--text-main)"},onFocus:c=>{C(!0),c.currentTarget.style.borderColor="var(--primary)",c.currentTarget.style.boxShadow="0 0 0 3px rgba(59,130,246,0.12)"},onBlur:c=>{C(!1),c.currentTarget.style.borderColor="var(--border)",c.currentTarget.style.boxShadow="none"}}),r&&e.jsx("button",{type:"button",onClick:()=>t(""),className:"absolute right-2 top-1/2 flex !h-6 !w-6 -translate-y-1/2 items-center justify-center rounded-full !p-0 leading-none transition-colors hover:bg-black/5",style:{color:"var(--text-muted)"},"aria-label":"Limpiar búsqueda",children:e.jsx(y.HiXMark,{className:"h-3.5 w-3.5 flex-shrink-0"})})]})}const or=o.createContext({});function Ur(r){var n;const t=Array.from(r.querySelectorAll("*")).filter(i=>{var u;return i.scrollWidth>i.clientWidth&&!!((u=i.textContent)!=null&&u.trim())&&i.tagName.toLowerCase()!=="svg"&&!i.closest("svg")});return(r.scrollWidth>r.clientWidth||t.length>0)&&(((n=t[0])==null?void 0:n.textContent)??r.textContent??"").trim()||null}function De({children:r,content:t,onlyWhenOverflow:a=!1,className:n="",style:i,as:u="div"}){const p=o.useRef(null),h=o.useRef(null),[d,b]=o.useState(null),[k,C]=o.useState("");o.useEffect(()=>{const g=p.current;g&&(g.querySelectorAll("[title]").forEach(c=>{const w=c.getAttribute("title");w&&(c.getAttribute("aria-label")||c.setAttribute("aria-label",w),c.removeAttribute("title"))}),g.querySelectorAll("svg title").forEach(c=>c.remove()))}),o.useLayoutEffect(()=>{if(!d)return;const g=h.current;if(!g)return;const c=12,w=14,B=g.getBoundingClientRect(),_=window.innerWidth-B.width-c,P=window.innerHeight-B.height-c;let E=d.mouseX+w,H=d.mouseY+w;E>_&&(E=d.mouseX-B.width-w),H>P&&(H=d.mouseY-B.height-w),E=Math.min(Math.max(c,E),Math.max(c,_)),H=Math.min(Math.max(c,H),Math.max(c,P)),(Math.abs(E-d.x)>.5||Math.abs(H-d.y)>.5)&&b(T=>T&&{...T,x:E,y:H})},[d]);const m=(g,c)=>{const w=p.current;if(w){if(a){const B=Ur(w);if(!B)return;C(B)}!a&&!t||b({mouseX:g,mouseY:c,x:g+14,y:c+14})}},f=a?k:t;return e.jsxs(e.Fragment,{children:[e.jsx(u,{ref:g=>{p.current=g},className:n,style:i,onMouseEnter:g=>m(g.clientX,g.clientY),onMouseMove:g=>{d&&m(g.clientX,g.clientY)},onMouseLeave:()=>b(null),children:r}),d&&f?Le.createPortal(e.jsx("div",{ref:h,role:"tooltip",style:{position:"fixed",top:d.y,left:d.x,zIndex:9999,background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:6,padding:"5px 10px",fontSize:12,color:"var(--text-main)",boxShadow:"0 4px 16px rgba(0,0,0,0.35)",pointerEvents:"none",maxWidth:"min(420px, calc(100vw - 24px))",whiteSpace:"normal",lineHeight:1.6,overflowWrap:"anywhere"},children:f}),document.body):null]})}function sr(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}const qr="inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap leading-none font-medium transition-all duration-150 focus:outline-none disabled:opacity-50 rounded-lg",Gr={primary:"border border-[var(--border)] text-[var(--text-main)] hover:border-[var(--border)] hover:bg-[var(--bg-input)] active:scale-[0.98] transition-colors",secondary:"border border-[var(--border)] text-[var(--text-main)] hover:border-[var(--border)] hover:bg-[var(--bg-input)] active:scale-[0.98] transition-colors",danger:"border border-[var(--border)] text-[var(--danger)] hover:border-[var(--danger)] hover:bg-[var(--danger-bg)] active:scale-[0.98] transition-colors",ghost:"text-[var(--text-secondary)] hover:opacity-70",icon:"text-[var(--text-muted)] hover:text-[var(--primary)] hover:bg-primary/5"},Yr={xs:"h-8 px-2.5 text-xs",sm:"h-9 px-3.5 text-xs",md:"h-11 px-4 text-sm",lg:"h-12 px-5 text-sm font-semibold"},Xr={xs:"h-8 w-8",sm:"h-9 w-9",md:"h-10 w-10",lg:"h-11 w-11"},Vr={primary:{background:"var(--bg-card)"},secondary:{background:"var(--bg-card)"},danger:{background:"var(--bg-card)"},ghost:{},icon:{}};function Ge(r){return typeof r=="string"||typeof r=="number"?String(r):Array.isArray(r)?r.map(Ge).join(" ").trim():o.isValidElement(r)?Ge(r.props.children):""}function Zr(r){return o.Children.toArray(r).find(o.isValidElement)??null}function ue({variant:r="primary",size:t="md",loading:a=!1,icon:n,tooltip:i,iconOnly:u,height:p,padding:h,children:d,className:b="",disabled:k,style:C,...m}){const f=o.useContext(or),g=u??f.iconOnly??r==="icon",c=f.compact??!1,w=c&&t==="md"?"xs":t,B=r==="icon"||g,_=Ge(d),P=i??m.title??m["aria-label"]??(g?_:void 0),E=P?void 0:m.title,H=m["aria-label"]??(typeof P=="string"?P:_||void 0),T=a?null:n??(g?Zr(d):null),$=e.jsxs("button",{...m,title:E,"aria-label":H,"data-variant":r,"data-size":w,"data-icon":B?"true":void 0,disabled:k||a,className:`${qr} ${Gr[r]} ${B?Xr[w]:Yr[w]} ${c&&!B?"px-2.5":""} ${b}`,style:{...Vr[r],height:sr(p),padding:sr(h),...C},children:[a?e.jsx("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):T,!g&&d]});return P?e.jsx(De,{as:"span",content:P,className:"inline-flex shrink-0",children:$}):$}function ir({variant:r="page",title:t="Cargando...",rows:a=6,children:n}){return r==="table"?e.jsx(lr,{rows:a}):r==="sections"?e.jsx(Jr,{rows:a}):r==="cards"?e.jsx(Kr,{rows:a}):e.jsx("div",{className:"flex min-h-[240px] items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-6",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[e.jsx("div",{className:"h-9 w-9 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--primary)]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-[var(--text-main)]",children:t}),n&&e.jsx("div",{className:"mt-1 text-xs text-[var(--text-muted)]",children:n})]})]})})}function Jr({rows:r}){return e.jsx("div",{className:"space-y-4",children:Array.from({length:Math.max(2,Math.min(r,4))}).map((t,a)=>e.jsxs("section",{className:"overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[var(--border)] px-3 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-pulse rounded bg-[var(--bg-input)]"}),e.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-[var(--bg-input)]"}),e.jsx("div",{className:"h-5 w-20 animate-pulse rounded-full bg-[var(--bg-input)]"})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("div",{className:"h-8 w-8 animate-pulse rounded-md bg-[var(--bg-input)]"}),e.jsx("div",{className:"h-8 w-8 animate-pulse rounded-md bg-[var(--bg-input)]"})]})]}),e.jsx(lr,{rows:a===0?r:Math.max(3,r-2),compact:!0})]},a))})}function Kr({rows:r}){return e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:Array.from({length:r}).map((t,a)=>e.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("div",{className:"h-4 w-2/3 animate-pulse rounded bg-[var(--bg-input)]"}),e.jsx("div",{className:"mt-3 h-3 w-full animate-pulse rounded bg-[var(--bg-input)]"}),e.jsx("div",{className:"mt-2 h-3 w-4/5 animate-pulse rounded bg-[var(--bg-input)]"})]},a))})}function lr({rows:r,compact:t=!1}){const a=t?5:6;return e.jsxs("div",{className:"overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("div",{className:"grid border-b border-[var(--border)]",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:Array.from({length:a}).map((n,i)=>e.jsx("div",{className:"px-3 py-3",children:e.jsx("div",{className:"h-3 w-2/3 animate-pulse rounded bg-[var(--bg-input)]"})},i))}),Array.from({length:r}).map((n,i)=>e.jsx("div",{className:"grid border-b border-[var(--border)] last:border-b-0",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:Array.from({length:a}).map((u,p)=>e.jsx("div",{className:"px-3 py-3",children:e.jsx("div",{className:"h-3.5 animate-pulse rounded-full bg-[var(--bg-input)]",style:{width:`${52+(i*13+p*11)%36}%`}})},p))},i))]})}function cr(r){const t=r.split("/").filter(Boolean);return(t[t.length-1]??r).replace(/^lv_/,"").split(/[-_]/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function dr(r){return r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function Qr(r){return[r.label,cr(r.service),r.description,r.service].filter(Boolean).join(" ")}function Rr(r){return typeof r=="function"?r:r.default}function et(r,t){return e.jsx("div",{className:"flex min-h-[220px] items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-6 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("p",{className:"text-sm font-semibold text-[var(--text-main)]",children:"No se pudo cargar este modulo"}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:r.message}),e.jsx(ue,{className:"mt-4",height:36,padding:"0 14px",onClick:t,children:"Reintentar"})]})})}function rt({parentPanel:r,parentPanelComponent:t,renderParentPanel:a,parent:n,context:i,links:u,moduleRegistry:p,loadModule:h,activeService:d,initialService:b,onActiveServiceChange:k,canAccess:C,keepAlive:m=!0,title:f,subtitle:g,emptyState:c,loadingState:w,errorState:B=et,renderTabLabel:_,searchableTabs:P="auto",tabsSearchThreshold:E=6,tabsSearchPlaceholder:H="Buscar modulo...",tabsSearchValue:T,onTabsSearchChange:$,emptySearchState:F,showTabCount:O=!0,className:D="",parentClassName:I="",contentClassName:K="",tabsClassName:W=""}){var ve;const U=o.useMemo(()=>u.filter(v=>!v.hidden&&((C==null?void 0:C(v,i))??!0)),[C,i,u]),Z=(ve=U.find(v=>!v.disabled))==null?void 0:ve.service,[R,s]=o.useState(b??Z??""),[N,q]=o.useState({}),[G,V]=o.useState({}),[re,le]=o.useState(""),[te,ye]=o.useState(!1),he=o.useRef(G),be=o.useRef(0),ce=T??re,S=dr(ce),j=P===!0||P==="auto"&&U.length>=E,X=j&&ce.trim().length>0,ae=o.useMemo(()=>S?U.filter(v=>dr(Qr(v)).includes(S)):U,[S,U]),oe=d??R,z=U.find(v=>v.service===oe)??U.find(v=>!v.disabled);o.useEffect(()=>{!z&&Z&&s(Z)},[Z,z]),o.useEffect(()=>{he.current=G},[G]);const we=v=>{v.disabled||(d||s(v.service),k==null||k(v.service,v))},je=v=>{T===void 0&&le(v),$==null||$(v)},Ke=(v,ee)=>{const J=ae.filter(ie=>!ie.disabled),ge=J.findIndex(ie=>ie.service===ee.service);ge<0||((v.key==="ArrowRight"||v.key==="ArrowDown")&&(v.preventDefault(),we(J[(ge+1)%J.length])),(v.key==="ArrowLeft"||v.key==="ArrowUp")&&(v.preventDefault(),we(J[(ge-1+J.length)%J.length])),v.key==="Home"&&(v.preventDefault(),we(J[0])),v.key==="End"&&(v.preventDefault(),we(J[J.length-1])))},fe=o.useCallback(()=>{if(!z)return;const v=z.service,ee=he.current[v];if(ee!=null&&ee.loading||ee!=null&&ee.component&&m)return;const J=(p==null?void 0:p[v])??h;if(!J){V(ie=>({...ie,[v]:{loading:!1,error:new Error(`No module loader found for service "${v}".`)}}));return}const ge=++be.current;V(ie=>({...ie,[v]:{...ie[v],loading:!0,error:void 0}})),J(z,i).then(ie=>{if(ge!==be.current&&!m)return;const Oe=Rr(ie);V(ke=>({...ke,[v]:{component:Oe,loading:!1}}))}).catch(ie=>{const Oe=ie instanceof Error?ie:new Error(String(ie));V(ke=>({...ke,[v]:{...ke[v],loading:!1,error:Oe}}))})},[i,m,h,p,z]);o.useEffect(fe,[fe]);const _e=z?N[z.service]??null:null,ne=z?G[z.service]:void 0,Fe=ne==null?void 0:ne.component,Ee=v=>{z&&q(ee=>({...ee,[z.service]:v}))},Te=()=>{z&&q(v=>({...v,[z.service]:null}))},We={context:i,parent:n,links:u,visibleLinks:U,filteredLinks:ae,selectedLink:z,selectedService:z==null?void 0:z.service,activeItemId:_e,tabsSearch:ce,onSelectService:we,onOpenDetail:Ee,onBackToList:Te},Ne=a?a(We):t?e.jsx(t,{...We}):r;return e.jsxs("section",{className:`grid min-h-[520px] gap-4 lg:grid-cols-[minmax(260px,360px)_minmax(0,1fr)] ${D}`,children:[e.jsx("aside",{className:`min-w-0 rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-4 ${I}`,children:Ne}),e.jsxs("div",{className:`relative min-w-0 overflow-visible rounded-lg border border-[var(--border)] bg-[var(--bg-card)] ${K}`,children:[(f||g||j||O)&&e.jsx("div",{className:"relative border-b border-[var(--border)] px-4 py-3",children:e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[f&&e.jsx("h2",{className:"truncate text-sm font-semibold text-[var(--text-main)]",children:f}),g&&e.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-[var(--text-muted)]",children:g})]}),(j||O)&&e.jsxs("div",{className:"flex min-w-0 flex-shrink-0 items-center justify-end gap-2",children:[O&&e.jsxs("span",{className:"hidden text-xs font-semibold text-[var(--text-muted)] transition-opacity duration-200 sm:inline",children:[ae.length," / ",U.length]}),j&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`origin-right overflow-hidden transition-[width,opacity,transform] duration-200 ease-out ${te?"w-[min(20rem,44vw)] translate-x-0 opacity-100":"w-0 translate-x-2 opacity-0"}`,"aria-hidden":!te,children:e.jsx(nr,{value:ce,onChange:je,placeholder:H,className:"w-full",autoFocus:te,forceExpanded:!0,onEscape:()=>ye(!1),size:"sm",inputTabIndex:te?0:-1})}),e.jsx("button",{type:"button","aria-label":te?"Cerrar busqueda":"Buscar tabs","aria-expanded":te,onClick:()=>{te&&ce&&je(""),ye(v=>!v)},className:`inline-flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md border transition-all duration-200 hover:scale-[1.03] active:scale-95 ${te||X?"border-[var(--primary)] bg-[var(--bg-input)] text-[var(--text-main)] shadow-sm":"border-[var(--border)] text-[var(--text-muted)] hover:bg-[var(--bg-input)] hover:text-[var(--text-main)]"}`,children:e.jsx("span",{className:"grid h-4 w-4 place-items-center transition-transform duration-200",children:te||X?e.jsx(y.HiXMark,{className:"h-4 w-4"}):e.jsx(y.HiMagnifyingGlass,{className:"h-4 w-4"})})})]})]})]})}),e.jsx("div",{role:"tablist","aria-label":f??"Modulos relacionados",className:`flex gap-1 overflow-x-auto border-b border-[var(--border)] bg-[var(--bg-input)] px-2 py-1.5 transition-colors duration-200 ${W}`,children:ae.length>0?ae.map(v=>{const ee=v.service===(z==null?void 0:z.service);return e.jsx("button",{type:"button",role:"tab","aria-selected":ee,disabled:v.disabled,onClick:()=>we(v),onKeyDown:J=>Ke(J,v),className:`inline-flex h-9 min-w-max items-center gap-2 rounded-md border px-3 text-xs font-semibold transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-50 ${ee?"border-[var(--primary)] bg-[var(--bg-card)] text-[var(--text-main)] shadow-sm":"border-transparent text-[var(--text-muted)] hover:bg-[var(--bg-card)] hover:text-[var(--text-main)]"}`,children:_?_(v,ee):e.jsxs(e.Fragment,{children:[v.icon,e.jsx("span",{children:v.label??cr(v.service)}),v.badge&&e.jsx("span",{className:"rounded-full bg-[var(--bg-input)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:v.badge})]})},v.service)}):e.jsx("div",{className:"flex min-h-9 flex-1 items-center rounded-md border border-dashed border-[var(--border)] px-3 text-xs text-[var(--text-muted)]",children:F??"No hay modulos que coincidan con la busqueda."})}),(z==null?void 0:z.description)&&e.jsx("div",{className:"border-b border-[var(--border)] px-4 py-2 text-xs text-[var(--text-muted)]",children:z.description}),e.jsxs("div",{className:"min-h-[420px] p-4",children:[!z&&(c??e.jsx("div",{className:"flex min-h-[220px] items-center justify-center rounded-lg border border-dashed border-[var(--border)] text-sm text-[var(--text-muted)]",children:"No hay modulos disponibles."})),z&&(ne==null?void 0:ne.loading)&&(w??e.jsx(ir,{title:"Cargando modulo..."})),z&&(ne==null?void 0:ne.error)&&B(ne.error,fe),z&&Fe&&!(ne!=null&&ne.loading)&&!(ne!=null&&ne.error)&&e.jsx(Fe,{context:i,parent:n,link:z,activeItemId:_e,onOpenDetail:Ee,onBackToList:Te})]})]})]})}const ur=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],tt=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],at=["Do","Lu","Ma","Mi","Ju","Vi","Sá"],Ye=6;function Xe(r,t,a){return`${r}-${String(t).padStart(2,"0")}-${String(a).padStart(2,"0")}`}function nt(){const r=new Date;return Xe(r.getFullYear(),r.getMonth()+1,r.getDate())}function fr(r){const[t,a,n]=r.split("-").map(Number);return{year:t,month:a,day:n}}function ot(r){if(!r)return"Seleccionar fecha";const{year:t,month:a,day:n}=fr(r);return!t||!a||!n?"Seleccionar fecha":`${String(n).padStart(2,"0")} ${ur[a-1]} ${t}`}function st({value:r,onChange:t,minDate:a,displayMode:n="inline"}){const i=nt(),p=fr(r||i),h=n==="popover",[d,b]=o.useState(!1),k=o.useRef(null),[C,m]=o.useState({horizontal:"left",vertical:"bottom"}),[f,g]=o.useState(p.year),[c,w]=o.useState(p.month),[B,_]=o.useState("days"),P=16,[E,H]=o.useState(0),T=f-7+E,$=Array.from({length:P},(s,N)=>T+N);o.useEffect(()=>{if(!h||!d||!k.current)return;const s=k.current.getBoundingClientRect(),N=8,q=280,G=340,V=s.left+q>window.innerWidth-N,re=s.right-q>=N,le=s.bottom+8+G>window.innerHeight-N,te=s.top-8-G>=N;m({horizontal:V&&re?"right":"left",vertical:le&&te?"top":"bottom"})},[h,d]),o.useEffect(()=>{if(!h||!d)return;function s(q){k.current&&(k.current.contains(q.target)||b(!1))}function N(q){q.key==="Escape"&&b(!1)}return document.addEventListener("mousedown",s),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",N)}},[h,d]);function F(){c===1?(g(s=>s-1),w(12)):w(s=>s-1)}function O(){c===12?(g(s=>s+1),w(1)):w(s=>s+1)}const D=new Date(f,c-1,1).getDay(),I=new Date(f,c,0).getDate(),K=[...Array(D).fill(null),...Array.from({length:I},(s,N)=>N+1)];for(;K.length<Ye*7;)K.push(null);const W=K.slice(0,Ye*7);function U(s){const N=Xe(f,c,s);a&&N<a||(t(N),h&&b(!1))}const Z={background:"none",border:"none",cursor:"pointer",color:"var(--text-muted)",padding:4,borderRadius:6,display:"flex",alignItems:"center"},R=e.jsxs("div",{style:{background:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",userSelect:"none",width:280},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 12px",borderBottom:"1px solid var(--border)"},children:B==="days"?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:F,style:Z,title:"Mes anterior",children:e.jsx(y.HiChevronLeft,{size:16})}),e.jsxs("button",{type:"button",onClick:()=>{_("years"),H(0)},style:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:4,fontSize:13,fontWeight:700,color:"var(--text-main)",borderRadius:6,padding:"2px 6px"},children:[ur[c-1]," ",f,e.jsx(y.HiChevronDown,{size:13,style:{color:"var(--text-muted)"}})]}),e.jsx("button",{type:"button",onClick:O,style:Z,title:"Mes siguiente",children:e.jsx(y.HiChevronRight,{size:16})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>H(s=>s-P),style:Z,children:e.jsx(y.HiChevronLeft,{size:16})}),e.jsxs("button",{type:"button",onClick:()=>_("days"),style:{background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:700,color:"var(--text-main)",borderRadius:6,padding:"2px 6px"},children:[$[0]," – ",$[$.length-1]]}),e.jsx("button",{type:"button",onClick:()=>H(s=>s+P),style:Z,children:e.jsx(y.HiChevronRight,{size:16})})]})}),B==="years"&&e.jsxs("div",{style:{padding:"8px 10px 10px"},children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4,1fr)",gap:3,marginBottom:8},children:tt.map((s,N)=>{const q=N+1===c;return e.jsx("button",{type:"button",onClick:()=>w(N+1),style:{border:"none",cursor:"pointer",borderRadius:6,fontSize:11,fontWeight:q?700:400,padding:"4px 0",background:q?"var(--primary)":"transparent",color:q?"var(--primary-fg, #ffffff)":"var(--text-secondary)"},children:s},s)})}),e.jsx("div",{style:{height:1,background:"var(--border)",marginBottom:8}}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4,1fr)",gap:3},children:$.map(s=>{const N=s===f;return e.jsx("button",{type:"button",onClick:()=>{g(s),_("days")},style:{border:"none",cursor:"pointer",borderRadius:6,fontSize:12,fontWeight:N?700:400,padding:"6px 0",background:N?"var(--primary)":"transparent",color:N?"var(--primary-fg, #ffffff)":"var(--text-main)",outline:s===new Date().getFullYear()&&!N?"2px solid var(--primary)":"none",outlineOffset:"-2px"},children:s},s)})})]}),B==="days"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7,1fr)",padding:"6px 8px 0"},children:at.map(s=>e.jsx("div",{style:{textAlign:"center",fontSize:10,fontWeight:700,color:"var(--text-muted)",padding:"2px 0",textTransform:"uppercase"},children:s},s))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7,1fr)",gridTemplateRows:`repeat(${Ye},1fr)`,padding:"4px 8px 10px",gap:2},children:W.map((s,N)=>{if(s===null)return e.jsx("div",{style:{aspectRatio:"1"}},N);const q=Xe(f,c,s),G=q===r,V=q===i,re=!!(a&&q<a);return e.jsx("button",{type:"button",onClick:()=>!re&&U(s),style:{width:"100%",aspectRatio:"1",borderRadius:6,border:"none",cursor:re?"not-allowed":"pointer",fontSize:12,fontWeight:G||V?700:400,background:G?"var(--primary)":"transparent",color:G?"var(--primary-fg, #ffffff)":re?"var(--text-muted)":"var(--text-main)",opacity:re?.4:1,outline:V&&!G?"2px solid var(--primary)":"none",outlineOffset:"-2px"},children:s},N)})})]})]});return h?e.jsxs("div",{ref:k,className:"relative w-full",children:[e.jsxs("button",{type:"button",onClick:()=>b(s=>!s),className:"flex h-11 w-full items-center justify-between gap-2 rounded-lg px-3 py-0 text-sm transition-all duration-150 focus:outline-none",style:{background:"var(--bg-input)",border:`1px solid ${d?"var(--primary)":"var(--border)"}`,color:"var(--text-main)",boxShadow:d?"0 0 0 3px rgba(59,130,246,0.12)":"none"},children:[e.jsxs("span",{className:"inline-flex items-center gap-2 min-w-0",children:[e.jsx(y.HiCalendarDays,{className:"w-4 h-4 text-[var(--text-muted)]"}),e.jsx("span",{className:"truncate",children:ot(r)})]}),e.jsx(y.HiChevronDown,{className:`w-4 h-4 text-[var(--text-muted)] transition-transform ${d?"rotate-180":""}`})]}),d&&e.jsx("div",{className:"absolute z-50",style:{...C.horizontal==="left"?{left:0}:{right:0},...C.vertical==="bottom"?{top:"calc(100% + 8px)"}:{bottom:"calc(100% + 8px)"}},children:R})]}):R}function pr(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}function Ve({value:r,onChange:t,options:a,placeholder:n="Seleccionar…",emptyLabel:i,disabled:u=!1,className:p="",style:h,height:d=44,padding:b="0 12px",searchable:k=!0,minOptionsForSearch:C=6}){const[m,f]=o.useState(!1),[g,c]=o.useState(""),[w,B]=o.useState(-1),[_,P]=o.useState(!1),[E,H]=o.useState({}),T=o.useRef(null),$=o.useRef(null),F=o.useRef(null),O=o.useRef(null),D=k&&a.length>=C,I=a.find(s=>s.value===r)??null,K=D&&g.trim()?a.filter(s=>{var N;return s.label.toLowerCase().includes(g.toLowerCase())||((N=s.sublabel)==null?void 0:N.toLowerCase().includes(g.toLowerCase()))}):a,W=o.useCallback(()=>{const s=T.current;if(!s)return;const N=s.getBoundingClientRect(),q=D?272:212,G=window.innerHeight-N.bottom,V=G<q&&N.top>G;H({position:"fixed",left:N.left,top:V?void 0:N.bottom+4,bottom:V?window.innerHeight-N.top+4:void 0,width:N.width,zIndex:9999})},[D]);o.useEffect(()=>P(!0),[]),o.useEffect(()=>{if(!m)return;function s(N){var G,V;const q=N.target;!((G=T.current)!=null&&G.contains(q))&&!((V=$.current)!=null&&V.contains(q))&&(f(!1),c(""))}return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[m]),o.useEffect(()=>{m&&(B(-1),W(),D&&setTimeout(()=>{var s;return(s=F.current)==null?void 0:s.focus()},0))},[m,D,W]),o.useEffect(()=>{if(m)return window.addEventListener("resize",W),window.addEventListener("scroll",W,!0),()=>{window.removeEventListener("resize",W),window.removeEventListener("scroll",W,!0)}},[m,W]),o.useEffect(()=>{if(w<0||!O.current)return;const s=O.current.children[w];s==null||s.scrollIntoView({block:"nearest"})},[w]);const U=o.useCallback(s=>{t(s),f(!1),c("")},[t]);function Z(s){if(!m){(s.key==="Enter"||s.key===" "||s.key==="ArrowDown")&&(s.preventDefault(),f(!0));return}s.key==="Escape"?(s.preventDefault(),f(!1),c("")):s.key==="ArrowDown"?(s.preventDefault(),B(N=>Math.min(N+1,K.length-1))):s.key==="ArrowUp"?(s.preventDefault(),B(N=>Math.max(N-1,i?-1:0))):s.key==="Enter"&&(s.preventDefault(),w===-1&&i?U(""):K[w]&&U(K[w].value))}const R=e.jsxs("div",{ref:$,className:"rounded-xl shadow-xl overflow-hidden",style:{...E,background:"var(--bg-card)",border:"1px solid var(--border)"},children:[D&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{borderBottom:"1px solid var(--border)"},children:[e.jsx(y.HiMagnifyingGlass,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"var(--text-muted)"}}),e.jsx("input",{ref:F,value:g,onChange:s=>{c(s.target.value),B(-1)},placeholder:"Buscar…",className:"min-w-0 flex-1 text-sm bg-transparent outline-none",style:{color:"var(--text-main)"}}),g&&e.jsx("button",{type:"button",onMouseDown:s=>{s.preventDefault(),c("")},children:e.jsx(y.HiXMark,{className:"w-3.5 h-3.5",style:{color:"var(--text-muted)"}})})]}),e.jsxs("ul",{ref:O,role:"listbox",className:"overflow-y-auto",style:{maxHeight:D?220:180,scrollbarWidth:"thin",scrollbarColor:"var(--border) transparent",overscrollBehavior:"contain"},children:[i&&e.jsx("li",{role:"option","aria-selected":r==="",onMouseDown:s=>{s.preventDefault(),U("")},onMouseEnter:()=>B(-1),className:"flex items-center gap-2 px-3 py-2 cursor-pointer text-sm transition-colors",style:{background:w===-1?"var(--bg-hover)":"transparent",color:"var(--text-muted)",fontStyle:"italic"},children:i}),K.map((s,N)=>{const G=N===w,V=s.value===r;return e.jsxs("li",{role:"option","aria-selected":V,onMouseDown:re=>{re.preventDefault(),s.disabled||U(s.value)},onMouseEnter:()=>!s.disabled&&B(N),className:"flex items-center gap-2 px-3 py-2 cursor-pointer text-sm transition-colors",style:{background:G?"var(--bg-hover)":V?"color-mix(in srgb, var(--primary) 6%, transparent)":"transparent",color:s.disabled?"var(--text-muted)":"var(--text-main)",cursor:s.disabled?"not-allowed":"pointer",boxShadow:V?"inset 2px 0 0 var(--primary)":void 0},children:[s.color&&e.jsx("span",{className:"flex-shrink-0 w-2.5 h-2.5 rounded-full",style:{background:s.color}}),e.jsxs("span",{className:"min-w-0 flex flex-1 items-baseline gap-1 overflow-hidden",children:[e.jsx("span",{className:"truncate",children:s.label}),s.sublabel&&e.jsx("span",{className:"min-w-0 flex-shrink truncate",style:{color:"var(--text-muted)",fontSize:12},children:s.sublabel})]}),s.badge&&e.jsx("span",{className:"text-xs flex-shrink-0",style:{color:"var(--text-muted)"},children:s.badge})]},s.value)}),K.length===0&&e.jsx("li",{className:"px-3 py-4 text-sm text-center",style:{color:"var(--text-muted)"},children:"Sin resultados"})]})]});return e.jsxs("div",{ref:T,className:`relative ${p||"w-full"}`,style:h,onKeyDown:Z,children:[e.jsxs("button",{type:"button",disabled:u,onClick:()=>!u&&f(s=>!s),className:"flex w-full items-center gap-2 rounded-lg text-left text-sm transition-colors focus:outline-none",style:{height:pr(d),padding:pr(b),background:"var(--bg-input)",color:I?"var(--text-main)":"var(--text-muted)",border:m?"1px solid var(--primary)":"1px solid var(--border)",opacity:u?.5:1,cursor:u?"not-allowed":"pointer"},"aria-haspopup":"listbox","aria-expanded":m,children:[(I==null?void 0:I.color)&&e.jsx("span",{className:"flex-shrink-0 w-2.5 h-2.5 rounded-full",style:{background:I.color}}),e.jsx("span",{className:"min-w-0 flex flex-1 items-baseline gap-1 overflow-hidden",children:I?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"truncate",children:I.label}),I.sublabel&&e.jsx("span",{className:"min-w-0 flex-shrink truncate",style:{color:"var(--text-muted)",fontSize:12},children:I.sublabel})]}):e.jsx("span",{className:"truncate",children:n})}),I&&i?e.jsx("span",{role:"button",tabIndex:-1,onMouseDown:s=>{s.preventDefault(),s.stopPropagation(),U("")},className:"flex-shrink-0 rounded-full p-0.5 transition-colors hover:bg-black/10",style:{color:"var(--text-muted)"},children:e.jsx(y.HiXMark,{className:"w-3 h-3"})}):e.jsx(y.HiChevronDown,{className:"flex-shrink-0 w-4 h-4 transition-transform",style:{color:"var(--text-muted)",transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),m&&_&&Le.createPortal(R,document.body)]})}function He(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}function it({value:r,onChange:t,placeholder:a="Buscar...",className:n="",height:i=44,padding:u="0 12px 0 34px",iconLeft:p=12}){return e.jsxs("div",{className:`relative ${n}`,children:[e.jsx(y.HiMagnifyingGlass,{className:"absolute top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)] pointer-events-none",style:{left:He(p)}}),e.jsx("input",{type:"text",value:r,onChange:h=>t(h.target.value),placeholder:a,className:"w-full rounded-lg border border-[var(--border)] [background:var(--bg-card)] text-sm text-[var(--text-main)] placeholder:text-[var(--text-muted)] outline-none transition-[border-color,box-shadow] focus:border-primary focus:ring-2 focus:ring-primary/20",style:{height:He(i),padding:He(u)}})]})}function lt({value:r,onChange:t,options:a,placeholder:n,icon:i,className:u="",height:p=44,padding:h,iconLeft:d=12,searchable:b=!0}){const k=i?a.map((C,m)=>m===0&&!C.color?{...C,sublabel:C.sublabel??void 0}:C):a;return e.jsxs("div",{className:`relative ${u}`,children:[i&&e.jsx("span",{className:"pointer-events-none absolute top-1/2 z-10 -translate-y-1/2 text-[var(--text-muted)]",style:{left:He(d)},children:i}),e.jsx(Ve,{value:r,onChange:t,options:k,placeholder:n,searchable:b,minOptionsForSearch:5,height:p,padding:h??(i?"0 12px 0 34px":"0 12px"),className:"[&>button]:text-sm [&>button]:[background:var(--bg-card)]"})]})}const ct={sm:"24rem",md:"28rem",lg:"32rem",xl:"40rem","2xl":"48rem","4xl":"56rem","5xl":"64rem"},Pe=180;function hr({open:r,onClose:t,title:a,subtitle:n,leadingIcon:i,headerActions:u,footer:p,children:h,size:d="md",maxWidth:b,zIndex:k=1e3,closeOnBackdrop:C=!0,closeOnEscape:m=!0,showCloseButton:f=!0,placement:g="center",bodyClassName:c="px-6 py-5",panelClassName:w="",backdropClassName:B="bg-black/50 backdrop-blur-sm",contentClassName:_="p-4",ariaLabel:P,frameless:E=!1}){const[H,T]=o.useState(!1),[$,F]=o.useState(!1),O=o.useRef(null);if(o.useEffect(()=>(r?(O.current&&clearTimeout(O.current),T(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>F(!0)))):(F(!1),O.current=setTimeout(()=>T(!1),Pe+40)),()=>{O.current&&clearTimeout(O.current)}),[r]),o.useEffect(()=>{if(r)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[r]),o.useEffect(()=>{if(!r||!m)return;const Z=R=>{R.key==="Escape"&&t()};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[m,t,r]),!H)return null;const D=a||n||i||u||f,I=b??ct[d],K=g==="bottom-mobile"?"items-end sm:items-center justify-center p-0 sm:p-4":"items-center justify-center",W=g==="bottom-mobile"?"rounded-t-2xl sm:rounded-2xl":"rounded-2xl",U=$?"translateY(0) scale(1)":g==="bottom-mobile"?"translateY(16px) scale(0.98)":"translateY(10px) scale(0.96)";return Le.createPortal(e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":P??a,className:`fixed inset-0 flex ${K} ${_}`,style:{zIndex:k},children:[e.jsx("div",{className:`absolute inset-0 ${B}`,onClick:C?t:void 0,style:{opacity:$?1:0,transition:`opacity ${Pe}ms ease`}}),e.jsxs("div",{className:`relative z-10 flex max-h-[92dvh] w-full flex-col overflow-hidden ${E?"shadow-none":"shadow-2xl"} ${W} ${w}`,style:{maxWidth:I,background:E?"transparent":"var(--bg-card)",border:E?"none":"1px solid var(--border)",opacity:$?1:0,transform:U,transition:`opacity ${Pe}ms ease, transform ${Pe}ms ease`},onClick:Z=>Z.stopPropagation(),children:[D&&e.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between gap-3 px-6 py-4",style:{borderBottom:"1px solid var(--border)"},children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[i&&e.jsx("div",{className:"flex-shrink-0",children:i}),(a||n)&&e.jsxs("div",{className:"min-w-0",children:[a&&e.jsx("h2",{className:"truncate text-base font-semibold",style:{color:"var(--text-main)"},children:a}),n&&e.jsx("p",{className:"truncate text-xs",style:{color:"var(--text-muted)"},children:n})]})]}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2",children:[u,f&&e.jsx(ue,{variant:"icon",onClick:t,title:"Cerrar",children:e.jsx(y.HiXMark,{className:"h-5 w-5"})})]})]}),e.jsx("div",{className:`min-h-0 flex-1 overflow-y-auto ${c}`,children:h}),p&&e.jsx("div",{className:"flex flex-shrink-0 justify-end gap-2 px-6 py-4",style:{borderTop:"1px solid var(--border)"},children:p})]})]}),document.body)}const dt={danger:{iconBg:"rgba(239,68,68,0.12)",iconColor:"var(--danger)",btnBg:"var(--danger)",btnColor:"#fff"},warning:{iconBg:"rgba(245,158,11,0.12)",iconColor:"var(--warning)",btnBg:"var(--warning)",btnColor:"#fff"},primary:{iconBg:"rgba(59,130,246,0.12)",iconColor:"var(--primary)",btnBg:"var(--primary)",btnColor:"#fff"}};function ut({open:r,title:t,description:a,confirmLabel:n="Confirmar",cancelLabel:i="Cancelar",variant:u="danger",onConfirm:p,onCancel:h}){const d=dt[u];return e.jsxs(hr,{open:r,onClose:h,size:"sm",zIndex:9998,showCloseButton:!1,bodyClassName:"p-6",panelClassName:"px-1",ariaLabel:t,children:[e.jsx(ue,{variant:"icon",onClick:h,className:"absolute right-3 top-3 h-7 w-7 hover:opacity-70",style:{color:"var(--text-muted)"},"aria-label":"Cancelar",children:e.jsx(y.HiXMark,{className:"h-4 w-4"})}),e.jsx("div",{className:"mb-4 flex h-11 w-11 items-center justify-center rounded-xl",style:{background:d.iconBg},children:e.jsx(y.HiExclamationTriangle,{className:"h-5 w-5",style:{color:d.iconColor}})}),e.jsx("h2",{className:"mb-1 text-base font-semibold",style:{color:"var(--text-main)"},children:t}),a&&e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:a}),e.jsxs("div",{className:"mt-6 flex gap-2",children:[e.jsx(ue,{variant:"secondary",onClick:h,className:"flex-1",style:{background:"var(--bg-input)"},children:i}),e.jsx(ue,{variant:"danger",onClick:p,className:"flex-1",style:{background:d.btnBg,color:d.btnColor,borderColor:"transparent"},children:n})]})]})}function br(r){const t=document.createElement("textarea");t.value=r,t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}async function ft(r){var t;if((t=navigator.clipboard)!=null&&t.writeText){await navigator.clipboard.writeText(r);return}br(r)}function pt(r){return typeof r=="function"?r():r}function mr({value:r,resetDelay:t=2e3,title:a,copiedTitle:n="Copiado",copiedLabel:i,icon:u=e.jsx(y.HiClipboardDocument,{className:"h-3.5 w-3.5"}),copiedIcon:p=e.jsx(y.HiCheck,{className:"h-3.5 w-3.5"}),stopPropagation:h=!0,onCopied:d,onCopyError:b,className:k="",style:C,children:m,onClick:f,type:g="button",...c}){const[w,B]=o.useState(!1),_=o.useRef(null);o.useEffect(()=>()=>{_.current&&window.clearTimeout(_.current)},[]);function P(H){B(!0),d==null||d(H),_.current&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>{B(!1),_.current=null},t)}async function E(H){var $;if(h&&H.stopPropagation(),f==null||f(H),H.defaultPrevented)return;const T=pt(r);if(T)try{await ft(T),P(T)}catch(F){try{br(T),P(T)}catch(O){b==null||b(O,T);return}($=navigator.clipboard)!=null&&$.writeText||b==null||b(F,T)}}return e.jsxs("button",{...c,type:g,onClick:E,title:w?n:a,"aria-label":c["aria-label"]??(w?n:a),"data-copied":w?"true":void 0,className:`relative inline-flex h-7 shrink-0 items-center justify-center rounded-md transition-all duration-200 ${m?"min-w-7 px-2":"w-7"} ${k}`,style:{cursor:"pointer",background:w?"rgba(22,163,74,0.15)":"transparent",border:w?"1px solid rgba(22,163,74,0.4)":"1px solid transparent",color:w?"#16a34a":"var(--text-muted)",boxShadow:w?"0 0 0 3px rgba(22,163,74,0.12)":"none",...C},children:[e.jsx("span",{className:"inline-flex items-center justify-center transition-all duration-150",style:{transform:w?"scale(1.15)":"scale(1)"},children:w?p:u}),m&&e.jsx("span",{className:"ml-2 text-xs font-medium",children:w?i??m:m})]})}function ht(r,t){const a=typeof r=="function"?r():r;return t?t(a):a}function bt({url:r,resolveUrl:t,title:a="Copiar link",copiedTitle:n="Link copiado",icon:i=e.jsx(y.HiLink,{className:"h-3.5 w-3.5"}),...u}){return e.jsx(mr,{...u,value:()=>ht(r,t),title:a,copiedTitle:n,icon:i})}const mt="[&_button]:h-7 [&_button]:min-h-0 [&_button]:gap-1 [&_button]:px-2 [&_button]:text-xs [&_button_svg]:h-3.5 [&_button_svg]:w-3.5 [&_button[data-icon=true]]:w-7 [&_button[data-icon=true]]:px-0";function $e(r){if(!r)return 150;const t=parseInt(r,10);return isNaN(t)||t<=0?150:t}function Se(r,t){const a=r.minWidth??80,n=r.maxWidth??1/0;return Math.min(n,Math.max(a,t))}function vt(r,t){if(t<=7)return Array.from({length:t},(n,i)=>i+1);const a=[1];r>3&&a.push("...");for(let n=Math.max(2,r-1);n<=Math.min(t-1,r+1);n++)a.push(n);return r<t-2&&a.push("..."),a.push(t),a}function vr({children:r,className:t="",style:a}){return e.jsx(De,{onlyWhenOverflow:!0,className:t,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",...a},children:r})}function gt({columns:r,data:t,getRowId:a,loading:n=!1,skeletonRows:i=8,emptyIcon:u,emptyText:p="Sin resultados",onRowClick:h,selected:d,onToggleOne:b,onToggleAll:k,highlightSelected:C=!0,rowClassName:m,getRowCategory:f,stickyHeader:g=!0,pageSize:c=25,pageSizeOptions:w=[25,50,100],pageSizeSelectWidth:B=62,pageSizeSelectHeight:_=30,pageSizeSelectPadding:P="0 7px",totalRows:E,page:H,onPageChange:T,onPageSizeChange:$,storageKey:F,stickyFirstColumn:O=!1,bottomOffset:D=0,compact:I=!0,restrictHeight:K=!0,minTableWidth:W}){const U=r.map(l=>l.key).join(","),[Z,R]=o.useState(!F),s=o.useRef(null),N=o.useRef(!F),q=(l,x)=>50+(l*17+x*13+7)%40,G=o.useRef(null),[V,re]=o.useState(void 0),[le,te]=o.useState(!1);o.useEffect(()=>{const x=c!==!1?32:0,M=12;function A(){if(te(window.innerWidth<640),!G.current)return;const Y=G.current.getBoundingClientRect().top;re(Math.max(120,window.innerHeight-Y-x-M-D))}return A(),window.addEventListener("resize",A),()=>window.removeEventListener("resize",A)},[n,c,D]);const[ye,he]=o.useState(()=>r.map(l=>l.key)),[be,ce]=o.useState(()=>Object.fromEntries(r.map(l=>[l.key,Se(l,$e(l.width))])));o.useEffect(()=>{const l=r.map(M=>M.key);if(!F){he(l),N.current=!1,R(!0);return}let x=!1;return N.current=!1,R(!1),fetch(`/api/user/preferences/datatables?key=${encodeURIComponent(F)}`,{cache:"no-store"}).then(M=>M.ok?M.json():null).then(M=>{var Ue,qe;if(x)return;const A=(Ue=M==null?void 0:M.settings)==null?void 0:Ue.columnOrder,Y=Array.isArray(A)?A.filter(pe=>l.includes(pe)):[],de=l.filter(pe=>!Y.includes(pe)),me=Y.length>0?[...Y,...de]:l,Ce=Object.fromEntries(r.map(pe=>[pe.key,Se(pe,$e(pe.width))])),Q=((qe=M==null?void 0:M.settings)==null?void 0:qe.columnWidths)??{},se=Object.fromEntries(r.map(pe=>[pe.key,Se(pe,Q[pe.key]??Ce[pe.key])]));he(me),ce(se),s.current=JSON.stringify({columnOrder:me,columnWidths:se}),N.current=!0}).catch(()=>{if(!x){he(l);const M=Object.fromEntries(r.map(A=>[A.key,Se(A,$e(A.width))]));ce(M),s.current=JSON.stringify({columnOrder:l,columnWidths:M}),N.current=!0}}).finally(()=>{x||R(!0)}),()=>{x=!0}},[F,U,r]),o.useEffect(()=>{if(!F||!Z||!N.current)return;const l={columnOrder:ye,columnWidths:be},x=JSON.stringify(l);if(x===s.current)return;const M=window.setTimeout(()=>{fetch("/api/user/preferences/datatables",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:F,settings:l})}).then(A=>{A.ok&&(s.current=x)}).catch(()=>{})},300);return()=>window.clearTimeout(M)},[ye,be,F,Z]),o.useEffect(()=>{he(l=>{const x=r.map(Y=>Y.key),M=l.filter(Y=>x.includes(Y)),A=x.filter(Y=>!M.includes(Y));return[...M,...A]})},[U,r]);const S=ye.map(l=>r.find(x=>x.key===l)).filter(l=>!!l);o.useEffect(()=>{ce(l=>{const x=Object.fromEntries(r.map(M=>[M.key,Se(M,$e(M.width))]));return Object.fromEntries(r.map(M=>[M.key,Se(M,l[M.key]??x[M.key])]))})},[U,r]);const j=o.useRef(null);o.useEffect(()=>{function l(M){const A=j.current;if(!A)return;const Y=M.clientX-A.startX,de=r.find(me=>me.key===A.colKey);de&&ce(me=>({...me,[A.colKey]:Se(de,A.startWidth+Y)}))}function x(){j.current&&(j.current=null,document.body.style.cursor="",document.body.style.userSelect="")}return document.addEventListener("pointermove",l),document.addEventListener("pointerup",x),()=>{document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",x)}},[r]);const X=o.useRef(null),[ae,oe]=o.useState(null);function z(l,x){X.current=l,x.dataTransfer.effectAllowed="move"}function we(l,x){x.preventDefault(),x.dataTransfer.dropEffect="move",ae!==l&&oe(l)}function je(l,x){x.preventDefault();const M=X.current;M!==null&&M!==l&&he(A=>{const Y=[...A],[de]=Y.splice(M,1);return Y.splice(l,0,de),Y}),X.current=null,oe(null)}function Ke(){X.current=null,oe(null)}const[fe,_e]=o.useState(null);function ne(l){l.sortKey&&_e(x=>(x==null?void 0:x.key)===l.key?{key:l.key,dir:x.dir==="asc"?"desc":"asc"}:{key:l.key,dir:"asc"})}const[Fe,Ee]=o.useState(1),[Te,We]=o.useState(c===!1?0:c);o.useEffect(()=>{Ee(1)},[t]);const Ne=!!(T&&$),ve=c!==!1,v=Ne?H??1:Fe,ee=Ne||ve?Te:t.length,J=!!d&&!!b&&!!k,ge=J?40:0,ie=J&&t.length>0&&d.size===t.length,Oe=J&&d.size>0&&d.size<t.length,ke=o.useMemo(()=>{if(!fe)return t;const l=r.find(x=>x.key===fe.key&&x.sortKey);return l!=null&&l.sortKey?[...t].sort((x,M)=>{const A=x[l.sortKey],Y=M[l.sortKey],de=A===Y?0:A==null?1:Y==null||A<Y?-1:1;return fe.dir==="asc"?de:-de}):t},[t,fe,r]),Hr=o.useMemo(()=>{if(Ne||!ve)return ke;const l=(v-1)*ee;return ke.slice(l,l+ee)},[ke,Ne,ve,v,ee]),Be=E??t.length,Qe=ve?Math.max(1,Math.ceil(Be/ee)):1,ia=ve?(v-1)*ee+1:1,la=ve?Math.min(v*ee,Be):Be;function Re(l){const x=Math.max(1,Math.min(l,Qe));Ne?T(x):Ee(x)}function ca(l){We(l),Ne?($(l),T(1)):Ee(1),$&&$(l)}const Pr=l=>l==="center"?"text-center":l==="right"?"text-right":"text-left",da="color-mix(in srgb, var(--primary) 6%, var(--bg-card))",ua=S.length+(J?1:0);function Ar(l){return l?typeof l=="string"?{key:l,label:l}:l:null}const Ir=()=>e.jsxs("tr",{style:{background:"color-mix(in srgb, var(--bg-input) 72%, transparent)"},children:[J&&e.jsx("th",{className:`${I?"px-2 py-1.5":"px-3 py-2.5"} w-10`,style:O?{position:"sticky",left:0,zIndex:12,background:"color-mix(in srgb, var(--bg-input) 72%, transparent)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",boxShadow:"inset 0 -2px 0 var(--border)",borderRight:"1px solid var(--border)"}:{borderBottom:"2px solid var(--border)",borderRight:"1px solid var(--border)"},children:e.jsx("input",{type:"checkbox",checked:ie,ref:l=>{l&&(l.indeterminate=Oe)},onChange:k,className:"rounded cursor-pointer accent-[var(--primary)]"})}),S.map((l,x)=>{const M=(fe==null?void 0:fe.key)===l.key,A=!!l.sortKey,Y=O&&!le&&x===0,de=ae===x,Ce=(be[l.key]??$e(l.width))<120;return e.jsxs("th",{className:`group select-none ${Ce?"text-left":Pr(l.align)}`,style:{...Y?{position:"sticky",left:ge,zIndex:12,background:"color-mix(in srgb, var(--bg-input) 72%, transparent)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",boxShadow:"3px 0 6px -2px rgba(0,0,0,0.12), inset 0 -2px 0 var(--border)",borderRight:"1px solid var(--border)"}:{position:"relative",borderBottom:"2px solid var(--border)",borderRight:"1px solid var(--border)"},color:M?"var(--primary)":"var(--text-muted)",whiteSpace:"nowrap",transition:"color 0.15s",borderLeft:de?"2px solid var(--primary)":"2px solid transparent",cursor:A?"pointer":"default",padding:I?"5px 24px 5px 6px":"7px 28px 7px 6px"},onDragOver:Q=>we(x,Q),onDrop:Q=>je(x,Q),onClick:A?()=>ne(l):void 0,children:[e.jsx("span",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),z(x,Q)},onDragEnd:Q=>{Q.stopPropagation(),Ke()},onClick:Q=>Q.stopPropagation(),title:"Arrastrar para reordenar",className:"inline-flex items-center mr-1 opacity-0 group-hover:opacity-40 transition-opacity",style:{cursor:"grab",color:"var(--text-muted)",verticalAlign:"middle"},children:e.jsx(jr.MdDragIndicator,{size:15})}),e.jsx(vr,{className:"inline-block max-w-full align-middle",style:{width:"calc(100% - 22px)",textAlign:Ce?"left":l.align==="center"?"center":l.align==="right"?"right":"left"},children:e.jsxs("span",{className:`inline-flex max-w-full items-center gap-1 font-semibold uppercase tracking-wider ${I?"text-[11px]":"text-xs"}`,children:[e.jsx("span",{className:"min-w-0 truncate",children:l.header}),A&&e.jsx("span",{className:"flex-shrink-0 opacity-60",children:M?fe.dir==="asc"?e.jsx(y.HiChevronUp,{className:"w-3 h-3"}):e.jsx(y.HiChevronDown,{className:"w-3 h-3"}):e.jsx(y.HiChevronUpDown,{className:"w-3 h-3 opacity-40"})})]})}),e.jsx("span",{role:"separator","aria-orientation":"vertical",title:"Arrastrar para redimensionar",onPointerDown:Q=>{Q.preventDefault(),Q.stopPropagation(),j.current={colKey:l.key,startX:Q.clientX,startWidth:be[l.key]??150},document.body.style.cursor="col-resize",document.body.style.userSelect="none"},onClick:Q=>Q.stopPropagation(),className:"absolute right-0 top-0 h-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",style:{width:12,cursor:"col-resize",zIndex:3},children:e.jsx("span",{style:{width:3,height:"40%",borderRadius:2,background:"var(--primary)",display:"block"}})})]},l.key)})]}),zr=()=>{if(!ve||n)return null;const l=vt(v,Qe);return e.jsxs("div",{className:`grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-2 rounded-b-xl border-t text-xs select-none ${I?"px-2 py-0.5":"px-3 py-1"}`,style:{borderColor:"var(--border)",background:"var(--bg-input)"},children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{style:{color:"var(--text-muted)"},children:Be===0?"0 filas":`${ia}–${la} de ${Be}`}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{style:{color:"var(--text-muted)"},children:"Filas:"}),e.jsx(Ve,{value:String(ee),onChange:x=>ca(Number(x)),options:w.map(x=>({value:String(x),label:String(x)})),placeholder:"Filas",searchable:!1,height:_,padding:P,className:"shrink-0 [&>button]:rounded-md [&>button]:text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",style:{width:B}})]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-0.5",children:[e.jsx("button",{disabled:v<=1,onClick:()=>Re(v-1),className:"rounded p-0.5 transition-colors disabled:opacity-30",style:{color:"var(--text-muted)",background:"transparent"},children:e.jsx(y.HiChevronLeft,{className:"h-3.5 w-3.5"})}),l.map((x,M)=>x==="..."?e.jsx("span",{className:"px-1",style:{color:"var(--text-muted)"},children:"…"},`e${M}`):e.jsx("button",{onClick:()=>Re(x),className:"h-5 w-5 rounded text-[11px] font-medium transition-colors",style:{background:x===v?"var(--primary)":"transparent",color:x===v?"var(--primary-fg)":"var(--text-muted)"},children:x},x)),e.jsx("button",{disabled:v>=Qe,onClick:()=>Re(v+1),className:"rounded p-0.5 transition-colors disabled:opacity-30",style:{color:"var(--text-muted)",background:"transparent"},children:e.jsx(y.HiChevronRight,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{"aria-hidden":"true"})]})};return n&&t.length===0?e.jsxs("div",{className:"w-full min-w-0 max-w-full flex flex-col rounded-xl overflow-visible",style:{border:"1px solid var(--border)"},children:[e.jsx("div",{ref:G,className:"min-w-0 max-w-full overflow-hidden rounded-t-xl",children:e.jsx(rr.OverlayScrollbarsComponent,{options:{scrollbars:{autoHide:"leave",autoHideDelay:200}},className:"w-full",style:{maxHeight:K?V:void 0,maxWidth:"100%"},defer:!0,children:e.jsxs("table",{className:"text-sm",style:{tableLayout:"fixed",width:"100%",minWidth:W??"max-content",borderCollapse:"separate",borderSpacing:0},children:[e.jsxs("colgroup",{children:[J&&e.jsx("col",{style:{width:40}}),S.map(l=>e.jsx("col",{style:{width:be[l.key]??150}},l.key))]}),e.jsx("thead",{style:g?{position:"sticky",top:0,zIndex:10,backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"}:void 0,children:Ir()}),e.jsx("tbody",{children:Array.from({length:i}).map((l,x)=>e.jsxs("tr",{children:[J&&e.jsx("td",{className:`${I?"px-2 py-1.5":"px-3 py-2"} w-10`,style:{borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)"}}),S.map((M,A)=>{const Y=O&&!le&&A===0;return e.jsx("td",{className:I?"px-2 py-1.5":"px-3 py-2",style:Y?{position:"sticky",left:ge,zIndex:1,background:"color-mix(in srgb, var(--bg-card) 72%, transparent)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",boxShadow:"3px 0 6px -2px rgba(0,0,0,0.12), inset 0 -1px 0 var(--border)",borderRight:"1px solid var(--border)"}:{borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)"},children:e.jsx("div",{className:"h-3.5 rounded-full animate-pulse",style:{background:"var(--border)",width:`${q(x,A)}%`,minWidth:32}})},M.key)})]},x))})]})})}),zr()]}):!n&&t.length===0?e.jsxs("div",{className:"py-20 flex flex-col items-center gap-3",children:[u&&e.jsx("div",{style:{color:"var(--text-muted)",opacity:.5},children:u}),e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:p})]}):e.jsxs("div",{className:"w-full min-w-0 max-w-full flex flex-col rounded-xl overflow-visible",style:{border:"1px solid var(--border)"},children:[e.jsx("div",{ref:G,className:"min-w-0 max-w-full overflow-hidden rounded-t-xl",children:e.jsx(rr.OverlayScrollbarsComponent,{options:{scrollbars:{autoHide:"leave",autoHideDelay:200}},className:"w-full",style:{maxHeight:K?V:void 0,maxWidth:"100%"},defer:!0,children:e.jsxs("table",{className:"text-sm",style:{tableLayout:"fixed",width:"100%",minWidth:W??"max-content",borderCollapse:"separate",borderSpacing:0},children:[e.jsxs("colgroup",{children:[J&&e.jsx("col",{style:{width:40}}),S.map(l=>e.jsx("col",{style:{width:be[l.key]??150}},l.key))]}),e.jsx("thead",{style:g?{position:"sticky",top:0,zIndex:10,backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"}:void 0,children:Ir()}),e.jsx("tbody",{children:Hr.map((l,x)=>{const M=a(l),A=Ar(f==null?void 0:f(l)),Y=x>0?Ar(f==null?void 0:f(Hr[x-1])):null,de=A&&A.key!==(Y==null?void 0:Y.key),me=J&&d.has(M),Ce=!!h,Q=me&&C?"color-mix(in srgb, var(--primary) 8%, var(--bg-card))":x%2===1?"color-mix(in srgb, var(--bg-input) 50%, var(--bg-card))":"var(--bg-card)";return e.jsxs(o.Fragment,{children:[de&&e.jsx("tr",{className:A.className??"",children:e.jsx("td",{colSpan:ua,className:I?"px-2 py-2":"px-3 py-3",style:{background:"color-mix(in srgb, var(--primary) 8%, var(--bg-input))",borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)"},children:e.jsx("div",{className:"flex min-w-0 items-center justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-xs font-semibold uppercase tracking-wider text-[var(--text-main)]",children:A.label}),A.description&&e.jsx("div",{className:"mt-0.5 truncate text-xs text-[var(--text-muted)]",children:A.description})]})})})}),e.jsxs("tr",{onClick:Ce?()=>h(l):void 0,className:`transition-colors ${Ce?"cursor-pointer":""} ${m?m(l):""}`,style:{"--dt-row-bg":Q,"--dt-sticky-bg":Q,background:"var(--dt-row-bg)"},onMouseEnter:se=>{me||(se.currentTarget.style.setProperty("--dt-row-bg","var(--bg-hover)"),se.currentTarget.style.setProperty("--dt-sticky-bg",da))},onMouseLeave:se=>{se.currentTarget.style.setProperty("--dt-row-bg",Q),se.currentTarget.style.setProperty("--dt-sticky-bg",Q)},children:[J&&e.jsx("td",{className:`${I?"px-2 py-1.5":"px-3 py-2"} w-10`,style:O?{position:"sticky",left:0,zIndex:3,background:"var(--dt-sticky-bg)",boxShadow:"inset 0 -1px 0 var(--border)"}:{borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)"},onClick:se=>{se.stopPropagation(),b(M)},children:e.jsx("input",{type:"checkbox",checked:me,onClick:se=>se.stopPropagation(),onChange:()=>b(M),className:"rounded cursor-pointer accent-[var(--primary)]"})}),S.map((se,Ue)=>{const qe=O&&!le&&Ue===0;return e.jsx("td",{className:`${I?"px-2 py-1.5":"px-3 py-2"} ${mt} ${Pr(se.align)} ${se.className??""}`,style:{overflow:"hidden",whiteSpace:"nowrap",...qe?{position:"sticky",left:ge,zIndex:3,background:"var(--dt-sticky-bg)",boxShadow:"3px 0 6px -2px rgba(0,0,0,0.12), inset 0 -1px 0 var(--border)",borderRight:"1px solid var(--border)"}:{borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)"}},children:e.jsx(vr,{children:se.cell(l)})},se.key)})]})]},M)})})]})})}),zr()]})}function Me(r){return r?new Date(`${r}T12:00:00`):void 0}function gr(r){return r.toISOString().slice(0,10)}function xt({calendarMonth:r,displayIndex:t}){const{previousMonth:a,nextMonth:n,goToMonth:i,months:u,labels:p,formatters:h}=tr.useDayPicker(),d=!!a&&t===0,b=!!n&&t===u.length-1;return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:8,width:"100%",color:"var(--text-main)",marginBottom:6},children:[e.jsx("span",{style:{fontWeight:700},children:h.formatCaption(r.date)}),e.jsx("button",{type:"button","aria-label":p.labelPrevious(a),onClick:()=>a&&i(a),disabled:!d,style:{height:28,width:28,borderRadius:8,border:"1px solid var(--border)",background:"var(--bg-card)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"var(--text-main)",opacity:d?1:.45,cursor:d?"pointer":"not-allowed"},children:e.jsx(y.HiChevronLeft,{size:16})}),e.jsx("button",{type:"button","aria-label":p.labelNext(n),onClick:()=>n&&i(n),disabled:!b,style:{height:28,width:28,borderRadius:8,border:"1px solid var(--border)",background:"var(--bg-card)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"var(--text-main)",opacity:b?1:.45,cursor:b?"pointer":"not-allowed"},children:e.jsx(y.HiChevronRight,{size:16})})]})}function yt(r){return r.charAt(0).toUpperCase()+r.slice(1)}function wt({startDate:r,endDate:t,onChange:a,minDate:n,viewMonth:i,numberOfMonths:u=1,showSummary:p=!0,startLabel:h="Inicio",endLabel:d="Regreso"}){const b={from:Me(r),to:Me(t)},k=Me(n),[C,m]=o.useState(Me(i||r));return o.useEffect(()=>{m(Me(i||r))},[i,r]),e.jsxs("div",{children:[e.jsx("div",{style:{borderRadius:10,overflow:"hidden",border:"1px solid var(--border)",background:"var(--bg-input)",display:"flex",justifyContent:"center",padding:"10px 8px"},children:e.jsx(tr.DayPicker,{mode:"range",selected:b,month:C,onMonthChange:m,onSelect:f=>{const g=f!=null&&f.from?gr(f.from):r,c=f!=null&&f.to?gr(f.to):"";a({startDate:g,endDate:c})},numberOfMonths:u,hideNavigation:!0,disabled:k?{before:k}:void 0,showOutsideDays:!1,components:{MonthCaption:xt},className:"text-sm",classNames:{root:"w-full",months:"flex gap-3 justify-center",month:"space-y-2",month_caption:"flex items-center justify-between px-1",caption_label:"capitalize",nav:"flex items-center gap-1",button_previous:"h-8 w-8 inline-flex items-center justify-center rounded-md transition-colors",button_next:"h-8 w-8 inline-flex items-center justify-center rounded-md transition-colors",month_grid:"w-full border-collapse",weekdays:"grid grid-cols-7 gap-1 mb-1",weekday:"text-[11px] font-semibold text-center",week:"grid grid-cols-7 gap-1",day:"h-9 w-9 p-0 flex items-center justify-center",day_button:"h-9 w-9 rounded-md text-sm font-medium transition-colors outline-none",selected:"font-semibold",range_start:"font-semibold",range_middle:"font-medium",range_end:"font-semibold",today:"font-bold",disabled:"opacity-40 cursor-not-allowed",hidden:"invisible"},styles:{month_caption:{color:"var(--text-main)",marginBottom:6,display:"flex",alignItems:"center",justifyContent:"space-between"},caption_label:{color:"var(--text-main)",fontWeight:700},nav:{position:"static",display:"flex",alignItems:"center",gap:6},weekday:{color:"var(--text-muted)",textTransform:"lowercase"},button_previous:{height:32,width:32,background:"var(--bg-card)",color:"var(--text-main)",border:"1px solid var(--border)"},button_next:{height:32,width:32,background:"var(--bg-card)",color:"var(--text-main)",border:"1px solid var(--border)"},day_button:{color:"var(--text-main)",borderRadius:8},chevron:{fill:"var(--text-main)"},today:{border:"1px solid color-mix(in srgb, var(--primary) 35%, transparent)"},disabled:{color:"var(--text-muted)"}},modifiersStyles:{selected:{background:"var(--primary)",color:"var(--primary-fg, #ffffff)"},range_start:{background:"var(--primary)",color:"var(--primary-fg, #ffffff)"},range_end:{background:"var(--primary)",color:"var(--primary-fg, #ffffff)"},range_middle:{background:"color-mix(in srgb, var(--primary) 20%, transparent)",color:"var(--text-main)"}},formatters:{formatCaption:f=>yt(new Intl.DateTimeFormat("es-MX",{month:"long",year:"numeric"}).format(f)),formatWeekdayName:f=>new Intl.DateTimeFormat("es-MX",{weekday:"short"}).format(f)},labels:{labelMonthDropdown:()=>"Mes",labelYearDropdown:()=>"Año"}})}),p&&r&&e.jsxs("div",{style:{marginTop:8,fontSize:12,color:"var(--text-muted)",display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsxs("span",{children:[h,":"," ",e.jsx("strong",{style:{color:"var(--text-main)"},children:r})]}),t&&e.jsxs("span",{children:[d,":"," ",e.jsx("strong",{style:{color:"var(--text-main)"},children:t})]})]})]})}function Nt({open:r,onClose:t,title:a,subtitle:n,leadingIcon:i,confirmLabel:u="Guardar",onConfirm:p,loading:h=!1,confirmDisabled:d=!1,headerActions:b,bodyClassName:k="flex-1 overflow-y-auto px-6 py-5",width:C=440,children:m}){const[f,g]=o.useState(!1);return o.useEffect(()=>{g(!0)},[]),o.useEffect(()=>(document.body.style.overflow=r?"hidden":"",()=>{document.body.style.overflow=""}),[r]),o.useEffect(()=>{if(!r)return;const c=w=>{w.key==="Escape"&&t()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r,t]),f?Le.createPortal(e.jsxs("div",{"aria-hidden":!r,className:`fixed inset-0 z-[1000] flex transition-opacity duration-300 ${r?"opacity-100":"opacity-0 pointer-events-none"}`,children:[e.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",onClick:t}),e.jsxs("div",{className:`absolute inset-y-0 right-0 flex flex-col shadow-2xl transition-transform duration-300 ${r?"translate-x-0":"translate-x-full"}`,style:{width:`min(100vw, ${C}px)`,background:"var(--bg-card)",borderLeft:"1px solid var(--border)"},children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 flex-shrink-0",style:{borderBottom:"1px solid var(--border)"},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(ue,{variant:"icon",onClick:t,title:"Cerrar",children:e.jsx(y.HiXMark,{className:"w-5 h-5"})}),i&&e.jsx("div",{className:"flex-shrink-0",children:i}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"text-base font-semibold truncate",style:{color:"var(--text-main)"},children:a}),n&&e.jsx("p",{className:"text-xs truncate",style:{color:"var(--text-muted)"},children:n})]})]}),(b||p)&&e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[b,p&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{variant:"secondary",size:"sm",onClick:t,style:{background:"var(--bg-input)"},children:"Cancelar"}),e.jsx(ue,{variant:"primary",size:"sm",icon:e.jsx(_r.FiSave,{className:"w-4 h-4"}),onClick:p,loading:h,disabled:d,title:u})]})]})]}),e.jsx("div",{"data-drawer-scroll":"true",className:k,children:m})]})]}),document.body):null}var xr={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},yr=o.createContext&&o.createContext(xr),kt=["attr","size","title"];function St(r,t){if(r==null)return{};var a,n,i=Ct(r,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(r);for(n=0;n<u.length;n++)a=u[n],t.indexOf(a)===-1&&{}.propertyIsEnumerable.call(r,a)&&(i[a]=r[a])}return i}function Ct(r,t){if(r==null)return{};var a={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(t.indexOf(n)!==-1)continue;a[n]=r[n]}return a}function Ae(){return Ae=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(r[n]=a[n])}return r},Ae.apply(null,arguments)}function wr(r,t){var a=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),a.push.apply(a,n)}return a}function Ie(r){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?wr(Object(a),!0).forEach(function(n){Et(r,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):wr(Object(a)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(a,n))})}return r}function Et(r,t,a){return(t=$t(t))in r?Object.defineProperty(r,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[t]=a,r}function $t(r){var t=Mt(r,"string");return typeof t=="symbol"?t:t+""}function Mt(r,t){if(typeof r!="object"||!r)return r;var a=r[Symbol.toPrimitive];if(a!==void 0){var n=a.call(r,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function Nr(r){return r&&r.map((t,a)=>o.createElement(t.tag,Ie({key:a},t.attr),Nr(t.child)))}function kr(r){return t=>o.createElement(Tt,Ae({attr:Ie({},r.attr)},t),Nr(r.child))}function Tt(r){var t=a=>{var{attr:n,size:i,title:u}=r,p=St(r,kt),h=i||a.size||"1em",d;return a.className&&(d=a.className),r.className&&(d=(d?d+" ":"")+r.className),o.createElement("svg",Ae({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,n,p,{className:d,style:Ie(Ie({color:r.color||a.color},a.style),r.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),u&&o.createElement("title",null,u),r.children)};return yr!==void 0?o.createElement(yr.Consumer,null,a=>t(a)):t(xr)}function Ot(r){return kr({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z"},child:[]}]})(r)}function Bt(r){return kr({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M228,175a8,8,0,0,1-10.92-3l-19-33.2A123.23,123.23,0,0,1,162,155.46l5.87,35.22a8,8,0,0,1-6.58,9.21A8.4,8.4,0,0,1,160,200a8,8,0,0,1-7.88-6.69l-5.77-34.58a133.06,133.06,0,0,1-36.68,0l-5.77,34.58A8,8,0,0,1,96,200a8.4,8.4,0,0,1-1.32-.11,8,8,0,0,1-6.58-9.21L94,155.46a123.23,123.23,0,0,1-36.06-16.69L39,172A8,8,0,1,1,25.06,164l20-35a153.47,153.47,0,0,1-19.3-20A8,8,0,1,1,38.22,99c16.6,20.54,45.64,45,89.78,45s73.18-24.49,89.78-45A8,8,0,1,1,230.22,109a153.47,153.47,0,0,1-19.3,20l20,35A8,8,0,0,1,228,175Z"},child:[]}]})(r)}function ze({className:r="",...t}){return e.jsx("input",{...t,className:`h-11 rounded-lg border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-main)] outline-none placeholder:text-[var(--text-muted)] transition-colors focus:border-[var(--primary)] ${r}`})}function Lt({label:r,containerClassName:t="",helperText:a,error:n,labelAction:i,floatingLabel:u=!1,showPasswordToggle:p=!0,className:h="",required:d,...b}){const[k,C]=o.useState(()=>!!b.autoFocus),[m,f]=o.useState(!1),g=b.type==="password"&&p,c=g&&m?"text":b.type,w=b.value!==void 0?String(b.value).length>0:b.defaultValue!==void 0&&String(b.defaultValue).length>0,B=k||w,_={top:B?8:15,color:k?"var(--primary)":"var(--text-muted)",fontSize:B?11:14,fontWeight:B?600:400,textTransform:B?"uppercase":"none"},P=T=>{var $;C(!0),($=b.onFocus)==null||$.call(b,T)},E=T=>{var $;C(!1),($=b.onBlur)==null||$.call(b,T)},H=g?e.jsxs("button",{type:"button","aria-label":m?"Ocultar contraseña":"Mostrar contraseña","aria-pressed":m,className:"absolute right-2.5 top-1/2 flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-md text-[var(--text-muted)] transition-colors duration-200 hover:text-[var(--primary)] focus:outline-none",tabIndex:-1,onClick:()=>f(T=>!T),children:[e.jsx("span",{"aria-hidden":"true",className:`absolute inset-0 flex items-center justify-center transition-[opacity,transform] duration-200 ease-out ${m?"scale-y-0 rotate-[-8deg] opacity-0":"scale-y-100 rotate-0 opacity-100"}`,children:e.jsx(Ot,{className:"h-[18px] w-[18px]"})}),e.jsx("span",{"aria-hidden":"true",className:`absolute inset-0 flex items-center justify-center transition-[opacity,transform] duration-200 ease-out ${m?"scale-y-100 rotate-0 opacity-100":"scale-y-0 rotate-[8deg] opacity-0"}`,children:e.jsx(Bt,{className:"h-[18px] w-[18px]"})})]}):null;return u?e.jsxs("label",{className:`flex flex-col gap-2 ${t}`,children:[e.jsxs("span",{className:"relative block",children:[e.jsx(ze,{...b,type:c,required:d,placeholder:" ","aria-invalid":!!n||b["aria-invalid"],"data-has-value":w?"true":void 0,className:`h-12 w-full pt-5 ${g?"pr-10":""} ${h}`,onFocus:P,onBlur:E}),e.jsxs("span",{className:"pointer-events-none absolute left-3 transition-all duration-150",style:_,children:[r,d&&e.jsx("span",{className:"ml-1 text-[var(--danger)]",children:"*"})]}),i&&e.jsx("span",{className:"absolute right-2 transition-all duration-150",style:{top:B?8:15},children:i}),H]}),n?e.jsx("span",{className:"text-xs font-medium normal-case text-[var(--danger)]",children:n}):a?e.jsx("span",{className:"text-xs font-medium normal-case text-[var(--text-muted)]",children:a}):null]}):e.jsxs("label",{className:`flex flex-col gap-2 ${t}`,children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-semibold uppercase text-[var(--text-muted)]",children:[e.jsx("span",{children:r}),d&&e.jsx("span",{className:"text-[var(--danger)]",children:"*"}),i&&e.jsx("span",{className:"ml-auto normal-case",children:i})]}),g?e.jsxs("span",{className:"relative block",children:[e.jsx(ze,{...b,type:c,required:d,"aria-invalid":!!n||b["aria-invalid"],className:`w-full pr-10 ${h}`,onFocus:P,onBlur:E}),H]}):e.jsx(ze,{...b,required:d,"aria-invalid":!!n||b["aria-invalid"],className:h}),n?e.jsx("span",{className:"text-xs font-medium normal-case text-[var(--danger)]",children:n}):a?e.jsx("span",{className:"text-xs font-medium normal-case text-[var(--text-muted)]",children:a}):null]})}function xe(...r){return r.filter(Boolean).join(" ")}function Dt({steps:r,activeStepId:t,initialStepId:a,completedStepIds:n,defaultCompletedStepIds:i=[],onActiveStepChange:u,onCompletedStepIdsChange:p,onBlockedStep:h,allowBackNavigation:d=!0,showFooter:b=!0,previousLabel:k="Anterior",nextLabel:C="Siguiente",blockedNextLabel:m="Completa este paso",className:f="",headerClassName:g="",contentClassName:c="",footerClassName:w=""}){var ce;const B=((ce=r[0])==null?void 0:ce.id)??"",[_,P]=o.useState(a??B),[E,H]=o.useState(i),T=t??_,$=n??E,F=o.useMemo(()=>new Set($),[$]),O=Math.max(0,r.findIndex(S=>S.id===T)),D=r[O]??r[0],I=r.length<=1?100:O/(r.length-1)*100,K=S=>{n||H(S),p==null||p(S)},W=S=>{const j=r.find(X=>X.id===S);j&&(t||P(S),u==null||u(S,j))},U=S=>F.has(S),Z=S=>r.slice(0,S).find(j=>!j.optional&&!F.has(j.id)),R=S=>{const j=r[S];return!j||j.disabled?!1:S===O||d&&S<O?!0:!Z(S)},s=S=>{const j=r.findIndex(X=>X.id===S);return j>=0&&R(j)},N=S=>{const j=r.findIndex(X=>X.id===S);if(j<0)return!1;if(!R(j)){const X=Z(j);return X&&(h==null||h(r[j],X)),!1}return W(S),!0},q=(S=D==null?void 0:D.id)=>{!S||F.has(S)||K([...$,S])},G=(S=D==null?void 0:D.id)=>{if(!S)return;const j=r.findIndex(ae=>ae.id===S),X=$.filter(ae=>{const oe=r.findIndex(z=>z.id===ae);return oe>=0&&oe<j});K(X),j>=0&&O>j&&W(S)},V=()=>O<=0?!1:N(r[O-1].id),re=()=>{const S=r[O+1];return S?N(S.id):!1},le={activeStep:D,activeIndex:O,completedStepIds:$,isCompleted:U,isUnlocked:s,completeStep:q,uncompleteStep:G,goToStep:N,goNext:re,goPrevious:V};if(!D)return null;const te=r[O+1],ye=O>0,he=te?s(te.id):!1,be=typeof D.content=="function"?D.content(le):D.content;return e.jsxs("section",{className:xe("overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)]",f),children:[e.jsxs("div",{className:xe("border-b border-[var(--border)] bg-[var(--bg-input)]",g),children:[e.jsx("div",{className:"relative h-1 overflow-hidden bg-[var(--border)]/55",children:e.jsx("div",{className:"h-full rounded-r-full bg-[var(--primary)] transition-[width] duration-500 ease-out",style:{width:`${I}%`}})}),e.jsx("div",{className:"grid gap-2 p-2",style:{gridTemplateColumns:`repeat(${r.length}, minmax(0, 1fr))`},children:r.map((S,j)=>{const X=S.id===D.id,ae=U(S.id),oe=R(j),z=Z(j);return e.jsxs("button",{type:"button",disabled:!oe,"aria-current":X?"step":void 0,"aria-disabled":!oe,title:!oe&&z?`Completa ${z.title}`:S.title,onClick:()=>N(S.id),className:xe("group relative min-h-16 min-w-0 overflow-hidden rounded-md border p-3 text-left transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)]/35 disabled:cursor-not-allowed",X&&"border-[var(--primary)] bg-[var(--bg-card)] shadow-sm",ae&&!X&&"border-[var(--primary)]/35 bg-[var(--bg-card)]",!X&&!ae&&oe&&"border-transparent bg-[var(--bg-card)]/45 hover:border-[var(--border)] hover:bg-[var(--bg-card)]",!oe&&"border-transparent bg-[var(--bg-card)]/35 opacity-60"),children:[e.jsx("span",{className:xe("absolute inset-x-0 top-0 h-0.5 origin-left scale-x-0 bg-[var(--primary)] transition-transform duration-300",X&&"scale-x-100")}),e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:xe("grid h-7 w-7 shrink-0 place-items-center rounded-full border text-xs font-bold transition-all duration-200",X&&"border-[var(--primary)] bg-[var(--primary)] text-[var(--primary-fg)]",ae&&!X&&"border-[var(--primary)] bg-[var(--primary)]/12 text-[var(--primary)]",!ae&&!X&&oe&&"border-[var(--border)] text-[var(--text-muted)]",!oe&&"border-[var(--border)] text-[var(--text-muted)]"),children:ae?e.jsx(y.HiCheck,{className:"h-4 w-4"}):oe?j+1:e.jsx(y.HiLockClosed,{className:"h-3.5 w-3.5"})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:xe("block truncate text-xs font-semibold transition-colors duration-200",X?"text-[var(--text-main)]":"text-[var(--text-secondary)]"),children:[j+1,". ",S.title]}),S.description&&e.jsx("span",{className:"mt-1 block truncate text-[11px] text-[var(--text-muted)]",children:S.description})]}),S.badge&&e.jsx("span",{className:"shrink-0",children:S.badge})]})]},S.id)})})]}),e.jsx("div",{className:xe("min-h-72 animate-[stepWizardIn_220ms_ease-out] p-5",c),children:be},D.id),b&&e.jsxs("div",{className:xe("flex flex-wrap items-center justify-between gap-3 border-t border-[var(--border)] bg-[var(--bg-input)] px-4 py-3",w),children:[e.jsx(ue,{variant:"secondary",height:38,padding:"0 14px",icon:e.jsx(y.HiChevronLeft,{}),disabled:!ye,onClick:V,children:k}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-[var(--text-muted)]",children:[e.jsxs("span",{children:["Paso ",O+1," de ",r.length]}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-[var(--border)]"}),e.jsxs("span",{children:[$.length," completados"]})]}),e.jsx(ue,{height:38,padding:"0 14px",icon:e.jsx(y.HiChevronRight,{}),disabled:!te||!he,onClick:re,children:te&&!he?m:C})]})]})}const Ht={xs:{width:28,height:16,thumb:12,padding:2},sm:{width:36,height:20,thumb:16,padding:2}};function Pt({checked:r,disabled:t,onCheckedChange:a,size:n="sm",className:i="",...u}){const p=Ht[n],h=r?p.width-p.thumb-p.padding*2:0;return e.jsx("button",{...u,type:"button",role:"switch","aria-checked":r,disabled:t,onClick:()=>!t&&a(!r),className:`relative inline-flex shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)]/50 disabled:cursor-not-allowed disabled:opacity-50 ${i}`,style:{width:p.width,height:p.height,background:r?"color-mix(in srgb, var(--primary) 85%, transparent)":"var(--bg-input)",border:r?"1px solid color-mix(in srgb, var(--primary) 55%, transparent)":"1px solid var(--border)"},children:e.jsx("span",{className:"absolute inline-block rounded-full transition-transform",style:{width:p.thumb,height:p.thumb,left:p.padding,top:"50%",transform:`translate(${h}px, -50%)`,background:r?"var(--primary-fg)":"var(--text-muted)"}})})}const Sr=[".sidebar-scroll","[data-overlay-scroll='true']"].join(",");function At(r){if(!(r instanceof HTMLElement)||r.dataset.overlayScroll==="false"||r.closest("[data-overlayscrollbars]")||r.matches("textarea,input,select,[contenteditable='true']"))return!1;const t=window.getComputedStyle(r);return!(![t.overflow,t.overflowX,t.overflowY].join(" ").match(/auto|scroll/)||r.clientWidth===0&&r.clientHeight===0)}function Cr(r){return r.classList.contains("sidebar-scroll")}function Er(r){Cr(r)&&r.querySelectorAll(".os-scrollbar-horizontal").forEach(t=>{t.style.display="none",t.style.height="0",t.style.pointerEvents="none"})}function $r(){return o.useEffect(()=>{const r=new WeakMap;let t=0;const a=()=>{t=0,document.querySelectorAll(Sr).forEach(u=>{if(!At(u))return;if(er.OverlayScrollbars(u)){Er(u);return}const h=er.OverlayScrollbars(u,{overflow:Cr(u)?{x:"hidden",y:"scroll"}:void 0,scrollbars:{autoHide:"leave",autoHideDelay:180}});Er(u),r.set(u,h)})},n=()=>{t||(t=window.requestAnimationFrame(a))};a();const i=new MutationObserver(n);return i.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","data-overlay-scroll"]}),window.addEventListener("resize",n),()=>{t&&window.cancelAnimationFrame(t),i.disconnect(),window.removeEventListener("resize",n),document.querySelectorAll(Sr).forEach(u=>{var p;u instanceof HTMLElement&&((p=r.get(u))==null||p.destroy())})}},[]),null}const It={xs:{wh:"w-5 h-5",text:"text-[8px]"},sm:{wh:"w-7 h-7",text:"text-[11px]"},md:{wh:"w-9 h-9",text:"text-sm"},lg:{wh:"w-12 h-12",text:"text-base"},xl:{wh:"w-16 h-16",text:"text-xl"}},Mr=["bg-indigo-500","bg-blue-500","bg-emerald-500","bg-violet-500","bg-amber-500","bg-teal-500","bg-rose-500","bg-cyan-500"],zt={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg"},jt="bonsaif.bot",_t="Bonsaif Bot",Ft={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2",xl:"p-2.5"};function Tr(r){return typeof r=="string"?r.trim():""}function Wt(r){let t=0;for(const a of r)t=t*31+a.charCodeAt(0)&65535;return Mr[t%Mr.length]}function Ut(r,t){return r===jt||t===_t}function Or({userId:r,username:t,name:a,size:n="md",showName:i=!1,showTooltip:u,tooltipContent:p,fallbackLabel:h="Usuario",wrapperClassName:d="",labelClassName:b="",labelSize:k="xs",avatarVersion:C=0,className:m="",style:f}){var W;const[g,c]=o.useState(!1),w=typeof r=="string"&&r.trim()&&r!=="undefined"&&r!=="null"?r.trim():"";o.useEffect(()=>{c(!1)},[w,C]);const{wh:B,text:_}=It[n],P=Tr(a)||Tr(t)||h,E=P.trim()[0]||"?",H=typeof process<"u"&&((W=process.env)==null?void 0:W.NEXT_PUBLIC_BASE_PATH)||"",T=Ut(t,a),$=w?`${H}/api/user/avatar/${w}${C?`?v=${C}`:""}`:"",O={xs:20,sm:28,md:36,lg:48,xl:64}[n],D=T?e.jsx("span",{className:`${B} ${Ft[n]} rounded-full flex items-center justify-center bg-[#071f1a] ring-1 ring-emerald-400/35 shadow-[0_0_0_1px_rgba(255,255,255,0.06)] flex-shrink-0 ${m}`,style:f,children:e.jsx("img",{src:`${H}/favicon.svg`,alt:P,width:O,height:O,className:"h-full w-full object-contain"})}):$&&!g?e.jsx("img",{src:$,alt:P,width:O,height:O,className:`${B} rounded-full object-cover flex-shrink-0 ${m}`,style:f,onError:()=>c(!0)},`${w}-${C}`):e.jsx("span",{className:`${B} ${Wt(P)} ${_} rounded-full flex items-center justify-center font-black text-white uppercase flex-shrink-0 ${m}`,style:f,title:P,children:E});if(i)return e.jsxs("span",{className:`inline-flex min-w-0 items-center gap-2 ${d}`,children:[D,e.jsx("span",{className:`min-w-0 truncate ${zt[k]} font-medium text-[var(--text-main)] ${b}`,title:P,children:P})]});const I=u??!0,K=p??P;return I&&K?e.jsx(De,{as:"span",content:K,className:`inline-flex flex-shrink-0 ${d}`,children:D}):D}function qt({href:r,className:t,children:a}){return e.jsx("a",{href:r,className:t,children:a})}function Gt(r){return r.reduce((t,a)=>{const n=a.section??"Principal";return t[n]=[...t[n]??[],a],t},{})}function Br({children:r,navItems:t=[],currentPath:a=typeof window>"u"?"/":window.location.pathname,user:n,appName:i="Bonsaif",appLogo:u,header:p,footer:h,onLogout:d,LinkComponent:b=qt}){const[k,C]=o.useState(!1),m=Gt(t);return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-main)] text-[var(--text-main)]",children:[e.jsx($r,{}),e.jsx("button",{type:"button","aria-label":"Abrir navegación",className:"fixed left-3 top-3 z-50 inline-flex h-9 w-9 items-center justify-center rounded-md border border-white/10 bg-black/70 text-white lg:hidden",onClick:()=>C(!0),children:e.jsx(y.HiBars3,{className:"h-5 w-5"})}),k&&e.jsx("button",{type:"button","aria-label":"Cerrar navegación",className:"fixed inset-0 z-40 bg-black/45 lg:hidden",onClick:()=>C(!1)}),e.jsxs("aside",{className:`fixed inset-y-0 left-0 z-50 flex w-72 flex-col bg-[#071716] text-white shadow-2xl transition-transform duration-200 lg:translate-x-0 ${k?"translate-x-0":"-translate-x-full"}`,children:[e.jsxs("div",{className:"flex h-16 items-center gap-3 border-b border-white/10 px-4",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-white/10 text-white",children:u??e.jsx(y.HiHome,{className:"h-5 w-5"})}),e.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:i}),e.jsx("button",{type:"button","aria-label":"Cerrar navegación",className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-white/70 hover:bg-white/10 lg:hidden",onClick:()=>C(!1),children:e.jsx(y.HiXMark,{className:"h-5 w-5"})})]}),e.jsx("nav",{className:"sidebar-scroll min-h-0 flex-1 overflow-y-auto px-3 py-4","data-overlay-scroll":"true",children:Object.entries(m).map(([f,g])=>e.jsxs("div",{className:"mb-5",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 px-2 text-[11px] font-semibold uppercase tracking-wide text-white/35",children:[e.jsx(y.HiChevronDown,{className:"h-3.5 w-3.5"}),f]}),e.jsx("div",{className:"space-y-1",children:g.map(c=>{const w=a===c.href||a.startsWith(`${c.href}/`);return e.jsxs(b,{href:c.href,className:`flex min-w-0 items-center gap-2 rounded-md px-2 py-2 text-sm transition-colors ${w?"bg-white/10 text-white":"text-white/55 hover:bg-white/[0.06] hover:text-white/85"}`,children:[e.jsx("span",{className:"flex h-5 w-5 flex-shrink-0 items-center justify-center",children:c.icon??e.jsx(y.HiHome,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate",children:c.label})]},c.href)})})]},f))}),e.jsxs("div",{className:"border-t border-white/10 p-3",children:[n&&e.jsxs("div",{className:"mb-3 flex min-w-0 items-center gap-3 rounded-lg bg-white/[0.04] p-2",children:[e.jsx(Or,{name:n.initials??n.name??n.email??"Usuario",size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-medium text-white",children:n.name??"Usuario"}),n.email&&e.jsx("div",{className:"truncate text-xs text-white/45",children:n.email})]})]}),d&&e.jsxs(ue,{variant:"ghost",className:"w-full justify-start text-white hover:bg-white/10",onClick:d,children:[e.jsx(y.HiArrowRightOnRectangle,{className:"h-4 w-4"})," Salir"]}),h]})]}),e.jsxs("div",{className:"min-h-screen lg:pl-72",children:[p,e.jsx("main",{className:"min-h-screen",children:r})]})]})}const Yt={dashboard:"Dashboard",tickets:"Tickets",teams:"Equipos",projects:"Proyectos",clients:"Clientes",surveys:"Encuestas",profile:"Perfil",settings:"Configuración",notifications:"Notificaciones",changelog:"Historial",admin:"Inicio",users:"Usuarios",roles:"Roles",menus:"Menús",guards:"Guardias",vacations:"Vacaciones",audit:"Auditoría",positions:"Puestos",ranks:"Rangos","email-inbox":"Buzones","security-incidents":"Incidentes","guard-schedule":"Guardias"},Ze={dashboard:e.jsx(y.HiChartBar,{className:"h-5 w-5"}),tickets:e.jsx(y.HiTicket,{className:"h-5 w-5"}),teams:e.jsx(y.HiUsers,{className:"h-5 w-5"}),projects:e.jsx(y.HiRectangleGroup,{className:"h-5 w-5"}),clients:e.jsx(y.HiBuildingOffice2,{className:"h-5 w-5"}),surveys:e.jsx(y.HiClipboardDocumentList,{className:"h-5 w-5"}),profile:e.jsx(y.HiUser,{className:"h-5 w-5"}),settings:e.jsx(y.HiCog6Tooth,{className:"h-5 w-5"}),notifications:e.jsx(y.HiBell,{className:"h-5 w-5"}),changelog:e.jsx(y.HiDocumentText,{className:"h-5 w-5"}),admin:e.jsx(y.HiShieldCheck,{className:"h-5 w-5"}),users:e.jsx(y.HiUsers,{className:"h-5 w-5"}),roles:e.jsx(y.HiShieldCheck,{className:"h-5 w-5"}),menus:e.jsx(y.HiCog6Tooth,{className:"h-5 w-5"}),guards:e.jsx(y.HiCalendarDays,{className:"h-5 w-5"}),vacations:e.jsx(y.HiCalendarDays,{className:"h-5 w-5"}),audit:e.jsx(y.HiListBullet,{className:"h-5 w-5"}),positions:e.jsx(y.HiBriefcase,{className:"h-5 w-5"}),ranks:e.jsx(y.HiListBullet,{className:"h-5 w-5"}),"email-inbox":e.jsx(y.HiInbox,{className:"h-5 w-5"}),"security-incidents":e.jsx(y.HiShieldCheck,{className:"h-5 w-5"})};function Xt({href:r,className:t,style:a,children:n}){return e.jsx("a",{href:r,className:t,style:a,children:n})}function Vt(r){return r.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Zt(r){return/^\d+$/.test(r)||/^[a-f0-9]{8,}$/i.test(r)}function Jt(r){const t=r.split("/").filter(Boolean);if(t.length===0||t.length===1&&t[0]==="dashboard")return[];const a=decodeURIComponent(t[t.length-1]),n=t.length>1?decodeURIComponent(t[t.length-2]):void 0,i=Zt(a)&&n?n:a,u=Yt[i]??Vt(i);return[{label:"Inicio",href:"/"},{label:u}]}function Je(r){return(r==null?void 0:r.querySelector(":scope > .os-viewport"))??(r==null?void 0:r.querySelector(":scope > [data-overlayscrollbars-viewport]"))}function Kt(r){const t=r.split("/").filter(Boolean),a=t[t.length-1];if(!a)return e.jsx(y.HiHome,{className:"h-5 w-5"});if(Ze[a])return Ze[a];const n=t.length>1?t[t.length-2]:"";return Ze[n]??e.jsx(y.HiHome,{className:"h-5 w-5"})}function Qt({title:r,subtitle:t,action:a,meta:n,icon:i,className:u="",contentClassName:p="",breadcrumbs:h,currentPath:d=typeof window>"u"?"/":window.location.pathname,showBreadcrumbs:b=!0,contained:k=!1,LinkComponent:C=Xt}){const m=o.useRef(null),[f,g]=o.useState(!1),[c,w]=o.useState(null),B=h??Jt(d),_=i??Kt(d),P=b&&B.length>1;return o.useEffect(()=>{if(k){g(!1);return}let E=null,H=0,T=0;const $=()=>{const D=m.current,I=document.querySelector("[data-app-scroll='true']");return(D==null?void 0:D.closest(".os-viewport"))??(D==null?void 0:D.closest("[data-overlayscrollbars-viewport]"))??Je(I)??I??window},F=()=>{const D=E&&E!==window?E.scrollTop:window.scrollY;g(I=>I?D>24:D>72)},O=()=>{E==null||E.removeEventListener("scroll",F),E=$(),E.addEventListener("scroll",F,{passive:!0}),F()};return O(),H=window.requestAnimationFrame(O),T=window.setTimeout(O,120),()=>{window.cancelAnimationFrame(H),window.clearTimeout(T),E==null||E.removeEventListener("scroll",F)}},[k]),o.useEffect(()=>{if(k){w(null);return}let E=0;const H=[],T=()=>{const W=m.current,U=W==null?void 0:W.parentElement,Z=document.querySelector("[data-app-scroll='true']"),R=Je(Z)??Z;if(!W||!U||!R){w(null);return}const s=U.getBoundingClientRect(),N=window.getComputedStyle(U),q=R.getBoundingClientRect(),G=R instanceof HTMLElement&&R.clientWidth>0?R.clientWidth:q.width,V=s.left+parseFloat(N.paddingLeft||"0"),re={marginLeft:Math.round(q.left-V),width:Math.round(G)};w(le=>le&&le.marginLeft===re.marginLeft&&le.width===re.width?le:re)},$=()=>{window.cancelAnimationFrame(E),E=window.requestAnimationFrame(T)};$(),window.addEventListener("resize",$);const F=new ResizeObserver($),O=m.current,D=O==null?void 0:O.parentElement,I=document.querySelector("[data-app-scroll='true']"),K=Je(I)??I;return[D,I,K].forEach(W=>{W&&F.observe(W)}),H.push(window.setTimeout($,120)),H.push(window.setTimeout($,280)),()=>{window.cancelAnimationFrame(E),window.removeEventListener("resize",$),F.disconnect(),H.forEach(W=>window.clearTimeout(W))}},[k]),e.jsx("div",{ref:m,"data-page-header":"true","data-compact":f?"true":"false",className:`sticky top-0 z-30 overflow-visible py-0 transition-[background-color,box-shadow,border-color] duration-300 ease-out ${k?"mb-0 flex-shrink-0":"mb-4 sm:mb-0"} ${u}`,style:{...c?{marginLeft:c.marginLeft,width:c.width}:null,background:k?"var(--bg-card)":f?"var(--bg-main)":"color-mix(in srgb, var(--bg-main) 44%, transparent)",backdropFilter:"saturate(1.2) blur(14px)",WebkitBackdropFilter:"saturate(1.2) blur(14px)",borderBottom:k||f?"1px solid var(--border)":"1px solid transparent",boxShadow:f?"0 10px 28px rgba(12, 54, 53, 0.12)":"none"},children:e.jsxs("div",{className:`flex flex-wrap items-center justify-between px-4 pt-0.5 transition-[gap,min-height,padding] duration-300 ease-out ${f?"min-h-9 gap-2 sm:min-h-10 sm:gap-2.5":"min-h-10 gap-2.5 sm:min-h-11 sm:gap-3"} ${p}`,children:[e.jsxs("div",{className:`min-w-0 flex flex-1 flex-col justify-center transition-[gap,transform] duration-300 ease-out ${f?"gap-1":"gap-1.5 sm:gap-2"}`,children:[P&&e.jsx("nav",{"aria-label":"Breadcrumb",className:"min-w-0 flex-shrink-0 transition-[opacity,transform] duration-300 ease-out",children:e.jsx("ol",{className:`flex flex-wrap items-center gap-1.5 leading-none transition-[font-size,line-height] duration-300 ease-out ${f?"text-[10px]":"text-[10px] sm:text-[11px]"}`,children:B.map((E,H)=>{const T=H===B.length-1;return e.jsxs("li",{className:"flex min-w-0 items-center gap-1.5",children:[H>0&&e.jsx(y.HiChevronRight,{className:"h-3.5 w-3.5 transition-[color,transform] duration-300 ease-out",style:{color:"var(--text-muted)"}}),E.href&&!T?e.jsx(C,{href:E.href,className:"truncate transition-colors duration-300 hover:underline",style:{color:"var(--text-muted)"},children:E.label}):e.jsx("span",{"aria-current":T?"page":void 0,className:T?"truncate font-semibold":"truncate",style:{color:T?"var(--text-main)":"var(--text-muted)"},children:E.label})]},`${E.label}-${H}`)})})}),e.jsxs("div",{className:`flex min-w-0 items-center transition-[gap,transform] duration-300 ease-out ${f?"gap-2":"gap-2.5 sm:gap-3"}`,children:[e.jsx("span",{className:`flex-shrink-0 transition-[color,transform,opacity] duration-300 ease-out ${f?"scale-75 opacity-80":"scale-90 opacity-100"}`,style:{color:P?"var(--text-secondary)":"var(--text-muted)"},children:_}),e.jsxs("div",{className:`flex min-w-0 flex-1 flex-wrap items-center transition-[gap] duration-300 ease-out ${f?"gap-x-2 gap-y-1":"gap-x-3 gap-y-2"}`,children:[e.jsxs("div",{className:"min-w-0 flex-shrink transition-[transform] duration-300 ease-out",children:[e.jsx("h1",{className:`truncate font-bold tracking-tight transition-[font-size,line-height,color] duration-300 ease-out ${f?"text-base sm:text-lg":"text-lg sm:text-xl"}`,style:{color:"var(--text-main)"},children:r}),t&&e.jsx("p",{"aria-hidden":f,className:`overflow-hidden text-xs transition-[max-height,opacity,transform,margin] duration-300 ease-out ${f?"mt-0 max-h-0 -translate-y-1 opacity-0":"mt-0.5 max-h-5 translate-y-0 opacity-100"}`,style:{color:"var(--text-muted)"},children:t})]}),n&&e.jsx("div",{className:`page-header-meta flex min-w-0 flex-1 basis-full items-center overflow-visible transition-[gap,opacity,transform] duration-300 ease-out sm:basis-auto ${f?"translate-y-0 gap-1.5 opacity-95":"gap-2 opacity-100"}`,children:n})]})]})]}),a&&e.jsx("div",{className:`page-header-actions flex flex-shrink-0 items-center self-center overflow-visible transition-[gap,min-height,opacity,transform] duration-300 ease-out ${f?"min-h-8 gap-1 opacity-95":"min-h-9 gap-1.5 opacity-100"}`,children:e.jsx(or.Provider,{value:{compact:!0,iconOnly:!0},children:a})})]})})}function Rt({children:r,currentPath:t=typeof window>"u"?"/":window.location.pathname,publicRoutes:a=["/","/login","/reset-password"],...n}){return a.includes(t)?e.jsx(e.Fragment,{children:r}):e.jsx(Br,{currentPath:t,...n,children:r})}function Lr(){if(typeof window>"u")return"system";const r=localStorage.getItem("theme");return r==="light"||r==="dark"?r:r==="system"?"system":document.documentElement.classList.contains("dark")?"dark":"light"}function ea(r,t,a){try{const n=new URL(r),i=n.searchParams.get("callbackUrl");if(i){const u=new URL(i,n.origin);return u.searchParams.set("theme",t),a&&(u.searchParams.set("primeAuthOrigin",window.location.origin),u.searchParams.set("primeAuthProjectKey",a)),n.searchParams.set("callbackUrl",`${u.pathname}${u.search}${u.hash}`),n.toString()}return n.searchParams.set("theme",t),a&&(n.searchParams.set("primeAuthOrigin",window.location.origin),n.searchParams.set("primeAuthProjectKey",a)),n.toString()}catch{return r}}function ra({name:r,src:t,projectKey:a}){const[n,i]=o.useState(()=>Lr()),u=o.useRef(null);o.useEffect(()=>{const d=new MutationObserver(()=>i(Lr()));return d.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>d.disconnect()},[]);const p=o.useMemo(()=>ea(t,n,a),[a,t,n]),h=o.useMemo(()=>{try{return new URL(p).origin}catch{return""}},[p]);return o.useEffect(()=>{if(!a)return;const d=a;function b(k){var f,g,c;if(k.source!==((f=u.current)==null?void 0:f.contentWindow)||h&&k.origin!==h)return;if(((g=k.data)==null?void 0:g.type)==="prime-microservice:overlay"){window.dispatchEvent(new CustomEvent("prime-auth:microservice-overlay",{detail:{active:!!k.data.active}}));return}if(((c=k.data)==null?void 0:c.type)!=="prime-microservice:navigation")return;const C=k.data.path;if(!C||!C.startsWith("/")||C.startsWith("//"))return;const m=`/apps/${encodeURIComponent(d)}${C}`;`${window.location.pathname}${window.location.search}${window.location.hash}`!==m&&(window.history.replaceState(window.history.state,"",m),window.dispatchEvent(new CustomEvent("prime-auth:microservice-navigation")))}return window.addEventListener("message",b),()=>{window.removeEventListener("message",b),window.dispatchEvent(new CustomEvent("prime-auth:microservice-overlay",{detail:{active:!1}}))}},[h,a]),e.jsx("div",{className:"flex h-full min-h-screen flex-col bg-[var(--bg-main)]",children:e.jsx("iframe",{ref:u,src:p,title:r,className:"min-h-0 flex-1 border-0 bg-[var(--bg-main)]",allow:"clipboard-write",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-same-origin allow-scripts",referrerPolicy:"strict-origin-when-cross-origin"})})}function ta(){const[r,t]=o.useState(""),[a,n]=o.useState(!1),[i,u]=o.useState({width:96,height:96});return o.useEffect(()=>{let p=!1;return fetch("/api/microservices/prime-suite/chat-url",{cache:"no-store"}).then(h=>h.ok?h.json():null).then(h=>{!p&&(h!=null&&h.src)&&t(h.src)}).catch(()=>{}),()=>{p=!0}},[]),o.useEffect(()=>{const p=h=>{var b;if(((b=h.data)==null?void 0:b.type)!=="prime-suite-chat:state")return;const d=!!h.data.active;n(d),u({width:Dr(h.data.width,96,720),height:Dr(h.data.height,96,560)})};return window.addEventListener("message",p),()=>window.removeEventListener("message",p)},[]),r?e.jsx("iframe",{title:"Chat Bonsaif",src:r,allow:"clipboard-write",className:"fixed bottom-0 right-0 z-[70] border-0 bg-transparent transition-[width,height] duration-200",style:{width:a?`min(${i.width}px, 100vw)`:96,height:a?`min(${i.height}px, 100vh)`:96,background:"transparent",backgroundColor:"transparent",colorScheme:"normal"}}):null}function Dr(r,t,a){const n=typeof r=="number"&&Number.isFinite(r)?r:t;return Math.max(t,Math.min(a,Math.ceil(n)))}function aa(r){const t=document.documentElement,a=new MutationObserver(r);a.observe(t,{attributes:!0,attributeFilter:["class"]});const n=window.matchMedia("(prefers-color-scheme: dark)");return n.addEventListener("change",r),()=>{a.disconnect(),n.removeEventListener("change",r)}}function na(){const r=localStorage.getItem("theme")||"system",t=window.matchMedia("(prefers-color-scheme: dark)").matches;return document.documentElement.classList.contains("dark")||r==="dark"||r==="system"&&t?"dark":"light"}function oa(){return"light"}function sa(){const r=o.useSyncExternalStore(aa,na,oa);return e.jsx(Fr.Toaster,{position:"bottom-center",theme:r,richColors:!0,closeButton:!0})}L.AuthShell=Br,L.BonsaifButton=Wr,L.Button=ue,L.CalendarPicker=st,L.CompactFilterSelect=lt,L.CompactSearchInput=it,L.ConfirmDialog=ut,L.CopyButton=mr,L.CopyLinkButton=bt,L.DataTable=gt,L.DateRangePicker=wt,L.Drawer=Nt,L.DynamicDetailTabs=rt,L.GlobalScrollbars=$r,L.InputField=Lt,L.LoadingState=ir,L.MicroserviceFrame=ra,L.Modal=hr,L.MouseTooltip=De,L.PageHeader=Qt,L.PageSearchInput=nr,L.PrimeAuthRouteShell=Rt,L.PrimeAuthToaster=sa,L.PrimeSuiteChatFrame=ta,L.SearchableSelect=Ve,L.StepWizard=Dt,L.TextInput=ze,L.Toggle=Pt,L.UserAvatar=Or,L.cn=ar,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(L,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("react-icons/hi2"),require("react-dom"),require("overlayscrollbars"),require("react-icons/md"),require("overlayscrollbars-react"),require("react-day-picker"),require("react-day-picker/dist/style.css"),require("react-icons/fi"),require("sonner")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-icons/hi2","react-dom","overlayscrollbars","react-icons/md","overlayscrollbars-react","react-day-picker","react-day-picker/dist/style.css","react-icons/fi","sonner"],e):(L=typeof globalThis<"u"?globalThis:L||self,e(L.BonsaifUI={},L.jsxRuntime,L.React,L.ReactIconsHi2,L.ReactDOM,L.OverlayScrollbarsGlobal,L.ReactIconsMd,L.OverlayScrollbarsReact,L.ReactDayPicker,L.ReactDayPickerStyles,L.ReactIconsFi,L.Sonner))})(this,(function(L,e,o,y,De,er,_r,rr,tr,pa,jr,Fr){"use strict";"use client";function ar(...r){return r.filter(Boolean).join(" ")}function Wr({variant:r="primary",className:t,type:a="button",children:n,...i}){return e.jsx("button",{className:ar("bonsaif-ui-button",`bonsaif-ui-button--${r}`,t),type:a,...i,children:n})}function nr({value:r,onChange:t,placeholder:a,className:n="",autoFocus:i=!1,forceExpanded:u=!1,onEscape:p,size:h="default",inputTabIndex:d}){const b=o.useRef(null),[k,C]=o.useState(!1),m=u||k||r.trim().length>0,f=h==="sm"?"h-9 rounded-md":"h-11 rounded-lg";o.useEffect(()=>{var c;i&&(C(!0),(c=b.current)==null||c.focus())},[i]);const g=()=>{var c;C(!0),(c=b.current)==null||c.focus()};return e.jsxs("div",{className:`relative flex-shrink-0 overflow-visible transition-[width] duration-200 ease-out ${m?n||"w-full":"w-28"}`,onMouseDown:c=>{m||(c.preventDefault(),g())},children:[e.jsx(y.HiMagnifyingGlass,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 pointer-events-none transition-colors duration-200",style:{color:"var(--text-muted)"}}),e.jsx("input",{ref:b,type:"text",tabIndex:d,"aria-label":a,value:r,onChange:c=>t(c.target.value),onKeyDown:c=>{c.key==="Escape"&&(p==null||p())},placeholder:m?a:"Buscar",className:`${f} w-full py-0 text-sm placeholder:text-[var(--text-muted)] focus:outline-none transition-all duration-200 ${m?"pl-9 pr-9":"cursor-pointer pl-9 pr-3"}`,style:{background:"var(--bg-card)",border:"1px solid var(--border)",color:"var(--text-main)"},onFocus:c=>{C(!0),c.currentTarget.style.borderColor="var(--primary)",c.currentTarget.style.boxShadow="0 0 0 3px rgba(59,130,246,0.12)"},onBlur:c=>{C(!1),c.currentTarget.style.borderColor="var(--border)",c.currentTarget.style.boxShadow="none"}}),r&&e.jsx("button",{type:"button",onClick:()=>t(""),className:"absolute right-2 top-1/2 flex !h-6 !w-6 -translate-y-1/2 items-center justify-center rounded-full !p-0 leading-none transition-colors hover:bg-black/5",style:{color:"var(--text-muted)"},"aria-label":"Limpiar búsqueda",children:e.jsx(y.HiXMark,{className:"h-3.5 w-3.5 flex-shrink-0"})})]})}const or=o.createContext({});function Ur(r){var n;const t=Array.from(r.querySelectorAll("*")).filter(i=>{var u;return i.scrollWidth>i.clientWidth&&!!((u=i.textContent)!=null&&u.trim())&&i.tagName.toLowerCase()!=="svg"&&!i.closest("svg")});return(r.scrollWidth>r.clientWidth||t.length>0)&&(((n=t[0])==null?void 0:n.textContent)??r.textContent??"").trim()||null}function Le({children:r,content:t,onlyWhenOverflow:a=!1,className:n="",style:i,as:u="div"}){const p=o.useRef(null),h=o.useRef(null),[d,b]=o.useState(null),[k,C]=o.useState("");o.useEffect(()=>{const g=p.current;g&&(g.querySelectorAll("[title]").forEach(c=>{const w=c.getAttribute("title");w&&(c.getAttribute("aria-label")||c.setAttribute("aria-label",w),c.removeAttribute("title"))}),g.querySelectorAll("svg title").forEach(c=>c.remove()))}),o.useLayoutEffect(()=>{if(!d)return;const g=h.current;if(!g)return;const c=12,w=14,D=g.getBoundingClientRect(),_=window.innerWidth-D.width-c,I=window.innerHeight-D.height-c;let E=d.mouseX+w,T=d.mouseY+w;E>_&&(E=d.mouseX-D.width-w),T>I&&(T=d.mouseY-D.height-w),E=Math.min(Math.max(c,E),Math.max(c,_)),T=Math.min(Math.max(c,T),Math.max(c,I)),(Math.abs(E-d.x)>.5||Math.abs(T-d.y)>.5)&&b(B=>B&&{...B,x:E,y:T})},[d]);const m=(g,c)=>{const w=p.current;if(w){if(a){const D=Ur(w);if(!D)return;C(D)}!a&&!t||b({mouseX:g,mouseY:c,x:g+14,y:c+14})}},f=a?k:t;return e.jsxs(e.Fragment,{children:[e.jsx(u,{ref:g=>{p.current=g},className:n,style:i,onMouseEnter:g=>m(g.clientX,g.clientY),onMouseMove:g=>{d&&m(g.clientX,g.clientY)},onMouseLeave:()=>b(null),children:r}),d&&f?De.createPortal(e.jsx("div",{ref:h,role:"tooltip",style:{position:"fixed",top:d.y,left:d.x,zIndex:9999,background:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:6,padding:"5px 10px",fontSize:12,color:"var(--text-main)",boxShadow:"0 4px 16px rgba(0,0,0,0.35)",pointerEvents:"none",maxWidth:"min(420px, calc(100vw - 24px))",whiteSpace:"normal",lineHeight:1.6,overflowWrap:"anywhere"},children:f}),document.body):null]})}function sr(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}const qr="inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap leading-none font-medium transition-all duration-150 focus:outline-none disabled:opacity-50 rounded-lg",Gr={primary:"border border-[var(--border)] text-[var(--text-main)] hover:border-[var(--border)] hover:bg-[var(--bg-input)] active:scale-[0.98] transition-colors",secondary:"border border-[var(--border)] text-[var(--text-main)] hover:border-[var(--border)] hover:bg-[var(--bg-input)] active:scale-[0.98] transition-colors",danger:"border border-[var(--border)] text-[var(--danger)] hover:border-[var(--danger)] hover:bg-[var(--danger-bg)] active:scale-[0.98] transition-colors",ghost:"text-[var(--text-secondary)] hover:opacity-70",icon:"text-[var(--text-muted)] hover:text-[var(--primary)] hover:bg-primary/5"},Yr="border border-[var(--border)] text-[var(--text-muted)] shadow-sm shadow-black/5 hover:border-[var(--border)] hover:bg-[var(--bg-input)] hover:text-[var(--primary)] active:scale-[0.98] transition-colors",Xr={xs:"h-8 px-2.5 text-xs",sm:"h-9 px-3.5 text-xs",md:"h-11 px-4 text-sm",lg:"h-12 px-5 text-sm font-semibold"},Vr={xs:"h-8 w-8",sm:"h-9 w-9",md:"h-10 w-10",lg:"h-11 w-11"},Zr={primary:{background:"var(--bg-card)"},secondary:{background:"var(--bg-card)"},danger:{background:"var(--bg-card)"},ghost:{},icon:{}};function Ge(r){return typeof r=="string"||typeof r=="number"?String(r):Array.isArray(r)?r.map(Ge).join(" ").trim():o.isValidElement(r)?Ge(r.props.children):""}function Jr(r){return o.Children.toArray(r).find(o.isValidElement)??null}function ue({variant:r="primary",size:t="md",loading:a=!1,icon:n,tooltip:i,iconOnly:u,height:p,padding:h,children:d,className:b="",disabled:k,style:C,...m}){const f=o.useContext(or),g=u??f.iconOnly??r==="icon",c=f.compact??!1,w=f.headerAction??!1,D=c&&t==="md"?"xs":t,_=r==="icon"||g,I=w&&_,E=Ge(d),T=i??m.title??m["aria-label"]??(g?E:void 0),B=T?void 0:m.title,M=m["aria-label"]??(typeof T=="string"?T:E||void 0),j=a?null:n??(g?Jr(d):null),$=e.jsxs("button",{...m,title:B,"aria-label":M,"data-variant":r,"data-size":D,"data-icon":_?"true":void 0,disabled:k||a,className:`${qr} ${I?Yr:Gr[r]} ${_?Vr[D]:Xr[D]} ${c&&!_?"px-2.5":""} ${b}`,style:{...Zr[r],height:sr(p),padding:sr(h),...C,...I?{width:"32px",height:"32px",padding:0,background:"var(--bg-card)",borderRadius:"8px"}:null},children:[a?e.jsx("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-current border-t-transparent"}):j,!g&&d]});return T?e.jsx(Le,{as:"span",content:T,className:"inline-flex shrink-0",children:$}):$}function ir({variant:r="page",title:t="Cargando...",rows:a=6,children:n}){return r==="table"?e.jsx(lr,{rows:a}):r==="sections"?e.jsx(Kr,{rows:a}):r==="cards"?e.jsx(Qr,{rows:a}):e.jsx("div",{className:"flex min-h-[240px] items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-6",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[e.jsx("div",{className:"h-9 w-9 animate-spin rounded-full border-2 border-[var(--border)] border-t-[var(--primary)]"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-[var(--text-main)]",children:t}),n&&e.jsx("div",{className:"mt-1 text-xs text-[var(--text-muted)]",children:n})]})]})})}function Kr({rows:r}){return e.jsx("div",{className:"space-y-4",children:Array.from({length:Math.max(2,Math.min(r,4))}).map((t,a)=>e.jsxs("section",{className:"overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[var(--border)] px-3 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-pulse rounded bg-[var(--bg-input)]"}),e.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-[var(--bg-input)]"}),e.jsx("div",{className:"h-5 w-20 animate-pulse rounded-full bg-[var(--bg-input)]"})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("div",{className:"h-8 w-8 animate-pulse rounded-md bg-[var(--bg-input)]"}),e.jsx("div",{className:"h-8 w-8 animate-pulse rounded-md bg-[var(--bg-input)]"})]})]}),e.jsx(lr,{rows:a===0?r:Math.max(3,r-2),compact:!0})]},a))})}function Qr({rows:r}){return e.jsx("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:Array.from({length:r}).map((t,a)=>e.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("div",{className:"h-4 w-2/3 animate-pulse rounded bg-[var(--bg-input)]"}),e.jsx("div",{className:"mt-3 h-3 w-full animate-pulse rounded bg-[var(--bg-input)]"}),e.jsx("div",{className:"mt-2 h-3 w-4/5 animate-pulse rounded bg-[var(--bg-input)]"})]},a))})}function lr({rows:r,compact:t=!1}){const a=t?5:6;return e.jsxs("div",{className:"overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("div",{className:"grid border-b border-[var(--border)]",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:Array.from({length:a}).map((n,i)=>e.jsx("div",{className:"px-3 py-3",children:e.jsx("div",{className:"h-3 w-2/3 animate-pulse rounded bg-[var(--bg-input)]"})},i))}),Array.from({length:r}).map((n,i)=>e.jsx("div",{className:"grid border-b border-[var(--border)] last:border-b-0",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:Array.from({length:a}).map((u,p)=>e.jsx("div",{className:"px-3 py-3",children:e.jsx("div",{className:"h-3.5 animate-pulse rounded-full bg-[var(--bg-input)]",style:{width:`${52+(i*13+p*11)%36}%`}})},p))},i))]})}function cr(r){const t=r.split("/").filter(Boolean);return(t[t.length-1]??r).replace(/^lv_/,"").split(/[-_]/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function dr(r){return r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function Rr(r){return[r.label,cr(r.service),r.description,r.service].filter(Boolean).join(" ")}function et(r){return typeof r=="function"?r:r.default}function rt(r,t){return e.jsx("div",{className:"flex min-h-[220px] items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-6 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("p",{className:"text-sm font-semibold text-[var(--text-main)]",children:"No se pudo cargar este modulo"}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:r.message}),e.jsx(ue,{className:"mt-4",height:36,padding:"0 14px",onClick:t,children:"Reintentar"})]})})}function tt({parentPanel:r,parentPanelComponent:t,renderParentPanel:a,parent:n,context:i,links:u,moduleRegistry:p,loadModule:h,activeService:d,initialService:b,onActiveServiceChange:k,canAccess:C,keepAlive:m=!0,title:f,subtitle:g,emptyState:c,loadingState:w,errorState:D=rt,renderTabLabel:_,searchableTabs:I="auto",tabsSearchThreshold:E=6,tabsSearchPlaceholder:T="Buscar modulo...",tabsSearchValue:B,onTabsSearchChange:M,emptySearchState:j,showTabCount:$=!0,className:H="",parentClassName:P="",contentClassName:K="",tabsClassName:W=""}){var ve;const U=o.useMemo(()=>u.filter(v=>!v.hidden&&((C==null?void 0:C(v,i))??!0)),[C,i,u]),Z=(ve=U.find(v=>!v.disabled))==null?void 0:ve.service,[R,s]=o.useState(b??Z??""),[N,q]=o.useState({}),[G,V]=o.useState({}),[re,le]=o.useState(""),[te,ye]=o.useState(!1),he=o.useRef(G),be=o.useRef(0),ce=B??re,S=dr(ce),F=I===!0||I==="auto"&&U.length>=E,X=F&&ce.trim().length>0,ae=o.useMemo(()=>S?U.filter(v=>dr(Rr(v)).includes(S)):U,[S,U]),oe=d??R,z=U.find(v=>v.service===oe)??U.find(v=>!v.disabled);o.useEffect(()=>{!z&&Z&&s(Z)},[Z,z]),o.useEffect(()=>{he.current=G},[G]);const we=v=>{v.disabled||(d||s(v.service),k==null||k(v.service,v))},_e=v=>{B===void 0&&le(v),M==null||M(v)},Ke=(v,ee)=>{const J=ae.filter(ie=>!ie.disabled),ge=J.findIndex(ie=>ie.service===ee.service);ge<0||((v.key==="ArrowRight"||v.key==="ArrowDown")&&(v.preventDefault(),we(J[(ge+1)%J.length])),(v.key==="ArrowLeft"||v.key==="ArrowUp")&&(v.preventDefault(),we(J[(ge-1+J.length)%J.length])),v.key==="Home"&&(v.preventDefault(),we(J[0])),v.key==="End"&&(v.preventDefault(),we(J[J.length-1])))},fe=o.useCallback(()=>{if(!z)return;const v=z.service,ee=he.current[v];if(ee!=null&&ee.loading||ee!=null&&ee.component&&m)return;const J=(p==null?void 0:p[v])??h;if(!J){V(ie=>({...ie,[v]:{loading:!1,error:new Error(`No module loader found for service "${v}".`)}}));return}const ge=++be.current;V(ie=>({...ie,[v]:{...ie[v],loading:!0,error:void 0}})),J(z,i).then(ie=>{if(ge!==be.current&&!m)return;const Te=et(ie);V(ke=>({...ke,[v]:{component:Te,loading:!1}}))}).catch(ie=>{const Te=ie instanceof Error?ie:new Error(String(ie));V(ke=>({...ke,[v]:{...ke[v],loading:!1,error:Te}}))})},[i,m,h,p,z]);o.useEffect(fe,[fe]);const je=z?N[z.service]??null:null,ne=z?G[z.service]:void 0,Fe=ne==null?void 0:ne.component,Ee=v=>{z&&q(ee=>({...ee,[z.service]:v}))},Oe=()=>{z&&q(v=>({...v,[z.service]:null}))},We={context:i,parent:n,links:u,visibleLinks:U,filteredLinks:ae,selectedLink:z,selectedService:z==null?void 0:z.service,activeItemId:je,tabsSearch:ce,onSelectService:we,onOpenDetail:Ee,onBackToList:Oe},Ne=a?a(We):t?e.jsx(t,{...We}):r;return e.jsxs("section",{className:`grid min-h-[520px] gap-4 lg:grid-cols-[minmax(260px,360px)_minmax(0,1fr)] ${H}`,children:[e.jsx("aside",{className:`min-w-0 rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-4 ${P}`,children:Ne}),e.jsxs("div",{className:`relative min-w-0 overflow-visible rounded-lg border border-[var(--border)] bg-[var(--bg-card)] ${K}`,children:[(f||g||F||$)&&e.jsx("div",{className:"relative border-b border-[var(--border)] px-4 py-3",children:e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[f&&e.jsx("h2",{className:"truncate text-sm font-semibold text-[var(--text-main)]",children:f}),g&&e.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-[var(--text-muted)]",children:g})]}),(F||$)&&e.jsxs("div",{className:"flex min-w-0 flex-shrink-0 items-center justify-end gap-2",children:[$&&e.jsxs("span",{className:"hidden text-xs font-semibold text-[var(--text-muted)] transition-opacity duration-200 sm:inline",children:[ae.length," / ",U.length]}),F&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`origin-right overflow-hidden transition-[width,opacity,transform] duration-200 ease-out ${te?"w-[min(20rem,44vw)] translate-x-0 opacity-100":"w-0 translate-x-2 opacity-0"}`,"aria-hidden":!te,children:e.jsx(nr,{value:ce,onChange:_e,placeholder:T,className:"w-full",autoFocus:te,forceExpanded:!0,onEscape:()=>ye(!1),size:"sm",inputTabIndex:te?0:-1})}),e.jsx("button",{type:"button","aria-label":te?"Cerrar busqueda":"Buscar tabs","aria-expanded":te,onClick:()=>{te&&ce&&_e(""),ye(v=>!v)},className:`inline-flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md border transition-all duration-200 hover:scale-[1.03] active:scale-95 ${te||X?"border-[var(--primary)] bg-[var(--bg-input)] text-[var(--text-main)] shadow-sm":"border-[var(--border)] text-[var(--text-muted)] hover:bg-[var(--bg-input)] hover:text-[var(--text-main)]"}`,children:e.jsx("span",{className:"grid h-4 w-4 place-items-center transition-transform duration-200",children:te||X?e.jsx(y.HiXMark,{className:"h-4 w-4"}):e.jsx(y.HiMagnifyingGlass,{className:"h-4 w-4"})})})]})]})]})}),e.jsx("div",{role:"tablist","aria-label":f??"Modulos relacionados",className:`flex gap-1 overflow-x-auto border-b border-[var(--border)] bg-[var(--bg-input)] px-2 py-1.5 transition-colors duration-200 ${W}`,children:ae.length>0?ae.map(v=>{const ee=v.service===(z==null?void 0:z.service);return e.jsx("button",{type:"button",role:"tab","aria-selected":ee,disabled:v.disabled,onClick:()=>we(v),onKeyDown:J=>Ke(J,v),className:`inline-flex h-9 min-w-max items-center gap-2 rounded-md border px-3 text-xs font-semibold transition-all duration-200 disabled:cursor-not-allowed disabled:opacity-50 ${ee?"border-[var(--primary)] bg-[var(--bg-card)] text-[var(--text-main)] shadow-sm":"border-transparent text-[var(--text-muted)] hover:bg-[var(--bg-card)] hover:text-[var(--text-main)]"}`,children:_?_(v,ee):e.jsxs(e.Fragment,{children:[v.icon,e.jsx("span",{children:v.label??cr(v.service)}),v.badge&&e.jsx("span",{className:"rounded-full bg-[var(--bg-input)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:v.badge})]})},v.service)}):e.jsx("div",{className:"flex min-h-9 flex-1 items-center rounded-md border border-dashed border-[var(--border)] px-3 text-xs text-[var(--text-muted)]",children:j??"No hay modulos que coincidan con la busqueda."})}),(z==null?void 0:z.description)&&e.jsx("div",{className:"border-b border-[var(--border)] px-4 py-2 text-xs text-[var(--text-muted)]",children:z.description}),e.jsxs("div",{className:"min-h-[420px] p-4",children:[!z&&(c??e.jsx("div",{className:"flex min-h-[220px] items-center justify-center rounded-lg border border-dashed border-[var(--border)] text-sm text-[var(--text-muted)]",children:"No hay modulos disponibles."})),z&&(ne==null?void 0:ne.loading)&&(w??e.jsx(ir,{title:"Cargando modulo..."})),z&&(ne==null?void 0:ne.error)&&D(ne.error,fe),z&&Fe&&!(ne!=null&&ne.loading)&&!(ne!=null&&ne.error)&&e.jsx(Fe,{context:i,parent:n,link:z,activeItemId:je,onOpenDetail:Ee,onBackToList:Oe})]})]})]})}const ur=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],at=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],nt=["Do","Lu","Ma","Mi","Ju","Vi","Sá"],Ye=6;function Xe(r,t,a){return`${r}-${String(t).padStart(2,"0")}-${String(a).padStart(2,"0")}`}function ot(){const r=new Date;return Xe(r.getFullYear(),r.getMonth()+1,r.getDate())}function fr(r){const[t,a,n]=r.split("-").map(Number);return{year:t,month:a,day:n}}function st(r){if(!r)return"Seleccionar fecha";const{year:t,month:a,day:n}=fr(r);return!t||!a||!n?"Seleccionar fecha":`${String(n).padStart(2,"0")} ${ur[a-1]} ${t}`}function it({value:r,onChange:t,minDate:a,displayMode:n="inline"}){const i=ot(),p=fr(r||i),h=n==="popover",[d,b]=o.useState(!1),k=o.useRef(null),[C,m]=o.useState({horizontal:"left",vertical:"bottom"}),[f,g]=o.useState(p.year),[c,w]=o.useState(p.month),[D,_]=o.useState("days"),I=16,[E,T]=o.useState(0),B=f-7+E,M=Array.from({length:I},(s,N)=>B+N);o.useEffect(()=>{if(!h||!d||!k.current)return;const s=k.current.getBoundingClientRect(),N=8,q=280,G=340,V=s.left+q>window.innerWidth-N,re=s.right-q>=N,le=s.bottom+8+G>window.innerHeight-N,te=s.top-8-G>=N;m({horizontal:V&&re?"right":"left",vertical:le&&te?"top":"bottom"})},[h,d]),o.useEffect(()=>{if(!h||!d)return;function s(q){k.current&&(k.current.contains(q.target)||b(!1))}function N(q){q.key==="Escape"&&b(!1)}return document.addEventListener("mousedown",s),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",N)}},[h,d]);function j(){c===1?(g(s=>s-1),w(12)):w(s=>s-1)}function $(){c===12?(g(s=>s+1),w(1)):w(s=>s+1)}const H=new Date(f,c-1,1).getDay(),P=new Date(f,c,0).getDate(),K=[...Array(H).fill(null),...Array.from({length:P},(s,N)=>N+1)];for(;K.length<Ye*7;)K.push(null);const W=K.slice(0,Ye*7);function U(s){const N=Xe(f,c,s);a&&N<a||(t(N),h&&b(!1))}const Z={background:"none",border:"none",cursor:"pointer",color:"var(--text-muted)",padding:4,borderRadius:6,display:"flex",alignItems:"center"},R=e.jsxs("div",{style:{background:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",userSelect:"none",width:280},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 12px",borderBottom:"1px solid var(--border)"},children:D==="days"?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:j,style:Z,title:"Mes anterior",children:e.jsx(y.HiChevronLeft,{size:16})}),e.jsxs("button",{type:"button",onClick:()=>{_("years"),T(0)},style:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:4,fontSize:13,fontWeight:700,color:"var(--text-main)",borderRadius:6,padding:"2px 6px"},children:[ur[c-1]," ",f,e.jsx(y.HiChevronDown,{size:13,style:{color:"var(--text-muted)"}})]}),e.jsx("button",{type:"button",onClick:$,style:Z,title:"Mes siguiente",children:e.jsx(y.HiChevronRight,{size:16})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>T(s=>s-I),style:Z,children:e.jsx(y.HiChevronLeft,{size:16})}),e.jsxs("button",{type:"button",onClick:()=>_("days"),style:{background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:700,color:"var(--text-main)",borderRadius:6,padding:"2px 6px"},children:[M[0]," – ",M[M.length-1]]}),e.jsx("button",{type:"button",onClick:()=>T(s=>s+I),style:Z,children:e.jsx(y.HiChevronRight,{size:16})})]})}),D==="years"&&e.jsxs("div",{style:{padding:"8px 10px 10px"},children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4,1fr)",gap:3,marginBottom:8},children:at.map((s,N)=>{const q=N+1===c;return e.jsx("button",{type:"button",onClick:()=>w(N+1),style:{border:"none",cursor:"pointer",borderRadius:6,fontSize:11,fontWeight:q?700:400,padding:"4px 0",background:q?"var(--primary)":"transparent",color:q?"var(--primary-fg, #ffffff)":"var(--text-secondary)"},children:s},s)})}),e.jsx("div",{style:{height:1,background:"var(--border)",marginBottom:8}}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4,1fr)",gap:3},children:M.map(s=>{const N=s===f;return e.jsx("button",{type:"button",onClick:()=>{g(s),_("days")},style:{border:"none",cursor:"pointer",borderRadius:6,fontSize:12,fontWeight:N?700:400,padding:"6px 0",background:N?"var(--primary)":"transparent",color:N?"var(--primary-fg, #ffffff)":"var(--text-main)",outline:s===new Date().getFullYear()&&!N?"2px solid var(--primary)":"none",outlineOffset:"-2px"},children:s},s)})})]}),D==="days"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7,1fr)",padding:"6px 8px 0"},children:nt.map(s=>e.jsx("div",{style:{textAlign:"center",fontSize:10,fontWeight:700,color:"var(--text-muted)",padding:"2px 0",textTransform:"uppercase"},children:s},s))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7,1fr)",gridTemplateRows:`repeat(${Ye},1fr)`,padding:"4px 8px 10px",gap:2},children:W.map((s,N)=>{if(s===null)return e.jsx("div",{style:{aspectRatio:"1"}},N);const q=Xe(f,c,s),G=q===r,V=q===i,re=!!(a&&q<a);return e.jsx("button",{type:"button",onClick:()=>!re&&U(s),style:{width:"100%",aspectRatio:"1",borderRadius:6,border:"none",cursor:re?"not-allowed":"pointer",fontSize:12,fontWeight:G||V?700:400,background:G?"var(--primary)":"transparent",color:G?"var(--primary-fg, #ffffff)":re?"var(--text-muted)":"var(--text-main)",opacity:re?.4:1,outline:V&&!G?"2px solid var(--primary)":"none",outlineOffset:"-2px"},children:s},N)})})]})]});return h?e.jsxs("div",{ref:k,className:"relative w-full",children:[e.jsxs("button",{type:"button",onClick:()=>b(s=>!s),className:"flex h-11 w-full items-center justify-between gap-2 rounded-lg px-3 py-0 text-sm transition-all duration-150 focus:outline-none",style:{background:"var(--bg-input)",border:`1px solid ${d?"var(--primary)":"var(--border)"}`,color:"var(--text-main)",boxShadow:d?"0 0 0 3px rgba(59,130,246,0.12)":"none"},children:[e.jsxs("span",{className:"inline-flex items-center gap-2 min-w-0",children:[e.jsx(y.HiCalendarDays,{className:"w-4 h-4 text-[var(--text-muted)]"}),e.jsx("span",{className:"truncate",children:st(r)})]}),e.jsx(y.HiChevronDown,{className:`w-4 h-4 text-[var(--text-muted)] transition-transform ${d?"rotate-180":""}`})]}),d&&e.jsx("div",{className:"absolute z-50",style:{...C.horizontal==="left"?{left:0}:{right:0},...C.vertical==="bottom"?{top:"calc(100% + 8px)"}:{bottom:"calc(100% + 8px)"}},children:R})]}):R}function pr(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}function Ve({value:r,onChange:t,options:a,placeholder:n="Seleccionar…",emptyLabel:i,disabled:u=!1,className:p="",style:h,height:d=44,padding:b="0 12px",searchable:k=!0,minOptionsForSearch:C=6}){const[m,f]=o.useState(!1),[g,c]=o.useState(""),[w,D]=o.useState(-1),[_,I]=o.useState(!1),[E,T]=o.useState({}),B=o.useRef(null),M=o.useRef(null),j=o.useRef(null),$=o.useRef(null),H=k&&a.length>=C,P=a.find(s=>s.value===r)??null,K=H&&g.trim()?a.filter(s=>{var N;return s.label.toLowerCase().includes(g.toLowerCase())||((N=s.sublabel)==null?void 0:N.toLowerCase().includes(g.toLowerCase()))}):a,W=o.useCallback(()=>{const s=B.current;if(!s)return;const N=s.getBoundingClientRect(),q=H?272:212,G=window.innerHeight-N.bottom,V=G<q&&N.top>G;T({position:"fixed",left:N.left,top:V?void 0:N.bottom+4,bottom:V?window.innerHeight-N.top+4:void 0,width:N.width,zIndex:9999})},[H]);o.useEffect(()=>I(!0),[]),o.useEffect(()=>{if(!m)return;function s(N){var G,V;const q=N.target;!((G=B.current)!=null&&G.contains(q))&&!((V=M.current)!=null&&V.contains(q))&&(f(!1),c(""))}return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[m]),o.useEffect(()=>{m&&(D(-1),W(),H&&setTimeout(()=>{var s;return(s=j.current)==null?void 0:s.focus()},0))},[m,H,W]),o.useEffect(()=>{if(m)return window.addEventListener("resize",W),window.addEventListener("scroll",W,!0),()=>{window.removeEventListener("resize",W),window.removeEventListener("scroll",W,!0)}},[m,W]),o.useEffect(()=>{if(w<0||!$.current)return;const s=$.current.children[w];s==null||s.scrollIntoView({block:"nearest"})},[w]);const U=o.useCallback(s=>{t(s),f(!1),c("")},[t]);function Z(s){if(!m){(s.key==="Enter"||s.key===" "||s.key==="ArrowDown")&&(s.preventDefault(),f(!0));return}s.key==="Escape"?(s.preventDefault(),f(!1),c("")):s.key==="ArrowDown"?(s.preventDefault(),D(N=>Math.min(N+1,K.length-1))):s.key==="ArrowUp"?(s.preventDefault(),D(N=>Math.max(N-1,i?-1:0))):s.key==="Enter"&&(s.preventDefault(),w===-1&&i?U(""):K[w]&&U(K[w].value))}const R=e.jsxs("div",{ref:M,className:"rounded-xl shadow-xl overflow-hidden",style:{...E,background:"var(--bg-card)",border:"1px solid var(--border)"},children:[H&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{borderBottom:"1px solid var(--border)"},children:[e.jsx(y.HiMagnifyingGlass,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"var(--text-muted)"}}),e.jsx("input",{ref:j,value:g,onChange:s=>{c(s.target.value),D(-1)},placeholder:"Buscar…",className:"min-w-0 flex-1 text-sm bg-transparent outline-none",style:{color:"var(--text-main)"}}),g&&e.jsx("button",{type:"button",onMouseDown:s=>{s.preventDefault(),c("")},children:e.jsx(y.HiXMark,{className:"w-3.5 h-3.5",style:{color:"var(--text-muted)"}})})]}),e.jsxs("ul",{ref:$,role:"listbox",className:"overflow-y-auto",style:{maxHeight:H?220:180,scrollbarWidth:"thin",scrollbarColor:"var(--border) transparent",overscrollBehavior:"contain"},children:[i&&e.jsx("li",{role:"option","aria-selected":r==="",onMouseDown:s=>{s.preventDefault(),U("")},onMouseEnter:()=>D(-1),className:"flex items-center gap-2 px-3 py-2 cursor-pointer text-sm transition-colors",style:{background:w===-1?"var(--bg-hover)":"transparent",color:"var(--text-muted)",fontStyle:"italic"},children:i}),K.map((s,N)=>{const G=N===w,V=s.value===r;return e.jsxs("li",{role:"option","aria-selected":V,onMouseDown:re=>{re.preventDefault(),s.disabled||U(s.value)},onMouseEnter:()=>!s.disabled&&D(N),className:"flex items-center gap-2 px-3 py-2 cursor-pointer text-sm transition-colors",style:{background:G?"var(--bg-hover)":V?"color-mix(in srgb, var(--primary) 6%, transparent)":"transparent",color:s.disabled?"var(--text-muted)":"var(--text-main)",cursor:s.disabled?"not-allowed":"pointer",boxShadow:V?"inset 2px 0 0 var(--primary)":void 0},children:[s.color&&e.jsx("span",{className:"flex-shrink-0 w-2.5 h-2.5 rounded-full",style:{background:s.color}}),e.jsxs("span",{className:"min-w-0 flex flex-1 items-baseline gap-1 overflow-hidden",children:[e.jsx("span",{className:"truncate",children:s.label}),s.sublabel&&e.jsx("span",{className:"min-w-0 flex-shrink truncate",style:{color:"var(--text-muted)",fontSize:12},children:s.sublabel})]}),s.badge&&e.jsx("span",{className:"text-xs flex-shrink-0",style:{color:"var(--text-muted)"},children:s.badge})]},s.value)}),K.length===0&&e.jsx("li",{className:"px-3 py-4 text-sm text-center",style:{color:"var(--text-muted)"},children:"Sin resultados"})]})]});return e.jsxs("div",{ref:B,className:`relative ${p||"w-full"}`,style:h,onKeyDown:Z,children:[e.jsxs("button",{type:"button",disabled:u,onClick:()=>!u&&f(s=>!s),className:"flex w-full items-center gap-2 rounded-lg text-left text-sm transition-colors focus:outline-none",style:{height:pr(d),padding:pr(b),background:"var(--bg-input)",color:P?"var(--text-main)":"var(--text-muted)",border:m?"1px solid var(--primary)":"1px solid var(--border)",opacity:u?.5:1,cursor:u?"not-allowed":"pointer"},"aria-haspopup":"listbox","aria-expanded":m,children:[(P==null?void 0:P.color)&&e.jsx("span",{className:"flex-shrink-0 w-2.5 h-2.5 rounded-full",style:{background:P.color}}),e.jsx("span",{className:"min-w-0 flex flex-1 items-baseline gap-1 overflow-hidden",children:P?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"truncate",children:P.label}),P.sublabel&&e.jsx("span",{className:"min-w-0 flex-shrink truncate",style:{color:"var(--text-muted)",fontSize:12},children:P.sublabel})]}):e.jsx("span",{className:"truncate",children:n})}),P&&i?e.jsx("span",{role:"button",tabIndex:-1,onMouseDown:s=>{s.preventDefault(),s.stopPropagation(),U("")},className:"flex-shrink-0 rounded-full p-0.5 transition-colors hover:bg-black/10",style:{color:"var(--text-muted)"},children:e.jsx(y.HiXMark,{className:"w-3 h-3"})}):e.jsx(y.HiChevronDown,{className:"flex-shrink-0 w-4 h-4 transition-transform",style:{color:"var(--text-muted)",transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),m&&_&&De.createPortal(R,document.body)]})}function He(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}function lt({value:r,onChange:t,placeholder:a="Buscar...",className:n="",height:i=44,padding:u="0 12px 0 34px",iconLeft:p=12}){return e.jsxs("div",{className:`relative ${n}`,children:[e.jsx(y.HiMagnifyingGlass,{className:"absolute top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)] pointer-events-none",style:{left:He(p)}}),e.jsx("input",{type:"text",value:r,onChange:h=>t(h.target.value),placeholder:a,className:"w-full rounded-lg border border-[var(--border)] [background:var(--bg-card)] text-sm text-[var(--text-main)] placeholder:text-[var(--text-muted)] outline-none transition-[border-color,box-shadow] focus:border-primary focus:ring-2 focus:ring-primary/20",style:{height:He(i),padding:He(u)}})]})}function ct({value:r,onChange:t,options:a,placeholder:n,icon:i,className:u="",height:p=44,padding:h,iconLeft:d=12,searchable:b=!0}){const k=i?a.map((C,m)=>m===0&&!C.color?{...C,sublabel:C.sublabel??void 0}:C):a;return e.jsxs("div",{className:`relative ${u}`,children:[i&&e.jsx("span",{className:"pointer-events-none absolute top-1/2 z-10 -translate-y-1/2 text-[var(--text-muted)]",style:{left:He(d)},children:i}),e.jsx(Ve,{value:r,onChange:t,options:k,placeholder:n,searchable:b,minOptionsForSearch:5,height:p,padding:h??(i?"0 12px 0 34px":"0 12px"),className:"[&>button]:text-sm [&>button]:[background:var(--bg-card)]"})]})}const dt={sm:"24rem",md:"28rem",lg:"32rem",xl:"40rem","2xl":"48rem","4xl":"56rem","5xl":"64rem"},Ae=180;function hr({open:r,onClose:t,title:a,subtitle:n,leadingIcon:i,headerActions:u,footer:p,children:h,size:d="md",maxWidth:b,zIndex:k=1e3,closeOnBackdrop:C=!0,closeOnEscape:m=!0,showCloseButton:f=!0,placement:g="center",bodyClassName:c="px-6 py-5",panelClassName:w="",backdropClassName:D="bg-black/50 backdrop-blur-sm",contentClassName:_="p-4",ariaLabel:I,frameless:E=!1}){const[T,B]=o.useState(!1),[M,j]=o.useState(!1),$=o.useRef(null);if(o.useEffect(()=>(r?($.current&&clearTimeout($.current),B(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>j(!0)))):(j(!1),$.current=setTimeout(()=>B(!1),Ae+40)),()=>{$.current&&clearTimeout($.current)}),[r]),o.useEffect(()=>{if(r)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[r]),o.useEffect(()=>{if(!r||!m)return;const Z=R=>{R.key==="Escape"&&t()};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[m,t,r]),!T)return null;const H=a||n||i||u||f,P=b??dt[d],K=g==="bottom-mobile"?"items-end sm:items-center justify-center p-0 sm:p-4":"items-center justify-center",W=g==="bottom-mobile"?"rounded-t-2xl sm:rounded-2xl":"rounded-2xl",U=M?"translateY(0) scale(1)":g==="bottom-mobile"?"translateY(16px) scale(0.98)":"translateY(10px) scale(0.96)";return De.createPortal(e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":I??a,className:`fixed inset-0 flex ${K} ${_}`,style:{zIndex:k},children:[e.jsx("div",{className:`absolute inset-0 ${D}`,onClick:C?t:void 0,style:{opacity:M?1:0,transition:`opacity ${Ae}ms ease`}}),e.jsxs("div",{className:`relative z-10 flex max-h-[92dvh] w-full flex-col overflow-hidden ${E?"shadow-none":"shadow-2xl"} ${W} ${w}`,style:{maxWidth:P,background:E?"transparent":"var(--bg-card)",border:E?"none":"1px solid var(--border)",opacity:M?1:0,transform:U,transition:`opacity ${Ae}ms ease, transform ${Ae}ms ease`},onClick:Z=>Z.stopPropagation(),children:[H&&e.jsxs("div",{className:"flex flex-shrink-0 items-center justify-between gap-3 px-6 py-4",style:{borderBottom:"1px solid var(--border)"},children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[i&&e.jsx("div",{className:"flex-shrink-0",children:i}),(a||n)&&e.jsxs("div",{className:"min-w-0",children:[a&&e.jsx("h2",{className:"truncate text-base font-semibold",style:{color:"var(--text-main)"},children:a}),n&&e.jsx("p",{className:"truncate text-xs",style:{color:"var(--text-muted)"},children:n})]})]}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2",children:[u,f&&e.jsx(ue,{variant:"icon",onClick:t,title:"Cerrar",children:e.jsx(y.HiXMark,{className:"h-5 w-5"})})]})]}),e.jsx("div",{className:`min-h-0 flex-1 overflow-y-auto ${c}`,children:h}),p&&e.jsx("div",{className:"flex flex-shrink-0 justify-end gap-2 px-6 py-4",style:{borderTop:"1px solid var(--border)"},children:p})]})]}),document.body)}const ut={danger:{iconBg:"rgba(239,68,68,0.12)",iconColor:"var(--danger)",btnBg:"var(--danger)",btnColor:"#fff"},warning:{iconBg:"rgba(245,158,11,0.12)",iconColor:"var(--warning)",btnBg:"var(--warning)",btnColor:"#fff"},primary:{iconBg:"rgba(59,130,246,0.12)",iconColor:"var(--primary)",btnBg:"var(--primary)",btnColor:"#fff"}};function ft({open:r,title:t,description:a,confirmLabel:n="Confirmar",cancelLabel:i="Cancelar",variant:u="danger",onConfirm:p,onCancel:h}){const d=ut[u];return e.jsxs(hr,{open:r,onClose:h,size:"sm",zIndex:9998,showCloseButton:!1,bodyClassName:"p-6",panelClassName:"px-1",ariaLabel:t,children:[e.jsx(ue,{variant:"icon",onClick:h,className:"absolute right-3 top-3 h-7 w-7 hover:opacity-70",style:{color:"var(--text-muted)"},"aria-label":"Cancelar",children:e.jsx(y.HiXMark,{className:"h-4 w-4"})}),e.jsx("div",{className:"mb-4 flex h-11 w-11 items-center justify-center rounded-xl",style:{background:d.iconBg},children:e.jsx(y.HiExclamationTriangle,{className:"h-5 w-5",style:{color:d.iconColor}})}),e.jsx("h2",{className:"mb-1 text-base font-semibold",style:{color:"var(--text-main)"},children:t}),a&&e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:a}),e.jsxs("div",{className:"mt-6 flex gap-2",children:[e.jsx(ue,{variant:"secondary",onClick:h,className:"flex-1",style:{background:"var(--bg-input)"},children:i}),e.jsx(ue,{variant:"danger",onClick:p,className:"flex-1",style:{background:d.btnBg,color:d.btnColor,borderColor:"transparent"},children:n})]})]})}function br(r){const t=document.createElement("textarea");t.value=r,t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}async function pt(r){var t;if((t=navigator.clipboard)!=null&&t.writeText){await navigator.clipboard.writeText(r);return}br(r)}function ht(r){return typeof r=="function"?r():r}function mr({value:r,resetDelay:t=2e3,title:a,copiedTitle:n="Copiado",copiedLabel:i,icon:u=e.jsx(y.HiClipboardDocument,{className:"h-3.5 w-3.5"}),copiedIcon:p=e.jsx(y.HiCheck,{className:"h-3.5 w-3.5"}),stopPropagation:h=!0,onCopied:d,onCopyError:b,className:k="",style:C,children:m,onClick:f,type:g="button",...c}){const[w,D]=o.useState(!1),_=o.useRef(null);o.useEffect(()=>()=>{_.current&&window.clearTimeout(_.current)},[]);function I(T){D(!0),d==null||d(T),_.current&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>{D(!1),_.current=null},t)}async function E(T){var M;if(h&&T.stopPropagation(),f==null||f(T),T.defaultPrevented)return;const B=ht(r);if(B)try{await pt(B),I(B)}catch(j){try{br(B),I(B)}catch($){b==null||b($,B);return}(M=navigator.clipboard)!=null&&M.writeText||b==null||b(j,B)}}return e.jsxs("button",{...c,type:g,onClick:E,title:w?n:a,"aria-label":c["aria-label"]??(w?n:a),"data-copied":w?"true":void 0,className:`relative inline-flex h-7 shrink-0 items-center justify-center rounded-md transition-all duration-200 ${m?"min-w-7 px-2":"w-7"} ${k}`,style:{cursor:"pointer",background:w?"rgba(22,163,74,0.15)":"transparent",border:w?"1px solid rgba(22,163,74,0.4)":"1px solid transparent",color:w?"#16a34a":"var(--text-muted)",boxShadow:w?"0 0 0 3px rgba(22,163,74,0.12)":"none",...C},children:[e.jsx("span",{className:"inline-flex items-center justify-center transition-all duration-150",style:{transform:w?"scale(1.15)":"scale(1)"},children:w?p:u}),m&&e.jsx("span",{className:"ml-2 text-xs font-medium",children:w?i??m:m})]})}function bt(r,t){const a=typeof r=="function"?r():r;return t?t(a):a}function mt({url:r,resolveUrl:t,title:a="Copiar link",copiedTitle:n="Link copiado",icon:i=e.jsx(y.HiLink,{className:"h-3.5 w-3.5"}),...u}){return e.jsx(mr,{...u,value:()=>bt(r,t),title:a,copiedTitle:n,icon:i})}const vt="[&_button]:h-7 [&_button]:min-h-0 [&_button]:gap-1 [&_button]:px-2 [&_button]:text-xs [&_button_svg]:h-3.5 [&_button_svg]:w-3.5 [&_button[data-icon=true]]:w-7 [&_button[data-icon=true]]:px-0";function $e(r){if(!r)return 150;const t=parseInt(r,10);return isNaN(t)||t<=0?150:t}function Se(r,t){const a=r.minWidth??80,n=r.maxWidth??1/0;return Math.min(n,Math.max(a,t))}function gt(r,t){if(t<=7)return Array.from({length:t},(n,i)=>i+1);const a=[1];r>3&&a.push("...");for(let n=Math.max(2,r-1);n<=Math.min(t-1,r+1);n++)a.push(n);return r<t-2&&a.push("..."),a.push(t),a}function vr({children:r,className:t="",style:a}){return e.jsx(Le,{onlyWhenOverflow:!0,className:t,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",...a},children:r})}function xt({columns:r,data:t,getRowId:a,loading:n=!1,skeletonRows:i=8,emptyIcon:u,emptyText:p="Sin resultados",onRowClick:h,selected:d,onToggleOne:b,onToggleAll:k,highlightSelected:C=!0,rowClassName:m,getRowCategory:f,stickyHeader:g=!0,pageSize:c=25,pageSizeOptions:w=[25,50,100],pageSizeSelectWidth:D=62,pageSizeSelectHeight:_=30,pageSizeSelectPadding:I="0 7px",totalRows:E,page:T,onPageChange:B,onPageSizeChange:M,storageKey:j,stickyFirstColumn:$=!1,bottomOffset:H=0,compact:P=!0,restrictHeight:K=!0,minTableWidth:W}){const U=r.map(l=>l.key).join(","),[Z,R]=o.useState(!j),s=o.useRef(null),N=o.useRef(!j),q=(l,x)=>50+(l*17+x*13+7)%40,G=o.useRef(null),[V,re]=o.useState(void 0),[le,te]=o.useState(!1);o.useEffect(()=>{const x=c!==!1?32:0,O=12;function A(){if(te(window.innerWidth<640),!G.current)return;const Y=G.current.getBoundingClientRect().top;re(Math.max(120,window.innerHeight-Y-x-O-H))}return A(),window.addEventListener("resize",A),()=>window.removeEventListener("resize",A)},[n,c,H]);const[ye,he]=o.useState(()=>r.map(l=>l.key)),[be,ce]=o.useState(()=>Object.fromEntries(r.map(l=>[l.key,Se(l,$e(l.width))])));o.useEffect(()=>{const l=r.map(O=>O.key);if(!j){he(l),N.current=!1,R(!0);return}let x=!1;return N.current=!1,R(!1),fetch(`/api/user/preferences/datatables?key=${encodeURIComponent(j)}`,{cache:"no-store"}).then(O=>O.ok?O.json():null).then(O=>{var Ue,qe;if(x)return;const A=(Ue=O==null?void 0:O.settings)==null?void 0:Ue.columnOrder,Y=Array.isArray(A)?A.filter(pe=>l.includes(pe)):[],de=l.filter(pe=>!Y.includes(pe)),me=Y.length>0?[...Y,...de]:l,Ce=Object.fromEntries(r.map(pe=>[pe.key,Se(pe,$e(pe.width))])),Q=((qe=O==null?void 0:O.settings)==null?void 0:qe.columnWidths)??{},se=Object.fromEntries(r.map(pe=>[pe.key,Se(pe,Q[pe.key]??Ce[pe.key])]));he(me),ce(se),s.current=JSON.stringify({columnOrder:me,columnWidths:se}),N.current=!0}).catch(()=>{if(!x){he(l);const O=Object.fromEntries(r.map(A=>[A.key,Se(A,$e(A.width))]));ce(O),s.current=JSON.stringify({columnOrder:l,columnWidths:O}),N.current=!0}}).finally(()=>{x||R(!0)}),()=>{x=!0}},[j,U,r]),o.useEffect(()=>{if(!j||!Z||!N.current)return;const l={columnOrder:ye,columnWidths:be},x=JSON.stringify(l);if(x===s.current)return;const O=window.setTimeout(()=>{fetch("/api/user/preferences/datatables",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:j,settings:l})}).then(A=>{A.ok&&(s.current=x)}).catch(()=>{})},300);return()=>window.clearTimeout(O)},[ye,be,j,Z]),o.useEffect(()=>{he(l=>{const x=r.map(Y=>Y.key),O=l.filter(Y=>x.includes(Y)),A=x.filter(Y=>!O.includes(Y));return[...O,...A]})},[U,r]);const S=ye.map(l=>r.find(x=>x.key===l)).filter(l=>!!l);o.useEffect(()=>{ce(l=>{const x=Object.fromEntries(r.map(O=>[O.key,Se(O,$e(O.width))]));return Object.fromEntries(r.map(O=>[O.key,Se(O,l[O.key]??x[O.key])]))})},[U,r]);const F=o.useRef(null);o.useEffect(()=>{function l(O){const A=F.current;if(!A)return;const Y=O.clientX-A.startX,de=r.find(me=>me.key===A.colKey);de&&ce(me=>({...me,[A.colKey]:Se(de,A.startWidth+Y)}))}function x(){F.current&&(F.current=null,document.body.style.cursor="",document.body.style.userSelect="")}return document.addEventListener("pointermove",l),document.addEventListener("pointerup",x),()=>{document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",x)}},[r]);const X=o.useRef(null),[ae,oe]=o.useState(null);function z(l,x){X.current=l,x.dataTransfer.effectAllowed="move"}function we(l,x){x.preventDefault(),x.dataTransfer.dropEffect="move",ae!==l&&oe(l)}function _e(l,x){x.preventDefault();const O=X.current;O!==null&&O!==l&&he(A=>{const Y=[...A],[de]=Y.splice(O,1);return Y.splice(l,0,de),Y}),X.current=null,oe(null)}function Ke(){X.current=null,oe(null)}const[fe,je]=o.useState(null);function ne(l){l.sortKey&&je(x=>(x==null?void 0:x.key)===l.key?{key:l.key,dir:x.dir==="asc"?"desc":"asc"}:{key:l.key,dir:"asc"})}const[Fe,Ee]=o.useState(1),[Oe,We]=o.useState(c===!1?0:c);o.useEffect(()=>{Ee(1)},[t]);const Ne=!!(B&&M),ve=c!==!1,v=Ne?T??1:Fe,ee=Ne||ve?Oe:t.length,J=!!d&&!!b&&!!k,ge=J?40:0,ie=J&&t.length>0&&d.size===t.length,Te=J&&d.size>0&&d.size<t.length,ke=o.useMemo(()=>{if(!fe)return t;const l=r.find(x=>x.key===fe.key&&x.sortKey);return l!=null&&l.sortKey?[...t].sort((x,O)=>{const A=x[l.sortKey],Y=O[l.sortKey],de=A===Y?0:A==null?1:Y==null||A<Y?-1:1;return fe.dir==="asc"?de:-de}):t},[t,fe,r]),Hr=o.useMemo(()=>{if(Ne||!ve)return ke;const l=(v-1)*ee;return ke.slice(l,l+ee)},[ke,Ne,ve,v,ee]),Be=E??t.length,Qe=ve?Math.max(1,Math.ceil(Be/ee)):1,la=ve?(v-1)*ee+1:1,ca=ve?Math.min(v*ee,Be):Be;function Re(l){const x=Math.max(1,Math.min(l,Qe));Ne?B(x):Ee(x)}function da(l){We(l),Ne?(M(l),B(1)):Ee(1),M&&M(l)}const Ar=l=>l==="center"?"text-center":l==="right"?"text-right":"text-left",ua="color-mix(in srgb, var(--primary) 6%, var(--bg-card))",fa=S.length+(J?1:0);function Pr(l){return l?typeof l=="string"?{key:l,label:l}:l:null}const Ir=()=>e.jsxs("tr",{style:{background:"color-mix(in srgb, var(--bg-input) 72%, transparent)"},children:[J&&e.jsx("th",{className:`${P?"px-2 py-1.5":"px-3 py-2.5"} w-10`,style:$?{position:"sticky",left:0,zIndex:12,background:"color-mix(in srgb, var(--bg-input) 72%, transparent)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",boxShadow:"inset 0 -2px 0 var(--border)",borderRight:"1px solid var(--border)"}:{borderBottom:"2px solid var(--border)",borderRight:"1px solid var(--border)"},children:e.jsx("input",{type:"checkbox",checked:ie,ref:l=>{l&&(l.indeterminate=Te)},onChange:k,className:"rounded cursor-pointer accent-[var(--primary)]"})}),S.map((l,x)=>{const O=(fe==null?void 0:fe.key)===l.key,A=!!l.sortKey,Y=$&&!le&&x===0,de=ae===x,Ce=(be[l.key]??$e(l.width))<120;return e.jsxs("th",{className:`group select-none ${Ce?"text-left":Ar(l.align)}`,style:{...Y?{position:"sticky",left:ge,zIndex:12,background:"color-mix(in srgb, var(--bg-input) 72%, transparent)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",boxShadow:"3px 0 6px -2px rgba(0,0,0,0.12), inset 0 -2px 0 var(--border)",borderRight:"1px solid var(--border)"}:{position:"relative",borderBottom:"2px solid var(--border)",borderRight:"1px solid var(--border)"},color:O?"var(--primary)":"var(--text-muted)",whiteSpace:"nowrap",transition:"color 0.15s",borderLeft:de?"2px solid var(--primary)":"2px solid transparent",cursor:A?"pointer":"default",padding:P?"5px 24px 5px 6px":"7px 28px 7px 6px"},onDragOver:Q=>we(x,Q),onDrop:Q=>_e(x,Q),onClick:A?()=>ne(l):void 0,children:[e.jsx("span",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),z(x,Q)},onDragEnd:Q=>{Q.stopPropagation(),Ke()},onClick:Q=>Q.stopPropagation(),title:"Arrastrar para reordenar",className:"inline-flex items-center mr-1 opacity-0 group-hover:opacity-40 transition-opacity",style:{cursor:"grab",color:"var(--text-muted)",verticalAlign:"middle"},children:e.jsx(_r.MdDragIndicator,{size:15})}),e.jsx(vr,{className:"inline-block max-w-full align-middle",style:{width:"calc(100% - 22px)",textAlign:Ce?"left":l.align==="center"?"center":l.align==="right"?"right":"left"},children:e.jsxs("span",{className:`inline-flex max-w-full items-center gap-1 font-semibold uppercase tracking-wider ${P?"text-[11px]":"text-xs"}`,children:[e.jsx("span",{className:"min-w-0 truncate",children:l.header}),A&&e.jsx("span",{className:"flex-shrink-0 opacity-60",children:O?fe.dir==="asc"?e.jsx(y.HiChevronUp,{className:"w-3 h-3"}):e.jsx(y.HiChevronDown,{className:"w-3 h-3"}):e.jsx(y.HiChevronUpDown,{className:"w-3 h-3 opacity-40"})})]})}),e.jsx("span",{role:"separator","aria-orientation":"vertical",title:"Arrastrar para redimensionar",onPointerDown:Q=>{Q.preventDefault(),Q.stopPropagation(),F.current={colKey:l.key,startX:Q.clientX,startWidth:be[l.key]??150},document.body.style.cursor="col-resize",document.body.style.userSelect="none"},onClick:Q=>Q.stopPropagation(),className:"absolute right-0 top-0 h-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",style:{width:12,cursor:"col-resize",zIndex:3},children:e.jsx("span",{style:{width:3,height:"40%",borderRadius:2,background:"var(--primary)",display:"block"}})})]},l.key)})]}),zr=()=>{if(!ve||n)return null;const l=gt(v,Qe);return e.jsxs("div",{className:`grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-2 rounded-b-xl border-t text-xs select-none ${P?"px-2 py-0.5":"px-3 py-1"}`,style:{borderColor:"var(--border)",background:"var(--bg-input)"},children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{style:{color:"var(--text-muted)"},children:Be===0?"0 filas":`${la}–${ca} de ${Be}`}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{style:{color:"var(--text-muted)"},children:"Filas:"}),e.jsx(Ve,{value:String(ee),onChange:x=>da(Number(x)),options:w.map(x=>({value:String(x),label:String(x)})),placeholder:"Filas",searchable:!1,height:_,padding:I,className:"shrink-0 [&>button]:rounded-md [&>button]:text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",style:{width:D}})]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-0.5",children:[e.jsx("button",{disabled:v<=1,onClick:()=>Re(v-1),className:"rounded p-0.5 transition-colors disabled:opacity-30",style:{color:"var(--text-muted)",background:"transparent"},children:e.jsx(y.HiChevronLeft,{className:"h-3.5 w-3.5"})}),l.map((x,O)=>x==="..."?e.jsx("span",{className:"px-1",style:{color:"var(--text-muted)"},children:"…"},`e${O}`):e.jsx("button",{onClick:()=>Re(x),className:"h-5 w-5 rounded text-[11px] font-medium transition-colors",style:{background:x===v?"var(--primary)":"transparent",color:x===v?"var(--primary-fg)":"var(--text-muted)"},children:x},x)),e.jsx("button",{disabled:v>=Qe,onClick:()=>Re(v+1),className:"rounded p-0.5 transition-colors disabled:opacity-30",style:{color:"var(--text-muted)",background:"transparent"},children:e.jsx(y.HiChevronRight,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{"aria-hidden":"true"})]})};return n&&t.length===0?e.jsxs("div",{className:"w-full min-w-0 max-w-full flex flex-col rounded-xl overflow-visible",style:{border:"1px solid var(--border)"},children:[e.jsx("div",{ref:G,className:"min-w-0 max-w-full overflow-hidden rounded-t-xl",children:e.jsx(rr.OverlayScrollbarsComponent,{options:{scrollbars:{autoHide:"leave",autoHideDelay:200}},className:"w-full",style:{maxHeight:K?V:void 0,maxWidth:"100%"},defer:!0,children:e.jsxs("table",{className:"text-sm",style:{tableLayout:"fixed",width:"100%",minWidth:W??"max-content",borderCollapse:"separate",borderSpacing:0},children:[e.jsxs("colgroup",{children:[J&&e.jsx("col",{style:{width:40}}),S.map(l=>e.jsx("col",{style:{width:be[l.key]??150}},l.key))]}),e.jsx("thead",{style:g?{position:"sticky",top:0,zIndex:10,backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"}:void 0,children:Ir()}),e.jsx("tbody",{children:Array.from({length:i}).map((l,x)=>e.jsxs("tr",{children:[J&&e.jsx("td",{className:`${P?"px-2 py-1.5":"px-3 py-2"} w-10`,style:{borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)"}}),S.map((O,A)=>{const Y=$&&!le&&A===0;return e.jsx("td",{className:P?"px-2 py-1.5":"px-3 py-2",style:Y?{position:"sticky",left:ge,zIndex:1,background:"color-mix(in srgb, var(--bg-card) 72%, transparent)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",boxShadow:"3px 0 6px -2px rgba(0,0,0,0.12), inset 0 -1px 0 var(--border)",borderRight:"1px solid var(--border)"}:{borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)"},children:e.jsx("div",{className:"h-3.5 rounded-full animate-pulse",style:{background:"var(--border)",width:`${q(x,A)}%`,minWidth:32}})},O.key)})]},x))})]})})}),zr()]}):!n&&t.length===0?e.jsxs("div",{className:"py-20 flex flex-col items-center gap-3",children:[u&&e.jsx("div",{style:{color:"var(--text-muted)",opacity:.5},children:u}),e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:p})]}):e.jsxs("div",{className:"w-full min-w-0 max-w-full flex flex-col rounded-xl overflow-visible",style:{border:"1px solid var(--border)"},children:[e.jsx("div",{ref:G,className:"min-w-0 max-w-full overflow-hidden rounded-t-xl",children:e.jsx(rr.OverlayScrollbarsComponent,{options:{scrollbars:{autoHide:"leave",autoHideDelay:200}},className:"w-full",style:{maxHeight:K?V:void 0,maxWidth:"100%"},defer:!0,children:e.jsxs("table",{className:"text-sm",style:{tableLayout:"fixed",width:"100%",minWidth:W??"max-content",borderCollapse:"separate",borderSpacing:0},children:[e.jsxs("colgroup",{children:[J&&e.jsx("col",{style:{width:40}}),S.map(l=>e.jsx("col",{style:{width:be[l.key]??150}},l.key))]}),e.jsx("thead",{style:g?{position:"sticky",top:0,zIndex:10,backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"}:void 0,children:Ir()}),e.jsx("tbody",{children:Hr.map((l,x)=>{const O=a(l),A=Pr(f==null?void 0:f(l)),Y=x>0?Pr(f==null?void 0:f(Hr[x-1])):null,de=A&&A.key!==(Y==null?void 0:Y.key),me=J&&d.has(O),Ce=!!h,Q=me&&C?"color-mix(in srgb, var(--primary) 8%, var(--bg-card))":x%2===1?"color-mix(in srgb, var(--bg-input) 50%, var(--bg-card))":"var(--bg-card)";return e.jsxs(o.Fragment,{children:[de&&e.jsx("tr",{className:A.className??"",children:e.jsx("td",{colSpan:fa,className:P?"px-2 py-2":"px-3 py-3",style:{background:"color-mix(in srgb, var(--primary) 8%, var(--bg-input))",borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)"},children:e.jsx("div",{className:"flex min-w-0 items-center justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-xs font-semibold uppercase tracking-wider text-[var(--text-main)]",children:A.label}),A.description&&e.jsx("div",{className:"mt-0.5 truncate text-xs text-[var(--text-muted)]",children:A.description})]})})})}),e.jsxs("tr",{onClick:Ce?()=>h(l):void 0,className:`transition-colors ${Ce?"cursor-pointer":""} ${m?m(l):""}`,style:{"--dt-row-bg":Q,"--dt-sticky-bg":Q,background:"var(--dt-row-bg)"},onMouseEnter:se=>{me||(se.currentTarget.style.setProperty("--dt-row-bg","var(--bg-hover)"),se.currentTarget.style.setProperty("--dt-sticky-bg",ua))},onMouseLeave:se=>{se.currentTarget.style.setProperty("--dt-row-bg",Q),se.currentTarget.style.setProperty("--dt-sticky-bg",Q)},children:[J&&e.jsx("td",{className:`${P?"px-2 py-1.5":"px-3 py-2"} w-10`,style:$?{position:"sticky",left:0,zIndex:3,background:"var(--dt-sticky-bg)",boxShadow:"inset 0 -1px 0 var(--border)"}:{borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)"},onClick:se=>{se.stopPropagation(),b(O)},children:e.jsx("input",{type:"checkbox",checked:me,onClick:se=>se.stopPropagation(),onChange:()=>b(O),className:"rounded cursor-pointer accent-[var(--primary)]"})}),S.map((se,Ue)=>{const qe=$&&!le&&Ue===0;return e.jsx("td",{className:`${P?"px-2 py-1.5":"px-3 py-2"} ${vt} ${Ar(se.align)} ${se.className??""}`,style:{overflow:"hidden",whiteSpace:"nowrap",...qe?{position:"sticky",left:ge,zIndex:3,background:"var(--dt-sticky-bg)",boxShadow:"3px 0 6px -2px rgba(0,0,0,0.12), inset 0 -1px 0 var(--border)",borderRight:"1px solid var(--border)"}:{borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)"}},children:e.jsx(vr,{children:se.cell(l)})},se.key)})]})]},O)})})]})})}),zr()]})}function Me(r){return r?new Date(`${r}T12:00:00`):void 0}function gr(r){return r.toISOString().slice(0,10)}function yt({calendarMonth:r,displayIndex:t}){const{previousMonth:a,nextMonth:n,goToMonth:i,months:u,labels:p,formatters:h}=tr.useDayPicker(),d=!!a&&t===0,b=!!n&&t===u.length-1;return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:8,width:"100%",color:"var(--text-main)",marginBottom:6},children:[e.jsx("span",{style:{fontWeight:700},children:h.formatCaption(r.date)}),e.jsx("button",{type:"button","aria-label":p.labelPrevious(a),onClick:()=>a&&i(a),disabled:!d,style:{height:28,width:28,borderRadius:8,border:"1px solid var(--border)",background:"var(--bg-card)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"var(--text-main)",opacity:d?1:.45,cursor:d?"pointer":"not-allowed"},children:e.jsx(y.HiChevronLeft,{size:16})}),e.jsx("button",{type:"button","aria-label":p.labelNext(n),onClick:()=>n&&i(n),disabled:!b,style:{height:28,width:28,borderRadius:8,border:"1px solid var(--border)",background:"var(--bg-card)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"var(--text-main)",opacity:b?1:.45,cursor:b?"pointer":"not-allowed"},children:e.jsx(y.HiChevronRight,{size:16})})]})}function wt(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Nt({startDate:r,endDate:t,onChange:a,minDate:n,viewMonth:i,numberOfMonths:u=1,showSummary:p=!0,startLabel:h="Inicio",endLabel:d="Regreso"}){const b={from:Me(r),to:Me(t)},k=Me(n),[C,m]=o.useState(Me(i||r));return o.useEffect(()=>{m(Me(i||r))},[i,r]),e.jsxs("div",{children:[e.jsx("div",{style:{borderRadius:10,overflow:"hidden",border:"1px solid var(--border)",background:"var(--bg-input)",display:"flex",justifyContent:"center",padding:"10px 8px"},children:e.jsx(tr.DayPicker,{mode:"range",selected:b,month:C,onMonthChange:m,onSelect:f=>{const g=f!=null&&f.from?gr(f.from):r,c=f!=null&&f.to?gr(f.to):"";a({startDate:g,endDate:c})},numberOfMonths:u,hideNavigation:!0,disabled:k?{before:k}:void 0,showOutsideDays:!1,components:{MonthCaption:yt},className:"text-sm",classNames:{root:"w-full",months:"flex gap-3 justify-center",month:"space-y-2",month_caption:"flex items-center justify-between px-1",caption_label:"capitalize",nav:"flex items-center gap-1",button_previous:"h-8 w-8 inline-flex items-center justify-center rounded-md transition-colors",button_next:"h-8 w-8 inline-flex items-center justify-center rounded-md transition-colors",month_grid:"w-full border-collapse",weekdays:"grid grid-cols-7 gap-1 mb-1",weekday:"text-[11px] font-semibold text-center",week:"grid grid-cols-7 gap-1",day:"h-9 w-9 p-0 flex items-center justify-center",day_button:"h-9 w-9 rounded-md text-sm font-medium transition-colors outline-none",selected:"font-semibold",range_start:"font-semibold",range_middle:"font-medium",range_end:"font-semibold",today:"font-bold",disabled:"opacity-40 cursor-not-allowed",hidden:"invisible"},styles:{month_caption:{color:"var(--text-main)",marginBottom:6,display:"flex",alignItems:"center",justifyContent:"space-between"},caption_label:{color:"var(--text-main)",fontWeight:700},nav:{position:"static",display:"flex",alignItems:"center",gap:6},weekday:{color:"var(--text-muted)",textTransform:"lowercase"},button_previous:{height:32,width:32,background:"var(--bg-card)",color:"var(--text-main)",border:"1px solid var(--border)"},button_next:{height:32,width:32,background:"var(--bg-card)",color:"var(--text-main)",border:"1px solid var(--border)"},day_button:{color:"var(--text-main)",borderRadius:8},chevron:{fill:"var(--text-main)"},today:{border:"1px solid color-mix(in srgb, var(--primary) 35%, transparent)"},disabled:{color:"var(--text-muted)"}},modifiersStyles:{selected:{background:"var(--primary)",color:"var(--primary-fg, #ffffff)"},range_start:{background:"var(--primary)",color:"var(--primary-fg, #ffffff)"},range_end:{background:"var(--primary)",color:"var(--primary-fg, #ffffff)"},range_middle:{background:"color-mix(in srgb, var(--primary) 20%, transparent)",color:"var(--text-main)"}},formatters:{formatCaption:f=>wt(new Intl.DateTimeFormat("es-MX",{month:"long",year:"numeric"}).format(f)),formatWeekdayName:f=>new Intl.DateTimeFormat("es-MX",{weekday:"short"}).format(f)},labels:{labelMonthDropdown:()=>"Mes",labelYearDropdown:()=>"Año"}})}),p&&r&&e.jsxs("div",{style:{marginTop:8,fontSize:12,color:"var(--text-muted)",display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsxs("span",{children:[h,":"," ",e.jsx("strong",{style:{color:"var(--text-main)"},children:r})]}),t&&e.jsxs("span",{children:[d,":"," ",e.jsx("strong",{style:{color:"var(--text-main)"},children:t})]})]})]})}function kt({open:r,onClose:t,title:a,subtitle:n,leadingIcon:i,confirmLabel:u="Guardar",onConfirm:p,loading:h=!1,confirmDisabled:d=!1,headerActions:b,bodyClassName:k="flex-1 overflow-y-auto px-6 py-5",width:C=440,children:m}){const[f,g]=o.useState(!1);return o.useEffect(()=>{g(!0)},[]),o.useEffect(()=>(document.body.style.overflow=r?"hidden":"",()=>{document.body.style.overflow=""}),[r]),o.useEffect(()=>{if(!r)return;const c=w=>{w.key==="Escape"&&t()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r,t]),f?De.createPortal(e.jsxs("div",{"aria-hidden":!r,className:`fixed inset-0 z-[1000] flex transition-opacity duration-300 ${r?"opacity-100":"opacity-0 pointer-events-none"}`,children:[e.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",onClick:t}),e.jsxs("div",{className:`absolute inset-y-0 right-0 flex flex-col shadow-2xl transition-transform duration-300 ${r?"translate-x-0":"translate-x-full"}`,style:{width:`min(100vw, ${C}px)`,background:"var(--bg-card)",borderLeft:"1px solid var(--border)"},children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 flex-shrink-0",style:{borderBottom:"1px solid var(--border)"},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(ue,{variant:"icon",onClick:t,title:"Cerrar",children:e.jsx(y.HiXMark,{className:"w-5 h-5"})}),i&&e.jsx("div",{className:"flex-shrink-0",children:i}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"text-base font-semibold truncate",style:{color:"var(--text-main)"},children:a}),n&&e.jsx("p",{className:"text-xs truncate",style:{color:"var(--text-muted)"},children:n})]})]}),(b||p)&&e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[b,p&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{variant:"secondary",size:"sm",onClick:t,style:{background:"var(--bg-input)"},children:"Cancelar"}),e.jsx(ue,{variant:"primary",size:"sm",icon:e.jsx(jr.FiSave,{className:"w-4 h-4"}),onClick:p,loading:h,disabled:d,title:u})]})]})]}),e.jsx("div",{"data-drawer-scroll":"true",className:k,children:m})]})]}),document.body):null}var xr={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},yr=o.createContext&&o.createContext(xr),St=["attr","size","title"];function Ct(r,t){if(r==null)return{};var a,n,i=Et(r,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(r);for(n=0;n<u.length;n++)a=u[n],t.indexOf(a)===-1&&{}.propertyIsEnumerable.call(r,a)&&(i[a]=r[a])}return i}function Et(r,t){if(r==null)return{};var a={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(t.indexOf(n)!==-1)continue;a[n]=r[n]}return a}function Pe(){return Pe=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(r[n]=a[n])}return r},Pe.apply(null,arguments)}function wr(r,t){var a=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),a.push.apply(a,n)}return a}function Ie(r){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?wr(Object(a),!0).forEach(function(n){$t(r,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):wr(Object(a)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(a,n))})}return r}function $t(r,t,a){return(t=Mt(t))in r?Object.defineProperty(r,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[t]=a,r}function Mt(r){var t=Ot(r,"string");return typeof t=="symbol"?t:t+""}function Ot(r,t){if(typeof r!="object"||!r)return r;var a=r[Symbol.toPrimitive];if(a!==void 0){var n=a.call(r,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function Nr(r){return r&&r.map((t,a)=>o.createElement(t.tag,Ie({key:a},t.attr),Nr(t.child)))}function kr(r){return t=>o.createElement(Tt,Pe({attr:Ie({},r.attr)},t),Nr(r.child))}function Tt(r){var t=a=>{var{attr:n,size:i,title:u}=r,p=Ct(r,St),h=i||a.size||"1em",d;return a.className&&(d=a.className),r.className&&(d=(d?d+" ":"")+r.className),o.createElement("svg",Pe({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,n,p,{className:d,style:Ie(Ie({color:r.color||a.color},a.style),r.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),u&&o.createElement("title",null,u),r.children)};return yr!==void 0?o.createElement(yr.Consumer,null,a=>t(a)):t(xr)}function Bt(r){return kr({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M247.31,124.76c-.35-.79-8.82-19.58-27.65-38.41C194.57,61.26,162.88,48,128,48S61.43,61.26,36.34,86.35C17.51,105.18,9,124,8.69,124.76a8,8,0,0,0,0,6.5c.35.79,8.82,19.57,27.65,38.4C61.43,194.74,93.12,208,128,208s66.57-13.26,91.66-38.34c18.83-18.83,27.3-37.61,27.65-38.4A8,8,0,0,0,247.31,124.76ZM128,192c-30.78,0-57.67-11.19-79.93-33.25A133.47,133.47,0,0,1,25,128,133.33,133.33,0,0,1,48.07,97.25C70.33,75.19,97.22,64,128,64s57.67,11.19,79.93,33.25A133.46,133.46,0,0,1,231.05,128C223.84,141.46,192.43,192,128,192Zm0-112a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160Z"},child:[]}]})(r)}function Dt(r){return kr({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M228,175a8,8,0,0,1-10.92-3l-19-33.2A123.23,123.23,0,0,1,162,155.46l5.87,35.22a8,8,0,0,1-6.58,9.21A8.4,8.4,0,0,1,160,200a8,8,0,0,1-7.88-6.69l-5.77-34.58a133.06,133.06,0,0,1-36.68,0l-5.77,34.58A8,8,0,0,1,96,200a8.4,8.4,0,0,1-1.32-.11,8,8,0,0,1-6.58-9.21L94,155.46a123.23,123.23,0,0,1-36.06-16.69L39,172A8,8,0,1,1,25.06,164l20-35a153.47,153.47,0,0,1-19.3-20A8,8,0,1,1,38.22,99c16.6,20.54,45.64,45,89.78,45s73.18-24.49,89.78-45A8,8,0,1,1,230.22,109a153.47,153.47,0,0,1-19.3,20l20,35A8,8,0,0,1,228,175Z"},child:[]}]})(r)}function ze({className:r="",...t}){return e.jsx("input",{...t,className:`h-11 rounded-lg border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-sm text-[var(--text-main)] outline-none placeholder:text-[var(--text-muted)] transition-colors focus:border-[var(--primary)] ${r}`})}function Lt({label:r,containerClassName:t="",helperText:a,error:n,labelAction:i,floatingLabel:u=!1,showPasswordToggle:p=!0,className:h="",required:d,...b}){const[k,C]=o.useState(()=>!!b.autoFocus),[m,f]=o.useState(!1),g=b.type==="password"&&p,c=g&&m?"text":b.type,w=b.value!==void 0?String(b.value).length>0:b.defaultValue!==void 0&&String(b.defaultValue).length>0,D=k||w,_={top:D?8:15,color:k?"var(--primary)":"var(--text-muted)",fontSize:D?11:14,fontWeight:D?600:400,textTransform:D?"uppercase":"none"},I=B=>{var M;C(!0),(M=b.onFocus)==null||M.call(b,B)},E=B=>{var M;C(!1),(M=b.onBlur)==null||M.call(b,B)},T=g?e.jsxs("button",{type:"button","aria-label":m?"Ocultar contraseña":"Mostrar contraseña","aria-pressed":m,className:"absolute right-2.5 top-1/2 flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-md text-[var(--text-muted)] transition-colors duration-200 hover:text-[var(--primary)] focus:outline-none",tabIndex:-1,onClick:()=>f(B=>!B),children:[e.jsx("span",{"aria-hidden":"true",className:`absolute inset-0 flex items-center justify-center transition-[opacity,transform] duration-200 ease-out ${m?"scale-y-0 rotate-[-8deg] opacity-0":"scale-y-100 rotate-0 opacity-100"}`,children:e.jsx(Bt,{className:"h-[18px] w-[18px]"})}),e.jsx("span",{"aria-hidden":"true",className:`absolute inset-0 flex items-center justify-center transition-[opacity,transform] duration-200 ease-out ${m?"scale-y-100 rotate-0 opacity-100":"scale-y-0 rotate-[8deg] opacity-0"}`,children:e.jsx(Dt,{className:"h-[18px] w-[18px]"})})]}):null;return u?e.jsxs("label",{className:`flex flex-col gap-2 ${t}`,children:[e.jsxs("span",{className:"relative block",children:[e.jsx(ze,{...b,type:c,required:d,placeholder:" ","aria-invalid":!!n||b["aria-invalid"],"data-has-value":w?"true":void 0,className:`h-12 w-full pt-5 ${g?"pr-10":""} ${h}`,onFocus:I,onBlur:E}),e.jsxs("span",{className:"pointer-events-none absolute left-3 transition-all duration-150",style:_,children:[r,d&&e.jsx("span",{className:"ml-1 text-[var(--danger)]",children:"*"})]}),i&&e.jsx("span",{className:"absolute right-2 transition-all duration-150",style:{top:D?8:15},children:i}),T]}),n?e.jsx("span",{className:"text-xs font-medium normal-case text-[var(--danger)]",children:n}):a?e.jsx("span",{className:"text-xs font-medium normal-case text-[var(--text-muted)]",children:a}):null]}):e.jsxs("label",{className:`flex flex-col gap-2 ${t}`,children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-semibold uppercase text-[var(--text-muted)]",children:[e.jsx("span",{children:r}),d&&e.jsx("span",{className:"text-[var(--danger)]",children:"*"}),i&&e.jsx("span",{className:"ml-auto normal-case",children:i})]}),g?e.jsxs("span",{className:"relative block",children:[e.jsx(ze,{...b,type:c,required:d,"aria-invalid":!!n||b["aria-invalid"],className:`w-full pr-10 ${h}`,onFocus:I,onBlur:E}),T]}):e.jsx(ze,{...b,required:d,"aria-invalid":!!n||b["aria-invalid"],className:h}),n?e.jsx("span",{className:"text-xs font-medium normal-case text-[var(--danger)]",children:n}):a?e.jsx("span",{className:"text-xs font-medium normal-case text-[var(--text-muted)]",children:a}):null]})}function xe(...r){return r.filter(Boolean).join(" ")}function Ht({steps:r,activeStepId:t,initialStepId:a,completedStepIds:n,defaultCompletedStepIds:i=[],onActiveStepChange:u,onCompletedStepIdsChange:p,onBlockedStep:h,allowBackNavigation:d=!0,showFooter:b=!0,previousLabel:k="Anterior",nextLabel:C="Siguiente",blockedNextLabel:m="Completa este paso",className:f="",headerClassName:g="",contentClassName:c="",footerClassName:w=""}){var ce;const D=((ce=r[0])==null?void 0:ce.id)??"",[_,I]=o.useState(a??D),[E,T]=o.useState(i),B=t??_,M=n??E,j=o.useMemo(()=>new Set(M),[M]),$=Math.max(0,r.findIndex(S=>S.id===B)),H=r[$]??r[0],P=r.length<=1?100:$/(r.length-1)*100,K=S=>{n||T(S),p==null||p(S)},W=S=>{const F=r.find(X=>X.id===S);F&&(t||I(S),u==null||u(S,F))},U=S=>j.has(S),Z=S=>r.slice(0,S).find(F=>!F.optional&&!j.has(F.id)),R=S=>{const F=r[S];return!F||F.disabled?!1:S===$||d&&S<$?!0:!Z(S)},s=S=>{const F=r.findIndex(X=>X.id===S);return F>=0&&R(F)},N=S=>{const F=r.findIndex(X=>X.id===S);if(F<0)return!1;if(!R(F)){const X=Z(F);return X&&(h==null||h(r[F],X)),!1}return W(S),!0},q=(S=H==null?void 0:H.id)=>{!S||j.has(S)||K([...M,S])},G=(S=H==null?void 0:H.id)=>{if(!S)return;const F=r.findIndex(ae=>ae.id===S),X=M.filter(ae=>{const oe=r.findIndex(z=>z.id===ae);return oe>=0&&oe<F});K(X),F>=0&&$>F&&W(S)},V=()=>$<=0?!1:N(r[$-1].id),re=()=>{const S=r[$+1];return S?N(S.id):!1},le={activeStep:H,activeIndex:$,completedStepIds:M,isCompleted:U,isUnlocked:s,completeStep:q,uncompleteStep:G,goToStep:N,goNext:re,goPrevious:V};if(!H)return null;const te=r[$+1],ye=$>0,he=te?s(te.id):!1,be=typeof H.content=="function"?H.content(le):H.content;return e.jsxs("section",{className:xe("overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)]",f),children:[e.jsxs("div",{className:xe("border-b border-[var(--border)] bg-[var(--bg-input)]",g),children:[e.jsx("div",{className:"relative h-1 overflow-hidden bg-[var(--border)]/55",children:e.jsx("div",{className:"h-full rounded-r-full bg-[var(--primary)] transition-[width] duration-500 ease-out",style:{width:`${P}%`}})}),e.jsx("div",{className:"grid gap-2 p-2",style:{gridTemplateColumns:`repeat(${r.length}, minmax(0, 1fr))`},children:r.map((S,F)=>{const X=S.id===H.id,ae=U(S.id),oe=R(F),z=Z(F);return e.jsxs("button",{type:"button",disabled:!oe,"aria-current":X?"step":void 0,"aria-disabled":!oe,title:!oe&&z?`Completa ${z.title}`:S.title,onClick:()=>N(S.id),className:xe("group relative min-h-16 min-w-0 overflow-hidden rounded-md border p-3 text-left transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)]/35 disabled:cursor-not-allowed",X&&"border-[var(--primary)] bg-[var(--bg-card)] shadow-sm",ae&&!X&&"border-[var(--primary)]/35 bg-[var(--bg-card)]",!X&&!ae&&oe&&"border-transparent bg-[var(--bg-card)]/45 hover:border-[var(--border)] hover:bg-[var(--bg-card)]",!oe&&"border-transparent bg-[var(--bg-card)]/35 opacity-60"),children:[e.jsx("span",{className:xe("absolute inset-x-0 top-0 h-0.5 origin-left scale-x-0 bg-[var(--primary)] transition-transform duration-300",X&&"scale-x-100")}),e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:xe("grid h-7 w-7 shrink-0 place-items-center rounded-full border text-xs font-bold transition-all duration-200",X&&"border-[var(--primary)] bg-[var(--primary)] text-[var(--primary-fg)]",ae&&!X&&"border-[var(--primary)] bg-[var(--primary)]/12 text-[var(--primary)]",!ae&&!X&&oe&&"border-[var(--border)] text-[var(--text-muted)]",!oe&&"border-[var(--border)] text-[var(--text-muted)]"),children:ae?e.jsx(y.HiCheck,{className:"h-4 w-4"}):oe?F+1:e.jsx(y.HiLockClosed,{className:"h-3.5 w-3.5"})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:xe("block truncate text-xs font-semibold transition-colors duration-200",X?"text-[var(--text-main)]":"text-[var(--text-secondary)]"),children:[F+1,". ",S.title]}),S.description&&e.jsx("span",{className:"mt-1 block truncate text-[11px] text-[var(--text-muted)]",children:S.description})]}),S.badge&&e.jsx("span",{className:"shrink-0",children:S.badge})]})]},S.id)})})]}),e.jsx("div",{className:xe("min-h-72 animate-[stepWizardIn_220ms_ease-out] p-5",c),children:be},H.id),b&&e.jsxs("div",{className:xe("flex flex-wrap items-center justify-between gap-3 border-t border-[var(--border)] bg-[var(--bg-input)] px-4 py-3",w),children:[e.jsx(ue,{variant:"secondary",height:38,padding:"0 14px",icon:e.jsx(y.HiChevronLeft,{}),disabled:!ye,onClick:V,children:k}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-[var(--text-muted)]",children:[e.jsxs("span",{children:["Paso ",$+1," de ",r.length]}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-[var(--border)]"}),e.jsxs("span",{children:[M.length," completados"]})]}),e.jsx(ue,{height:38,padding:"0 14px",icon:e.jsx(y.HiChevronRight,{}),disabled:!te||!he,onClick:re,children:te&&!he?m:C})]})]})}const At={xs:{width:28,height:16,thumb:12,padding:2},sm:{width:36,height:20,thumb:16,padding:2}};function Pt({checked:r,disabled:t,onCheckedChange:a,size:n="sm",className:i="",...u}){const p=At[n],h=r?p.width-p.thumb-p.padding*2:0;return e.jsx("button",{...u,type:"button",role:"switch","aria-checked":r,disabled:t,onClick:()=>!t&&a(!r),className:`relative inline-flex shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)]/50 disabled:cursor-not-allowed disabled:opacity-50 ${i}`,style:{width:p.width,height:p.height,background:r?"color-mix(in srgb, var(--primary) 85%, transparent)":"var(--bg-input)",border:r?"1px solid color-mix(in srgb, var(--primary) 55%, transparent)":"1px solid var(--border)"},children:e.jsx("span",{className:"absolute inline-block rounded-full transition-transform",style:{width:p.thumb,height:p.thumb,left:p.padding,top:"50%",transform:`translate(${h}px, -50%)`,background:r?"var(--primary-fg)":"var(--text-muted)"}})})}const Sr=[".sidebar-scroll","[data-overlay-scroll='true']"].join(",");function It(r){if(!(r instanceof HTMLElement)||r.dataset.overlayScroll==="false"||r.closest("[data-overlayscrollbars]")||r.matches("textarea,input,select,[contenteditable='true']"))return!1;const t=window.getComputedStyle(r);return!(![t.overflow,t.overflowX,t.overflowY].join(" ").match(/auto|scroll/)||r.clientWidth===0&&r.clientHeight===0)}function Cr(r){return r.classList.contains("sidebar-scroll")}function Er(r){Cr(r)&&r.querySelectorAll(".os-scrollbar-horizontal").forEach(t=>{t.style.display="none",t.style.height="0",t.style.pointerEvents="none"})}function $r(){return o.useEffect(()=>{const r=new WeakMap;let t=0;const a=()=>{t=0,document.querySelectorAll(Sr).forEach(u=>{if(!It(u))return;if(er.OverlayScrollbars(u)){Er(u);return}const h=er.OverlayScrollbars(u,{overflow:Cr(u)?{x:"hidden",y:"scroll"}:void 0,scrollbars:{autoHide:"leave",autoHideDelay:180}});Er(u),r.set(u,h)})},n=()=>{t||(t=window.requestAnimationFrame(a))};a();const i=new MutationObserver(n);return i.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","data-overlay-scroll"]}),window.addEventListener("resize",n),()=>{t&&window.cancelAnimationFrame(t),i.disconnect(),window.removeEventListener("resize",n),document.querySelectorAll(Sr).forEach(u=>{var p;u instanceof HTMLElement&&((p=r.get(u))==null||p.destroy())})}},[]),null}const zt={xs:{wh:"w-5 h-5",text:"text-[8px]"},sm:{wh:"w-7 h-7",text:"text-[11px]"},md:{wh:"w-9 h-9",text:"text-sm"},lg:{wh:"w-12 h-12",text:"text-base"},xl:{wh:"w-16 h-16",text:"text-xl"}},Mr=["bg-indigo-500","bg-blue-500","bg-emerald-500","bg-violet-500","bg-amber-500","bg-teal-500","bg-rose-500","bg-cyan-500"],_t={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg"},jt="bonsaif.bot",Ft="Bonsaif Bot",Wt={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2",xl:"p-2.5"};function Or(r){return typeof r=="string"?r.trim():""}function Ut(r){let t=0;for(const a of r)t=t*31+a.charCodeAt(0)&65535;return Mr[t%Mr.length]}function qt(r,t){return r===jt||t===Ft}function Tr({userId:r,username:t,name:a,size:n="md",showName:i=!1,showTooltip:u,tooltipContent:p,fallbackLabel:h="Usuario",wrapperClassName:d="",labelClassName:b="",labelSize:k="xs",avatarVersion:C=0,className:m="",style:f}){var W;const[g,c]=o.useState(!1),w=typeof r=="string"&&r.trim()&&r!=="undefined"&&r!=="null"?r.trim():"";o.useEffect(()=>{c(!1)},[w,C]);const{wh:D,text:_}=zt[n],I=Or(a)||Or(t)||h,E=I.trim()[0]||"?",T=typeof process<"u"&&((W=process.env)==null?void 0:W.NEXT_PUBLIC_BASE_PATH)||"",B=qt(t,a),M=w?`${T}/api/user/avatar/${w}${C?`?v=${C}`:""}`:"",$={xs:20,sm:28,md:36,lg:48,xl:64}[n],H=B?e.jsx("span",{className:`${D} ${Wt[n]} rounded-full flex items-center justify-center bg-[#071f1a] ring-1 ring-emerald-400/35 shadow-[0_0_0_1px_rgba(255,255,255,0.06)] flex-shrink-0 ${m}`,style:f,children:e.jsx("img",{src:`${T}/favicon.svg`,alt:I,width:$,height:$,className:"h-full w-full object-contain"})}):M&&!g?e.jsx("img",{src:M,alt:I,width:$,height:$,className:`${D} rounded-full object-cover flex-shrink-0 ${m}`,style:f,onError:()=>c(!0)},`${w}-${C}`):e.jsx("span",{className:`${D} ${Ut(I)} ${_} rounded-full flex items-center justify-center font-black text-white uppercase flex-shrink-0 ${m}`,style:f,title:I,children:E});if(i)return e.jsxs("span",{className:`inline-flex min-w-0 items-center gap-2 ${d}`,children:[H,e.jsx("span",{className:`min-w-0 truncate ${_t[k]} font-medium text-[var(--text-main)] ${b}`,title:I,children:I})]});const P=u??!0,K=p??I;return P&&K?e.jsx(Le,{as:"span",content:K,className:`inline-flex flex-shrink-0 ${d}`,children:H}):H}function Gt({href:r,className:t,children:a}){return e.jsx("a",{href:r,className:t,children:a})}function Yt(r){return r.reduce((t,a)=>{const n=a.section??"Principal";return t[n]=[...t[n]??[],a],t},{})}function Br({children:r,navItems:t=[],currentPath:a=typeof window>"u"?"/":window.location.pathname,user:n,appName:i="Bonsaif",appLogo:u,header:p,footer:h,onLogout:d,LinkComponent:b=Gt}){const[k,C]=o.useState(!1),m=Yt(t);return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-main)] text-[var(--text-main)]",children:[e.jsx($r,{}),e.jsx("button",{type:"button","aria-label":"Abrir navegación",className:"fixed left-3 top-3 z-50 inline-flex h-9 w-9 items-center justify-center rounded-md border border-white/10 bg-black/70 text-white lg:hidden",onClick:()=>C(!0),children:e.jsx(y.HiBars3,{className:"h-5 w-5"})}),k&&e.jsx("button",{type:"button","aria-label":"Cerrar navegación",className:"fixed inset-0 z-40 bg-black/45 lg:hidden",onClick:()=>C(!1)}),e.jsxs("aside",{className:`fixed inset-y-0 left-0 z-50 flex w-72 flex-col bg-[#071716] text-white shadow-2xl transition-transform duration-200 lg:translate-x-0 ${k?"translate-x-0":"-translate-x-full"}`,children:[e.jsxs("div",{className:"flex h-16 items-center gap-3 border-b border-white/10 px-4",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-white/10 text-white",children:u??e.jsx(y.HiHome,{className:"h-5 w-5"})}),e.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:i}),e.jsx("button",{type:"button","aria-label":"Cerrar navegación",className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-white/70 hover:bg-white/10 lg:hidden",onClick:()=>C(!1),children:e.jsx(y.HiXMark,{className:"h-5 w-5"})})]}),e.jsx("nav",{className:"sidebar-scroll min-h-0 flex-1 overflow-y-auto px-3 py-4","data-overlay-scroll":"true",children:Object.entries(m).map(([f,g])=>e.jsxs("div",{className:"mb-5",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 px-2 text-[11px] font-semibold uppercase tracking-wide text-white/35",children:[e.jsx(y.HiChevronDown,{className:"h-3.5 w-3.5"}),f]}),e.jsx("div",{className:"space-y-1",children:g.map(c=>{const w=a===c.href||a.startsWith(`${c.href}/`);return e.jsxs(b,{href:c.href,className:`flex min-w-0 items-center gap-2 rounded-md px-2 py-2 text-sm transition-colors ${w?"bg-white/10 text-white":"text-white/55 hover:bg-white/[0.06] hover:text-white/85"}`,children:[e.jsx("span",{className:"flex h-5 w-5 flex-shrink-0 items-center justify-center",children:c.icon??e.jsx(y.HiHome,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate",children:c.label})]},c.href)})})]},f))}),e.jsxs("div",{className:"border-t border-white/10 p-3",children:[n&&e.jsxs("div",{className:"mb-3 flex min-w-0 items-center gap-3 rounded-lg bg-white/[0.04] p-2",children:[e.jsx(Tr,{name:n.initials??n.name??n.email??"Usuario",size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-medium text-white",children:n.name??"Usuario"}),n.email&&e.jsx("div",{className:"truncate text-xs text-white/45",children:n.email})]})]}),d&&e.jsxs(ue,{variant:"ghost",className:"w-full justify-start text-white hover:bg-white/10",onClick:d,children:[e.jsx(y.HiArrowRightOnRectangle,{className:"h-4 w-4"})," Salir"]}),h]})]}),e.jsxs("div",{className:"min-h-screen lg:pl-72",children:[p,e.jsx("main",{className:"min-h-screen",children:r})]})]})}const Xt={dashboard:"Dashboard",tickets:"Tickets",teams:"Equipos",projects:"Proyectos",clients:"Clientes",surveys:"Encuestas",profile:"Perfil",settings:"Configuración",notifications:"Notificaciones",changelog:"Historial",admin:"Inicio",users:"Usuarios",roles:"Roles",menus:"Menús",guards:"Guardias",vacations:"Vacaciones",audit:"Auditoría",positions:"Puestos",ranks:"Rangos","email-inbox":"Buzones","security-incidents":"Incidentes","guard-schedule":"Guardias"},Ze={dashboard:e.jsx(y.HiChartBar,{className:"h-5 w-5"}),tickets:e.jsx(y.HiTicket,{className:"h-5 w-5"}),teams:e.jsx(y.HiUsers,{className:"h-5 w-5"}),projects:e.jsx(y.HiRectangleGroup,{className:"h-5 w-5"}),clients:e.jsx(y.HiBuildingOffice2,{className:"h-5 w-5"}),surveys:e.jsx(y.HiClipboardDocumentList,{className:"h-5 w-5"}),profile:e.jsx(y.HiUser,{className:"h-5 w-5"}),settings:e.jsx(y.HiCog6Tooth,{className:"h-5 w-5"}),notifications:e.jsx(y.HiBell,{className:"h-5 w-5"}),changelog:e.jsx(y.HiDocumentText,{className:"h-5 w-5"}),admin:e.jsx(y.HiShieldCheck,{className:"h-5 w-5"}),users:e.jsx(y.HiUsers,{className:"h-5 w-5"}),roles:e.jsx(y.HiShieldCheck,{className:"h-5 w-5"}),menus:e.jsx(y.HiCog6Tooth,{className:"h-5 w-5"}),guards:e.jsx(y.HiCalendarDays,{className:"h-5 w-5"}),vacations:e.jsx(y.HiCalendarDays,{className:"h-5 w-5"}),audit:e.jsx(y.HiListBullet,{className:"h-5 w-5"}),positions:e.jsx(y.HiBriefcase,{className:"h-5 w-5"}),ranks:e.jsx(y.HiListBullet,{className:"h-5 w-5"}),"email-inbox":e.jsx(y.HiInbox,{className:"h-5 w-5"}),"security-incidents":e.jsx(y.HiShieldCheck,{className:"h-5 w-5"})};function Vt({href:r,className:t,style:a,children:n}){return e.jsx("a",{href:r,className:t,style:a,children:n})}function Zt(r){return r.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Jt(r){return/^\d+$/.test(r)||/^[a-f0-9]{8,}$/i.test(r)}function Kt(r){const t=r.split("/").filter(Boolean);if(t.length===0||t.length===1&&t[0]==="dashboard")return[];const a=decodeURIComponent(t[t.length-1]),n=t.length>1?decodeURIComponent(t[t.length-2]):void 0,i=Jt(a)&&n?n:a,u=Xt[i]??Zt(i);return[{label:"Inicio",href:"/"},{label:u}]}function Je(r){return(r==null?void 0:r.querySelector(":scope > .os-viewport"))??(r==null?void 0:r.querySelector(":scope > [data-overlayscrollbars-viewport]"))}function Qt(r){const t=r.split("/").filter(Boolean),a=t[t.length-1];if(!a)return e.jsx(y.HiHome,{className:"h-5 w-5"});if(Ze[a])return Ze[a];const n=t.length>1?t[t.length-2]:"";return Ze[n]??e.jsx(y.HiHome,{className:"h-5 w-5"})}function Rt({title:r,subtitle:t,action:a,meta:n,icon:i,className:u="",contentClassName:p="",breadcrumbs:h,currentPath:d=typeof window>"u"?"/":window.location.pathname,showBreadcrumbs:b=!0,contained:k=!1,LinkComponent:C=Vt}){const m=o.useRef(null),[f,g]=o.useState(!1),[c,w]=o.useState(null),D=h??Kt(d),_=i??Qt(d),I=b&&D.length>1;return o.useEffect(()=>{if(k){g(!1);return}let E=null,T=0,B=0;const M=()=>{const H=m.current,P=document.querySelector("[data-app-scroll='true']");return(H==null?void 0:H.closest(".os-viewport"))??(H==null?void 0:H.closest("[data-overlayscrollbars-viewport]"))??Je(P)??P??window},j=()=>{const H=E&&E!==window?E.scrollTop:window.scrollY;g(P=>P?H>24:H>72)},$=()=>{E==null||E.removeEventListener("scroll",j),E=M(),E.addEventListener("scroll",j,{passive:!0}),j()};return $(),T=window.requestAnimationFrame($),B=window.setTimeout($,120),()=>{window.cancelAnimationFrame(T),window.clearTimeout(B),E==null||E.removeEventListener("scroll",j)}},[k]),o.useEffect(()=>{if(k){w(null);return}let E=0;const T=[],B=()=>{const W=m.current,U=W==null?void 0:W.parentElement,Z=document.querySelector("[data-app-scroll='true']"),R=Je(Z)??Z;if(!W||!U||!R){w(null);return}const s=U.getBoundingClientRect(),N=window.getComputedStyle(U),q=R.getBoundingClientRect(),G=R instanceof HTMLElement&&R.clientWidth>0?R.clientWidth:q.width,V=s.left+parseFloat(N.paddingLeft||"0"),re={marginLeft:Math.round(q.left-V),width:Math.round(G)};w(le=>le&&le.marginLeft===re.marginLeft&&le.width===re.width?le:re)},M=()=>{window.cancelAnimationFrame(E),E=window.requestAnimationFrame(B)};M(),window.addEventListener("resize",M);const j=new ResizeObserver(M),$=m.current,H=$==null?void 0:$.parentElement,P=document.querySelector("[data-app-scroll='true']"),K=Je(P)??P;return[H,P,K].forEach(W=>{W&&j.observe(W)}),T.push(window.setTimeout(M,120)),T.push(window.setTimeout(M,280)),()=>{window.cancelAnimationFrame(E),window.removeEventListener("resize",M),j.disconnect(),T.forEach(W=>window.clearTimeout(W))}},[k]),e.jsx("div",{ref:m,"data-page-header":"true","data-compact":f?"true":"false",className:`sticky top-0 z-30 overflow-visible py-0 transition-[background-color,box-shadow,border-color] duration-300 ease-out ${k?"mb-0 flex-shrink-0":"mb-4 sm:mb-0"} ${u}`,style:{...c?{marginLeft:c.marginLeft,width:c.width}:null,background:k?"var(--bg-card)":f?"var(--bg-main)":"color-mix(in srgb, var(--bg-main) 44%, transparent)",backdropFilter:"saturate(1.2) blur(14px)",WebkitBackdropFilter:"saturate(1.2) blur(14px)",borderBottom:k||f?"1px solid var(--border)":"1px solid transparent",boxShadow:f?"0 10px 28px rgba(12, 54, 53, 0.12)":"none"},children:e.jsxs("div",{className:`flex flex-wrap items-center justify-between px-4 pt-0.5 transition-[gap,min-height,padding] duration-300 ease-out ${f?"min-h-9 gap-2 sm:min-h-10 sm:gap-2.5":"min-h-10 gap-2.5 sm:min-h-11 sm:gap-3"} ${p}`,children:[e.jsxs("div",{className:`min-w-0 flex flex-1 flex-col justify-center transition-[gap,transform] duration-300 ease-out ${f?"gap-1":"gap-1.5 sm:gap-2"}`,children:[I&&e.jsx("nav",{"aria-label":"Breadcrumb",className:"min-w-0 flex-shrink-0 transition-[opacity,transform] duration-300 ease-out",children:e.jsx("ol",{className:`flex flex-wrap items-center gap-1.5 leading-none transition-[font-size,line-height] duration-300 ease-out ${f?"text-[10px]":"text-[10px] sm:text-[11px]"}`,children:D.map((E,T)=>{const B=T===D.length-1;return e.jsxs("li",{className:"flex min-w-0 items-center gap-1.5",children:[T>0&&e.jsx(y.HiChevronRight,{className:"h-3.5 w-3.5 transition-[color,transform] duration-300 ease-out",style:{color:"var(--text-muted)"}}),E.href&&!B?e.jsx(C,{href:E.href,className:"truncate transition-colors duration-300 hover:underline",style:{color:"var(--text-muted)"},children:E.label}):e.jsx("span",{"aria-current":B?"page":void 0,className:B?"truncate font-semibold":"truncate",style:{color:B?"var(--text-main)":"var(--text-muted)"},children:E.label})]},`${E.label}-${T}`)})})}),e.jsxs("div",{className:`flex min-w-0 items-center transition-[gap,transform] duration-300 ease-out ${f?"gap-2":"gap-2.5 sm:gap-3"}`,children:[e.jsx("span",{className:`flex-shrink-0 transition-[color,transform,opacity] duration-300 ease-out ${f?"scale-75 opacity-80":"scale-90 opacity-100"}`,style:{color:I?"var(--text-secondary)":"var(--text-muted)"},children:_}),e.jsxs("div",{className:`flex min-w-0 flex-1 flex-wrap items-center transition-[gap] duration-300 ease-out ${f?"gap-x-2 gap-y-1":"gap-x-3 gap-y-2"}`,children:[e.jsxs("div",{className:"min-w-0 flex-shrink transition-[transform] duration-300 ease-out",children:[e.jsx("h1",{className:`truncate font-bold tracking-tight transition-[font-size,line-height,color] duration-300 ease-out ${f?"text-base sm:text-lg":"text-lg sm:text-xl"}`,style:{color:"var(--text-main)"},children:r}),t&&e.jsx("p",{"aria-hidden":f,className:`overflow-hidden text-xs transition-[max-height,opacity,transform,margin] duration-300 ease-out ${f?"mt-0 max-h-0 -translate-y-1 opacity-0":"mt-0.5 max-h-5 translate-y-0 opacity-100"}`,style:{color:"var(--text-muted)"},children:t})]}),n&&e.jsx("div",{className:`page-header-meta flex min-w-0 flex-1 basis-full items-center overflow-visible transition-[gap,opacity,transform] duration-300 ease-out sm:basis-auto ${f?"translate-y-0 gap-1.5 opacity-95":"gap-2 opacity-100"}`,children:n})]})]})]}),a&&e.jsx("div",{className:`page-header-actions flex flex-shrink-0 items-center self-center overflow-visible transition-[gap,min-height,opacity,transform] duration-300 ease-out ${f?"min-h-8 gap-1 opacity-95":"min-h-9 gap-1.5 opacity-100"}`,children:e.jsx(or.Provider,{value:{compact:!0,iconOnly:!0,headerAction:!0},children:a})})]})})}function ea({children:r,currentPath:t=typeof window>"u"?"/":window.location.pathname,publicRoutes:a=["/","/login","/reset-password"],...n}){return a.includes(t)?e.jsx(e.Fragment,{children:r}):e.jsx(Br,{currentPath:t,...n,children:r})}function Dr(){if(typeof window>"u")return"system";const r=localStorage.getItem("theme");return r==="light"||r==="dark"?r:r==="system"?"system":document.documentElement.classList.contains("dark")?"dark":"light"}function ra(r,t,a){try{const n=new URL(r),i=n.searchParams.get("callbackUrl");if(i){const u=new URL(i,n.origin);return u.searchParams.set("theme",t),a&&(u.searchParams.set("primeAuthOrigin",window.location.origin),u.searchParams.set("primeAuthProjectKey",a)),n.searchParams.set("callbackUrl",`${u.pathname}${u.search}${u.hash}`),n.toString()}return n.searchParams.set("theme",t),a&&(n.searchParams.set("primeAuthOrigin",window.location.origin),n.searchParams.set("primeAuthProjectKey",a)),n.toString()}catch{return r}}function ta({name:r,src:t,projectKey:a}){const[n,i]=o.useState(()=>Dr()),u=o.useRef(null);o.useEffect(()=>{const d=new MutationObserver(()=>i(Dr()));return d.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>d.disconnect()},[]);const p=o.useMemo(()=>ra(t,n,a),[a,t,n]),h=o.useMemo(()=>{try{return new URL(p).origin}catch{return""}},[p]);return o.useEffect(()=>{if(!a)return;const d=a;function b(k){var f,g,c;if(k.source!==((f=u.current)==null?void 0:f.contentWindow)||h&&k.origin!==h)return;if(((g=k.data)==null?void 0:g.type)==="prime-microservice:overlay"){window.dispatchEvent(new CustomEvent("prime-auth:microservice-overlay",{detail:{active:!!k.data.active}}));return}if(((c=k.data)==null?void 0:c.type)!=="prime-microservice:navigation")return;const C=k.data.path;if(!C||!C.startsWith("/")||C.startsWith("//"))return;const m=`/apps/${encodeURIComponent(d)}${C}`;`${window.location.pathname}${window.location.search}${window.location.hash}`!==m&&(window.history.replaceState(window.history.state,"",m),window.dispatchEvent(new CustomEvent("prime-auth:microservice-navigation")))}return window.addEventListener("message",b),()=>{window.removeEventListener("message",b),window.dispatchEvent(new CustomEvent("prime-auth:microservice-overlay",{detail:{active:!1}}))}},[h,a]),e.jsx("div",{className:"flex h-full min-h-screen flex-col bg-[var(--bg-main)]",children:e.jsx("iframe",{ref:u,src:p,title:r,className:"min-h-0 flex-1 border-0 bg-[var(--bg-main)]",allow:"clipboard-write",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-same-origin allow-scripts",referrerPolicy:"strict-origin-when-cross-origin"})})}function aa(){const[r,t]=o.useState(""),[a,n]=o.useState(!1),[i,u]=o.useState({width:96,height:96});return o.useEffect(()=>{let p=!1;return fetch("/api/microservices/prime-suite/chat-url",{cache:"no-store"}).then(h=>h.ok?h.json():null).then(h=>{!p&&(h!=null&&h.src)&&t(h.src)}).catch(()=>{}),()=>{p=!0}},[]),o.useEffect(()=>{const p=h=>{var b;if(((b=h.data)==null?void 0:b.type)!=="prime-suite-chat:state")return;const d=!!h.data.active;n(d),u({width:Lr(h.data.width,96,720),height:Lr(h.data.height,96,560)})};return window.addEventListener("message",p),()=>window.removeEventListener("message",p)},[]),r?e.jsx("iframe",{title:"Chat Bonsaif",src:r,allow:"clipboard-write",className:"fixed bottom-0 right-0 z-[70] border-0 bg-transparent transition-[width,height] duration-200",style:{width:a?`min(${i.width}px, 100vw)`:96,height:a?`min(${i.height}px, 100vh)`:96,background:"transparent",backgroundColor:"transparent",colorScheme:"normal"}}):null}function Lr(r,t,a){const n=typeof r=="number"&&Number.isFinite(r)?r:t;return Math.max(t,Math.min(a,Math.ceil(n)))}function na(r){const t=document.documentElement,a=new MutationObserver(r);a.observe(t,{attributes:!0,attributeFilter:["class"]});const n=window.matchMedia("(prefers-color-scheme: dark)");return n.addEventListener("change",r),()=>{a.disconnect(),n.removeEventListener("change",r)}}function oa(){const r=localStorage.getItem("theme")||"system",t=window.matchMedia("(prefers-color-scheme: dark)").matches;return document.documentElement.classList.contains("dark")||r==="dark"||r==="system"&&t?"dark":"light"}function sa(){return"light"}function ia(){const r=o.useSyncExternalStore(na,oa,sa);return e.jsx(Fr.Toaster,{position:"bottom-center",theme:r,richColors:!0,closeButton:!0})}L.AuthShell=Br,L.BonsaifButton=Wr,L.Button=ue,L.CalendarPicker=it,L.CompactFilterSelect=ct,L.CompactSearchInput=lt,L.ConfirmDialog=ft,L.CopyButton=mr,L.CopyLinkButton=mt,L.DataTable=xt,L.DateRangePicker=Nt,L.Drawer=kt,L.DynamicDetailTabs=tt,L.GlobalScrollbars=$r,L.InputField=Lt,L.LoadingState=ir,L.MicroserviceFrame=ta,L.Modal=hr,L.MouseTooltip=Le,L.PageHeader=Rt,L.PageSearchInput=nr,L.PrimeAuthRouteShell=ea,L.PrimeAuthToaster=ia,L.PrimeSuiteChatFrame=aa,L.SearchableSelect=Ve,L.StepWizard=Ht,L.TextInput=ze,L.Toggle=Pt,L.UserAvatar=Tr,L.cn=ar,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})}));
@@ -1 +1 @@
1
- {"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../../src/components/layout/PageHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAsBf,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,aAAa,CAAC,mBAAmB,CAAC,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC;AAiHD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,SAAc,EACd,gBAAqB,EACrB,WAAW,EACX,WAA4E,EAC5E,eAAsB,EACtB,SAAiB,EACjB,aAA2B,GAC5B,EAAE,eAAe,2CAmRjB"}
1
+ {"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../../src/components/layout/PageHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAsBf,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,aAAa,CAAC,mBAAmB,CAAC,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC;AAiHD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,SAAc,EACd,gBAAqB,EACrB,WAAW,EACX,WAA4E,EAC5E,eAAsB,EACtB,SAAiB,EACjB,aAA2B,GAC5B,EAAE,eAAe,2CAqRjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EAGpB,SAAS,EAEV,MAAM,OAAO,CAAC;AAIf,KAAK,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAC3E,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,UAAU,WAAY,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACnE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAsDD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,OAAmB,EACnB,IAAW,EACX,OAAe,EACf,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAc,EACd,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE,WAAW,2CA6Cb"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EAGpB,SAAS,EAEV,MAAM,OAAO,CAAC;AAIf,KAAK,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAC3E,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,UAAU,WAAY,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACnE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AA0DD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,OAAmB,EACnB,IAAW,EACX,OAAe,EACf,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAc,EACd,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE,WAAW,2CAsEb"}
@@ -1,6 +1,7 @@
1
1
  export type ButtonChrome = {
2
2
  compact?: boolean;
3
3
  iconOnly?: boolean;
4
+ headerAction?: boolean;
4
5
  };
5
6
  export declare const ButtonChromeContext: import('react').Context<ButtonChrome>;
6
7
  //# sourceMappingURL=ButtonChromeContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonChromeContext.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ButtonChromeContext.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,mBAAmB,uCAAkC,CAAC"}
1
+ {"version":3,"file":"ButtonChromeContext.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ButtonChromeContext.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,mBAAmB,uCAAkC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bonsaif-ui",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Reusable Bonsaif UI components for Bonsaif applications.",
5
5
  "type": "module",
6
6
  "author": "Bonsaif",