bonsaif-ui 0.1.19 → 0.1.24
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.
- package/CHANGELOG.md +8 -0
- package/README.md +206 -16
- package/dist/bonsaif-ui.js +3827 -2855
- package/dist/bonsaif-ui.umd.cjs +1 -1
- package/dist/components/BonsaifButton/BonsaifButton.stories.d.ts +22 -0
- package/dist/components/BonsaifButton/BonsaifButton.stories.d.ts.map +1 -0
- package/dist/components/composition/DynamicDetailTabs.stories.d.ts +11 -0
- package/dist/components/composition/DynamicDetailTabs.stories.d.ts.map +1 -0
- package/dist/components/layout/AuthShell.stories.d.ts +12 -0
- package/dist/components/layout/AuthShell.stories.d.ts.map +1 -0
- package/dist/components/layout/GlobalScrollbars.stories.d.ts +9 -0
- package/dist/components/layout/GlobalScrollbars.stories.d.ts.map +1 -0
- package/dist/components/layout/LayoutShells.stories.d.ts +16 -0
- package/dist/components/layout/LayoutShells.stories.d.ts.map +1 -0
- package/dist/components/layout/PageHeader.stories.d.ts +12 -0
- package/dist/components/layout/PageHeader.stories.d.ts.map +1 -0
- package/dist/components/layout/PageSearchInput.stories.d.ts +9 -0
- package/dist/components/layout/PageSearchInput.stories.d.ts.map +1 -0
- package/dist/components/layout/PrimeAuthRouteShell.stories.d.ts +12 -0
- package/dist/components/layout/PrimeAuthRouteShell.stories.d.ts.map +1 -0
- package/dist/components/messaging/PrimeSuiteChatFrame.stories.d.ts +14 -0
- package/dist/components/messaging/PrimeSuiteChatFrame.stories.d.ts.map +1 -0
- package/dist/components/microservices/MicroserviceFrame.stories.d.ts +14 -0
- package/dist/components/microservices/MicroserviceFrame.stories.d.ts.map +1 -0
- package/dist/components/notifications/PrimeAuthToaster.stories.d.ts +11 -0
- package/dist/components/notifications/PrimeAuthToaster.stories.d.ts.map +1 -0
- package/dist/components/ui/ActionUtilities.stories.d.ts +13 -0
- package/dist/components/ui/ActionUtilities.stories.d.ts.map +1 -0
- package/dist/components/ui/Alert.stories.d.ts +23 -0
- package/dist/components/ui/Alert.stories.d.ts.map +1 -0
- package/dist/components/ui/Button.stories.d.ts +36 -0
- package/dist/components/ui/Button.stories.d.ts.map +1 -0
- package/dist/components/ui/CalendarPicker.stories.d.ts +9 -0
- package/dist/components/ui/CalendarPicker.stories.d.ts.map +1 -0
- package/dist/components/ui/Checkbox.stories.d.ts +11 -0
- package/dist/components/ui/Checkbox.stories.d.ts.map +1 -0
- package/dist/components/ui/CodeBlock.stories.d.ts +11 -0
- package/dist/components/ui/CodeBlock.stories.d.ts.map +1 -0
- package/dist/components/ui/CompactFilterSelect.stories.d.ts +11 -0
- package/dist/components/ui/CompactFilterSelect.stories.d.ts.map +1 -0
- package/dist/components/ui/CompactSearchInput.stories.d.ts +11 -0
- package/dist/components/ui/CompactSearchInput.stories.d.ts.map +1 -0
- package/dist/components/ui/ConfirmDialog.stories.d.ts +9 -0
- package/dist/components/ui/ConfirmDialog.stories.d.ts.map +1 -0
- package/dist/components/ui/CopyButton.stories.d.ts +11 -0
- package/dist/components/ui/CopyButton.stories.d.ts.map +1 -0
- package/dist/components/ui/CopyLinkButton.stories.d.ts +11 -0
- package/dist/components/ui/CopyLinkButton.stories.d.ts.map +1 -0
- package/dist/components/ui/DataDisplay.stories.d.ts +11 -0
- package/dist/components/ui/DataDisplay.stories.d.ts.map +1 -0
- package/dist/components/ui/DataTable.d.ts.map +1 -1
- package/dist/components/ui/DataTable.stories.d.ts +9 -0
- package/dist/components/ui/DataTable.stories.d.ts.map +1 -0
- package/dist/components/ui/DateRangePicker.stories.d.ts +9 -0
- package/dist/components/ui/DateRangePicker.stories.d.ts.map +1 -0
- package/dist/components/ui/Drawer.stories.d.ts +9 -0
- package/dist/components/ui/Drawer.stories.d.ts.map +1 -0
- package/dist/components/ui/DropdownMenu.stories.d.ts +9 -0
- package/dist/components/ui/DropdownMenu.stories.d.ts.map +1 -0
- package/dist/components/ui/EmailField.d.ts +7 -0
- package/dist/components/ui/EmailField.d.ts.map +1 -0
- package/dist/components/ui/EmailField.stories.d.ts +11 -0
- package/dist/components/ui/EmailField.stories.d.ts.map +1 -0
- package/dist/components/ui/EmptyState.stories.d.ts +22 -0
- package/dist/components/ui/EmptyState.stories.d.ts.map +1 -0
- package/dist/components/ui/Feedback.stories.d.ts +18 -0
- package/dist/components/ui/Feedback.stories.d.ts.map +1 -0
- package/dist/components/ui/FeedbackComponents.stories.d.ts +11 -0
- package/dist/components/ui/FeedbackComponents.stories.d.ts.map +1 -0
- package/dist/components/ui/FileUpload.d.ts +29 -0
- package/dist/components/ui/FileUpload.d.ts.map +1 -0
- package/dist/components/ui/FileUpload.stories.d.ts +57 -0
- package/dist/components/ui/FileUpload.stories.d.ts.map +1 -0
- package/dist/components/ui/FormField.stories.d.ts +16 -0
- package/dist/components/ui/FormField.stories.d.ts.map +1 -0
- package/dist/components/ui/FormFields.stories.d.ts +30 -0
- package/dist/components/ui/FormFields.stories.d.ts.map +1 -0
- package/dist/components/ui/InputField.d.ts +6 -2
- package/dist/components/ui/InputField.d.ts.map +1 -1
- package/dist/components/ui/InputField.stories.d.ts +26 -0
- package/dist/components/ui/InputField.stories.d.ts.map +1 -0
- package/dist/components/ui/LoadingState.stories.d.ts +10 -0
- package/dist/components/ui/LoadingState.stories.d.ts.map +1 -0
- package/dist/components/ui/Modal.stories.d.ts +9 -0
- package/dist/components/ui/Modal.stories.d.ts.map +1 -0
- package/dist/components/ui/MouseTooltip.d.ts.map +1 -1
- package/dist/components/ui/MouseTooltip.stories.d.ts +9 -0
- package/dist/components/ui/MouseTooltip.stories.d.ts.map +1 -0
- package/dist/components/ui/MultiSelect.stories.d.ts +11 -0
- package/dist/components/ui/MultiSelect.stories.d.ts.map +1 -0
- package/dist/components/ui/Navigation.stories.d.ts +12 -0
- package/dist/components/ui/Navigation.stories.d.ts.map +1 -0
- package/dist/components/ui/NumberField.d.ts +4 -0
- package/dist/components/ui/NumberField.d.ts.map +1 -0
- package/dist/components/ui/NumberField.stories.d.ts +11 -0
- package/dist/components/ui/NumberField.stories.d.ts.map +1 -0
- package/dist/components/ui/Overlays.stories.d.ts +11 -0
- package/dist/components/ui/Overlays.stories.d.ts.map +1 -0
- package/dist/components/ui/Pagination.stories.d.ts +9 -0
- package/dist/components/ui/Pagination.stories.d.ts.map +1 -0
- package/dist/components/ui/PhoneField.d.ts +22 -0
- package/dist/components/ui/PhoneField.d.ts.map +1 -0
- package/dist/components/ui/PhoneField.stories.d.ts +11 -0
- package/dist/components/ui/PhoneField.stories.d.ts.map +1 -0
- package/dist/components/ui/RadioGroup.stories.d.ts +11 -0
- package/dist/components/ui/RadioGroup.stories.d.ts.map +1 -0
- package/dist/components/ui/SearchableSelect.d.ts +6 -1
- package/dist/components/ui/SearchableSelect.d.ts.map +1 -1
- package/dist/components/ui/SearchableSelect.stories.d.ts +11 -0
- package/dist/components/ui/SearchableSelect.stories.d.ts.map +1 -0
- package/dist/components/ui/SectionPanel.stories.d.ts +9 -0
- package/dist/components/ui/SectionPanel.stories.d.ts.map +1 -0
- package/dist/components/ui/StatusBadge.stories.d.ts +27 -0
- package/dist/components/ui/StatusBadge.stories.d.ts.map +1 -0
- package/dist/components/ui/StatusSelect.d.ts +29 -0
- package/dist/components/ui/StatusSelect.d.ts.map +1 -0
- package/dist/components/ui/StatusSelect.stories.d.ts +9 -0
- package/dist/components/ui/StatusSelect.stories.d.ts.map +1 -0
- package/dist/components/ui/StepWizard.stories.d.ts +9 -0
- package/dist/components/ui/StepWizard.stories.d.ts.map +1 -0
- package/dist/components/ui/Tabs.stories.d.ts +9 -0
- package/dist/components/ui/Tabs.stories.d.ts.map +1 -0
- package/dist/components/ui/TextInput.stories.d.ts +15 -0
- package/dist/components/ui/TextInput.stories.d.ts.map +1 -0
- package/dist/components/ui/Textarea.stories.d.ts +17 -0
- package/dist/components/ui/Textarea.stories.d.ts.map +1 -0
- package/dist/components/ui/TextareaField.stories.d.ts +20 -0
- package/dist/components/ui/TextareaField.stories.d.ts.map +1 -0
- package/dist/components/ui/Toggle.stories.d.ts +31 -0
- package/dist/components/ui/Toggle.stories.d.ts.map +1 -0
- package/dist/components/ui/index.d.ts +11 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/users/UserAvatar.stories.d.ts +12 -0
- package/dist/components/users/UserAvatar.stories.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/phoneCountryCodes.d.ts +7 -0
- package/dist/lib/phoneCountryCodes.d.ts.map +1 -0
- package/dist/lib/validation.d.ts +23 -0
- package/dist/lib/validation.d.ts.map +1 -0
- package/dist/lib/validationVisibility.d.ts +12 -0
- package/dist/lib/validationVisibility.d.ts.map +1 -0
- package/package.json +10 -2
package/dist/bonsaif-ui.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(B,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react-icons/hi2"),require("react"),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-icons/hi2","react","react-dom","overlayscrollbars","react-icons/md","overlayscrollbars-react","react-day-picker","react-day-picker/dist/style.css","react-icons/fi","sonner"],e):(B=typeof globalThis<"u"?globalThis:B||self,e(B.BonsaifUI={},B.jsxRuntime,B.ReactIconsHi2,B.React,B.ReactDOM,B.OverlayScrollbarsGlobal,B.ReactIconsMd,B.OverlayScrollbarsReact,B.ReactDayPicker,B.ReactDayPickerStyles,B.ReactIconsFi,B.Sonner))})(this,(function(B,e,w,o,$e,gr,gt,yr,wr,Bn,yt,wt){"use strict";"use client";function Nr(...r){return r.filter(Boolean).join(" ")}function Nt({variant:r="primary",className:t,type:a="button",children:n,...s}){return e.jsx("button",{className:Nr("bonsaif-ui-button",`bonsaif-ui-button--${r}`,t),type:a,...s,children:n})}function kr({value:r,onChange:t,placeholder:a,className:n="",autoFocus:s=!1,forceExpanded:c=!1,onEscape:d,size:i="default",inputTabIndex:p}){const b=o.useRef(null),[C,k]=o.useState(!1),y=c||C||r.trim().length>0,g=i==="sm"?"h-9 rounded-md":"h-10 rounded-lg",u=n||"w-48 max-w-full sm:w-64 lg:w-72";o.useEffect(()=>{var h;s&&((h=b.current)==null||h.focus())},[s]);const m=()=>{var h;k(!0),(h=b.current)==null||h.focus()};return e.jsxs("div",{className:`relative min-w-0 max-w-full flex-shrink-0 overflow-visible transition-[width] duration-200 ease-out ${y?u:"w-24 sm:w-28"}`,onMouseDown:h=>{y||(h.preventDefault(),m())},children:[e.jsx(w.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:p,"aria-label":a,value:r,onChange:h=>t(h.target.value),onKeyDown:h=>{h.key==="Escape"&&(d==null||d())},placeholder:y?a:"Buscar",className:`${g} w-full py-0 text-sm leading-none placeholder:text-[var(--text-muted)] focus:outline-none transition-all duration-200 ${y?"pl-9 pr-8":"cursor-pointer pl-9 pr-3"}`,style:{background:"color-mix(in srgb, var(--bg-card) 86%, transparent)",border:"1px solid var(--border)",color:"var(--text-main)"},onFocus:h=>{k(!0),h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.boxShadow="0 0 0 3px rgba(59,130,246,0.12)"},onBlur:h=>{k(!1),h.currentTarget.style.borderColor="var(--border)",h.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(w.HiXMark,{className:"h-3.5 w-3.5 flex-shrink-0"})})]})}const Sr=o.createContext({});function kt(r){var n;const t=Array.from(r.querySelectorAll("*")).filter(s=>{var c;return s.scrollWidth>s.clientWidth&&!!((c=s.textContent)!=null&&c.trim())&&s.tagName.toLowerCase()!=="svg"&&!s.closest("svg")});return(r.scrollWidth>r.clientWidth||t.length>0)&&(((n=t[0])==null?void 0:n.textContent)??r.textContent??"").trim()||null}function Ue({children:r,content:t,onlyWhenOverflow:a=!1,className:n="",style:s,as:c="div"}){const d=o.useRef(null),i=o.useRef(null),[p,b]=o.useState(null),[C,k]=o.useState("");o.useEffect(()=>{const u=d.current;u&&(u.querySelectorAll("[title]").forEach(m=>{const h=m.getAttribute("title");h&&(m.getAttribute("aria-label")||m.setAttribute("aria-label",h),m.removeAttribute("title"))}),u.querySelectorAll("svg title").forEach(m=>m.remove()))}),o.useLayoutEffect(()=>{if(!p)return;const u=i.current;if(!u)return;const m=12,h=14,E=u.getBoundingClientRect(),j=window.innerWidth-E.width-m,z=window.innerHeight-E.height-m;let H=p.mouseX+h,N=p.mouseY+h;H>j&&(H=p.mouseX-E.width-h),N>z&&(N=p.mouseY-E.height-h),H=Math.min(Math.max(m,H),Math.max(m,j)),N=Math.min(Math.max(m,N),Math.max(m,z)),(Math.abs(H-p.x)>.5||Math.abs(N-p.y)>.5)&&b($=>$&&{...$,x:H,y:N})},[p]);const y=(u,m)=>{const h=d.current;if(h){if(a){const E=kt(h);if(!E)return;k(E)}!a&&!t||b({mouseX:u,mouseY:m,x:u+14,y:m+14})}},g=a?C:t;return e.jsxs(e.Fragment,{children:[e.jsx(c,{ref:u=>{d.current=u},className:n,style:s,onMouseEnter:u=>y(u.clientX,u.clientY),onMouseMove:u=>{p&&y(u.clientX,u.clientY)},onMouseLeave:()=>b(null),children:r}),p&&g?$e.createPortal(e.jsx("div",{ref:i,role:"tooltip",style:{position:"fixed",top:p.y,left:p.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:g}),document.body):null]})}function Cr(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}const St="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",Ct={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"},Et="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",$t={xs:"h-8 px-2.5 text-xs",sm:"h-9 px-3.5 text-xs",md:"h-10 px-3.5 text-sm",lg:"h-11 px-4 text-sm font-semibold"},Mt={xs:"h-8 w-8",sm:"h-9 w-9",md:"h-10 w-10",lg:"h-10 w-10"},Dt={primary:{background:"var(--bg-card)"},secondary:{background:"var(--bg-card)"},danger:{background:"var(--bg-card)"},ghost:{},icon:{}};function ar(r){return typeof r=="string"||typeof r=="number"?String(r):Array.isArray(r)?r.map(ar).join(" ").trim():o.isValidElement(r)?ar(r.props.children):""}function Lt(r){return o.Children.toArray(r).find(o.isValidElement)??null}function de({variant:r="primary",size:t="md",loading:a=!1,icon:n,tooltip:s,iconOnly:c,height:d,padding:i,children:p,className:b="",disabled:C,style:k,...y}){const g=o.useContext(Sr),u=c??g.iconOnly??r==="icon",m=g.compact??!1,h=g.headerAction??!1,E=m&&!h&&t==="md"?"xs":t,j=r==="icon"||u,z=h&&j,H=ar(p),N=s??y.title??y["aria-label"]??(u?H:void 0),$=N?void 0:y.title,T=y["aria-label"]??(typeof N=="string"?N:H||void 0),P=a?null:n??(u?Lt(p):null),L=e.jsxs("button",{...y,title:$,"aria-label":T,"data-variant":r,"data-size":E,"data-icon":j?"true":void 0,disabled:C||a,className:`${St} ${z?Et:Ct[r]} ${j?Mt[E]:$t[E]} ${m&&!j?"px-2.5":""} ${b}`,style:{...Dt[r],height:Cr(d),padding:Cr(i),...k,...z?{width:"40px",height:"40px",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"}):P,!u&&p]});return N?e.jsx(Ue,{as:"span",content:N,className:"inline-flex shrink-0",children:L}):L}function Er({variant:r="page",title:t="Cargando...",rows:a=6,children:n}){return r==="table"?e.jsx($r,{rows:a}):r==="sections"?e.jsx(Ht,{rows:a}):r==="cards"?e.jsx(Tt,{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 Ht({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($r,{rows:a===0?r:Math.max(3,r-2),compact:!0})]},a))})}function Tt({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 $r({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,s)=>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)]"})},s))}),Array.from({length:r}).map((n,s)=>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((c,d)=>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+(s*13+d*11)%36}%`}})},d))},s))]})}function Mr(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 Bt(r){return[r.label,Mr(r.service),r.description,r.service].filter(Boolean).join(" ")}function At(r){return typeof r=="function"?r:r.default}function Ot(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(de,{className:"mt-4",height:36,padding:"0 14px",onClick:t,children:"Reintentar"})]})})}function It({parentPanel:r,parentPanelComponent:t,renderParentPanel:a,parent:n,context:s,links:c,moduleRegistry:d,loadModule:i,activeService:p,initialService:b,onActiveServiceChange:C,canAccess:k,keepAlive:y=!0,title:g,subtitle:u,emptyState:m,loadingState:h,errorState:E=Ot,renderTabLabel:j,searchableTabs:z="auto",tabsSearchThreshold:H=6,tabsSearchPlaceholder:N="Buscar modulo...",tabsSearchValue:$,onTabsSearchChange:T,emptySearchState:P,showTabCount:L=!0,className:M="",parentClassName:_="",contentClassName:I="",tabsClassName:F=""}){var Ie;const U=o.useMemo(()=>c.filter(O=>!O.hidden&&((k==null?void 0:k(O,s))??!0)),[k,s,c]),V=(Ie=U.find(O=>!O.disabled))==null?void 0:Ie.service,[ee,f]=o.useState(b??V??""),[D,G]=o.useState({}),[J,Z]=o.useState({}),[re,he]=o.useState(""),[x,K]=o.useState(!1),ae=o.useRef(J),ne=o.useRef(0),oe=$??re,A=Dr(oe),X=z===!0||z==="auto"&&U.length>=H,Q=X&&oe.trim().length>0,ie=o.useMemo(()=>A?U.filter(O=>Dr(Bt(O)).includes(A)):U,[A,U]),ue=p??ee,Y=U.find(O=>O.service===ue)??U.find(O=>!O.disabled);o.useEffect(()=>{!Y&&V&&f(V)},[V,Y]),o.useEffect(()=>{ae.current=J},[J]);const Se=O=>{O.disabled||(p||f(O.service),C==null||C(O.service,O))},je=O=>{$===void 0&&he(O),T==null||T(O)},Oe=(O,fe)=>{const se=ie.filter(le=>!le.disabled),ve=se.findIndex(le=>le.service===fe.service);ve<0||((O.key==="ArrowRight"||O.key==="ArrowDown")&&(O.preventDefault(),Se(se[(ve+1)%se.length])),(O.key==="ArrowLeft"||O.key==="ArrowUp")&&(O.preventDefault(),Se(se[(ve-1+se.length)%se.length])),O.key==="Home"&&(O.preventDefault(),Se(se[0])),O.key==="End"&&(O.preventDefault(),Se(se[se.length-1])))},He=o.useCallback(()=>{if(!Y)return;const O=Y.service,fe=ae.current[O];if(fe!=null&&fe.loading||fe!=null&&fe.component&&y)return;const se=(d==null?void 0:d[O])??i;if(!se){Z(le=>({...le,[O]:{loading:!1,error:new Error(`No module loader found for service "${O}".`)}}));return}const ve=++ne.current;Z(le=>({...le,[O]:{...le[O],loading:!0,error:void 0}})),se(Y,s).then(le=>{if(ve!==ne.current&&!y)return;const Ce=At(le);Z(Te=>({...Te,[O]:{component:Ce,loading:!1}}))}).catch(le=>{const Ce=le instanceof Error?le:new Error(String(le));Z(Te=>({...Te,[O]:{...Te[O],loading:!1,error:Ce}}))})},[s,y,i,d,Y]);o.useEffect(He,[He]);const We=Y?D[Y.service]??null:null,ce=Y?J[Y.service]:void 0,ye=ce==null?void 0:ce.component,Ke=O=>{Y&&G(fe=>({...fe,[Y.service]:O}))},Ze=()=>{Y&&G(O=>({...O,[Y.service]:null}))},Fe={context:s,parent:n,links:c,visibleLinks:U,filteredLinks:ie,selectedLink:Y,selectedService:Y==null?void 0:Y.service,activeItemId:We,tabsSearch:oe,onSelectService:Se,onOpenDetail:Ke,onBackToList:Ze},dr=a?a(Fe):t?e.jsx(t,{...Fe}):r;return e.jsxs("section",{className:`grid min-h-[520px] gap-4 lg:grid-cols-[minmax(260px,360px)_minmax(0,1fr)] ${M}`,children:[e.jsx("aside",{className:`min-w-0 rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-4 ${_}`,children:dr}),e.jsxs("div",{className:`relative min-w-0 overflow-visible rounded-lg border border-[var(--border)] bg-[var(--bg-card)] ${I}`,children:[(g||u||X||L)&&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:[g&&e.jsx("h2",{className:"truncate text-sm font-semibold text-[var(--text-main)]",children:g}),u&&e.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-[var(--text-muted)]",children:u})]}),(X||L)&&e.jsxs("div",{className:"flex min-w-0 flex-shrink-0 items-center justify-end gap-2",children:[L&&e.jsxs("span",{className:"hidden text-xs font-semibold text-[var(--text-muted)] transition-opacity duration-200 sm:inline",children:[ie.length," / ",U.length]}),X&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`origin-right overflow-hidden transition-[width,opacity,transform] duration-200 ease-out ${x?"w-[min(20rem,44vw)] translate-x-0 opacity-100":"w-0 translate-x-2 opacity-0"}`,"aria-hidden":!x,children:e.jsx(kr,{value:oe,onChange:je,placeholder:N,className:"w-full",autoFocus:x,forceExpanded:!0,onEscape:()=>K(!1),size:"sm",inputTabIndex:x?0:-1})}),e.jsx("button",{type:"button","aria-label":x?"Cerrar busqueda":"Buscar tabs","aria-expanded":x,onClick:()=>{x&&oe&&je(""),K(O=>!O)},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 ${x||Q?"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:x||Q?e.jsx(w.HiXMark,{className:"h-4 w-4"}):e.jsx(w.HiMagnifyingGlass,{className:"h-4 w-4"})})})]})]})]})}),e.jsx("div",{role:"tablist","aria-label":g??"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 ${F}`,children:ie.length>0?ie.map(O=>{const fe=O.service===(Y==null?void 0:Y.service);return e.jsx("button",{type:"button",role:"tab","aria-selected":fe,disabled:O.disabled,onClick:()=>Se(O),onKeyDown:se=>Oe(se,O),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 ${fe?"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:j?j(O,fe):e.jsxs(e.Fragment,{children:[O.icon,e.jsx("span",{children:O.label??Mr(O.service)}),O.badge&&e.jsx("span",{className:"rounded-full bg-[var(--bg-input)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:O.badge})]})},O.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:P??"No hay modulos que coincidan con la busqueda."})}),(Y==null?void 0:Y.description)&&e.jsx("div",{className:"border-b border-[var(--border)] px-4 py-2 text-xs text-[var(--text-muted)]",children:Y.description}),e.jsxs("div",{className:"min-h-[420px] p-4",children:[!Y&&(m??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."})),Y&&(ce==null?void 0:ce.loading)&&(h??e.jsx(Er,{title:"Cargando modulo..."})),Y&&(ce==null?void 0:ce.error)&&E(ce.error,He),Y&&ye&&!(ce!=null&&ce.loading)&&!(ce!=null&&ce.error)&&e.jsx(ye,{context:s,parent:n,link:Y,activeItemId:We,onOpenDetail:Ke,onBackToList:Ze})]})]})]})}const zt={info:{color:"#2563eb",background:"rgba(59, 130, 246, 0.1)",border:"rgba(59, 130, 246, 0.24)",icon:e.jsx(w.HiInformationCircle,{className:"h-5 w-5"})},success:{color:"#047857",background:"rgba(16, 185, 129, 0.1)",border:"rgba(16, 185, 129, 0.24)",icon:e.jsx(w.HiCheckCircle,{className:"h-5 w-5"})},warning:{color:"#b45309",background:"rgba(245, 158, 11, 0.12)",border:"rgba(245, 158, 11, 0.26)",icon:e.jsx(w.HiExclamationTriangle,{className:"h-5 w-5"})},danger:{color:"var(--danger)",background:"var(--danger-bg)",border:"color-mix(in srgb, var(--danger) 20%, var(--border))",icon:e.jsx(w.HiExclamationCircle,{className:"h-5 w-5"})},neutral:{color:"var(--text-secondary)",background:"var(--bg-input)",border:"var(--border)",icon:e.jsx(w.HiInformationCircle,{className:"h-5 w-5"})}};function Pt({variant:r="info",title:t,children:a,icon:n,action:s,onDismiss:c,className:d=""}){const i=zt[r];return e.jsxs("div",{role:r==="danger"||r==="warning"?"alert":"status",className:`flex items-start gap-3 rounded-lg border px-3 py-3 ${d}`,style:{background:i.background,borderColor:i.border},children:[e.jsx("div",{className:"mt-0.5 shrink-0",style:{color:i.color},children:n??i.icon}),e.jsxs("div",{className:"min-w-0 flex-1",children:[t&&e.jsx("div",{className:"text-sm font-semibold text-[var(--text-main)]",children:t}),a&&e.jsx("div",{className:"mt-0.5 text-sm leading-5 text-[var(--text-secondary)]",children:a}),s&&e.jsx("div",{className:"mt-3",children:s})]}),c&&e.jsx(de,{variant:"icon",size:"xs","aria-label":"Cerrar alerta",onClick:c,className:"-mr-1 -mt-1",children:e.jsx(w.HiXMark,{className:"h-4 w-4"})})]})}const Lr=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],_t=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],jt=["Do","Lu","Ma","Mi","Ju","Vi","Sá"],nr=6;function or(r,t,a){return`${r}-${String(t).padStart(2,"0")}-${String(a).padStart(2,"0")}`}function Wt(){const r=new Date;return or(r.getFullYear(),r.getMonth()+1,r.getDate())}function Hr(r){const[t,a,n]=r.split("-").map(Number);return{year:t,month:a,day:n}}function Ft(r){if(!r)return"Seleccionar fecha";const{year:t,month:a,day:n}=Hr(r);return!t||!a||!n?"Seleccionar fecha":`${String(n).padStart(2,"0")} ${Lr[a-1]} ${t}`}function Ut({value:r,onChange:t,minDate:a,displayMode:n="inline"}){const s=Wt(),d=Hr(r||s),i=n==="popover",[p,b]=o.useState(!1),C=o.useRef(null),[k,y]=o.useState({horizontal:"left",vertical:"bottom"}),[g,u]=o.useState(d.year),[m,h]=o.useState(d.month),[E,j]=o.useState("days"),z=16,[H,N]=o.useState(0),$=g-7+H,T=Array.from({length:z},(f,D)=>$+D);o.useEffect(()=>{if(!i||!p||!C.current)return;const f=C.current.getBoundingClientRect(),D=8,G=280,J=340,Z=f.left+G>window.innerWidth-D,re=f.right-G>=D,he=f.bottom+8+J>window.innerHeight-D,x=f.top-8-J>=D;y({horizontal:Z&&re?"right":"left",vertical:he&&x?"top":"bottom"})},[i,p]),o.useEffect(()=>{if(!i||!p)return;function f(G){C.current&&(C.current.contains(G.target)||b(!1))}function D(G){G.key==="Escape"&&b(!1)}return document.addEventListener("mousedown",f),document.addEventListener("keydown",D),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",D)}},[i,p]);function P(){m===1?(u(f=>f-1),h(12)):h(f=>f-1)}function L(){m===12?(u(f=>f+1),h(1)):h(f=>f+1)}const M=new Date(g,m-1,1).getDay(),_=new Date(g,m,0).getDate(),I=[...Array(M).fill(null),...Array.from({length:_},(f,D)=>D+1)];for(;I.length<nr*7;)I.push(null);const F=I.slice(0,nr*7);function U(f){const D=or(g,m,f);a&&D<a||(t(D),i&&b(!1))}const V={background:"none",border:"none",cursor:"pointer",color:"var(--text-muted)",padding:4,borderRadius:6,display:"flex",alignItems:"center"},ee=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:E==="days"?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:P,style:V,title:"Mes anterior",children:e.jsx(w.HiChevronLeft,{size:16})}),e.jsxs("button",{type:"button",onClick:()=>{j("years"),N(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:[Lr[m-1]," ",g,e.jsx(w.HiChevronDown,{size:13,style:{color:"var(--text-muted)"}})]}),e.jsx("button",{type:"button",onClick:L,style:V,title:"Mes siguiente",children:e.jsx(w.HiChevronRight,{size:16})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>N(f=>f-z),style:V,children:e.jsx(w.HiChevronLeft,{size:16})}),e.jsxs("button",{type:"button",onClick:()=>j("days"),style:{background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:700,color:"var(--text-main)",borderRadius:6,padding:"2px 6px"},children:[T[0]," – ",T[T.length-1]]}),e.jsx("button",{type:"button",onClick:()=>N(f=>f+z),style:V,children:e.jsx(w.HiChevronRight,{size:16})})]})}),E==="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:_t.map((f,D)=>{const G=D+1===m;return e.jsx("button",{type:"button",onClick:()=>h(D+1),style:{border:"none",cursor:"pointer",borderRadius:6,fontSize:11,fontWeight:G?700:400,padding:"4px 0",background:G?"var(--primary)":"transparent",color:G?"var(--primary-fg, #ffffff)":"var(--text-secondary)"},children:f},f)})}),e.jsx("div",{style:{height:1,background:"var(--border)",marginBottom:8}}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4,1fr)",gap:3},children:T.map(f=>{const D=f===g;return e.jsx("button",{type:"button",onClick:()=>{u(f),j("days")},style:{border:"none",cursor:"pointer",borderRadius:6,fontSize:12,fontWeight:D?700:400,padding:"6px 0",background:D?"var(--primary)":"transparent",color:D?"var(--primary-fg, #ffffff)":"var(--text-main)",outline:f===new Date().getFullYear()&&!D?"2px solid var(--primary)":"none",outlineOffset:"-2px"},children:f},f)})})]}),E==="days"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7,1fr)",padding:"6px 8px 0"},children:jt.map(f=>e.jsx("div",{style:{textAlign:"center",fontSize:10,fontWeight:700,color:"var(--text-muted)",padding:"2px 0",textTransform:"uppercase"},children:f},f))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7,1fr)",gridTemplateRows:`repeat(${nr},1fr)`,padding:"4px 8px 10px",gap:2},children:F.map((f,D)=>{if(f===null)return e.jsx("div",{style:{aspectRatio:"1"}},D);const G=or(g,m,f),J=G===r,Z=G===s,re=!!(a&&G<a);return e.jsx("button",{type:"button",onClick:()=>!re&&U(f),style:{width:"100%",aspectRatio:"1",borderRadius:6,border:"none",cursor:re?"not-allowed":"pointer",fontSize:12,fontWeight:J||Z?700:400,background:J?"var(--primary)":"transparent",color:J?"var(--primary-fg, #ffffff)":re?"var(--text-muted)":"var(--text-main)",opacity:re?.4:1,outline:Z&&!J?"2px solid var(--primary)":"none",outlineOffset:"-2px"},children:f},D)})})]})]});return i?e.jsxs("div",{ref:C,className:"relative w-full",children:[e.jsxs("button",{type:"button",onClick:()=>b(f=>!f),className:"flex h-10 w-full items-center justify-between gap-2 rounded-lg px-2.5 py-0 text-sm transition-all duration-150 focus:outline-none",style:{background:"var(--bg-input)",border:`1px solid ${p?"var(--primary)":"var(--border)"}`,color:"var(--text-main)",boxShadow:p?"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(w.HiCalendarDays,{className:"w-4 h-4 text-[var(--text-muted)]"}),e.jsx("span",{className:"truncate",children:Ft(r)})]}),e.jsx(w.HiChevronDown,{className:`w-4 h-4 text-[var(--text-muted)] transition-transform ${p?"rotate-180":""}`})]}),p&&e.jsx("div",{className:"absolute z-50",style:{...k.horizontal==="left"?{left:0}:{right:0},...k.vertical==="bottom"?{top:"calc(100% + 8px)"}:{bottom:"calc(100% + 8px)"}},children:ee})]}):ee}const qt={sm:"h-4 w-4",md:"h-5 w-5"};function Gt({label:r,description:t,error:a,size:n="md",className:s="",containerClassName:c="",disabled:d,...i}){return e.jsxs("label",{className:`group inline-flex items-start gap-2.5 ${d?"cursor-not-allowed opacity-60":"cursor-pointer"} ${c}`,children:[e.jsxs("span",{className:"relative mt-0.5 inline-flex shrink-0",children:[e.jsx("input",{...i,type:"checkbox",disabled:d,"aria-invalid":!!a||i["aria-invalid"],className:`peer ${qt[n]} appearance-none rounded border border-[var(--border)] bg-[var(--bg-input)] transition-colors checked:border-[var(--primary)] checked:bg-[var(--primary)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)]/40 ${s}`}),e.jsx(w.HiCheck,{className:"pointer-events-none absolute left-1/2 top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 scale-75 text-[var(--primary-fg)] opacity-0 transition peer-checked:scale-100 peer-checked:opacity-100"})]}),(r||t||a)&&e.jsxs("span",{className:"min-w-0",children:[r&&e.jsx("span",{className:"block text-sm font-medium leading-5 text-[var(--text-main)]",children:r}),t&&!a&&e.jsx("span",{className:"block text-xs leading-5 text-[var(--text-muted)]",children:t}),a&&e.jsx("span",{className:"block text-xs leading-5 text-[var(--danger)]",children:a})]})]})}function Tr(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 Xt(r){var t;if((t=navigator.clipboard)!=null&&t.writeText){await navigator.clipboard.writeText(r);return}Tr(r)}function Yt(r){return typeof r=="function"?r():r}function sr({value:r,resetDelay:t=2e3,title:a,copiedTitle:n="Copiado",copiedLabel:s,icon:c=e.jsx(w.HiClipboardDocument,{size:14}),copiedIcon:d=e.jsx(w.HiCheck,{size:14}),stopPropagation:i=!0,onCopied:p,onCopyError:b,className:C="",style:k,children:y,onClick:g,type:u="button",...m}){const[h,E]=o.useState(!1),j=o.useRef(null);o.useEffect(()=>()=>{j.current&&window.clearTimeout(j.current)},[]);function z(N){E(!0),p==null||p(N),j.current&&window.clearTimeout(j.current),j.current=window.setTimeout(()=>{E(!1),j.current=null},t)}async function H(N){var T;if(i&&N.stopPropagation(),g==null||g(N),N.defaultPrevented)return;const $=Yt(r);if($)try{await Xt($),z($)}catch(P){try{Tr($),z($)}catch(L){b==null||b(L,$);return}(T=navigator.clipboard)!=null&&T.writeText||b==null||b(P,$)}}return e.jsxs("button",{...m,type:u,onClick:H,title:h?n:a,"aria-label":m["aria-label"]??(h?n:a),"data-copied":h?"true":void 0,className:`relative inline-flex h-7 shrink-0 items-center justify-center gap-1.5 rounded-md transition-all duration-200 ${y?"min-w-7 px-2":"w-7"} ${C}`,style:{cursor:"pointer",background:h?"rgba(22,163,74,0.15)":"var(--bg-card)",border:h?"1px solid rgba(22,163,74,0.4)":"1px solid var(--border)",color:h?"#16a34a":"var(--text-secondary)",boxShadow:h?"0 0 0 3px rgba(22,163,74,0.12)":"none",...k},children:[e.jsx("span",{className:"inline-flex items-center justify-center transition-all duration-150",style:{transform:h?"scale(1.15)":"scale(1)"},children:h?d:c}),y&&e.jsx("span",{className:"text-xs font-semibold leading-none",children:h?s??y:y})]})}function Vt({code:r,children:t,title:a="Codigo",language:n,copyLabel:s="Copiar",copiedLabel:c="Copiado",className:d="",style:i,onCopied:p}){const b=(r??t??"").trim();return e.jsxs("div",{className:`overflow-hidden rounded-lg border ${d}`,style:{borderColor:"rgba(148, 163, 184, 0.22)",background:"#0f172a",color:"#e2e8f0",...i},children:[e.jsxs("div",{className:"flex min-h-9 items-center justify-between gap-3 border-b px-3 py-1.5",style:{borderColor:"rgba(148, 163, 184, 0.18)",background:"#111827",color:"#94a3b8"},children:[e.jsx("span",{className:"min-w-0 truncate text-[11px] font-black uppercase tracking-[0.08em]",children:a}),e.jsx(sr,{value:b,title:"Copiar codigo",copiedTitle:"Codigo copiado",copiedLabel:c,onCopied:p,className:"h-7 min-w-[72px] px-2",style:{background:"#182235",border:"1px solid rgba(148, 163, 184, 0.28)",color:"#f8fafc"},children:s})]}),e.jsx("pre",{className:"m-0 overflow-x-auto p-3 text-xs leading-6",style:{background:"#0f172a",color:"#e2e8f0",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace'},children:e.jsx("code",{className:n?`language-${n}`:void 0,children:b})})]})}function Br(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}function lr({value:r,onChange:t,options:a,placeholder:n="Seleccionar…",emptyLabel:s,disabled:c=!1,className:d="",style:i,height:p=40,padding:b="0 10px",searchable:C=!0,minOptionsForSearch:k=6}){const[y,g]=o.useState(!1),[u,m]=o.useState(""),[h,E]=o.useState(-1),[j,z]=o.useState(!1),[H,N]=o.useState({}),$=o.useRef(null),T=o.useRef(null),P=o.useRef(null),L=o.useRef(null),M=C&&a.length>=k,_=a.find(f=>f.value===r)??null,I=M&&u.trim()?a.filter(f=>{var D;return f.label.toLowerCase().includes(u.toLowerCase())||((D=f.sublabel)==null?void 0:D.toLowerCase().includes(u.toLowerCase()))}):a,F=o.useCallback(()=>{const f=$.current;if(!f)return;const D=f.getBoundingClientRect(),G=M?272:212,J=window.innerHeight-D.bottom,Z=J<G&&D.top>J;N({position:"fixed",left:D.left,top:Z?void 0:D.bottom+4,bottom:Z?window.innerHeight-D.top+4:void 0,width:D.width,zIndex:9999})},[M]);o.useEffect(()=>z(!0),[]),o.useEffect(()=>{if(!y)return;function f(D){var J,Z;const G=D.target;!((J=$.current)!=null&&J.contains(G))&&!((Z=T.current)!=null&&Z.contains(G))&&(g(!1),m(""))}return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[y]),o.useEffect(()=>{y&&(E(-1),F(),M&&setTimeout(()=>{var f;return(f=P.current)==null?void 0:f.focus()},0))},[y,M,F]),o.useEffect(()=>{if(y)return window.addEventListener("resize",F),window.addEventListener("scroll",F,!0),()=>{window.removeEventListener("resize",F),window.removeEventListener("scroll",F,!0)}},[y,F]),o.useEffect(()=>{if(h<0||!L.current)return;const f=L.current.children[h];f==null||f.scrollIntoView({block:"nearest"})},[h]);const U=o.useCallback(f=>{t(f),g(!1),m("")},[t]);function V(f){if(!y){(f.key==="Enter"||f.key===" "||f.key==="ArrowDown")&&(f.preventDefault(),g(!0));return}f.key==="Escape"?(f.preventDefault(),g(!1),m("")):f.key==="ArrowDown"?(f.preventDefault(),E(D=>Math.min(D+1,I.length-1))):f.key==="ArrowUp"?(f.preventDefault(),E(D=>Math.max(D-1,s?-1:0))):f.key==="Enter"&&(f.preventDefault(),h===-1&&s?U(""):I[h]&&U(I[h].value))}const ee=e.jsxs("div",{ref:T,className:"rounded-xl shadow-xl overflow-hidden",style:{...H,background:"var(--bg-card)",border:"1px solid var(--border)"},children:[M&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{borderBottom:"1px solid var(--border)"},children:[e.jsx(w.HiMagnifyingGlass,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"var(--text-muted)"}}),e.jsx("input",{ref:P,value:u,onChange:f=>{m(f.target.value),E(-1)},placeholder:"Buscar…",className:"min-w-0 flex-1 text-sm bg-transparent outline-none",style:{color:"var(--text-main)"}}),u&&e.jsx("button",{type:"button",onMouseDown:f=>{f.preventDefault(),m("")},children:e.jsx(w.HiXMark,{className:"w-3.5 h-3.5",style:{color:"var(--text-muted)"}})})]}),e.jsxs("ul",{ref:L,role:"listbox",className:"overflow-y-auto",style:{maxHeight:M?220:180,scrollbarWidth:"thin",scrollbarColor:"var(--border) transparent",overscrollBehavior:"contain"},children:[s&&e.jsx("li",{role:"option","aria-selected":r==="",onMouseDown:f=>{f.preventDefault(),U("")},onMouseEnter:()=>E(-1),className:"flex items-center gap-2 px-3 py-2 cursor-pointer text-sm transition-colors",style:{background:h===-1?"var(--bg-hover)":"transparent",color:"var(--text-muted)",fontStyle:"italic"},children:s}),I.map((f,D)=>{const J=D===h,Z=f.value===r;return e.jsxs("li",{role:"option","aria-selected":Z,onMouseDown:re=>{re.preventDefault(),f.disabled||U(f.value)},onMouseEnter:()=>!f.disabled&&E(D),className:"flex items-center gap-2 px-3 py-2 cursor-pointer text-sm transition-colors",style:{background:J?"var(--bg-hover)":Z?"color-mix(in srgb, var(--primary) 6%, transparent)":"transparent",color:f.disabled?"var(--text-muted)":"var(--text-main)",cursor:f.disabled?"not-allowed":"pointer",boxShadow:Z?"inset 2px 0 0 var(--primary)":void 0},children:[f.color&&e.jsx("span",{className:"flex-shrink-0 w-2.5 h-2.5 rounded-full",style:{background:f.color}}),e.jsxs("span",{className:"min-w-0 flex flex-1 items-baseline gap-1 overflow-hidden",children:[e.jsx("span",{className:"truncate",children:f.label}),f.sublabel&&e.jsx("span",{className:"min-w-0 flex-shrink truncate",style:{color:"var(--text-muted)",fontSize:12},children:f.sublabel})]}),f.badge&&e.jsx("span",{className:"text-xs flex-shrink-0",style:{color:"var(--text-muted)"},children:f.badge})]},f.value)}),I.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:$,className:`relative ${d||"w-full"}`,style:i,onKeyDown:V,children:[e.jsxs("button",{type:"button",disabled:c,onClick:()=>!c&&g(f=>!f),className:"flex w-full items-center gap-2 rounded-lg text-left text-sm transition-colors focus:outline-none",style:{height:Br(p),padding:Br(b),background:"var(--bg-input)",color:_?"var(--text-main)":"var(--text-muted)",border:y?"1px solid var(--primary)":"1px solid var(--border)",opacity:c?.5:1,cursor:c?"not-allowed":"pointer"},"aria-haspopup":"listbox","aria-expanded":y,children:[(_==null?void 0:_.color)&&e.jsx("span",{className:"flex-shrink-0 w-2.5 h-2.5 rounded-full",style:{background:_.color}}),e.jsx("span",{className:"min-w-0 flex flex-1 items-baseline gap-1 overflow-hidden",children:_?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"truncate",children:_.label}),_.sublabel&&e.jsx("span",{className:"min-w-0 flex-shrink truncate",style:{color:"var(--text-muted)",fontSize:12},children:_.sublabel})]}):e.jsx("span",{className:"truncate",children:n})}),_&&s?e.jsx("span",{role:"button",tabIndex:-1,onMouseDown:f=>{f.preventDefault(),f.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(w.HiXMark,{className:"w-3 h-3"})}):e.jsx(w.HiChevronDown,{className:"flex-shrink-0 w-4 h-4 transition-transform",style:{color:"var(--text-muted)",transform:y?"rotate(180deg)":"rotate(0deg)"}})]}),y&&j&&$e.createPortal(ee,document.body)]})}function qe(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}function Kt({value:r,onChange:t,placeholder:a="Buscar...",className:n="",height:s=40,padding:c="0 10px 0 30px",iconLeft:d=10}){return e.jsxs("div",{className:`relative ${n}`,children:[e.jsx(w.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:qe(d)}}),e.jsx("input",{type:"text",value:r,onChange:i=>t(i.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:qe(s),padding:qe(c)}})]})}function Zt({value:r,onChange:t,options:a,placeholder:n,icon:s,className:c="",height:d=40,padding:i,iconLeft:p=10,searchable:b=!0}){const C=s?a.map((k,y)=>y===0&&!k.color?{...k,sublabel:k.sublabel??void 0}:k):a;return e.jsxs("div",{className:`relative ${c}`,children:[s&&e.jsx("span",{className:"pointer-events-none absolute top-1/2 z-10 -translate-y-1/2 text-[var(--text-muted)]",style:{left:qe(p)},children:s}),e.jsx(lr,{value:r,onChange:t,options:C,placeholder:n,searchable:b,minOptionsForSearch:5,height:d,padding:i??(s?"0 10px 0 30px":"0 10px"),className:"[&>button]:text-sm [&>button]:[background:var(--bg-card)]"})]})}const Jt={sm:"24rem",md:"28rem",lg:"32rem",xl:"40rem","2xl":"48rem","4xl":"56rem","5xl":"64rem"},Ge=180;function Ar({open:r,onClose:t,title:a,subtitle:n,leadingIcon:s,headerActions:c,footer:d,children:i,size:p="md",maxWidth:b,zIndex:C=1e3,closeOnBackdrop:k=!0,closeOnEscape:y=!0,showCloseButton:g=!0,placement:u="center",bodyClassName:m="px-6 py-5",panelClassName:h="",backdropClassName:E="bg-black/50 backdrop-blur-sm",contentClassName:j="p-4",ariaLabel:z,frameless:H=!1}){const[N,$]=o.useState(!1),[T,P]=o.useState(!1),L=o.useRef(null);if(o.useEffect(()=>(r?(L.current&&clearTimeout(L.current),$(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>P(!0)))):(P(!1),L.current=setTimeout(()=>$(!1),Ge+40)),()=>{L.current&&clearTimeout(L.current)}),[r]),o.useEffect(()=>{if(r)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[r]),o.useEffect(()=>{if(!r||!y)return;const V=ee=>{ee.key==="Escape"&&t()};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[y,t,r]),!N)return null;const M=a||n||s||c||g,_=b??Jt[p],I=u==="bottom-mobile"?"items-end sm:items-center justify-center p-0 sm:p-4":"items-center justify-center",F=u==="bottom-mobile"?"rounded-t-2xl sm:rounded-2xl":"rounded-2xl",U=T?"translateY(0) scale(1)":u==="bottom-mobile"?"translateY(16px) scale(0.98)":"translateY(10px) scale(0.96)";return $e.createPortal(e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":z??a,className:`fixed inset-0 flex ${I} ${j}`,style:{zIndex:C},children:[e.jsx("div",{className:`absolute inset-0 ${E}`,onClick:k?t:void 0,style:{opacity:T?1:0,transition:`opacity ${Ge}ms ease`}}),e.jsxs("div",{className:`relative z-10 flex max-h-[92dvh] w-full flex-col overflow-hidden ${H?"shadow-none":"shadow-2xl"} ${F} ${h}`,style:{maxWidth:_,background:H?"transparent":"var(--bg-card)",border:H?"none":"1px solid var(--border)",opacity:T?1:0,transform:U,transition:`opacity ${Ge}ms ease, transform ${Ge}ms ease`},onClick:V=>V.stopPropagation(),children:[M&&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:[s&&e.jsx("div",{className:"flex-shrink-0",children:s}),(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:[c,g&&e.jsx(de,{variant:"icon",onClick:t,title:"Cerrar",children:e.jsx(w.HiXMark,{className:"h-5 w-5"})})]})]}),e.jsx("div",{className:`min-h-0 flex-1 overflow-y-auto ${m}`,children:i}),d&&e.jsx("div",{className:"flex flex-shrink-0 justify-end gap-2 px-6 py-4",style:{borderTop:"1px solid var(--border)"},children:d})]})]}),document.body)}const Qt={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 Rt({open:r,title:t,description:a,confirmLabel:n="Confirmar",cancelLabel:s="Cancelar",variant:c="danger",onConfirm:d,onCancel:i}){const p=Qt[c];return e.jsxs(Ar,{open:r,onClose:i,size:"sm",zIndex:9998,showCloseButton:!1,bodyClassName:"p-6",panelClassName:"px-1",ariaLabel:t,children:[e.jsx(de,{variant:"icon",onClick:i,className:"absolute right-3 top-3 h-7 w-7 hover:opacity-70",style:{color:"var(--text-muted)"},"aria-label":"Cancelar",children:e.jsx(w.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:p.iconBg},children:e.jsx(w.HiExclamationTriangle,{className:"h-5 w-5",style:{color:p.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(de,{variant:"secondary",onClick:i,className:"flex-1",style:{background:"var(--bg-input)"},children:s}),e.jsx(de,{variant:"danger",onClick:d,className:"flex-1",style:{background:p.btnBg,color:p.btnColor,borderColor:"transparent"},children:n})]})]})}function ea(r,t){const a=typeof r=="function"?r():r;return t?t(a):a}function ra({url:r,resolveUrl:t,title:a="Copiar link",copiedTitle:n="Link copiado",icon:s=e.jsx(w.HiLink,{className:"h-3.5 w-3.5"}),...c}){return e.jsx(sr,{...c,value:()=>ea(r,t),title:a,copiedTitle:n,icon:s})}const ta="[&_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",aa=[];function Me(r){if(!r)return 150;const t=parseInt(r,10);return isNaN(t)||t<=0?150:t}function De(r,t){const a=r.minWidth??80,n=r.maxWidth??1/0;return Math.min(n,Math.max(a,t))}function na(r,t){if(t<=7)return Array.from({length:t},(n,s)=>s+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 Le(r,t){var d;const a=new Set(t.filter(i=>i.hideable!==!1).map(i=>i.key)),n=Array.from(new Set(r??[])).filter(i=>a.has(i));if(t.filter(i=>!n.includes(i.key)).length>0)return n;const c=(d=t.find(i=>i.hideable!==!1))==null?void 0:d.key;return c?n.filter(i=>i!==c):[]}function Or({children:r,className:t="",style:a}){return e.jsx(Ue,{onlyWhenOverflow:!0,className:t,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",...a},children:r})}function oa({columns:r,data:t,getRowId:a,loading:n=!1,skeletonRows:s=8,emptyIcon:c,emptyText:d="Sin resultados",initialEmptyDelay:i=450,onRowClick:p,selected:b,onToggleOne:C,onToggleAll:k,highlightSelected:y=!0,rowClassName:g,getRowCategory:u,stickyHeader:m=!0,pageSize:h=25,pageSizeOptions:E=[25,50,100],pageSizeSelectWidth:j=62,pageSizeSelectHeight:z=30,pageSizeSelectPadding:H="0 7px",totalRows:N,page:$,onPageChange:T,onPageSizeChange:P,storageKey:L,stickyFirstColumn:M=!1,bottomOffset:_=0,compact:I=!0,restrictHeight:F=!0,maxHeight:U,minTableWidth:V,enableColumnVisibility:ee=!0,hiddenColumnKeys:f,defaultHiddenColumnKeys:D=aa,onHiddenColumnKeysChange:G,columnVisibilityLabel:J="Columnas"}){var mt;const Z=r.map(l=>l.key).join(","),[re,he]=o.useState(!L),x=o.useRef(null),K=o.useRef(!L),ae=f!==void 0,[ne,oe]=o.useState(()=>Le(D,r)),A=Le(ae?f:ne,r),[X,Q]=o.useState(!1),[ie,ue]=o.useState(null),[Y,Se]=o.useState({}),je=o.useRef(null),Oe=o.useRef(null),[He,We]=o.useState(t.length>0||n||i===!1),ce=(l,v)=>50+(l*17+v*13+7)%40,ye=o.useRef(null),[Ke,Ze]=o.useState(void 0),[Fe,dr]=o.useState(0),[Ie,O]=o.useState(!1);o.useEffect(()=>{function l(){O(window.innerWidth<640)}if(!F||U!==void 0)return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l);const S=h!==!1?32:0,W=12;function q(){if(l(),!ye.current)return;const te=ye.current.getBoundingClientRect().top;Ze(Math.max(120,window.innerHeight-te-S-W-_))}return q(),window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[n,h,_,F,U]);const fe=F?U??Ke:void 0;o.useEffect(()=>{const l=ye.current;if(!l)return;const v=()=>dr(l.clientWidth);if(v(),typeof ResizeObserver>"u")return window.addEventListener("resize",v),()=>window.removeEventListener("resize",v);const S=new ResizeObserver(v);return S.observe(l),()=>S.disconnect()},[n,re,t.length]),o.useEffect(()=>{if(i===!1||n||t.length>0){We(!0);return}if(He)return;const l=window.setTimeout(()=>{We(!0)},i);return()=>window.clearTimeout(l)},[t.length,i,He,n]);const[se,ve]=o.useState(()=>r.map(l=>l.key)),[le,Ce]=o.useState(()=>Object.fromEntries(r.map(l=>[l.key,De(l,Me(l.width))])));o.useEffect(()=>{const l=r.map(S=>S.key);if(!L){ve(l),ae||oe(Le(D,r)),K.current=!1,he(!0);return}let v=!1;return K.current=!1,he(!1),fetch(`/api/user/preferences/datatables?key=${encodeURIComponent(L)}`,{cache:"no-store"}).then(S=>S.ok?S.json():null).then(S=>{var tr,vt,xt;if(v)return;const W=(tr=S==null?void 0:S.settings)==null?void 0:tr.columnOrder,q=Array.isArray(W)?W.filter(me=>l.includes(me)):[],te=l.filter(me=>!q.includes(me)),pe=q.length>0?[...q,...te]:l,Ae=Object.fromEntries(r.map(me=>[me.key,De(me,Me(me.width))])),R=((vt=S==null?void 0:S.settings)==null?void 0:vt.columnWidths)??{},be=Object.fromEntries(r.map(me=>[me.key,De(me,R[me.key]??Ae[me.key])])),rr=Le(((xt=S==null?void 0:S.settings)==null?void 0:xt.hiddenColumnKeys)??D,r);ve(pe),Ce(be),ae||oe(rr),x.current=JSON.stringify({columnOrder:pe,columnWidths:be,hiddenColumnKeys:rr}),K.current=!0}).catch(()=>{if(!v){ve(l);const S=Object.fromEntries(r.map(q=>[q.key,De(q,Me(q.width))]));Ce(S);const W=Le(D,r);ae||oe(W),x.current=JSON.stringify({columnOrder:l,columnWidths:S,hiddenColumnKeys:W}),K.current=!0}}).finally(()=>{v||he(!0)}),()=>{v=!0}},[L,Z,r,D,ae]),o.useEffect(()=>{if(!L||!re||!K.current)return;const l={columnOrder:se,columnWidths:le,hiddenColumnKeys:A},v=JSON.stringify(l);if(v===x.current)return;const S=window.setTimeout(()=>{fetch("/api/user/preferences/datatables",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:L,settings:l})}).then(W=>{W.ok&&(x.current=v)}).catch(()=>{})},300);return()=>window.clearTimeout(S)},[se,le,A,L,re]),o.useEffect(()=>{ve(l=>{const v=r.map(q=>q.key),S=l.filter(q=>v.includes(q)),W=v.filter(q=>!S.includes(q));return[...S,...W]})},[Z,r]);const Te=se.map(l=>r.find(v=>v.key===l)).filter(l=>!!l),we=Te.filter(l=>!A.includes(l.key));function rt(l){const v=Le(l,r);ae||oe(v),G==null||G(v)}function mn(l){rt(A.includes(l)?A.filter(v=>v!==l):[...A,l])}function vn(){rt([])}const ur=o.useCallback((l=Oe.current)=>{if(!l)return;const v=l.getBoundingClientRect(),S=256,W=Math.min(Math.max(8,v.right-S),window.innerWidth-S-8),q=window.innerHeight-v.bottom,te=q<288&&v.top>q?void 0:v.bottom+6,pe=te===void 0?window.innerHeight-v.top+6:void 0;Se({position:"fixed",zIndex:9999,left:W,top:te,bottom:pe,width:S})},[]);function xn(l,v){l.preventDefault(),l.stopPropagation();const S=Oe.current===l.currentTarget&&ie===v;if(X&&S){Q(!1),ue(null);return}Oe.current=l.currentTarget,ue(v),ur(l.currentTarget),Q(!0)}o.useEffect(()=>{Ce(l=>{const v=Object.fromEntries(r.map(S=>[S.key,De(S,Me(S.width))]));return Object.fromEntries(r.map(S=>[S.key,De(S,l[S.key]??v[S.key])]))})},[Z,r]),o.useEffect(()=>{ae||oe(l=>Le(l,r))},[Z,r,ae]),o.useEffect(()=>{function l(W){var te,pe;const q=W.target;!((te=je.current)!=null&&te.contains(q))&&!((pe=Oe.current)!=null&&pe.contains(q))&&(Q(!1),ue(null))}function v(W){W.key==="Escape"&&(Q(!1),ue(null))}function S(){ur()}return X&&(document.addEventListener("mousedown",l),window.addEventListener("keydown",v),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0)),()=>{document.removeEventListener("mousedown",l),window.removeEventListener("keydown",v),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[X,ur]);const Je=o.useRef(null);o.useEffect(()=>{function l(S){const W=Je.current;if(!W)return;const q=S.clientX-W.startX,te=r.find(pe=>pe.key===W.colKey);te&&Ce(pe=>({...pe,[W.colKey]:De(te,W.startWidth+q)}))}function v(){Je.current&&(Je.current=null,document.body.style.cursor="",document.body.style.userSelect="")}return document.addEventListener("pointermove",l),document.addEventListener("pointerup",v),()=>{document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",v)}},[r]);const Qe=o.useRef(null),[tt,fr]=o.useState(null);function gn(l,v){Qe.current=se.indexOf(l),v.dataTransfer.effectAllowed="move"}function yn(l,v){v.preventDefault(),v.dataTransfer.dropEffect="move";const S=se.indexOf(l);tt!==S&&fr(S)}function wn(l,v){v.preventDefault();const S=Qe.current,W=se.indexOf(l);S!==null&&S!==W&&ve(q=>{const te=[...q],[pe]=te.splice(S,1);return te.splice(W,0,pe),te}),Qe.current=null,fr(null)}function Nn(){Qe.current=null,fr(null)}const[xe,at]=o.useState(null);function kn(l){l.sortKey&&at(v=>(v==null?void 0:v.key)===l.key?{key:l.key,dir:v.dir==="asc"?"desc":"asc"}:{key:l.key,dir:"asc"})}const[Sn,pr]=o.useState(1),[nt,Cn]=o.useState(h===!1?0:h);o.useEffect(()=>{pr(1)},[t]);const ze=!!(T&&P),Be=h!==!1,ge=ze?$??1:Sn,Ee=ze||Be?nt:t.length,Ne=!!b&&!!C&&!!k,br=Ne?40:0,En=Ne&&t.length>0&&b.size===t.length,$n=Ne&&b.size>0&&b.size<t.length,hr=o.useMemo(()=>{if(!xe)return t;const l=r.find(v=>v.key===xe.key&&v.sortKey);return l!=null&&l.sortKey?[...t].sort((v,S)=>{const W=v[l.sortKey],q=S[l.sortKey],te=W===q?0:W==null?1:q==null||W<q?-1:1;return xe.dir==="asc"?te:-te}):t},[t,xe,r]),ot=o.useMemo(()=>{if(ze||!Be)return hr;const l=(ge-1)*Ee;return hr.slice(l,l+Ee)},[hr,ze,Be,ge,Ee]),Pe=N??t.length,mr=Be?Math.max(1,Math.ceil(Pe/Ee)):1,st=Be&&Pe>Ee,Mn=Be?(ge-1)*Ee+1:1,Dn=Be?Math.min(ge*Ee,Pe):Pe;function vr(l){const v=Math.max(1,Math.min(l,mr));ze?T(v):pr(v)}function Ln(l){Cn(l),ze?(P(l),T(1)):pr(1),P&&P(l)}const lt=l=>l==="center"?"text-center":l==="right"?"text-right":"text-left",Hn="color-mix(in srgb, var(--primary) 6%, var(--bg-card))",xr=we.reduce((l,v)=>l+(le[v.key]??Me(v.width)),Ne?40:0),it=typeof V=="number"?V:typeof V=="string"?Number(((mt=V.match(/^(\d+(?:\.\d+)?)px$/))==null?void 0:mt[1])??NaN):NaN,Re=Number.isFinite(it)?Math.max(xr,it,Fe):Math.max(xr,Fe),ct=V??Re,Tn=we.length>0?Math.max(0,Re-xr)/we.length:0,er=`${Ne?"40px ":""}${we.map(l=>`${(le[l.key]??Me(l.width))+Tn}px`).join(" ")}`;o.useEffect(()=>{xe&&A.includes(xe.key)&&at(null)},[A,xe]);function dt(l){return l?typeof l=="string"?{key:l,label:l}:l:null}const ut=()=>e.jsxs("div",{role:"row",className:"grid",style:{gridTemplateColumns:er,background:"color-mix(in srgb, var(--bg-input) 72%, transparent)"},children:[Ne&&e.jsx("div",{role:"columnheader",className:`${I?"px-2 py-1.5":"px-3 py-2.5"} w-10`,style:M?{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:En,ref:l=>{l&&(l.indeterminate=$n)},onChange:k,className:"rounded cursor-pointer accent-[var(--primary)]"})}),we.map((l,v)=>{const S=(xe==null?void 0:xe.key)===l.key,W=!!l.sortKey,q=M&&!Ie&&v===0,te=tt===v,Ae=(le[l.key]??Me(l.width))<120;return e.jsxs("div",{role:"columnheader",className:`group select-none ${Ae?"text-left":lt(l.align)}`,style:{...q?{position:"sticky",left:br,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:S?"var(--primary)":"var(--text-muted)",whiteSpace:"nowrap",transition:"color 0.15s",borderLeft:te?"2px solid var(--primary)":"2px solid transparent",cursor:W?"pointer":"default",padding:I?"5px 20px 5px 12px":"7px 24px 7px 12px"},onDragOver:R=>yn(l.key,R),onDrop:R=>wn(l.key,R),onClick:W?()=>kn(l):void 0,children:[e.jsx("span",{draggable:!0,onDragStart:R=>{R.stopPropagation(),gn(l.key,R)},onDragEnd:R=>{R.stopPropagation(),Nn()},onClick:R=>R.stopPropagation(),title:"Arrastrar para reordenar",className:`absolute left-2 top-1/2 inline-flex h-5 w-5 -translate-x-1/2 -translate-y-1/2 scale-75 items-center justify-center rounded-[1px] border bg-[var(--bg-card)] text-[var(--text-muted)] opacity-0 shadow-sm transition-[opacity,transform,background-color,border-color,color] duration-150 hover:border-[var(--primary)] hover:bg-[color-mix(in_srgb,var(--primary)_14%,var(--bg-card))] hover:text-[var(--primary)] group-hover:scale-100 group-hover:opacity-100 ${te?"scale-100 border-[var(--primary)] bg-[color-mix(in_srgb,var(--primary)_14%,var(--bg-card))] text-[var(--primary)] opacity-100":"border-[var(--border)]"}`,style:{cursor:"grab",zIndex:5},children:e.jsx(gt.MdDragIndicator,{size:14})}),e.jsx(Or,{className:"inline-block max-w-full align-middle",style:{width:"100%",textAlign:Ae?"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}),W&&e.jsx("span",{className:"flex-shrink-0 opacity-60",children:S?xe.dir==="asc"?e.jsx(w.HiChevronUp,{className:"w-3 h-3"}):e.jsx(w.HiChevronDown,{className:"w-3 h-3"}):e.jsx(w.HiChevronUpDown,{className:"w-3 h-3 opacity-40"})})]})}),ee&&e.jsx("button",{type:"button","aria-haspopup":"menu","aria-expanded":X&&ie===l.key,"aria-label":J,title:J,onClick:R=>xn(R,l.key),className:`absolute right-3 top-1/2 inline-flex h-5 w-5 -translate-y-1/2 scale-75 items-center justify-center rounded-[1px] border bg-[var(--bg-card)] text-[var(--text-muted)] opacity-0 shadow-sm transition-[opacity,transform,background-color,border-color,color] duration-150 hover:border-[var(--primary)] hover:bg-[color-mix(in_srgb,var(--primary)_14%,var(--bg-card))] hover:text-[var(--primary)] focus:scale-100 focus:border-[var(--primary)] focus:bg-[color-mix(in_srgb,var(--primary)_14%,var(--bg-card))] focus:text-[var(--primary)] focus:opacity-100 group-hover:scale-100 group-hover:opacity-100 ${X&&ie===l.key?"scale-100 border-[var(--primary)] bg-[color-mix(in_srgb,var(--primary)_14%,var(--bg-card))] text-[var(--primary)] opacity-100":"border-[var(--border)]"}`,style:{zIndex:4},children:e.jsx(w.HiEllipsisVertical,{className:"h-3.5 w-3.5"})}),e.jsx("span",{role:"separator","aria-orientation":"vertical",title:"Arrastrar para redimensionar",onPointerDown:R=>{R.preventDefault(),R.stopPropagation(),Je.current={colKey:l.key,startX:R.clientX,startWidth:le[l.key]??150},document.body.style.cursor="col-resize",document.body.style.userSelect="none"},onClick:R=>R.stopPropagation(),className:"absolute top-0 flex h-full items-center justify-center opacity-0 transition-opacity duration-150 group-hover:opacity-100",style:{right:0,width:8,cursor:"col-resize",zIndex:6},children:e.jsx("span",{style:{width:3,height:"calc(100% - 8px)",borderRadius:2,background:"var(--primary)",display:"block"}})})]},l.key)})]}),ft=()=>{if(!ee||!X||typeof document>"u")return null;const l=A.length;return $e.createPortal(e.jsxs("div",{ref:je,role:"menu",className:"overflow-hidden rounded-lg border p-1 shadow-xl",style:{...Y,borderColor:"var(--border)",background:"var(--bg-card)"},children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-[var(--border)] px-2 py-1.5",children:[e.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase text-[var(--text-muted)]",children:l>0?`${we.length} de ${r.length} visibles`:`${r.length} visibles`}),e.jsx("button",{type:"button",onClick:vn,disabled:l===0,className:"rounded px-1.5 py-0.5 text-xs font-medium text-[var(--primary)] transition-colors hover:bg-[var(--bg-input)] disabled:opacity-40",children:"Mostrar todas"})]}),e.jsx("div",{className:"max-h-72 overflow-auto py-1",children:Te.map(v=>{const S=!A.includes(v.key),q=!(v.hideable!==!1)||S&&we.length<=1;return e.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":S,disabled:q,onClick:()=>mn(v.key),className:"flex w-full min-w-0 items-center gap-2 rounded-md px-2.5 py-1.5 text-left transition-colors hover:bg-[var(--bg-input)] disabled:cursor-not-allowed disabled:opacity-50",style:{color:"var(--text-main)"},children:[e.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded border",style:{borderColor:S?"var(--primary)":"var(--border)",background:S?"var(--primary)":"var(--bg-input)",color:"var(--primary-fg)"},children:S&&e.jsx(w.HiCheck,{className:"h-3 w-3"})}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:v.header})]},v.key)})})]}),document.body)},pt=()=>{if(!st||n)return null;const l=na(ge,mr);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:Pe===0?"0 filas":`${Mn}–${Dn} de ${Pe}`}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{style:{color:"var(--text-muted)"},children:"Filas:"}),e.jsx(lr,{value:String(Ee),onChange:v=>Ln(Number(v)),options:E.map(v=>({value:String(v),label:String(v)})),placeholder:"Filas",searchable:!1,height:z,padding:H,className:"shrink-0 [&>button]:rounded-md [&>button]:text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",style:{width:j}})]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-0.5",children:[e.jsx("button",{disabled:ge<=1,onClick:()=>vr(ge-1),className:"rounded p-0.5 transition-colors disabled:opacity-30",style:{color:"var(--text-muted)",background:"transparent"},children:e.jsx(w.HiChevronLeft,{className:"h-3.5 w-3.5"})}),l.map((v,S)=>v==="..."?e.jsx("span",{className:"px-1",style:{color:"var(--text-muted)"},children:"…"},`e${S}`):e.jsx("button",{onClick:()=>vr(v),className:"h-5 w-5 rounded text-[11px] font-medium transition-colors",style:{background:v===ge?"var(--primary)":"transparent",color:v===ge?"var(--primary-fg)":"var(--text-muted)"},children:v},v)),e.jsx("button",{disabled:ge>=mr,onClick:()=>vr(ge+1),className:"rounded p-0.5 transition-colors disabled:opacity-30",style:{color:"var(--text-muted)",background:"transparent"},children:e.jsx(w.HiChevronRight,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{"aria-hidden":"true"})]})},bt=()=>e.jsx("div",{className:"w-full min-w-0 max-w-full flex flex-col rounded-xl overflow-hidden",style:{border:"1px solid var(--border)"},children:e.jsxs("div",{ref:ye,className:"min-w-0 max-w-full",style:{maxHeight:fe,background:"var(--bg-card)"},children:[e.jsx("div",{className:"border-b px-3 py-2",style:{borderColor:"var(--border)",background:"color-mix(in srgb, var(--bg-input) 72%, transparent)"},children:e.jsx("div",{className:"h-3.5 w-40 animate-pulse rounded-full",style:{background:"var(--border)"}})}),e.jsx("div",{className:"space-y-2 p-3",children:Array.from({length:Math.min(6,s)}).map((l,v)=>e.jsx("div",{className:"grid grid-cols-[1.2fr_1fr_0.8fr_0.7fr] gap-3",children:Array.from({length:4}).map((S,W)=>e.jsx("div",{className:"h-3.5 animate-pulse rounded-full",style:{background:"var(--border)",width:`${ce(v,W)}%`,minWidth:32}},W))},v))})]})}),ht=`min-w-0 max-w-full overflow-hidden ${st?"rounded-t-xl":"rounded-xl"}`;return L&&!re||!n&&t.length===0&&!He?bt():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:[ft(),e.jsx("div",{ref:ye,className:ht,children:e.jsx(yr.OverlayScrollbarsComponent,{options:{scrollbars:{autoHide:"leave",autoHideDelay:200}},className:"w-full",style:{maxHeight:fe,maxWidth:"100%"},defer:!0,children:e.jsxs("div",{role:"table",className:"text-sm",style:{width:Re,minWidth:ct},children:[e.jsx("div",{role:"rowgroup",style:m?{position:"sticky",top:0,zIndex:10,backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"}:void 0,children:ut()}),e.jsx("div",{role:"rowgroup",children:Array.from({length:s}).map((l,v)=>e.jsxs("div",{role:"row",className:"grid",style:{gridTemplateColumns:er},children:[Ne&&e.jsx("div",{role:"cell",className:`${I?"px-2 py-1.5":"px-3 py-2"} w-10`,style:{borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)"}}),we.map((S,W)=>{const q=M&&!Ie&&W===0;return e.jsx("div",{role:"cell",className:I?"px-2 py-1.5":"px-3 py-2",style:q?{position:"sticky",left:br,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:`${ce(v,W)}%`,minWidth:32}})},S.key)})]},v))})]})})}),pt()]}):!n&&t.length===0?e.jsxs("div",{className:"flex min-h-[220px] flex-col items-center justify-center gap-3 rounded-xl border px-6 py-14 text-center",style:{borderColor:"var(--border)",background:"linear-gradient(180deg, color-mix(in srgb, var(--bg-input) 58%, transparent), var(--bg-card))"},children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full border",style:{borderColor:"color-mix(in srgb, var(--primary) 24%, var(--border))",background:"color-mix(in srgb, var(--primary) 8%, var(--bg-card))",color:"var(--primary)"},children:c??e.jsx(w.HiMagnifyingGlass,{className:"h-5 w-5"})}),e.jsx("p",{className:"max-w-sm text-sm font-medium",style:{color:"var(--text-main)"},children:d}),e.jsx("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Ajusta la busqueda o cambia los filtros para ver mas informacion."})]}):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:[ft(),e.jsx("div",{ref:ye,className:ht,children:e.jsx(yr.OverlayScrollbarsComponent,{options:{scrollbars:{autoHide:"leave",autoHideDelay:200}},className:"w-full",style:{maxHeight:fe,maxWidth:"100%"},defer:!0,children:e.jsxs("div",{role:"table",className:"text-sm",style:{width:Re,minWidth:ct},children:[e.jsx("div",{role:"rowgroup",style:m?{position:"sticky",top:0,zIndex:10,backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"}:void 0,children:ut()}),e.jsx("div",{role:"rowgroup",children:ot.map((l,v)=>{const S=a(l),W=dt(u==null?void 0:u(l)),q=v>0?dt(u==null?void 0:u(ot[v-1])):null,te=W&&W.key!==(q==null?void 0:q.key),pe=Ne&&b.has(S),Ae=!!p,R=pe&&y?"color-mix(in srgb, var(--primary) 8%, var(--bg-card))":v%2===1?"color-mix(in srgb, var(--bg-input) 50%, var(--bg-card))":"var(--bg-card)";return e.jsxs(o.Fragment,{children:[te&&e.jsx("div",{role:"row",className:`grid ${W.className??""}`,style:{gridTemplateColumns:er},children:e.jsx("div",{role:"cell",className:I?"px-2 py-2":"px-3 py-3",style:{gridColumn:"1 / -1",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:W.label}),W.description&&e.jsx("div",{className:"mt-0.5 truncate text-xs text-[var(--text-muted)]",children:W.description})]})})})}),e.jsxs("div",{role:"row",onClick:Ae?()=>p(l):void 0,className:`grid transition-colors ${Ae?"cursor-pointer":""} ${g?g(l):""}`,style:{gridTemplateColumns:er,"--dt-row-bg":R,"--dt-sticky-bg":R,background:"var(--dt-row-bg)"},onMouseEnter:be=>{pe||(be.currentTarget.style.setProperty("--dt-row-bg","var(--bg-hover)"),be.currentTarget.style.setProperty("--dt-sticky-bg",Hn))},onMouseLeave:be=>{be.currentTarget.style.setProperty("--dt-row-bg",R),be.currentTarget.style.setProperty("--dt-sticky-bg",R)},children:[Ne&&e.jsx("div",{role:"cell",className:`${I?"px-2 py-1.5":"px-3 py-2"} w-10`,style:M?{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:be=>{be.stopPropagation(),C(S)},children:e.jsx("input",{type:"checkbox",checked:pe,onClick:be=>be.stopPropagation(),onChange:()=>C(S),className:"rounded cursor-pointer accent-[var(--primary)]"})}),we.map((be,rr)=>{const tr=M&&!Ie&&rr===0;return e.jsx("div",{role:"cell",className:`${I?"px-2 py-1.5":"px-3 py-2"} ${ta} ${lt(be.align)} ${be.className??""}`,style:{overflow:"hidden",whiteSpace:"nowrap",...tr?{position:"sticky",left:br,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(Or,{children:be.cell(l)})},be.key)})]})]},S)})})]})})}),pt()]})}function _e(r){return r?new Date(`${r}T12:00:00`):void 0}function Ir(r){return r.toISOString().slice(0,10)}function sa({calendarMonth:r,displayIndex:t}){const{previousMonth:a,nextMonth:n,goToMonth:s,months:c,labels:d,formatters:i}=wr.useDayPicker(),p=!!a&&t===0,b=!!n&&t===c.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:i.formatCaption(r.date)}),e.jsx("button",{type:"button","aria-label":d.labelPrevious(a),onClick:()=>a&&s(a),disabled:!p,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:p?1:.45,cursor:p?"pointer":"not-allowed"},children:e.jsx(w.HiChevronLeft,{size:16})}),e.jsx("button",{type:"button","aria-label":d.labelNext(n),onClick:()=>n&&s(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(w.HiChevronRight,{size:16})})]})}function la(r){return r.charAt(0).toUpperCase()+r.slice(1)}function ia({startDate:r,endDate:t,onChange:a,minDate:n,viewMonth:s,numberOfMonths:c=1,showSummary:d=!0,startLabel:i="Inicio",endLabel:p="Regreso"}){const b={from:_e(r),to:_e(t)},C=_e(n),[k,y]=o.useState(_e(s||r));return o.useEffect(()=>{y(_e(s||r))},[s,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(wr.DayPicker,{mode:"range",selected:b,month:k,onMonthChange:y,onSelect:g=>{const u=g!=null&&g.from?Ir(g.from):r,m=g!=null&&g.to?Ir(g.to):"";a({startDate:u,endDate:m})},numberOfMonths:c,hideNavigation:!0,disabled:C?{before:C}:void 0,showOutsideDays:!1,components:{MonthCaption:sa},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:g=>la(new Intl.DateTimeFormat("es-MX",{month:"long",year:"numeric"}).format(g)),formatWeekdayName:g=>new Intl.DateTimeFormat("es-MX",{weekday:"short"}).format(g)},labels:{labelMonthDropdown:()=>"Mes",labelYearDropdown:()=>"Año"}})}),d&&r&&e.jsxs("div",{style:{marginTop:8,fontSize:12,color:"var(--text-muted)",display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsxs("span",{children:[i,":"," ",e.jsx("strong",{style:{color:"var(--text-main)"},children:r})]}),t&&e.jsxs("span",{children:[p,":"," ",e.jsx("strong",{style:{color:"var(--text-main)"},children:t})]})]})]})}function ca(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}function da({trigger:r,items:t,align:a="end",width:n=220,disabled:s=!1,className:c="",menuClassName:d="",onOpenChange:i}){const[p,b]=o.useState(!1),[C,k]=o.useState(!1),[y,g]=o.useState({}),u=o.useRef(null),m=o.useRef(null),h=o.useCallback(N=>{b(N),i==null||i(N)},[i]),E=o.useCallback(()=>{const N=u.current;if(!N)return;const $=N.getBoundingClientRect(),T=typeof n=="number"?n:$.width,P=typeof n=="number"?n:Math.max($.width,180),L=a==="end"?Math.max(8,$.right-P):Math.min($.left,window.innerWidth-P-8),M=window.innerHeight-$.bottom,_=M<240&&$.top>M?void 0:$.bottom+6,I=_===void 0?window.innerHeight-$.top+6:void 0;g({position:"fixed",zIndex:9999,left:L,top:_,bottom:I,width:ca(typeof n=="number"?T:n)})},[a,n]);o.useEffect(()=>k(!0),[]),o.useEffect(()=>{if(!p)return;E();const N=T=>{var L,M;const P=T.target;!((L=u.current)!=null&&L.contains(P))&&!((M=m.current)!=null&&M.contains(P))&&h(!1)},$=T=>{T.key==="Escape"&&h(!1)};return document.addEventListener("mousedown",N),window.addEventListener("keydown",$),window.addEventListener("resize",E),window.addEventListener("scroll",E,!0),()=>{document.removeEventListener("mousedown",N),window.removeEventListener("keydown",$),window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0)}},[p,h,E]);const j=N=>{s||(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),h(!p))},z=o.isValidElement(r)?o.cloneElement(r,{onClick:()=>!s&&h(!p)}):r,H=p?e.jsx("div",{ref:m,role:"menu",className:`overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-1 shadow-xl ${d}`,style:y,children:t.map(N=>e.jsxs("div",{children:[N.separatorBefore&&e.jsx("div",{className:"my-1 border-t border-[var(--border)]"}),e.jsxs("button",{type:"button",role:"menuitem",disabled:N.disabled,onClick:()=>{var $;N.disabled||(($=N.onSelect)==null||$.call(N),h(!1))},className:"flex w-full min-w-0 items-start gap-2 rounded-md px-2.5 py-1.5 text-left transition-colors hover:bg-[var(--bg-input)] disabled:cursor-not-allowed disabled:opacity-50",style:{color:N.danger?"var(--danger)":"var(--text-main)"},children:[N.icon&&e.jsx("span",{className:"mt-0.5 shrink-0",children:N.icon}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-sm font-medium",children:N.label}),N.description&&e.jsx("span",{className:"block truncate text-xs text-[var(--text-muted)]",children:N.description})]})]})]},N.id))}):null;return e.jsxs("span",{ref:u,role:"button",tabIndex:s?-1:0,"aria-haspopup":"menu","aria-expanded":p,onKeyDown:j,className:`inline-flex ${s?"pointer-events-none opacity-60":""} ${c}`,children:[z,C&&H?$e.createPortal(H,document.body):null]})}const ua=180;function fa({open:r,onClose:t,title:a,subtitle:n,leadingIcon:s,confirmLabel:c="Guardar",onConfirm:d,loading:i=!1,confirmDisabled:p=!1,headerActions:b,bodyClassName:C="flex-1 overflow-y-auto px-6 py-5",width:k=440,hasUnsavedChanges:y=!1,unsavedChangesTitle:g="Descartar cambios",unsavedChangesDescription:u="Hay cambios sin guardar. Si cierras el drawer se perderán.",unsavedChangesConfirmLabel:m="Descartar",unsavedChangesCancelLabel:h="Seguir editando",onDiscardChanges:E,children:j}){const[z,H]=o.useState(!1),[N,$]=o.useState(!1),[T,P]=o.useState(!1),L=o.useCallback(()=>{$(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>P(!0))})},[]),M=o.useCallback(()=>{P(!1),window.setTimeout(()=>$(!1),ua)},[]),_=o.useCallback(()=>{if(y){L();return}t()},[y,t,L]),I=o.useCallback(()=>{P(!1),$(!1),E==null||E(),t()},[t,E]);return o.useEffect(()=>{H(!0)},[]),o.useEffect(()=>(document.body.style.overflow=r?"hidden":"",r||(P(!1),$(!1)),()=>{document.body.style.overflow=""}),[r]),o.useEffect(()=>{if(!r)return;const F=U=>{if(U.key==="Escape"){if(N){M();return}_()}};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[M,N,r,_]),z?$e.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:_}),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, ${k}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(de,{variant:"icon",onClick:_,title:"Cerrar",children:e.jsx(w.HiXMark,{className:"w-5 h-5"})}),s&&e.jsx("div",{className:"flex-shrink-0",children:s}),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||d)&&e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[b,d&&e.jsxs(e.Fragment,{children:[e.jsx(de,{variant:"secondary",size:"sm",onClick:_,style:{background:"var(--bg-input)"},children:"Cancelar"}),e.jsx(de,{variant:"primary",size:"sm",icon:e.jsx(yt.FiSave,{className:"w-4 h-4"}),onClick:d,loading:i,disabled:p,title:c})]})]})]}),e.jsx("div",{"data-drawer-scroll":"true",className:C,children:j})]}),N&&e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":g,className:"fixed inset-0 z-[1001] flex items-center justify-center p-4",children:[e.jsx("div",{className:`absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity duration-200 ease-out ${T?"opacity-100":"opacity-0"}`,onClick:M}),e.jsxs("div",{className:`relative z-10 w-full max-w-sm rounded-2xl border p-6 shadow-2xl transition-[opacity,transform] duration-200 ease-out ${T?"translate-y-0 scale-100 opacity-100":"translate-y-2 scale-[0.96] opacity-0"}`,style:{background:"var(--bg-card, #ffffff)",borderColor:"var(--border, #d8e1dc)"},children:[e.jsx(de,{variant:"icon",onClick:M,className:"absolute right-3 top-3 h-7 w-7 hover:opacity-70",style:{color:"var(--text-muted, #6b7f78)"},"aria-label":h,children:e.jsx(w.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:"var(--warning-bg, #fff7ed)"},children:e.jsx(w.HiExclamationTriangle,{className:"h-5 w-5",style:{color:"var(--warning, #d97706)"}})}),e.jsx("h2",{className:"mb-1 text-base font-semibold",style:{color:"var(--text-main, #0f2f2c)"},children:g}),e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted, #6b7f78)"},children:u}),e.jsxs("div",{className:"mt-6 flex gap-2",children:[e.jsx(de,{variant:"secondary",onClick:M,className:"flex-1 border",style:{background:"var(--bg-input, #f7faf8)",borderColor:"var(--border, #d8e1dc)",color:"var(--text-main, #0f2f2c)"},children:h}),e.jsx(de,{variant:"secondary",onClick:I,className:"flex-1 border",style:{background:"var(--warning, #d97706)",borderColor:"transparent",color:"#fff",boxShadow:"0 10px 22px rgba(217, 119, 6, 0.22)"},children:m})]})]})]})]}),document.body):null}const pa={sm:"min-h-[160px] p-4",md:"min-h-[220px] p-6",lg:"min-h-[300px] p-8"};function ba({title:r="Sin resultados",description:t,icon:a=e.jsx(w.HiInbox,{className:"h-5 w-5"}),action:n,secondaryAction:s,size:c="md",className:d=""}){return e.jsx("div",{className:`flex items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-card)] text-center ${pa[c]} ${d}`,children:e.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-3",children:[a&&e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-input)] text-[var(--text-muted)]",children:a}),e.jsxs("div",{className:"space-y-1",children:[r&&e.jsx("h3",{className:"text-sm font-semibold text-[var(--text-main)]",children:r}),t&&e.jsx("div",{className:"text-sm leading-5 text-[var(--text-muted)]",children:t})]}),(n||s)&&e.jsxs("div",{className:"mt-1 flex flex-wrap items-center justify-center gap-2",children:[s,n]})]})})}function zr({label:r,children:t,helperText:a,error:n,labelAction:s,required:c=!1,className:d="",contentClassName:i=""}){return e.jsxs("label",{className:`flex flex-col gap-2 ${d}`,children:[(r||s)&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-semibold uppercase text-[var(--text-muted)]",children:[r&&e.jsx("span",{children:r}),c&&e.jsx("span",{className:"text-[var(--danger)]",children:"*"}),s&&e.jsx("span",{className:"ml-auto normal-case",children:s})]}),e.jsx("span",{className:`block ${i}`,children: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]})}var Pr={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},_r=o.createContext&&o.createContext(Pr),ha=["attr","size","title"];function ma(r,t){if(r==null)return{};var a,n,s=va(r,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(r);for(n=0;n<c.length;n++)a=c[n],t.indexOf(a)===-1&&{}.propertyIsEnumerable.call(r,a)&&(s[a]=r[a])}return s}function va(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 Xe(){return Xe=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},Xe.apply(null,arguments)}function jr(r,t){var a=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),a.push.apply(a,n)}return a}function Ye(r){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?jr(Object(a),!0).forEach(function(n){xa(r,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):jr(Object(a)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(a,n))})}return r}function xa(r,t,a){return(t=ga(t))in r?Object.defineProperty(r,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[t]=a,r}function ga(r){var t=ya(r,"string");return typeof t=="symbol"?t:t+""}function ya(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 Wr(r){return r&&r.map((t,a)=>o.createElement(t.tag,Ye({key:a},t.attr),Wr(t.child)))}function Fr(r){return t=>o.createElement(wa,Xe({attr:Ye({},r.attr)},t),Wr(r.child))}function wa(r){var t=a=>{var{attr:n,size:s,title:c}=r,d=ma(r,ha),i=s||a.size||"1em",p;return a.className&&(p=a.className),r.className&&(p=(p?p+" ":"")+r.className),o.createElement("svg",Xe({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,n,d,{className:p,style:Ye(Ye({color:r.color||a.color},a.style),r.style),height:i,width:i,xmlns:"http://www.w3.org/2000/svg"}),c&&o.createElement("title",null,c),r.children)};return _r!==void 0?o.createElement(_r.Consumer,null,a=>t(a)):t(Pr)}function Na(r){return Fr({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 ka(r){return Fr({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 Ve({className:r="",...t}){return e.jsx("input",{...t,className:`h-10 rounded-lg border border-[var(--border)] bg-[var(--bg-input)] px-2.5 py-1.5 text-sm text-[var(--text-main)] outline-none placeholder:text-[var(--text-muted)] transition-colors focus:border-[var(--primary)] ${r}`})}function Sa({label:r,containerClassName:t="",helperText:a,error:n,labelAction:s,floatingLabel:c=!1,showPasswordToggle:d=!0,className:i="",required:p,...b}){const[C,k]=o.useState(()=>!!b.autoFocus),[y,g]=o.useState(!1),u=b.type==="password"&&d,m=u&&y?"text":b.type,h=b.value!==void 0?String(b.value).length>0:b.defaultValue!==void 0&&String(b.defaultValue).length>0,E=C||h,j={top:E?7:12,color:C?"var(--primary)":"var(--text-muted)",fontSize:E?10:13,fontWeight:E?600:400,textTransform:E?"uppercase":"none"},z=$=>{var T;k(!0),(T=b.onFocus)==null||T.call(b,$)},H=$=>{var T;k(!1),(T=b.onBlur)==null||T.call(b,$)},N=u?e.jsxs("button",{type:"button","aria-label":y?"Ocultar contraseña":"Mostrar contraseña","aria-pressed":y,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:()=>g($=>!$),children:[e.jsx("span",{"aria-hidden":"true",className:`absolute inset-0 flex items-center justify-center transition-[opacity,transform] duration-200 ease-out ${y?"scale-y-0 rotate-[-8deg] opacity-0":"scale-y-100 rotate-0 opacity-100"}`,children:e.jsx(Na,{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 ${y?"scale-y-100 rotate-0 opacity-100":"scale-y-0 rotate-[8deg] opacity-0"}`,children:e.jsx(ka,{className:"h-[18px] w-[18px]"})})]}):null;return c?e.jsxs("label",{className:`flex flex-col gap-2 ${t}`,children:[e.jsxs("span",{className:"relative block",children:[e.jsx(Ve,{...b,type:m,required:p,placeholder:" ","aria-invalid":!!n||b["aria-invalid"],"data-has-value":h?"true":void 0,className:`h-11 w-full pt-5 ${u?"pr-10":""} ${i}`,onFocus:z,onBlur:H}),e.jsxs("span",{className:"pointer-events-none absolute left-3 transition-all duration-150",style:j,children:[r,p&&e.jsx("span",{className:"ml-1 text-[var(--danger)]",children:"*"})]}),s&&e.jsx("span",{className:"absolute right-2 transition-all duration-150",style:{top:E?7:12},children:s}),N]}),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}),p&&e.jsx("span",{className:"text-[var(--danger)]",children:"*"}),s&&e.jsx("span",{className:"ml-auto normal-case",children:s})]}),u?e.jsxs("span",{className:"relative block",children:[e.jsx(Ve,{...b,type:m,required:p,"aria-invalid":!!n||b["aria-invalid"],className:`w-full pr-10 ${i}`,onFocus:z,onBlur:H}),N]}):e.jsx(Ve,{...b,required:p,"aria-invalid":!!n||b["aria-invalid"],className:i}),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 Ur(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}function Ca(r,t){return r.length!==t.length?!1:r.every((a,n)=>a===t[n])}function Ea({value:r,onChange:t,options:a,placeholder:n="Seleccionar…",disabled:s=!1,className:c="",style:d,height:i=40,padding:p="0 10px",searchable:b=!0,minOptionsForSearch:C=6,maxVisibleValues:k=2,emptyText:y="Sin resultados",clearLabel:g="Limpiar seleccion"}){const[u,m]=o.useState(!1),[h,E]=o.useState(""),[j,z]=o.useState(0),[H,N]=o.useState(!1),[$,T]=o.useState({}),P=o.useRef(null),L=o.useRef(null),M=o.useRef(null),_=o.useRef(null),I=b&&a.length>=C,F=o.useMemo(()=>new Set(r),[r]),U=o.useMemo(()=>a.filter(x=>F.has(x.value)),[a,F]),V=U.slice(0,k),ee=Math.max(0,U.length-V.length),f=I&&h.trim()?a.filter(x=>{var K;return x.label.toLowerCase().includes(h.toLowerCase())||((K=x.sublabel)==null?void 0:K.toLowerCase().includes(h.toLowerCase()))}):a,D=o.useCallback(()=>{const x=P.current;if(!x)return;const K=x.getBoundingClientRect(),ae=I?304:244,ne=window.innerHeight-K.bottom,oe=ne<ae&&K.top>ne;T({position:"fixed",left:K.left,top:oe?void 0:K.bottom+4,bottom:oe?window.innerHeight-K.top+4:void 0,width:K.width,zIndex:9999})},[I]),G=o.useCallback(x=>{Ca(r,x)||t(x)},[t,r]),J=o.useCallback(x=>{const K=a.find(ne=>ne.value===x);if(K!=null&&K.disabled)return;const ae=F.has(x)?r.filter(ne=>ne!==x):[...r,x];G(ae)},[G,a,r,F]),Z=o.useCallback(()=>G([]),[G]);o.useEffect(()=>N(!0),[]),o.useEffect(()=>{if(!u)return;function x(K){var ne,oe;const ae=K.target;!((ne=P.current)!=null&&ne.contains(ae))&&!((oe=L.current)!=null&&oe.contains(ae))&&(m(!1),E(""))}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]),o.useEffect(()=>{u&&(z(0),D(),I&&setTimeout(()=>{var x;return(x=M.current)==null?void 0:x.focus()},0))},[u,I,D]),o.useEffect(()=>{if(u)return window.addEventListener("resize",D),window.addEventListener("scroll",D,!0),()=>{window.removeEventListener("resize",D),window.removeEventListener("scroll",D,!0)}},[u,D]),o.useEffect(()=>{if(j<0||!_.current)return;const x=_.current.children[j];x==null||x.scrollIntoView({block:"nearest"})},[j]);function re(x){if(!u){(x.key==="Enter"||x.key===" "||x.key==="ArrowDown")&&(x.preventDefault(),m(!0));return}x.key==="Escape"&&(x.preventDefault(),m(!1),E("")),x.key==="ArrowDown"&&(x.preventDefault(),z(K=>Math.min(K+1,f.length-1))),x.key==="ArrowUp"&&(x.preventDefault(),z(K=>Math.max(K-1,0))),x.key==="Enter"&&f[j]&&(x.preventDefault(),J(f[j].value)),x.key==="Backspace"&&!h&&r.length&&(x.preventDefault(),G(r.slice(0,-1)))}const he=e.jsxs("div",{ref:L,className:"overflow-hidden rounded-xl shadow-xl",style:{...$,background:"var(--bg-card)",border:"1px solid var(--border)"},children:[I&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{borderBottom:"1px solid var(--border)"},children:[e.jsx(w.HiMagnifyingGlass,{className:"h-3.5 w-3.5 flex-shrink-0",style:{color:"var(--text-muted)"}}),e.jsx("input",{ref:M,value:h,onChange:x=>{E(x.target.value),z(0)},placeholder:"Buscar…",className:"min-w-0 flex-1 bg-transparent text-sm outline-none",style:{color:"var(--text-main)"}}),h&&e.jsx("button",{type:"button",onMouseDown:x=>{x.preventDefault(),E("")},children:e.jsx(w.HiXMark,{className:"h-3.5 w-3.5",style:{color:"var(--text-muted)"}})})]}),U.length>0&&e.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2 text-xs",style:{borderBottom:"1px solid var(--border)",color:"var(--text-muted)"},children:[e.jsxs("span",{children:[U.length," seleccionados"]}),e.jsx("button",{type:"button",onMouseDown:x=>{x.preventDefault(),Z()},className:"font-semibold transition-colors hover:text-[var(--primary)]",children:g})]}),e.jsxs("ul",{ref:_,role:"listbox","aria-multiselectable":"true",className:"overflow-y-auto",style:{maxHeight:I?220:200,scrollbarWidth:"thin",scrollbarColor:"var(--border) transparent",overscrollBehavior:"contain"},children:[f.map((x,K)=>{const ae=K===j,ne=F.has(x.value);return e.jsxs("li",{role:"option","aria-selected":ne,onMouseDown:oe=>{oe.preventDefault(),J(x.value)},onMouseEnter:()=>!x.disabled&&z(K),className:"flex cursor-pointer items-center gap-2 px-3 py-2 text-sm transition-colors",style:{background:ae?"var(--bg-hover)":ne?"color-mix(in srgb, var(--primary) 6%, transparent)":"transparent",color:x.disabled?"var(--text-muted)":"var(--text-main)",cursor:x.disabled?"not-allowed":"pointer",opacity:x.disabled?.58:1},children:[e.jsx("span",{className:"flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border",style:{borderColor:ne?"var(--primary)":"var(--border)",background:ne?"var(--primary)":"var(--bg-input)",color:"var(--primary-fg)"},children:ne&&e.jsx(w.HiCheck,{className:"h-3 w-3"})}),x.color&&e.jsx("span",{className:"h-2.5 w-2.5 flex-shrink-0 rounded-full",style:{background:x.color}}),e.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-1 overflow-hidden",children:[e.jsx("span",{className:"truncate",children:x.label}),x.sublabel&&e.jsx("span",{className:"min-w-0 flex-shrink truncate",style:{color:"var(--text-muted)",fontSize:12},children:x.sublabel})]}),x.badge&&e.jsx("span",{className:"flex-shrink-0 text-xs",style:{color:"var(--text-muted)"},children:x.badge})]},x.value)}),f.length===0&&e.jsx("li",{className:"px-3 py-4 text-center text-sm",style:{color:"var(--text-muted)"},children:y})]})]});return e.jsxs("div",{ref:P,className:`relative ${c||"w-full"}`,style:d,onKeyDown:re,children:[e.jsxs("button",{type:"button",disabled:s,onClick:()=>!s&&m(x=>!x),className:"flex w-full items-center gap-2 rounded-lg text-left text-sm transition-colors focus:outline-none",style:{minHeight:Ur(i),padding:Ur(p),background:"var(--bg-input)",color:U.length?"var(--text-main)":"var(--text-muted)",border:u?"1px solid var(--primary)":"1px solid var(--border)",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"},"aria-haspopup":"listbox","aria-expanded":u,children:[e.jsx("span",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1.5 overflow-hidden",children:V.length?e.jsxs(e.Fragment,{children:[V.map(x=>e.jsxs("span",{className:"inline-flex max-w-[160px] items-center gap-1 rounded-md border px-1.5 py-0.5 text-xs font-semibold",style:{background:"var(--bg-card)",borderColor:"var(--border)",color:"var(--text-main)"},children:[x.color&&e.jsx("span",{className:"h-1.5 w-1.5 flex-shrink-0 rounded-full",style:{background:x.color}}),e.jsx("span",{className:"truncate",children:x.label})]},x.value)),ee>0&&e.jsxs("span",{className:"inline-flex items-center rounded-md px-1.5 py-0.5 text-xs font-semibold",style:{background:"color-mix(in srgb, var(--primary) 10%, transparent)",color:"var(--primary)"},children:["+",ee]})]}):e.jsx("span",{className:"truncate",children:n})}),U.length?e.jsx("span",{role:"button",tabIndex:-1,"aria-label":g,onMouseDown:x=>{x.preventDefault(),x.stopPropagation(),Z()},className:"flex-shrink-0 rounded-full p-0.5 transition-colors hover:bg-black/10",style:{color:"var(--text-muted)"},children:e.jsx(w.HiXMark,{className:"h-3 w-3"})}):e.jsx(w.HiChevronDown,{className:"h-4 w-4 flex-shrink-0 transition-transform",style:{color:"var(--text-muted)",transform:u?"rotate(180deg)":"rotate(0deg)"}})]}),u&&H&&$e.createPortal(he,document.body)]})}function $a(r,t,a){const n=[],s=Math.max(2,r-a),c=Math.min(t-1,r+a);n.push(1),s>2&&n.push("...");for(let d=s;d<=c;d+=1)n.push(d);return c<t-1&&n.push("..."),t>1&&n.push(t),n}function Ma({page:r,totalPages:t,onPageChange:a,disabled:n=!1,siblingCount:s=1,className:c=""}){const d=Math.max(1,t),i=Math.min(Math.max(1,r),d),p=$a(i,d,s);return e.jsxs("nav",{"aria-label":"Paginacion",className:`inline-flex items-center gap-1 ${c}`,children:[e.jsx(de,{variant:"icon",size:"xs","aria-label":"Pagina anterior",disabled:n||i<=1,onClick:()=>a(i-1),children:e.jsx(w.HiChevronLeft,{className:"h-4 w-4"})}),p.map((b,C)=>b==="..."?e.jsx("span",{className:"flex h-8 min-w-8 items-center justify-center text-xs font-semibold text-[var(--text-muted)]",children:"..."},`ellipsis-${C}`):e.jsx("button",{type:"button","aria-current":b===i?"page":void 0,disabled:n,onClick:()=>a(b),className:"flex h-8 min-w-8 items-center justify-center rounded-md border px-2 text-xs font-semibold transition-colors disabled:cursor-not-allowed disabled:opacity-50",style:{borderColor:b===i?"var(--primary)":"var(--border)",background:b===i?"var(--primary)":"var(--bg-card)",color:b===i?"var(--primary-fg)":"var(--text-secondary)"},children:b},b)),e.jsx(de,{variant:"icon",size:"xs","aria-label":"Pagina siguiente",disabled:n||i>=d,onClick:()=>a(i+1),children:e.jsx(w.HiChevronRight,{className:"h-4 w-4"})})]})}function Da({value:r,onChange:t,options:a,name:n,label:s,orientation:c="vertical",disabled:d=!1,className:i="",optionClassName:p=""}){return e.jsxs("fieldset",{className:`min-w-0 ${i}`,disabled:d,children:[s&&e.jsx("legend",{className:"mb-2 text-xs font-semibold uppercase text-[var(--text-muted)]",children:s}),e.jsx("div",{className:c==="horizontal"?"flex flex-wrap gap-2":"flex flex-col gap-2",children:a.map(b=>{const C=b.value===r,k=d||b.disabled;return e.jsxs("label",{className:`inline-flex min-w-0 items-start gap-2 rounded-lg border px-2.5 py-1.5 transition-colors ${k?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-[var(--bg-input)]"} ${p}`,style:{borderColor:C?"color-mix(in srgb, var(--primary) 48%, var(--border))":"var(--border)",background:C?"color-mix(in srgb, var(--primary) 8%, transparent)":"var(--bg-card)"},children:[e.jsxs("span",{className:"relative mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border border-[var(--border)] bg-[var(--bg-input)]",children:[e.jsx("input",{type:"radio",name:n,value:b.value,checked:C,disabled:k,onChange:()=>t(b.value),className:"absolute inset-0 opacity-0"}),e.jsx("span",{className:`h-2 w-2 rounded-full transition ${C?"scale-100 opacity-100":"scale-50 opacity-0"}`,style:{background:"var(--primary)"}})]}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-sm font-medium leading-5 text-[var(--text-main)]",children:b.label}),b.description&&e.jsx("span",{className:"block text-xs leading-5 text-[var(--text-muted)]",children:b.description})]})]},b.value)})})]})}function La({title:r,subtitle:t,icon:a,actions:n,children:s,footer:c,className:d="",bodyClassName:i="p-4"}){const p=r||t||a||n;return e.jsxs("section",{className:`overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)] ${d}`,children:[p&&e.jsxs("header",{className:"flex items-center justify-between gap-3 border-b border-[var(--border)] px-4 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[a&&e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-input)] text-[var(--primary)]",children:a}),e.jsxs("div",{className:"min-w-0",children:[r&&e.jsx("h3",{className:"truncate text-sm font-semibold text-[var(--text-main)]",children:r}),t&&e.jsx("div",{className:"truncate text-xs text-[var(--text-muted)]",children:t})]})]}),n&&e.jsx("div",{className:"shrink-0",children:n})]}),e.jsx("div",{className:i,children:s}),c&&e.jsx("footer",{className:"border-t border-[var(--border)] px-4 py-3",children:c})]})}const Ha={neutral:{text:"var(--text-secondary)",bg:"var(--bg-input)",border:"var(--border)"},primary:{text:"var(--primary)",bg:"color-mix(in srgb, var(--primary) 10%, transparent)",border:"color-mix(in srgb, var(--primary) 24%, var(--border))"},success:{text:"#047857",bg:"rgba(16, 185, 129, 0.11)",border:"rgba(16, 185, 129, 0.24)"},warning:{text:"#b45309",bg:"rgba(245, 158, 11, 0.12)",border:"rgba(245, 158, 11, 0.26)"},danger:{text:"var(--danger)",bg:"var(--danger-bg)",border:"color-mix(in srgb, var(--danger) 20%, var(--border))"},info:{text:"#2563eb",bg:"rgba(59, 130, 246, 0.11)",border:"rgba(59, 130, 246, 0.24)"}},Ta={xs:"min-h-5 px-1.5 text-[10px]",sm:"min-h-6 px-2 text-xs",md:"min-h-7 px-2.5 text-sm"};function Ba({children:r,tone:t="neutral",size:a="sm",icon:n,dot:s=!1,className:c=""}){const d=Ha[t];return e.jsxs("span",{className:`inline-flex max-w-full shrink-0 items-center gap-1.5 rounded-full border font-semibold leading-none ${Ta[a]} ${c}`,style:{color:d.text,background:d.bg,borderColor:d.border},children:[s&&e.jsx("span",{"aria-hidden":"true",className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{background:d.text}}),n&&e.jsx("span",{className:"shrink-0",children:n}),e.jsx("span",{className:"min-w-0 truncate",children:r})]})}function Aa({tabs:r,activeTabId:t,defaultActiveTabId:a,onTabChange:n,ariaLabel:s="Pestanas",variant:c="underline",className:d="",listClassName:i="",panelClassName:p=""}){const b=r.find(u=>!u.disabled)??r[0],C=t??a??(b==null?void 0:b.id),k=r.find(u=>u.id===C)??b,y=u=>{u.disabled||n==null||n(u.id)},g=u=>{const m=r.filter(E=>!E.disabled);if(!m.length||!k)return;const h=m.findIndex(E=>E.id===k.id);(u.key==="ArrowRight"||u.key==="ArrowDown")&&(u.preventDefault(),y(m[(h+1)%m.length])),(u.key==="ArrowLeft"||u.key==="ArrowUp")&&(u.preventDefault(),y(m[(h-1+m.length)%m.length])),u.key==="Home"&&(u.preventDefault(),y(m[0])),u.key==="End"&&(u.preventDefault(),y(m[m.length-1]))};return e.jsxs("div",{className:d,children:[e.jsx("div",{role:"tablist","aria-label":s,onKeyDown:g,className:`flex min-w-0 gap-1 overflow-x-auto ${c==="underline"?"border-b border-[var(--border)]":"rounded-lg border border-[var(--border)] bg-[var(--bg-input)] p-1"} ${i}`,children:r.map(u=>{const m=u.id===(k==null?void 0:k.id);return e.jsxs("button",{type:"button",role:"tab","aria-selected":m,"aria-controls":`${u.id}-panel`,id:`${u.id}-tab`,disabled:u.disabled,tabIndex:m?0:-1,onClick:()=>y(u),className:`inline-flex min-h-8 shrink-0 items-center justify-center gap-1.5 whitespace-nowrap px-2.5 text-sm font-semibold transition-colors focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 ${c==="underline"?"border-b-2":"rounded-md border"}`,style:{color:m?"var(--primary)":"var(--text-muted)",borderColor:m?"var(--primary)":"transparent",background:c==="pills"&&m?"var(--bg-card)":"transparent"},children:[u.icon&&e.jsx("span",{className:"shrink-0",children:u.icon}),e.jsx("span",{children:u.label}),u.badge&&e.jsx("span",{className:"shrink-0",children:u.badge})]},u.id)})}),(k==null?void 0:k.content)!==void 0&&e.jsx("div",{role:"tabpanel",id:`${k.id}-panel`,"aria-labelledby":`${k.id}-tab`,className:`pt-4 ${p}`,children:k.content})]})}function ke(...r){return r.filter(Boolean).join(" ")}function Oa({steps:r,activeStepId:t,initialStepId:a,completedStepIds:n,defaultCompletedStepIds:s=[],onActiveStepChange:c,onCompletedStepIdsChange:d,onBlockedStep:i,allowBackNavigation:p=!0,showFooter:b=!0,previousLabel:C="Anterior",nextLabel:k="Siguiente",blockedNextLabel:y="Completa este paso",className:g="",headerClassName:u="",contentClassName:m="",footerClassName:h=""}){var oe;const E=((oe=r[0])==null?void 0:oe.id)??"",[j,z]=o.useState(a??E),[H,N]=o.useState(s),$=t??j,T=n??H,P=o.useMemo(()=>new Set(T),[T]),L=Math.max(0,r.findIndex(A=>A.id===$)),M=r[L]??r[0],_=r.length<=1?100:L/(r.length-1)*100,I=A=>{n||N(A),d==null||d(A)},F=A=>{const X=r.find(Q=>Q.id===A);X&&(t||z(A),c==null||c(A,X))},U=A=>P.has(A),V=A=>r.slice(0,A).find(X=>!X.optional&&!P.has(X.id)),ee=A=>{const X=r[A];return!X||X.disabled?!1:A===L||p&&A<L?!0:!V(A)},f=A=>{const X=r.findIndex(Q=>Q.id===A);return X>=0&&ee(X)},D=A=>{const X=r.findIndex(Q=>Q.id===A);if(X<0)return!1;if(!ee(X)){const Q=V(X);return Q&&(i==null||i(r[X],Q)),!1}return F(A),!0},G=(A=M==null?void 0:M.id)=>{!A||P.has(A)||I([...T,A])},J=(A=M==null?void 0:M.id)=>{if(!A)return;const X=r.findIndex(ie=>ie.id===A),Q=T.filter(ie=>{const ue=r.findIndex(Y=>Y.id===ie);return ue>=0&&ue<X});I(Q),X>=0&&L>X&&F(A)},Z=()=>L<=0?!1:D(r[L-1].id),re=()=>{const A=r[L+1];return A?D(A.id):!1},he={activeStep:M,activeIndex:L,completedStepIds:T,isCompleted:U,isUnlocked:f,completeStep:G,uncompleteStep:J,goToStep:D,goNext:re,goPrevious:Z};if(!M)return null;const x=r[L+1],K=L>0,ae=x?f(x.id):!1,ne=typeof M.content=="function"?M.content(he):M.content;return e.jsxs("section",{className:ke("overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)]",g),children:[e.jsxs("div",{className:ke("border-b border-[var(--border)] bg-[var(--bg-input)]",u),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:`${_}%`}})}),e.jsx("div",{className:"grid gap-2 p-2",style:{gridTemplateColumns:`repeat(${r.length}, minmax(0, 1fr))`},children:r.map((A,X)=>{const Q=A.id===M.id,ie=U(A.id),ue=ee(X),Y=V(X);return e.jsxs("button",{type:"button",disabled:!ue,"aria-current":Q?"step":void 0,"aria-disabled":!ue,title:!ue&&Y?`Completa ${Y.title}`:A.title,onClick:()=>D(A.id),className:ke("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",Q&&"border-[var(--primary)] bg-[var(--bg-card)] shadow-sm",ie&&!Q&&"border-[var(--primary)]/35 bg-[var(--bg-card)]",!Q&&!ie&&ue&&"border-transparent bg-[var(--bg-card)]/45 hover:border-[var(--border)] hover:bg-[var(--bg-card)]",!ue&&"border-transparent bg-[var(--bg-card)]/35 opacity-60"),children:[e.jsx("span",{className:ke("absolute inset-x-0 top-0 h-0.5 origin-left scale-x-0 bg-[var(--primary)] transition-transform duration-300",Q&&"scale-x-100")}),e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:ke("grid h-7 w-7 shrink-0 place-items-center rounded-full border text-xs font-bold transition-all duration-200",Q&&"border-[var(--primary)] bg-[var(--primary)] text-[var(--primary-fg)]",ie&&!Q&&"border-[var(--primary)] bg-[var(--primary)]/12 text-[var(--primary)]",!ie&&!Q&&ue&&"border-[var(--border)] text-[var(--text-muted)]",!ue&&"border-[var(--border)] text-[var(--text-muted)]"),children:ie?e.jsx(w.HiCheck,{className:"h-4 w-4"}):ue?X+1:e.jsx(w.HiLockClosed,{className:"h-3.5 w-3.5"})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:ke("block truncate text-xs font-semibold transition-colors duration-200",Q?"text-[var(--text-main)]":"text-[var(--text-secondary)]"),children:[X+1,". ",A.title]}),A.description&&e.jsx("span",{className:"mt-1 block truncate text-[11px] text-[var(--text-muted)]",children:A.description})]}),A.badge&&e.jsx("span",{className:"shrink-0",children:A.badge})]})]},A.id)})})]}),e.jsx("div",{className:ke("min-h-72 animate-[stepWizardIn_220ms_ease-out] p-5",m),children:ne},M.id),b&&e.jsxs("div",{className:ke("flex flex-wrap items-center justify-between gap-3 border-t border-[var(--border)] bg-[var(--bg-input)] px-4 py-3",h),children:[e.jsx(de,{variant:"secondary",height:38,padding:"0 14px",icon:e.jsx(w.HiChevronLeft,{}),disabled:!K,onClick:Z,children:C}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-[var(--text-muted)]",children:[e.jsxs("span",{children:["Paso ",L+1," de ",r.length]}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-[var(--border)]"}),e.jsxs("span",{children:[T.length," completados"]})]}),e.jsx(de,{height:38,padding:"0 14px",icon:e.jsx(w.HiChevronRight,{}),disabled:!x||!ae,onClick:re,children:x&&!ae?y:k})]})]})}const Ia={sm:"min-h-20 px-2.5 py-1.5 text-xs leading-5",md:"min-h-24 px-2.5 py-2 text-sm leading-5",lg:"min-h-32 px-3 py-2.5 text-sm leading-6"},za={none:"resize-none",vertical:"resize-y",horizontal:"resize-x",both:"resize"};function Pa(r,t){if(r){if(typeof r=="function"){r(t);return}r.current=t}}function _a(r,t){return r!==void 0?String(r).length:t!==void 0?String(t).length:0}const qr=o.forwardRef(function({className:t="",wrapperClassName:a="",size:n="md",resize:s="vertical",autoResize:c=!1,minRows:d,maxRows:i,showCount:p=!1,maxCount:b,status:C="default",icon:k,action:y,style:g,value:u,defaultValue:m,maxLength:h,onInput:E,...j},z){const H=o.useRef(null),N=_a(u,m),$=b??h,T=!!(k||y||p),P=C==="error"?"var(--danger)":C==="success"?"#16a34a":"var(--border)",L={...g??{},...d?{minHeight:`${d*24+18}px`}:null,...i?{maxHeight:`${i*24+18}px`}:null},M=()=>{const I=H.current;!I||!c||(I.style.height="auto",I.style.height=`${I.scrollHeight}px`)};o.useEffect(M,[c,u]);const _=e.jsx("textarea",{...j,ref:I=>{H.current=I,Pa(z,I)},value:u,defaultValue:m,maxLength:h,"aria-invalid":C==="error"||j["aria-invalid"],onInput:I=>{M(),E==null||E(I)},style:{...L,borderColor:P},className:`w-full rounded-lg border bg-[var(--bg-input)] text-[var(--text-main)] outline-none placeholder:text-[var(--text-muted)] transition-colors focus:border-[var(--primary)] disabled:cursor-not-allowed disabled:opacity-60 ${Ia[n]} ${za[c?"none":s]} ${k?"pl-8":""} ${y?"pr-10":""} ${t}`});return T?e.jsxs("span",{className:`relative block ${a}`,children:[k&&e.jsx("span",{className:"pointer-events-none absolute left-2.5 top-2.5 flex h-4 w-4 items-center justify-center text-[var(--text-muted)]",children:k}),_,y&&e.jsx("span",{className:"absolute right-2 top-2 flex items-center justify-center",children:y}),p&&e.jsxs("span",{className:"absolute bottom-1.5 right-2 rounded bg-[var(--bg-input)] px-1.5 text-[10px] font-semibold text-[var(--text-muted)]",children:[N,$?`/${$}`:""]})]}):_});function ja({label:r,containerClassName:t="",helperText:a,error:n,labelAction:s,required:c,className:d="",status:i,...p}){return e.jsx(zr,{label:r,required:c,helperText:a,error:n,labelAction:s,className:t,children:e.jsx(qr,{...p,required:c,status:n?"error":i,className:`w-full ${d}`})})}const Wa={xs:{width:28,height:16,thumb:12,padding:2},sm:{width:36,height:20,thumb:16,padding:2}};function Fa({checked:r,disabled:t,onCheckedChange:a,size:n="sm",className:s="",...c}){const d=Wa[n],i=r?d.width-d.thumb-d.padding*2:0;return e.jsx("button",{...c,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 ${s}`,style:{width:d.width,height:d.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:d.thumb,height:d.thumb,left:d.padding,top:"50%",transform:`translate(${i}px, -50%)`,background:r?"var(--primary-fg)":"var(--text-muted)"}})})}const Gr=[".sidebar-scroll","[data-overlay-scroll='true']"].join(",");function Ua(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 Xr(r){return r.classList.contains("sidebar-scroll")}function Yr(r){Xr(r)&&r.querySelectorAll(".os-scrollbar-horizontal").forEach(t=>{t.style.display="none",t.style.height="0",t.style.pointerEvents="none"})}function Vr(){return o.useEffect(()=>{const r=new WeakMap;let t=0;const a=()=>{t=0,document.querySelectorAll(Gr).forEach(c=>{if(!Ua(c))return;if(gr.OverlayScrollbars(c)){Yr(c);return}const i=gr.OverlayScrollbars(c,{overflow:Xr(c)?{x:"hidden",y:"scroll"}:void 0,scrollbars:{autoHide:"leave",autoHideDelay:180}});Yr(c),r.set(c,i)})},n=()=>{t||(t=window.requestAnimationFrame(a))};a();const s=new MutationObserver(n);return s.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","data-overlay-scroll"]}),window.addEventListener("resize",n),()=>{t&&window.cancelAnimationFrame(t),s.disconnect(),window.removeEventListener("resize",n),document.querySelectorAll(Gr).forEach(c=>{var d;c instanceof HTMLElement&&((d=r.get(c))==null||d.destroy())})}},[]),null}const qa={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"}},Kr=["bg-indigo-500","bg-blue-500","bg-emerald-500","bg-violet-500","bg-amber-500","bg-teal-500","bg-rose-500","bg-cyan-500"],Ga={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg"},Xa="bonsaif.bot",Ya="Bonsaif Bot",Va={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2",xl:"p-2.5"};function Zr(r){return typeof r=="string"?r.trim():""}function Ka(r){let t=0;for(const a of r)t=t*31+a.charCodeAt(0)&65535;return Kr[t%Kr.length]}function Za(r,t){return r===Xa||t===Ya}function Ja(r,t){return`${r.replace(/\/$/,"")}${t}`}function Jr({userId:r,username:t,name:a,size:n="md",showName:s=!1,showTooltip:c,tooltipContent:d,fallbackLabel:i="Usuario",wrapperClassName:p="",labelClassName:b="",labelSize:C="xs",avatarVersion:k=0,className:y="",style:g}){var U;const[u,m]=o.useState(!1),h=typeof r=="string"&&r.trim()&&r!=="undefined"&&r!=="null"?r.trim():"";o.useEffect(()=>{m(!1)},[h,k]);const{wh:E,text:j}=qa[n],z=Zr(a)||Zr(t)||i,H=z.trim()[0]||"?",N=typeof process<"u"&&((U=process.env)==null?void 0:U.NEXT_PUBLIC_BASE_PATH)||"",$=Za(t,a),T=Ja(N,"/favicon.svg"),P=h?`${N}/api/user/avatar/${h}${k?`?v=${k}`:""}`:"",M={xs:20,sm:28,md:36,lg:48,xl:64}[n],_=$?e.jsx("span",{className:`${E} ${Va[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 ${y}`,style:g,children:e.jsx("img",{src:T,alt:z,width:M,height:M,className:"h-full w-full object-contain"})}):P&&!u?e.jsx("img",{src:P,alt:z,width:M,height:M,className:`${E} rounded-full object-cover flex-shrink-0 ${y}`,style:g,onError:()=>m(!0)},`${h}-${k}`):e.jsx("span",{className:`${E} ${Ka(z)} ${j} rounded-full flex items-center justify-center font-black text-white uppercase flex-shrink-0 ${y}`,style:g,title:z,children:H});if(s)return e.jsxs("span",{className:`inline-flex min-w-0 items-center gap-2 ${p}`,children:[_,e.jsx("span",{className:`min-w-0 truncate ${Ga[C]} font-medium text-[var(--text-main)] ${b}`,title:z,children:z})]});const I=c??!0,F=d??z;return I&&F?e.jsx(Ue,{as:"span",content:F,className:`inline-flex flex-shrink-0 ${p}`,children:_}):_}function Qa({href:r,className:t,children:a}){return e.jsx("a",{href:r,className:t,children:a})}function Ra(r){return r.reduce((t,a)=>{const n=a.section??"Principal";return t[n]=[...t[n]??[],a],t},{})}function Qr({children:r,navItems:t=[],currentPath:a=typeof window>"u"?"/":window.location.pathname,user:n,appName:s="Bonsaif",appLogo:c,header:d,footer:i,onLogout:p,LinkComponent:b=Qa}){const[C,k]=o.useState(!1),y=Ra(t);return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-main)] text-[var(--text-main)]",children:[e.jsx(Vr,{}),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:()=>k(!0),children:e.jsx(w.HiBars3,{className:"h-5 w-5"})}),C&&e.jsx("button",{type:"button","aria-label":"Cerrar navegación",className:"fixed inset-0 z-40 bg-black/45 lg:hidden",onClick:()=>k(!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 ${C?"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:c??e.jsx(w.HiHome,{className:"h-5 w-5"})}),e.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:s}),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:()=>k(!1),children:e.jsx(w.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(y).map(([g,u])=>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(w.HiChevronDown,{className:"h-3.5 w-3.5"}),g]}),e.jsx("div",{className:"space-y-1",children:u.map(m=>{const h=a===m.href||a.startsWith(`${m.href}/`);return e.jsxs(b,{href:m.href,className:`flex min-w-0 items-center gap-2 rounded-md px-2 py-2 text-sm transition-colors ${h?"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:m.icon??e.jsx(w.HiHome,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate",children:m.label})]},m.href)})})]},g))}),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(Jr,{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})]})]}),p&&e.jsxs(de,{variant:"ghost",className:"w-full justify-start text-white hover:bg-white/10",onClick:p,children:[e.jsx(w.HiArrowRightOnRectangle,{className:"h-4 w-4"})," Salir"]}),i]})]}),e.jsxs("div",{className:"min-h-screen lg:pl-72",children:[d,e.jsx("main",{className:"min-h-screen",children:r})]})]})}const en={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"},ir={dashboard:e.jsx(w.HiChartBar,{className:"h-5 w-5"}),tickets:e.jsx(w.HiTicket,{className:"h-5 w-5"}),teams:e.jsx(w.HiUsers,{className:"h-5 w-5"}),projects:e.jsx(w.HiRectangleGroup,{className:"h-5 w-5"}),clients:e.jsx(w.HiBuildingOffice2,{className:"h-5 w-5"}),surveys:e.jsx(w.HiClipboardDocumentList,{className:"h-5 w-5"}),profile:e.jsx(w.HiUser,{className:"h-5 w-5"}),settings:e.jsx(w.HiCog6Tooth,{className:"h-5 w-5"}),notifications:e.jsx(w.HiBell,{className:"h-5 w-5"}),changelog:e.jsx(w.HiDocumentText,{className:"h-5 w-5"}),admin:e.jsx(w.HiShieldCheck,{className:"h-5 w-5"}),users:e.jsx(w.HiUsers,{className:"h-5 w-5"}),roles:e.jsx(w.HiShieldCheck,{className:"h-5 w-5"}),menus:e.jsx(w.HiCog6Tooth,{className:"h-5 w-5"}),guards:e.jsx(w.HiCalendarDays,{className:"h-5 w-5"}),vacations:e.jsx(w.HiCalendarDays,{className:"h-5 w-5"}),audit:e.jsx(w.HiListBullet,{className:"h-5 w-5"}),positions:e.jsx(w.HiBriefcase,{className:"h-5 w-5"}),ranks:e.jsx(w.HiListBullet,{className:"h-5 w-5"}),"email-inbox":e.jsx(w.HiInbox,{className:"h-5 w-5"}),"security-incidents":e.jsx(w.HiShieldCheck,{className:"h-5 w-5"})};function rn({href:r,className:t,style:a,children:n}){return e.jsx("a",{href:r,className:t,style:a,children:n})}function tn(r){return r.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function an(r){return/^\d+$/.test(r)||/^[a-f0-9]{8,}$/i.test(r)}function nn(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,s=an(a)&&n?n:a,c=en[s]??tn(s);return[{label:"Inicio",href:"/"},{label:c}]}function cr(r){return(r==null?void 0:r.querySelector(":scope > .os-viewport"))??(r==null?void 0:r.querySelector(":scope > [data-overlayscrollbars-viewport]"))}function on(r){const t=r.split("/").filter(Boolean),a=t[t.length-1];if(!a)return e.jsx(w.HiHome,{className:"h-5 w-5"});if(ir[a])return ir[a];const n=t.length>1?t[t.length-2]:"";return ir[n]??e.jsx(w.HiHome,{className:"h-5 w-5"})}function sn({title:r,subtitle:t,action:a,meta:n,icon:s,className:c="",contentClassName:d="",breadcrumbs:i,currentPath:p=typeof window>"u"?"/":window.location.pathname,showBreadcrumbs:b=!0,contained:C=!1,LinkComponent:k=rn}){const y=o.useRef(null),[g,u]=o.useState(!1),[m,h]=o.useState(null),E=i??nn(p),j=s??on(p),z=b&&E.length>1;return o.useEffect(()=>{if(C){u(!1);return}let H=null,N=0,$=0;const T=()=>{const M=y.current,_=document.querySelector("[data-app-scroll='true']");return(M==null?void 0:M.closest(".os-viewport"))??(M==null?void 0:M.closest("[data-overlayscrollbars-viewport]"))??cr(_)??_??window},P=()=>{const M=H&&H!==window?H.scrollTop:window.scrollY;u(_=>_?M>24:M>72)},L=()=>{H==null||H.removeEventListener("scroll",P),H=T(),H.addEventListener("scroll",P,{passive:!0}),P()};return L(),N=window.requestAnimationFrame(L),$=window.setTimeout(L,120),()=>{window.cancelAnimationFrame(N),window.clearTimeout($),H==null||H.removeEventListener("scroll",P)}},[C]),o.useEffect(()=>{if(C){h(null);return}let H=0;const N=[],$=()=>{const F=y.current,U=F==null?void 0:F.parentElement,V=document.querySelector("[data-app-scroll='true']"),ee=cr(V)??V;if(!F||!U||!ee){h(null);return}const f=U.getBoundingClientRect(),D=window.getComputedStyle(U),G=ee.getBoundingClientRect(),J=ee instanceof HTMLElement&&ee.clientWidth>0?ee.clientWidth:G.width,Z=f.left+parseFloat(D.paddingLeft||"0"),re={marginLeft:Math.round(G.left-Z),width:Math.round(J)};h(he=>he&&he.marginLeft===re.marginLeft&&he.width===re.width?he:re)},T=()=>{window.cancelAnimationFrame(H),H=window.requestAnimationFrame($)};T(),window.addEventListener("resize",T);const P=new ResizeObserver(T),L=y.current,M=L==null?void 0:L.parentElement,_=document.querySelector("[data-app-scroll='true']"),I=cr(_)??_;return[M,_,I].forEach(F=>{F&&P.observe(F)}),N.push(window.setTimeout(T,120)),N.push(window.setTimeout(T,280)),()=>{window.cancelAnimationFrame(H),window.removeEventListener("resize",T),P.disconnect(),N.forEach(F=>window.clearTimeout(F))}},[C]),e.jsx("div",{ref:y,"data-page-header":"true","data-compact":g?"true":"false",className:`sticky top-0 z-30 overflow-visible py-0 transition-[background-color,box-shadow,border-color] duration-300 ease-out ${C?"mb-0 flex-shrink-0":"mb-4 sm:mb-0"} ${c}`,style:{...m?{marginLeft:m.marginLeft,width:m.width}:null,background:C?"var(--bg-card)":g?"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:C||g?"1px solid var(--border)":"1px solid transparent",boxShadow:g?"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 ${g?"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"} ${d}`,children:[e.jsxs("div",{className:`min-w-0 flex flex-1 flex-col justify-center transition-[gap,transform] duration-300 ease-out ${g?"gap-1":"gap-1.5 sm:gap-2"}`,children:[z&&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 ${g?"text-[10px]":"text-[10px] sm:text-[11px]"}`,children:E.map((H,N)=>{const $=N===E.length-1;return e.jsxs("li",{className:"flex min-w-0 items-center gap-1.5",children:[N>0&&e.jsx(w.HiChevronRight,{className:"h-3.5 w-3.5 transition-[color,transform] duration-300 ease-out",style:{color:"var(--text-muted)"}}),H.href&&!$?e.jsx(k,{href:H.href,className:"truncate transition-colors duration-300 hover:underline",style:{color:"var(--text-muted)"},children:H.label}):e.jsx("span",{"aria-current":$?"page":void 0,className:$?"truncate font-semibold":"truncate",style:{color:$?"var(--text-main)":"var(--text-muted)"},children:H.label})]},`${H.label}-${N}`)})})}),e.jsxs("div",{className:`flex min-w-0 items-center transition-[gap,transform] duration-300 ease-out ${g?"gap-2":"gap-2.5 sm:gap-3"}`,children:[e.jsx("span",{className:`flex-shrink-0 transition-[color,transform,opacity] duration-300 ease-out ${g?"scale-75 opacity-80":"scale-90 opacity-100"}`,style:{color:z?"var(--text-secondary)":"var(--text-muted)"},children:j}),e.jsxs("div",{className:`flex min-w-0 flex-1 flex-wrap items-center transition-[gap] duration-300 ease-out ${g?"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 ${g?"text-base sm:text-lg":"text-lg sm:text-xl"}`,style:{color:"var(--text-main)"},children:r}),t&&e.jsx("p",{"aria-hidden":g,className:`overflow-hidden text-xs transition-[max-height,opacity,transform,margin] duration-300 ease-out ${g?"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 ${g?"translate-y-0 gap-1.5 opacity-95":"gap-2 opacity-100"}`,children:n})]})]})]}),a&&e.jsx("div",{className:`page-header-actions ml-auto flex max-w-full flex-shrink-0 flex-wrap items-center justify-end self-center overflow-visible transition-[gap,min-height,opacity,transform] duration-300 ease-out ${g?"min-h-10 gap-1 opacity-95":"min-h-10 gap-1.5 opacity-100"}`,children:e.jsx(Sr.Provider,{value:{compact:!0,headerAction:!0},children:a})})]})})}function ln({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(Qr,{currentPath:t,...n,children:r})}function Rr(){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 cn(r,t,a){try{const n=new URL(r),s=n.searchParams.get("callbackUrl");if(s){const c=new URL(s,n.origin);return c.searchParams.set("theme",t),a&&(c.searchParams.set("primeAuthOrigin",window.location.origin),c.searchParams.set("primeAuthProjectKey",a)),n.searchParams.set("callbackUrl",`${c.pathname}${c.search}${c.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 dn({name:r,src:t,projectKey:a}){const[n,s]=o.useState(()=>Rr()),c=o.useRef(null);o.useEffect(()=>{const p=new MutationObserver(()=>s(Rr()));return p.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>p.disconnect()},[]);const d=o.useMemo(()=>cn(t,n,a),[a,t,n]),i=o.useMemo(()=>{try{return new URL(d).origin}catch{return""}},[d]);return o.useEffect(()=>{if(!a)return;const p=a;function b(C){var g,u,m;if(C.source!==((g=c.current)==null?void 0:g.contentWindow)||i&&C.origin!==i)return;if(((u=C.data)==null?void 0:u.type)==="prime-microservice:overlay"){window.dispatchEvent(new CustomEvent("prime-auth:microservice-overlay",{detail:{active:!!C.data.active}}));return}if(((m=C.data)==null?void 0:m.type)!=="prime-microservice:navigation")return;const k=C.data.path;if(!k||!k.startsWith("/")||k.startsWith("//"))return;const y=`/apps/${encodeURIComponent(p)}${k}`;`${window.location.pathname}${window.location.search}${window.location.hash}`!==y&&(window.history.replaceState(window.history.state,"",y),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}}))}},[i,a]),e.jsx("div",{className:"flex h-full min-h-screen flex-col bg-[var(--bg-main)]",children:e.jsx("iframe",{ref:c,src:d,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 un(){const[r,t]=o.useState(""),[a,n]=o.useState(!1),[s,c]=o.useState({width:96,height:96});return o.useEffect(()=>{let d=!1;return fetch("/api/microservices/prime-suite/chat-url",{cache:"no-store"}).then(i=>i.ok?i.json():null).then(i=>{!d&&(i!=null&&i.src)&&t(i.src)}).catch(()=>{}),()=>{d=!0}},[]),o.useEffect(()=>{const d=i=>{var b;if(((b=i.data)==null?void 0:b.type)!=="prime-suite-chat:state")return;const p=!!i.data.active;n(p),c({width:et(i.data.width,96,720),height:et(i.data.height,96,560)})};return window.addEventListener("message",d),()=>window.removeEventListener("message",d)},[]),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(${s.width}px, 100vw)`:96,height:a?`min(${s.height}px, 100vh)`:96,background:"transparent",backgroundColor:"transparent",colorScheme:"normal"}}):null}function et(r,t,a){const n=typeof r=="number"&&Number.isFinite(r)?r:t;return Math.max(t,Math.min(a,Math.ceil(n)))}function fn(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 pn(){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 bn(){return"light"}function hn(){const r=o.useSyncExternalStore(fn,pn,bn);return e.jsx(wt.Toaster,{position:"bottom-center",theme:r,richColors:!0,closeButton:!0})}B.Alert=Pt,B.AuthShell=Qr,B.BonsaifButton=Nt,B.Button=de,B.CalendarPicker=Ut,B.Checkbox=Gt,B.CodeBlock=Vt,B.CompactFilterSelect=Zt,B.CompactSearchInput=Kt,B.ConfirmDialog=Rt,B.CopyButton=sr,B.CopyLinkButton=ra,B.DataTable=oa,B.DateRangePicker=ia,B.Drawer=fa,B.DropdownMenu=da,B.DynamicDetailTabs=It,B.EmptyState=ba,B.FormField=zr,B.GlobalScrollbars=Vr,B.InputField=Sa,B.LoadingState=Er,B.MicroserviceFrame=dn,B.Modal=Ar,B.MouseTooltip=Ue,B.MultiSelect=Ea,B.PageHeader=sn,B.PageSearchInput=kr,B.Pagination=Ma,B.PrimeAuthRouteShell=ln,B.PrimeAuthToaster=hn,B.PrimeSuiteChatFrame=un,B.RadioGroup=Da,B.SearchableSelect=lr,B.SectionPanel=La,B.StatusBadge=Ba,B.StepWizard=Oa,B.Tabs=Aa,B.TextInput=Ve,B.Textarea=qr,B.TextareaField=ja,B.Toggle=Fa,B.UserAvatar=Jr,B.cn=Nr,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function($,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react"),require("react/jsx-runtime"),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","react/jsx-runtime","react-icons/hi2","react-dom","overlayscrollbars","react-icons/md","overlayscrollbars-react","react-day-picker","react-day-picker/dist/style.css","react-icons/fi","sonner"],l):($=typeof globalThis<"u"?globalThis:$||self,l($.BonsaifUI={},$.React,$.jsxRuntime,$.ReactIconsHi2,$.ReactDOM,$.OverlayScrollbarsGlobal,$.ReactIconsMd,$.OverlayScrollbarsReact,$.ReactDayPicker,$.ReactDayPickerStyles,$.ReactIconsFi,$.Sonner))})(this,(function($,l,e,S,$e,Dr,Ot,Lr,Tr,Nl,Pt,zt){"use strict";"use client";function De(...r){return r.filter(Boolean).join(" ")}function _t({variant:r="primary",className:t,type:a="button",children:n,...s}){return e.jsx("button",{className:De("bonsaif-ui-button",`bonsaif-ui-button--${r}`,t),type:a,...s,children:n})}function Ir({value:r,onChange:t,placeholder:a,className:n="",autoFocus:s=!1,forceExpanded:u=!1,onEscape:i,size:c="default",inputTabIndex:b}){const h=l.useRef(null),[E,C]=l.useState(!1),v=u||E||r.trim().length>0,x=c==="sm"?"h-9 rounded-md":"h-10 rounded-lg",f=n||"w-48 max-w-full sm:w-64 lg:w-72";l.useEffect(()=>{var p;s&&((p=h.current)==null||p.focus())},[s]);const m=()=>{var p;C(!0),(p=h.current)==null||p.focus()};return e.jsxs("div",{className:`relative min-w-0 max-w-full flex-shrink-0 overflow-visible transition-[width] duration-200 ease-out ${v?f:"w-24 sm:w-28"}`,onMouseDown:p=>{v||(p.preventDefault(),m())},children:[e.jsx(S.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:h,type:"text",tabIndex:b,"aria-label":a,value:r,onChange:p=>t(p.target.value),onKeyDown:p=>{p.key==="Escape"&&(i==null||i())},placeholder:v?a:"Buscar",className:`${x} w-full py-0 text-sm leading-none placeholder:text-[var(--text-muted)] focus:outline-none transition-all duration-200 ${v?"pl-9 pr-8":"cursor-pointer pl-9 pr-3"}`,style:{background:"color-mix(in srgb, var(--bg-card) 86%, transparent)",border:"1px solid var(--border)",color:"var(--text-main)"},onFocus:p=>{C(!0),p.currentTarget.style.borderColor="var(--primary)",p.currentTarget.style.boxShadow="0 0 0 3px rgba(59,130,246,0.12)"},onBlur:p=>{C(!1),p.currentTarget.style.borderColor="var(--border)",p.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(S.HiXMark,{className:"h-3.5 w-3.5 flex-shrink-0"})})]})}const Ar=l.createContext({});function jt(r){var n;const t=Array.from(r.querySelectorAll("*")).filter(s=>{var u;return s.scrollWidth>s.clientWidth&&!!((u=s.textContent)!=null&&u.trim())&&s.tagName.toLowerCase()!=="svg"&&!s.closest("svg")});return(r.scrollWidth>r.clientWidth||t.length>0)&&(((n=t[0])==null?void 0:n.textContent)??r.textContent??"").trim()||null}function ze({children:r,content:t,onlyWhenOverflow:a=!1,className:n="",style:s,as:u="div"}){const i=l.useRef(null),c=l.useRef(null),[b,h]=l.useState(null),[E,C]=l.useState("");l.useEffect(()=>{const m=i.current;m&&(m.querySelectorAll("[title]").forEach(p=>{const N=p.getAttribute("title");N&&(p.getAttribute("aria-label")||p.setAttribute("aria-label",N),p.removeAttribute("title"))}),m.querySelectorAll("svg title").forEach(p=>p.remove()))}),l.useLayoutEffect(()=>{if(!b)return;const m=c.current;if(!m)return;const p=12,N=14,T=m.getBoundingClientRect(),H=window.innerWidth-T.width-p,I=window.innerHeight-T.height-p;let y=b.mouseX+N,M=b.mouseY+N;y>H&&(y=b.mouseX-T.width-N),M>I&&(M=b.mouseY-T.height-N),y=Math.min(Math.max(p,y),Math.max(p,H)),M=Math.min(Math.max(p,M),Math.max(p,I)),(Math.abs(y-b.x)>.5||Math.abs(M-b.y)>.5)&&h(A=>A&&{...A,x:y,y:M})},[b]);const v=(m,p)=>{const N=i.current;if(N){if(a){const T=jt(N);if(!T)return;C(T)}!a&&!t||h({mouseX:m,mouseY:p,x:m+14,y:p+14})}},x=()=>{const m=i.current;if(!m)return;const p=m.getBoundingClientRect();v(p.left+p.width/2,p.bottom)},f=a?E:t;return e.jsxs(e.Fragment,{children:[e.jsx(u,{ref:m=>{i.current=m},className:n,style:s,onMouseEnter:m=>v(m.clientX,m.clientY),onMouseMove:m=>{b&&v(m.clientX,m.clientY)},onMouseLeave:()=>h(null),onFocus:x,onBlur:()=>h(null),children:r}),b&&f?$e.createPortal(e.jsx("div",{ref:c,role:"tooltip",style:{position:"fixed",top:b.y,left:b.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 Br(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}const Ft="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",Wt={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"},qt="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",Ut={xs:"h-8 px-2.5 text-xs",sm:"h-9 px-3.5 text-xs",md:"h-10 px-3.5 text-sm",lg:"h-11 px-4 text-sm font-semibold"},Gt={xs:"h-8 w-8",sm:"h-9 w-9",md:"h-10 w-10",lg:"h-10 w-10"},Vt={primary:{background:"var(--bg-card)"},secondary:{background:"var(--bg-card)"},danger:{background:"var(--bg-card)"},ghost:{},icon:{}};function ir(r){return typeof r=="string"||typeof r=="number"?String(r):Array.isArray(r)?r.map(ir).join(" ").trim():l.isValidElement(r)?ir(r.props.children):""}function Kt(r){return l.Children.toArray(r).find(l.isValidElement)??null}function ue({variant:r="primary",size:t="md",loading:a=!1,icon:n,tooltip:s,iconOnly:u,height:i,padding:c,children:b,className:h="",disabled:E,style:C,...v}){const x=l.useContext(Ar),f=u??x.iconOnly??r==="icon",m=x.compact??!1,p=x.headerAction??!1,N=m&&!p&&t==="md"?"xs":t,T=r==="icon"||f,H=p&&T,I=ir(b),y=s??v.title??v["aria-label"]??(f?I:void 0),M=y?void 0:v.title,A=v["aria-label"]??(typeof y=="string"?y:I||void 0),P=a?null:n??(f?Kt(b):null),k=e.jsxs("button",{...v,title:M,"aria-label":A,"data-variant":r,"data-size":N,"data-icon":T?"true":void 0,disabled:E||a,className:`${Ft} ${H?qt:Wt[r]} ${T?Gt[N]:Ut[N]} ${m&&!T?"px-2.5":""} ${h}`,style:{...Vt[r],height:Br(i),padding:Br(c),...C,...H?{width:"40px",height:"40px",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"}):P,!f&&b]});return y?e.jsx(ze,{as:"span",content:y,className:"inline-flex shrink-0",children:k}):k}function Hr({variant:r="page",title:t="Cargando...",rows:a=6,children:n}){return r==="table"?e.jsx(Or,{rows:a}):r==="sections"?e.jsx(Yt,{rows:a}):r==="cards"?e.jsx(Xt,{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 Yt({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(Or,{rows:a===0?r:Math.max(3,r-2),compact:!0})]},a))})}function Xt({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 Or({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,s)=>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)]"})},s))}),Array.from({length:r}).map((n,s)=>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,i)=>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+(s*13+i*11)%36}%`}})},i))},s))]})}function Pr(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 zr(r){return r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim()}function Zt(r){return[r.label,Pr(r.service),r.description,r.service].filter(Boolean).join(" ")}function Jt(r){return typeof r=="function"?r:r.default}function Qt(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:s,links:u,moduleRegistry:i,loadModule:c,activeService:b,initialService:h,onActiveServiceChange:E,canAccess:C,keepAlive:v=!0,title:x,subtitle:f,emptyState:m,loadingState:p,errorState:N=Qt,renderTabLabel:T,searchableTabs:H="auto",tabsSearchThreshold:I=6,tabsSearchPlaceholder:y="Buscar modulo...",tabsSearchValue:M,onTabsSearchChange:A,emptySearchState:P,showTabCount:k=!0,className:D="",parentClassName:G="",contentClassName:j="",tabsClassName:V=""}){var rr;const q=l.useMemo(()=>u.filter(F=>!F.hidden&&((C==null?void 0:C(F,s))??!0)),[C,s,u]),Y=(rr=q.find(F=>!F.disabled))==null?void 0:rr.service,[Z,L]=l.useState(h??Y??""),[g,B]=l.useState({}),[K,Q]=l.useState({}),[re,oe]=l.useState(""),[o,W]=l.useState(!1),le=l.useRef(K),ee=l.useRef(0),te=M??re,z=zr(te),ae=H===!0||H==="auto"&&q.length>=I,ne=ae&&te.trim().length>0,_=l.useMemo(()=>z?q.filter(F=>zr(Zt(F)).includes(z)):q,[z,q]),R=b??Z,U=q.find(F=>F.service===R)??q.find(F=>!F.disabled);l.useEffect(()=>{!U&&Y&&L(Y)},[Y,U]),l.useEffect(()=>{le.current=K},[K]);const he=F=>{F.disabled||(b||L(F.service),E==null||E(F.service,F))},ke=F=>{M===void 0&&oe(F),A==null||A(F)},Ue=(F,pe)=>{const be=_.filter(fe=>!fe.disabled),He=be.findIndex(fe=>fe.service===pe.service);He<0||((F.key==="ArrowRight"||F.key==="ArrowDown")&&(F.preventDefault(),he(be[(He+1)%be.length])),(F.key==="ArrowLeft"||F.key==="ArrowUp")&&(F.preventDefault(),he(be[(He-1+be.length)%be.length])),F.key==="Home"&&(F.preventDefault(),he(be[0])),F.key==="End"&&(F.preventDefault(),he(be[be.length-1])))},Se=l.useCallback(()=>{if(!U)return;const F=U.service,pe=le.current[F];if(pe!=null&&pe.loading||pe!=null&&pe.component&&v)return;const be=(i==null?void 0:i[F])??c;if(!be){Q(fe=>({...fe,[F]:{loading:!1,error:new Error(`No module loader found for service "${F}".`)}}));return}const He=++ee.current;Q(fe=>({...fe,[F]:{...fe[F],loading:!0,error:void 0}})),be(U,s).then(fe=>{if(He!==ee.current&&!v)return;const we=Jt(fe);Q(Ne=>({...Ne,[F]:{component:we,loading:!1}}))}).catch(fe=>{const we=fe instanceof Error?fe:new Error(String(fe));Q(Ne=>({...Ne,[F]:{...Ne[F],loading:!1,error:we}}))})},[s,v,c,i,U]);l.useEffect(Se,[Se]);const Ge=U?g[U.service]??null:null,de=U?K[U.service]:void 0,_e=de==null?void 0:de.component,Ve=F=>{U&&B(pe=>({...pe,[U.service]:F}))},Ke=()=>{U&&B(F=>({...F,[U.service]:null}))},Ce={context:s,parent:n,links:u,visibleLinks:q,filteredLinks:_,selectedLink:U,selectedService:U==null?void 0:U.service,activeItemId:Ge,tabsSearch:te,onSelectService:he,onOpenDetail:Ve,onBackToList:Ke},xr=a?a(Ce):t?e.jsx(t,{...Ce}):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 ${G}`,children:xr}),e.jsxs("div",{className:`relative min-w-0 overflow-visible rounded-lg border border-[var(--border)] bg-[var(--bg-card)] ${j}`,children:[(x||f||ae||k)&&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:[x&&e.jsx("h2",{className:"truncate text-sm font-semibold text-[var(--text-main)]",children:x}),f&&e.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-[var(--text-muted)]",children:f})]}),(ae||k)&&e.jsxs("div",{className:"flex min-w-0 flex-shrink-0 items-center justify-end gap-2",children:[k&&e.jsxs("span",{className:"hidden text-xs font-semibold text-[var(--text-muted)] transition-opacity duration-200 sm:inline",children:[_.length," / ",q.length]}),ae&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`origin-right overflow-hidden transition-[width,opacity,transform] duration-200 ease-out ${o?"w-[min(20rem,44vw)] translate-x-0 opacity-100":"w-0 translate-x-2 opacity-0"}`,"aria-hidden":!o,children:e.jsx(Ir,{value:te,onChange:ke,placeholder:y,className:"w-full",autoFocus:o,forceExpanded:!0,onEscape:()=>W(!1),size:"sm",inputTabIndex:o?0:-1})}),e.jsx("button",{type:"button","aria-label":o?"Cerrar busqueda":"Buscar tabs","aria-expanded":o,onClick:()=>{o&&te&&ke(""),W(F=>!F)},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 ${o||ne?"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:o||ne?e.jsx(S.HiXMark,{className:"h-4 w-4"}):e.jsx(S.HiMagnifyingGlass,{className:"h-4 w-4"})})})]})]})]})}),e.jsx("div",{role:"tablist","aria-label":x??"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 ${V}`,children:_.length>0?_.map(F=>{const pe=F.service===(U==null?void 0:U.service);return e.jsx("button",{type:"button",role:"tab","aria-selected":pe,disabled:F.disabled,onClick:()=>he(F),onKeyDown:be=>Ue(be,F),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 ${pe?"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:T?T(F,pe):e.jsxs(e.Fragment,{children:[F.icon,e.jsx("span",{children:F.label??Pr(F.service)}),F.badge&&e.jsx("span",{className:"rounded-full bg-[var(--bg-input)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:F.badge})]})},F.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:P??"No hay modulos que coincidan con la busqueda."})}),(U==null?void 0:U.description)&&e.jsx("div",{className:"border-b border-[var(--border)] px-4 py-2 text-xs text-[var(--text-muted)]",children:U.description}),e.jsxs("div",{className:"min-h-[420px] p-4",children:[!U&&(m??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."})),U&&(de==null?void 0:de.loading)&&(p??e.jsx(Hr,{title:"Cargando modulo..."})),U&&(de==null?void 0:de.error)&&N(de.error,Se),U&&_e&&!(de!=null&&de.loading)&&!(de!=null&&de.error)&&e.jsx(_e,{context:s,parent:n,link:U,activeItemId:Ge,onOpenDetail:Ve,onBackToList:Ke})]})]})]})}const ea={info:{color:"#2563eb",background:"rgba(59, 130, 246, 0.1)",border:"rgba(59, 130, 246, 0.24)",icon:e.jsx(S.HiInformationCircle,{className:"h-5 w-5"})},success:{color:"#047857",background:"rgba(16, 185, 129, 0.1)",border:"rgba(16, 185, 129, 0.24)",icon:e.jsx(S.HiCheckCircle,{className:"h-5 w-5"})},warning:{color:"#b45309",background:"rgba(245, 158, 11, 0.12)",border:"rgba(245, 158, 11, 0.26)",icon:e.jsx(S.HiExclamationTriangle,{className:"h-5 w-5"})},danger:{color:"var(--danger)",background:"var(--danger-bg)",border:"color-mix(in srgb, var(--danger) 20%, var(--border))",icon:e.jsx(S.HiExclamationCircle,{className:"h-5 w-5"})},neutral:{color:"var(--text-secondary)",background:"var(--bg-input)",border:"var(--border)",icon:e.jsx(S.HiInformationCircle,{className:"h-5 w-5"})}};function ra({variant:r="info",title:t,children:a,icon:n,action:s,onDismiss:u,className:i=""}){const c=ea[r];return e.jsxs("div",{role:r==="danger"||r==="warning"?"alert":"status",className:`flex items-start gap-3 rounded-lg border px-3 py-3 ${i}`,style:{background:c.background,borderColor:c.border},children:[e.jsx("div",{className:"mt-0.5 shrink-0",style:{color:c.color},children:n??c.icon}),e.jsxs("div",{className:"min-w-0 flex-1",children:[t&&e.jsx("div",{className:"text-sm font-semibold text-[var(--text-main)]",children:t}),a&&e.jsx("div",{className:"mt-0.5 text-sm leading-5 text-[var(--text-secondary)]",children:a}),s&&e.jsx("div",{className:"mt-3",children:s})]}),u&&e.jsx(ue,{variant:"icon",size:"xs","aria-label":"Cerrar alerta",onClick:u,className:"-mr-1 -mt-1",children:e.jsx(S.HiXMark,{className:"h-4 w-4"})})]})}const _r=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],ta=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],aa=["Do","Lu","Ma","Mi","Ju","Vi","Sá"],cr=6;function dr(r,t,a){return`${r}-${String(t).padStart(2,"0")}-${String(a).padStart(2,"0")}`}function na(){const r=new Date;return dr(r.getFullYear(),r.getMonth()+1,r.getDate())}function jr(r){const[t,a,n]=r.split("-").map(Number);return{year:t,month:a,day:n}}function la(r){if(!r)return"Seleccionar fecha";const{year:t,month:a,day:n}=jr(r);return!t||!a||!n?"Seleccionar fecha":`${String(n).padStart(2,"0")} ${_r[a-1]} ${t}`}function sa({value:r,onChange:t,minDate:a,displayMode:n="inline"}){const s=na(),i=jr(r||s),c=n==="popover",[b,h]=l.useState(!1),E=l.useRef(null),[C,v]=l.useState({horizontal:"left",vertical:"bottom"}),[x,f]=l.useState(i.year),[m,p]=l.useState(i.month),[N,T]=l.useState("days"),H=16,[I,y]=l.useState(0),M=x-7+I,A=Array.from({length:H},(L,g)=>M+g);l.useEffect(()=>{if(!c||!b||!E.current)return;const L=E.current.getBoundingClientRect(),g=8,B=280,K=340,Q=L.left+B>window.innerWidth-g,re=L.right-B>=g,oe=L.bottom+8+K>window.innerHeight-g,o=L.top-8-K>=g;v({horizontal:Q&&re?"right":"left",vertical:oe&&o?"top":"bottom"})},[c,b]),l.useEffect(()=>{if(!c||!b)return;function L(B){E.current&&(E.current.contains(B.target)||h(!1))}function g(B){B.key==="Escape"&&h(!1)}return document.addEventListener("mousedown",L),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",L),document.removeEventListener("keydown",g)}},[c,b]);function P(){m===1?(f(L=>L-1),p(12)):p(L=>L-1)}function k(){m===12?(f(L=>L+1),p(1)):p(L=>L+1)}const D=new Date(x,m-1,1).getDay(),G=new Date(x,m,0).getDate(),j=[...Array(D).fill(null),...Array.from({length:G},(L,g)=>g+1)];for(;j.length<cr*7;)j.push(null);const V=j.slice(0,cr*7);function q(L){const g=dr(x,m,L);a&&g<a||(t(g),c&&h(!1))}const Y={background:"none",border:"none",cursor:"pointer",color:"var(--text-muted)",padding:4,borderRadius:6,display:"flex",alignItems:"center"},Z=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:N==="days"?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:P,style:Y,title:"Mes anterior",children:e.jsx(S.HiChevronLeft,{size:16})}),e.jsxs("button",{type:"button",onClick:()=>{T("years"),y(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:[_r[m-1]," ",x,e.jsx(S.HiChevronDown,{size:13,style:{color:"var(--text-muted)"}})]}),e.jsx("button",{type:"button",onClick:k,style:Y,title:"Mes siguiente",children:e.jsx(S.HiChevronRight,{size:16})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>y(L=>L-H),style:Y,children:e.jsx(S.HiChevronLeft,{size:16})}),e.jsxs("button",{type:"button",onClick:()=>T("days"),style:{background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:700,color:"var(--text-main)",borderRadius:6,padding:"2px 6px"},children:[A[0]," – ",A[A.length-1]]}),e.jsx("button",{type:"button",onClick:()=>y(L=>L+H),style:Y,children:e.jsx(S.HiChevronRight,{size:16})})]})}),N==="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:ta.map((L,g)=>{const B=g+1===m;return e.jsx("button",{type:"button",onClick:()=>p(g+1),style:{border:"none",cursor:"pointer",borderRadius:6,fontSize:11,fontWeight:B?700:400,padding:"4px 0",background:B?"var(--primary)":"transparent",color:B?"var(--primary-fg, #ffffff)":"var(--text-secondary)"},children:L},L)})}),e.jsx("div",{style:{height:1,background:"var(--border)",marginBottom:8}}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4,1fr)",gap:3},children:A.map(L=>{const g=L===x;return e.jsx("button",{type:"button",onClick:()=>{f(L),T("days")},style:{border:"none",cursor:"pointer",borderRadius:6,fontSize:12,fontWeight:g?700:400,padding:"6px 0",background:g?"var(--primary)":"transparent",color:g?"var(--primary-fg, #ffffff)":"var(--text-main)",outline:L===new Date().getFullYear()&&!g?"2px solid var(--primary)":"none",outlineOffset:"-2px"},children:L},L)})})]}),N==="days"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7,1fr)",padding:"6px 8px 0"},children:aa.map(L=>e.jsx("div",{style:{textAlign:"center",fontSize:10,fontWeight:700,color:"var(--text-muted)",padding:"2px 0",textTransform:"uppercase"},children:L},L))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7,1fr)",gridTemplateRows:`repeat(${cr},1fr)`,padding:"4px 8px 10px",gap:2},children:V.map((L,g)=>{if(L===null)return e.jsx("div",{style:{aspectRatio:"1"}},g);const B=dr(x,m,L),K=B===r,Q=B===s,re=!!(a&&B<a);return e.jsx("button",{type:"button",onClick:()=>!re&&q(L),style:{width:"100%",aspectRatio:"1",borderRadius:6,border:"none",cursor:re?"not-allowed":"pointer",fontSize:12,fontWeight:K||Q?700:400,background:K?"var(--primary)":"transparent",color:K?"var(--primary-fg, #ffffff)":re?"var(--text-muted)":"var(--text-main)",opacity:re?.4:1,outline:Q&&!K?"2px solid var(--primary)":"none",outlineOffset:"-2px"},children:L},g)})})]})]});return c?e.jsxs("div",{ref:E,className:"relative w-full",children:[e.jsxs("button",{type:"button",onClick:()=>h(L=>!L),className:"flex h-10 w-full items-center justify-between gap-2 rounded-lg px-2.5 py-0 text-sm transition-all duration-150 focus:outline-none",style:{background:"var(--bg-input)",border:`1px solid ${b?"var(--primary)":"var(--border)"}`,color:"var(--text-main)",boxShadow:b?"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(S.HiCalendarDays,{className:"w-4 h-4 text-[var(--text-muted)]"}),e.jsx("span",{className:"truncate",children:la(r)})]}),e.jsx(S.HiChevronDown,{className:`w-4 h-4 text-[var(--text-muted)] transition-transform ${b?"rotate-180":""}`})]}),b&&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:Z})]}):Z}const oa={sm:"h-4 w-4",md:"h-5 w-5"};function ia({label:r,description:t,error:a,size:n="md",className:s="",containerClassName:u="",disabled:i,...c}){return e.jsxs("label",{className:`group inline-flex items-start gap-2.5 ${i?"cursor-not-allowed opacity-60":"cursor-pointer"} ${u}`,children:[e.jsxs("span",{className:"relative mt-0.5 inline-flex shrink-0",children:[e.jsx("input",{...c,type:"checkbox",disabled:i,"aria-invalid":!!a||c["aria-invalid"],className:`peer ${oa[n]} appearance-none rounded border border-[var(--border)] bg-[var(--bg-input)] transition-colors checked:border-[var(--primary)] checked:bg-[var(--primary)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)]/40 ${s}`}),e.jsx(S.HiCheck,{className:"pointer-events-none absolute left-1/2 top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 scale-75 text-[var(--primary-fg)] opacity-0 transition peer-checked:scale-100 peer-checked:opacity-100"})]}),(r||t||a)&&e.jsxs("span",{className:"min-w-0",children:[r&&e.jsx("span",{className:"block text-sm font-medium leading-5 text-[var(--text-main)]",children:r}),t&&!a&&e.jsx("span",{className:"block text-xs leading-5 text-[var(--text-muted)]",children:t}),a&&e.jsx("span",{className:"block text-xs leading-5 text-[var(--danger)]",children:a})]})]})}function Fr(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 ca(r){var t;if((t=navigator.clipboard)!=null&&t.writeText){await navigator.clipboard.writeText(r);return}Fr(r)}function da(r){return typeof r=="function"?r():r}function ur({value:r,resetDelay:t=2e3,title:a,copiedTitle:n="Copiado",copiedLabel:s,icon:u=e.jsx(S.HiClipboardDocument,{size:14}),copiedIcon:i=e.jsx(S.HiCheck,{size:14}),stopPropagation:c=!0,onCopied:b,onCopyError:h,className:E="",style:C,children:v,onClick:x,type:f="button",...m}){const[p,N]=l.useState(!1),T=l.useRef(null);l.useEffect(()=>()=>{T.current&&window.clearTimeout(T.current)},[]);function H(y){N(!0),b==null||b(y),T.current&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{N(!1),T.current=null},t)}async function I(y){var A;if(c&&y.stopPropagation(),x==null||x(y),y.defaultPrevented)return;const M=da(r);if(M)try{await ca(M),H(M)}catch(P){try{Fr(M),H(M)}catch(k){h==null||h(k,M);return}(A=navigator.clipboard)!=null&&A.writeText||h==null||h(P,M)}}return e.jsxs("button",{...m,type:f,onClick:I,title:p?n:a,"aria-label":m["aria-label"]??(p?n:a),"data-copied":p?"true":void 0,className:`relative inline-flex h-7 shrink-0 items-center justify-center gap-1.5 rounded-md transition-all duration-200 ${v?"min-w-7 px-2":"w-7"} ${E}`,style:{cursor:"pointer",background:p?"rgba(22,163,74,0.15)":"var(--bg-card)",border:p?"1px solid rgba(22,163,74,0.4)":"1px solid var(--border)",color:p?"#16a34a":"var(--text-secondary)",boxShadow:p?"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:p?"scale(1.15)":"scale(1)"},children:p?i:u}),v&&e.jsx("span",{className:"text-xs font-semibold leading-none",children:p?s??v:v})]})}function ua({code:r,children:t,title:a="Codigo",language:n,copyLabel:s="Copiar",copiedLabel:u="Copiado",className:i="",style:c,onCopied:b}){const h=(r??t??"").trim();return e.jsxs("div",{className:`overflow-hidden rounded-lg border ${i}`,style:{borderColor:"rgba(148, 163, 184, 0.22)",background:"#0f172a",color:"#e2e8f0",...c},children:[e.jsxs("div",{className:"flex min-h-9 items-center justify-between gap-3 border-b px-3 py-1.5",style:{borderColor:"rgba(148, 163, 184, 0.18)",background:"#111827",color:"#94a3b8"},children:[e.jsx("span",{className:"min-w-0 truncate text-[11px] font-black uppercase tracking-[0.08em]",children:a}),e.jsx(ur,{value:h,title:"Copiar codigo",copiedTitle:"Codigo copiado",copiedLabel:u,onCopied:b,className:"h-7 min-w-[72px] px-2",style:{background:"#182235",border:"1px solid rgba(148, 163, 184, 0.28)",color:"#f8fafc"},children:s})]}),e.jsx("pre",{className:"m-0 overflow-x-auto p-3 text-xs leading-6",style:{background:"#0f172a",color:"#e2e8f0",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace'},children:e.jsx("code",{className:n?`language-${n}`:void 0,children:h})})]})}function br(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}function Ye({value:r,onChange:t,options:a,status:n="default",ariaLabel:s,triggerVariant:u="default",showSelectedSublabel:i=!0,placeholder:c="Seleccionar…",emptyLabel:b,disabled:h=!1,className:E="",style:C,dropdownMinWidth:v,height:x=40,padding:f="0 10px",searchable:m=!0,minOptionsForSearch:p=6}){const[N,T]=l.useState(!1),[H,I]=l.useState(""),[y,M]=l.useState(-1),[A,P]=l.useState(!1),[k,D]=l.useState({}),G=l.useRef(null),j=l.useRef(null),V=l.useRef(null),q=l.useRef(null),Y=m&&a.length>=p,Z=a.find(o=>o.value===r)??null,L=u==="ghost",g=n==="error"?"var(--danger)":N?"var(--primary)":"var(--border)",B=Y&&H.trim()?a.filter(o=>{var W;return o.label.toLowerCase().includes(H.toLowerCase())||((W=o.sublabel)==null?void 0:W.toLowerCase().includes(H.toLowerCase()))}):a,K=l.useCallback(()=>{const o=G.current;if(!o)return;const W=o.getBoundingClientRect(),le=Y?272:212,ee=window.innerHeight-W.bottom,te=ee<le&&W.top>ee;D({position:"fixed",left:W.left,top:te?void 0:W.bottom+4,bottom:te?window.innerHeight-W.top+4:void 0,width:W.width,minWidth:br(v),zIndex:9999})},[v,Y]);l.useEffect(()=>P(!0),[]),l.useEffect(()=>{if(!N)return;function o(W){var ee,te;const le=W.target;!((ee=G.current)!=null&&ee.contains(le))&&!((te=j.current)!=null&&te.contains(le))&&(T(!1),I(""))}return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[N]),l.useEffect(()=>{N&&(M(-1),K(),Y&&setTimeout(()=>{var o;return(o=V.current)==null?void 0:o.focus()},0))},[N,Y,K]),l.useEffect(()=>{if(N)return window.addEventListener("resize",K),window.addEventListener("scroll",K,!0),()=>{window.removeEventListener("resize",K),window.removeEventListener("scroll",K,!0)}},[N,K]),l.useEffect(()=>{if(y<0||!q.current)return;const o=q.current.children[y];o==null||o.scrollIntoView({block:"nearest"})},[y]);const Q=l.useCallback(o=>{t(o),T(!1),I("")},[t]);function re(o){if(!N){(o.key==="Enter"||o.key===" "||o.key==="ArrowDown")&&(o.preventDefault(),T(!0));return}o.key==="Escape"?(o.preventDefault(),T(!1),I("")):o.key==="ArrowDown"?(o.preventDefault(),M(W=>Math.min(W+1,B.length-1))):o.key==="ArrowUp"?(o.preventDefault(),M(W=>Math.max(W-1,b?-1:0))):o.key==="Enter"&&(o.preventDefault(),y===-1&&b?Q(""):B[y]&&Q(B[y].value))}const oe=e.jsxs("div",{ref:j,"data-bonsaif-select-dropdown":"true",className:"rounded-xl shadow-xl overflow-hidden",style:{...k,background:"var(--bg-card)",border:"1px solid var(--border)"},children:[Y&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{borderBottom:"1px solid var(--border)"},children:[e.jsx(S.HiMagnifyingGlass,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"var(--text-muted)"}}),e.jsx("input",{ref:V,value:H,onChange:o=>{I(o.target.value),M(-1)},placeholder:"Buscar…",className:"min-w-0 flex-1 text-sm bg-transparent outline-none",style:{color:"var(--text-main)"}}),H&&e.jsx("button",{type:"button",onMouseDown:o=>{o.preventDefault(),I("")},children:e.jsx(S.HiXMark,{className:"w-3.5 h-3.5",style:{color:"var(--text-muted)"}})})]}),e.jsxs("ul",{ref:q,role:"listbox",className:"overflow-y-auto",style:{maxHeight:Y?220:180,scrollbarWidth:"thin",scrollbarColor:"var(--border) transparent",overscrollBehavior:"contain"},children:[b&&e.jsx("li",{role:"option","aria-selected":r==="",onMouseDown:o=>{o.preventDefault(),Q("")},onMouseEnter:()=>M(-1),className:"flex items-center gap-2 px-3 py-2 cursor-pointer text-sm transition-colors",style:{background:y===-1?"var(--bg-hover)":"transparent",color:"var(--text-muted)",fontStyle:"italic"},children:b}),B.map((o,W)=>{const ee=W===y,te=o.value===r;return e.jsxs("li",{role:"option","aria-selected":te,onMouseDown:z=>{z.preventDefault(),o.disabled||Q(o.value)},onMouseEnter:()=>!o.disabled&&M(W),className:"flex items-center gap-2 px-3 py-2 cursor-pointer text-sm transition-colors",style:{background:ee?"var(--bg-hover)":te?"color-mix(in srgb, var(--primary) 6%, transparent)":"transparent",color:o.disabled?"var(--text-muted)":"var(--text-main)",cursor:o.disabled?"not-allowed":"pointer",boxShadow:te?"inset 2px 0 0 var(--primary)":void 0},children:[o.color&&e.jsx("span",{className:"flex-shrink-0 w-2.5 h-2.5 rounded-full",style:{background:o.color}}),e.jsxs("span",{className:"min-w-0 flex flex-1 items-baseline gap-1 overflow-hidden",children:[e.jsx("span",{className:"truncate",children:o.label}),o.sublabel&&e.jsx("span",{className:"min-w-0 flex-shrink truncate",style:{color:"var(--text-muted)",fontSize:12},children:o.sublabel})]}),o.badge&&e.jsx("span",{className:"text-xs flex-shrink-0",style:{color:"var(--text-muted)"},children:o.badge})]},o.value)}),B.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:G,className:`relative ${E||"w-full"}`,style:C,onKeyDown:re,children:[e.jsxs("button",{type:"button",disabled:h,onClick:()=>!h&&T(o=>!o),className:"flex w-full items-center gap-2 rounded-lg text-left text-sm transition-colors focus:outline-none",style:{height:br(x),padding:br(f),background:L?"transparent":"var(--bg-input)",color:Z?"var(--text-main)":"var(--text-muted)",border:L?"1px solid transparent":`1px solid ${g}`,opacity:h?.5:1,cursor:h?"not-allowed":"pointer"},"aria-haspopup":"listbox","aria-expanded":N,"aria-label":s,children:[(Z==null?void 0:Z.color)&&e.jsx("span",{className:"flex-shrink-0 w-2.5 h-2.5 rounded-full",style:{background:Z.color}}),e.jsx("span",{className:"min-w-0 flex flex-1 items-baseline gap-1 overflow-hidden",children:Z?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"truncate",children:Z.label}),i&&Z.sublabel&&e.jsx("span",{className:"min-w-0 flex-shrink truncate",style:{color:"var(--text-muted)",fontSize:12},children:Z.sublabel})]}):e.jsx("span",{className:"truncate",children:c})}),Z&&b?e.jsx("span",{role:"button",tabIndex:-1,onMouseDown:o=>{o.preventDefault(),o.stopPropagation(),Q("")},className:"flex-shrink-0 rounded-full p-0.5 transition-colors hover:bg-black/10",style:{color:"var(--text-muted)"},children:e.jsx(S.HiXMark,{className:"w-3 h-3"})}):e.jsx(S.HiChevronDown,{className:"flex-shrink-0 w-4 h-4 transition-transform",style:{color:"var(--text-muted)",transform:N?"rotate(180deg)":"rotate(0deg)"}})]}),N&&A&&$e.createPortal(oe,document.body)]})}function Xe(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}function ba({value:r,onChange:t,placeholder:a="Buscar...",className:n="",height:s=40,padding:u="0 10px 0 30px",iconLeft:i=10}){return e.jsxs("div",{className:`relative ${n}`,children:[e.jsx(S.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:Xe(i)}}),e.jsx("input",{type:"text",value:r,onChange:c=>t(c.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:Xe(s),padding:Xe(u)}})]})}function fa({value:r,onChange:t,options:a,placeholder:n,icon:s,className:u="",height:i=40,padding:c,iconLeft:b=10,searchable:h=!0}){const E=s?a.map((C,v)=>v===0&&!C.color?{...C,sublabel:C.sublabel??void 0}:C):a;return e.jsxs("div",{className:`relative ${u}`,children:[s&&e.jsx("span",{className:"pointer-events-none absolute top-1/2 z-10 -translate-y-1/2 text-[var(--text-muted)]",style:{left:Xe(b)},children:s}),e.jsx(Ye,{value:r,onChange:t,options:E,placeholder:n,searchable:h,minOptionsForSearch:5,height:i,padding:c??(s?"0 10px 0 30px":"0 10px"),className:"[&>button]:text-sm [&>button]:[background:var(--bg-card)]"})]})}const pa={sm:"24rem",md:"28rem",lg:"32rem",xl:"40rem","2xl":"48rem","4xl":"56rem","5xl":"64rem"},Ze=180;function Wr({open:r,onClose:t,title:a,subtitle:n,leadingIcon:s,headerActions:u,footer:i,children:c,size:b="md",maxWidth:h,zIndex:E=1e3,closeOnBackdrop:C=!0,closeOnEscape:v=!0,showCloseButton:x=!0,placement:f="center",bodyClassName:m="px-6 py-5",panelClassName:p="",backdropClassName:N="bg-black/50 backdrop-blur-sm",contentClassName:T="p-4",ariaLabel:H,frameless:I=!1}){const[y,M]=l.useState(!1),[A,P]=l.useState(!1),k=l.useRef(null);if(l.useEffect(()=>(r?(k.current&&clearTimeout(k.current),M(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>P(!0)))):(P(!1),k.current=setTimeout(()=>M(!1),Ze+40)),()=>{k.current&&clearTimeout(k.current)}),[r]),l.useEffect(()=>{if(r)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[r]),l.useEffect(()=>{if(!r||!v)return;const Y=Z=>{Z.key==="Escape"&&t()};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[v,t,r]),!y)return null;const D=a||n||s||u||x,G=h??pa[b],j=f==="bottom-mobile"?"items-end sm:items-center justify-center p-0 sm:p-4":"items-center justify-center",V=f==="bottom-mobile"?"rounded-t-2xl sm:rounded-2xl":"rounded-2xl",q=A?"translateY(0) scale(1)":f==="bottom-mobile"?"translateY(16px) scale(0.98)":"translateY(10px) scale(0.96)";return $e.createPortal(e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":H??a,className:`fixed inset-0 flex ${j} ${T}`,style:{zIndex:E},children:[e.jsx("div",{className:`absolute inset-0 ${N}`,onClick:C?t:void 0,style:{opacity:A?1:0,transition:`opacity ${Ze}ms ease`}}),e.jsxs("div",{className:`relative z-10 flex max-h-[92dvh] w-full flex-col overflow-hidden ${I?"shadow-none":"shadow-2xl"} ${V} ${p}`,style:{maxWidth:G,background:I?"transparent":"var(--bg-card)",border:I?"none":"1px solid var(--border)",opacity:A?1:0,transform:q,transition:`opacity ${Ze}ms ease, transform ${Ze}ms ease`},onClick:Y=>Y.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:[s&&e.jsx("div",{className:"flex-shrink-0",children:s}),(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,x&&e.jsx(ue,{variant:"icon",onClick:t,title:"Cerrar",children:e.jsx(S.HiXMark,{className:"h-5 w-5"})})]})]}),e.jsx("div",{className:`min-h-0 flex-1 overflow-y-auto ${m}`,children:c}),i&&e.jsx("div",{className:"flex flex-shrink-0 justify-end gap-2 px-6 py-4",style:{borderTop:"1px solid var(--border)"},children:i})]})]}),document.body)}const ma={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 ha({open:r,title:t,description:a,confirmLabel:n="Confirmar",cancelLabel:s="Cancelar",variant:u="danger",onConfirm:i,onCancel:c}){const b=ma[u];return e.jsxs(Wr,{open:r,onClose:c,size:"sm",zIndex:9998,showCloseButton:!1,bodyClassName:"p-6",panelClassName:"px-1",ariaLabel:t,children:[e.jsx(ue,{variant:"icon",onClick:c,className:"absolute right-3 top-3 h-7 w-7 hover:opacity-70",style:{color:"var(--text-muted)"},"aria-label":"Cancelar",children:e.jsx(S.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:b.iconBg},children:e.jsx(S.HiExclamationTriangle,{className:"h-5 w-5",style:{color:b.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:c,className:"flex-1",style:{background:"var(--bg-input)"},children:s}),e.jsx(ue,{variant:"danger",onClick:i,className:"flex-1",style:{background:b.btnBg,color:b.btnColor,borderColor:"transparent"},children:n})]})]})}function va(r,t){const a=typeof r=="function"?r():r;return t?t(a):a}function ga({url:r,resolveUrl:t,title:a="Copiar link",copiedTitle:n="Link copiado",icon:s=e.jsx(S.HiLink,{className:"h-3.5 w-3.5"}),...u}){return e.jsx(ur,{...u,value:()=>va(r,t),title:a,copiedTitle:n,icon:s})}const xa="[&_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",ya=[];function Ie(r){if(!r)return 150;const t=parseInt(r,10);return isNaN(t)||t<=0?150:t}function Ae(r,t){const a=r.minWidth??80,n=r.maxWidth??1/0;return Math.min(n,Math.max(a,t))}function wa(r,t){if(t<=7)return Array.from({length:t},(n,s)=>s+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 Be(r,t){var i;const a=new Set(t.filter(c=>c.hideable!==!1).map(c=>c.key)),n=Array.from(new Set(r??[])).filter(c=>a.has(c));if(t.filter(c=>!n.includes(c.key)).length>0)return n;const u=(i=t.find(c=>c.hideable!==!1))==null?void 0:i.key;return u?n.filter(c=>c!==u):[]}function qr({children:r,className:t="",style:a}){return e.jsx(ze,{onlyWhenOverflow:!0,className:t,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",...a},children:r})}function Na({columns:r,data:t,getRowId:a,loading:n=!1,skeletonRows:s=8,emptyIcon:u,emptyText:i="Sin resultados",initialEmptyDelay:c=450,onRowClick:b,selected:h,onToggleOne:E,onToggleAll:C,highlightSelected:v=!0,rowClassName:x,getRowCategory:f,stickyHeader:m=!0,pageSize:p=25,pageSizeOptions:N=[25,50,100],pageSizeSelectWidth:T=62,pageSizeSelectHeight:H=30,pageSizeSelectPadding:I="0 7px",totalRows:y,page:M,onPageChange:A,onPageSizeChange:P,storageKey:k,stickyFirstColumn:D=!1,bottomOffset:G=0,compact:j=!0,restrictHeight:V=!0,maxHeight:q,minTableWidth:Y,enableColumnVisibility:Z=!0,hiddenColumnKeys:L,defaultHiddenColumnKeys:g=ya,onHiddenColumnKeysChange:B,columnVisibilityLabel:K="Columnas"}){var Tt;const Q=r.map(d=>d.key).join(","),re=g.join(","),oe=l.useRef(r),o=l.useRef(g);oe.current=r,o.current=g;const[W,le]=l.useState(!k),ee=l.useRef(null),te=l.useRef(!k),z=L!==void 0,[ae,ne]=l.useState(()=>Be(g,r)),_=Be(z?L:ae,r),[R,U]=l.useState(!1),[he,ke]=l.useState(null),[Ue,Se]=l.useState({}),Ge=l.useRef(null),de=l.useRef(null),[_e,Ve]=l.useState(t.length>0||n||c===!1),Ke=(d,w)=>50+(d*17+w*13+7)%40,Ce=l.useRef(null),[xr,rr]=l.useState(void 0),[F,pe]=l.useState(0),[be,He]=l.useState(!1);l.useEffect(()=>{function d(){He(window.innerWidth<640)}if(!V||q!==void 0)return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d);const O=p!==!1?32:0,J=12;function X(){if(d(),!Ce.current)return;const se=Ce.current.getBoundingClientRect().top;rr(Math.max(120,window.innerHeight-se-O-J-G))}return X(),window.addEventListener("resize",X),()=>window.removeEventListener("resize",X)},[n,p,G,V,q]);const fe=V?q??xr:void 0;l.useEffect(()=>{const d=Ce.current;if(!d)return;const w=()=>pe(d.clientWidth);if(w(),typeof ResizeObserver>"u")return window.addEventListener("resize",w),()=>window.removeEventListener("resize",w);const O=new ResizeObserver(w);return O.observe(d),()=>O.disconnect()},[n,W,t.length]),l.useEffect(()=>{if(c===!1||n||t.length>0){Ve(!0);return}if(_e)return;const d=window.setTimeout(()=>{Ve(!0)},c);return()=>window.clearTimeout(d)},[t.length,c,_e,n]);const[we,Ne]=l.useState(()=>r.map(d=>d.key)),[je,tr]=l.useState(()=>Object.fromEntries(r.map(d=>[d.key,Ae(d,Ie(d.width))])));l.useEffect(()=>{const d=oe.current,w=o.current,O=d.map(X=>X.key);if(!k){Ne(O),z||ne(Be(w,d)),te.current=!1,le(!0);return}let J=!1;return te.current=!1,le(!1),fetch(`/api/user/preferences/datatables?key=${encodeURIComponent(k)}`,{cache:"no-store"}).then(X=>X.ok?X.json():null).then(X=>{var At,Bt,Ht;if(J)return;const se=(At=X==null?void 0:X.settings)==null?void 0:At.columnOrder,ce=Array.isArray(se)?se.filter(ve=>O.includes(ve)):[],Pe=O.filter(ve=>!ce.includes(ve)),ie=ce.length>0?[...ce,...Pe]:O,me=Object.fromEntries(d.map(ve=>[ve.key,Ae(ve,Ie(ve.width))])),$r=((Bt=X==null?void 0:X.settings)==null?void 0:Bt.columnWidths)??{},or=Object.fromEntries(d.map(ve=>[ve.key,Ae(ve,$r[ve.key]??me[ve.key])])),It=Be(((Ht=X==null?void 0:X.settings)==null?void 0:Ht.hiddenColumnKeys)??w,d);Ne(ie),tr(or),z||ne(It),ee.current=JSON.stringify({columnOrder:ie,columnWidths:or,hiddenColumnKeys:It}),te.current=!0}).catch(()=>{if(!J){Ne(O);const X=Object.fromEntries(d.map(ce=>[ce.key,Ae(ce,Ie(ce.width))]));tr(X);const se=Be(w,d);z||ne(se),ee.current=JSON.stringify({columnOrder:O,columnWidths:X,hiddenColumnKeys:se}),te.current=!0}}).finally(()=>{J||le(!0)}),()=>{J=!0}},[k,Q,re,z]),l.useEffect(()=>{if(!k||!W||!te.current)return;const d={columnOrder:we,columnWidths:je,hiddenColumnKeys:_},w=JSON.stringify(d);if(w===ee.current)return;const O=window.setTimeout(()=>{fetch("/api/user/preferences/datatables",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:k,settings:d})}).then(J=>{J.ok&&(ee.current=w)}).catch(()=>{})},300);return()=>window.clearTimeout(O)},[we,je,_,k,W]),l.useEffect(()=>{Ne(d=>{const w=r.map(X=>X.key),O=d.filter(X=>w.includes(X)),J=w.filter(X=>!O.includes(X));return[...O,...J]})},[Q,r]);const mt=we.map(d=>r.find(w=>w.key===d)).filter(d=>!!d),Ee=mt.filter(d=>!_.includes(d.key));function ht(d){const w=Be(d,r);z||ne(w),B==null||B(w)}function ll(d){ht(_.includes(d)?_.filter(w=>w!==d):[..._,d])}function sl(){ht([])}const yr=l.useCallback((d=de.current)=>{if(!d)return;const w=d.getBoundingClientRect(),O=256,J=Math.min(Math.max(8,w.right-O),window.innerWidth-O-8),X=window.innerHeight-w.bottom,se=X<288&&w.top>X?void 0:w.bottom+6,ce=se===void 0?window.innerHeight-w.top+6:void 0;Se({position:"fixed",zIndex:9999,left:J,top:se,bottom:ce,width:O})},[]);function ol(d,w){d.preventDefault(),d.stopPropagation();const O=de.current===d.currentTarget&&he===w;if(R&&O){U(!1),ke(null);return}de.current=d.currentTarget,ke(w),yr(d.currentTarget),U(!0)}l.useEffect(()=>{tr(d=>{const w=Object.fromEntries(r.map(O=>[O.key,Ae(O,Ie(O.width))]));return Object.fromEntries(r.map(O=>[O.key,Ae(O,d[O.key]??w[O.key])]))})},[Q,r]),l.useEffect(()=>{z||ne(d=>Be(d,r))},[Q,r,z]),l.useEffect(()=>{function d(J){var se,ce;const X=J.target;!((se=Ge.current)!=null&&se.contains(X))&&!((ce=de.current)!=null&&ce.contains(X))&&(U(!1),ke(null))}function w(J){J.key==="Escape"&&(U(!1),ke(null))}function O(){yr()}return R&&(document.addEventListener("mousedown",d),window.addEventListener("keydown",w),window.addEventListener("resize",O),window.addEventListener("scroll",O,!0)),()=>{document.removeEventListener("mousedown",d),window.removeEventListener("keydown",w),window.removeEventListener("resize",O),window.removeEventListener("scroll",O,!0)}},[R,yr]);const ar=l.useRef(null);l.useEffect(()=>{function d(O){const J=ar.current;if(!J)return;const X=O.clientX-J.startX,se=r.find(ce=>ce.key===J.colKey);se&&tr(ce=>({...ce,[J.colKey]:Ae(se,J.startWidth+X)}))}function w(){ar.current&&(ar.current=null,document.body.style.cursor="",document.body.style.userSelect="")}return document.addEventListener("pointermove",d),document.addEventListener("pointerup",w),()=>{document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",w)}},[r]);const nr=l.useRef(null),[vt,wr]=l.useState(null);function il(d,w){nr.current=we.indexOf(d),w.dataTransfer.effectAllowed="move"}function cl(d,w){w.preventDefault(),w.dataTransfer.dropEffect="move";const O=we.indexOf(d);vt!==O&&wr(O)}function dl(d,w){w.preventDefault();const O=nr.current,J=we.indexOf(d);O!==null&&O!==J&&Ne(X=>{const se=[...X],[ce]=se.splice(O,1);return se.splice(J,0,ce),se}),nr.current=null,wr(null)}function ul(){nr.current=null,wr(null)}const[ge,gt]=l.useState(null);function bl(d){d.sortKey&>(w=>(w==null?void 0:w.key)===d.key?{key:d.key,dir:w.dir==="asc"?"desc":"asc"}:{key:d.key,dir:"asc"})}const[fl,Nr]=l.useState(1),[xt,pl]=l.useState(p===!1?0:p);l.useEffect(()=>{Nr(1)},[t]);const Fe=!!(A&&P),Oe=p!==!1,xe=Fe?M??1:fl,Te=Fe||Oe?xt:t.length,Me=!!h&&!!E&&!!C,kr=Me?40:0,ml=Me&&t.length>0&&h.size===t.length,hl=Me&&h.size>0&&h.size<t.length,Sr=l.useMemo(()=>{if(!ge)return t;const d=r.find(w=>w.key===ge.key&&w.sortKey);return d!=null&&d.sortKey?[...t].sort((w,O)=>{const J=w[d.sortKey],X=O[d.sortKey],se=J===X?0:J==null?1:X==null||J<X?-1:1;return ge.dir==="asc"?se:-se}):t},[t,ge,r]),yt=l.useMemo(()=>{if(Fe||!Oe)return Sr;const d=(xe-1)*Te;return Sr.slice(d,d+Te)},[Sr,Fe,Oe,xe,Te]),We=y??t.length,Cr=Oe?Math.max(1,Math.ceil(We/Te)):1,wt=Oe&&We>Te,vl=Oe?(xe-1)*Te+1:1,gl=Oe?Math.min(xe*Te,We):We;function Er(d){const w=Math.max(1,Math.min(d,Cr));Fe?A(w):Nr(w)}function xl(d){pl(d),Fe?(P(d),A(1)):Nr(1),P&&P(d)}const Nt=d=>d==="center"?"text-center":d==="right"?"text-right":"text-left",yl="color-mix(in srgb, var(--primary) 6%, var(--bg-card))",Mr=Ee.reduce((d,w)=>d+(je[w.key]??Ie(w.width)),Me?40:0),kt=typeof Y=="number"?Y:typeof Y=="string"?Number(((Tt=Y.match(/^(\d+(?:\.\d+)?)px$/))==null?void 0:Tt[1])??NaN):NaN,lr=Number.isFinite(kt)?Math.max(Mr,kt,F):Math.max(Mr,F),St=Y??lr,wl=Ee.length>0?Math.max(0,lr-Mr)/Ee.length:0,sr=`${Me?"40px ":""}${Ee.map(d=>`${(je[d.key]??Ie(d.width))+wl}px`).join(" ")}`;l.useEffect(()=>{ge&&_.includes(ge.key)&>(null)},[_,ge]);function Ct(d){return d?typeof d=="string"?{key:d,label:d}:d:null}const Et=()=>e.jsxs("div",{role:"row",className:"grid",style:{gridTemplateColumns:sr,background:"color-mix(in srgb, var(--bg-input) 72%, transparent)"},children:[Me&&e.jsx("div",{role:"columnheader",className:`${j?"px-2 py-1.5":"px-3 py-2.5"} w-10`,style:D?{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:ml,ref:d=>{d&&(d.indeterminate=hl)},onChange:C,className:"rounded cursor-pointer accent-[var(--primary)]"})}),Ee.map((d,w)=>{const O=(ge==null?void 0:ge.key)===d.key,J=!!d.sortKey,X=D&&!be&&w===0,se=vt===w,Pe=(je[d.key]??Ie(d.width))<120;return e.jsxs("div",{role:"columnheader",className:`group select-none ${Pe?"text-left":Nt(d.align)}`,style:{...X?{position:"sticky",left:kr,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:se?"2px solid var(--primary)":"2px solid transparent",cursor:J?"pointer":"default",padding:j?"5px 20px 5px 12px":"7px 24px 7px 12px"},onDragOver:ie=>cl(d.key,ie),onDrop:ie=>dl(d.key,ie),onClick:J?()=>bl(d):void 0,children:[e.jsx("span",{draggable:!0,onDragStart:ie=>{ie.stopPropagation(),il(d.key,ie)},onDragEnd:ie=>{ie.stopPropagation(),ul()},onClick:ie=>ie.stopPropagation(),title:"Arrastrar para reordenar",className:`absolute left-2 top-1/2 inline-flex h-5 w-5 -translate-x-1/2 -translate-y-1/2 scale-75 items-center justify-center rounded-[1px] border bg-[var(--bg-card)] text-[var(--text-muted)] opacity-0 shadow-sm transition-[opacity,transform,background-color,border-color,color] duration-150 hover:border-[var(--primary)] hover:bg-[color-mix(in_srgb,var(--primary)_14%,var(--bg-card))] hover:text-[var(--primary)] group-hover:scale-100 group-hover:opacity-100 ${se?"scale-100 border-[var(--primary)] bg-[color-mix(in_srgb,var(--primary)_14%,var(--bg-card))] text-[var(--primary)] opacity-100":"border-[var(--border)]"}`,style:{cursor:"grab",zIndex:5},children:e.jsx(Ot.MdDragIndicator,{size:14})}),e.jsx(qr,{className:"inline-block max-w-full align-middle",style:{width:"100%",textAlign:Pe?"left":d.align==="center"?"center":d.align==="right"?"right":"left"},children:e.jsxs("span",{className:`inline-flex max-w-full items-center gap-1 font-semibold uppercase tracking-wider ${j?"text-[11px]":"text-xs"}`,children:[e.jsx("span",{className:"min-w-0 truncate",children:d.header}),J&&e.jsx("span",{className:"flex-shrink-0 opacity-60",children:O?ge.dir==="asc"?e.jsx(S.HiChevronUp,{className:"w-3 h-3"}):e.jsx(S.HiChevronDown,{className:"w-3 h-3"}):e.jsx(S.HiChevronUpDown,{className:"w-3 h-3 opacity-40"})})]})}),Z&&e.jsx("button",{type:"button","aria-haspopup":"menu","aria-expanded":R&&he===d.key,"aria-label":K,title:K,onClick:ie=>ol(ie,d.key),className:`absolute right-3 top-1/2 inline-flex h-5 w-5 -translate-y-1/2 scale-75 items-center justify-center rounded-[1px] border bg-[var(--bg-card)] text-[var(--text-muted)] opacity-0 shadow-sm transition-[opacity,transform,background-color,border-color,color] duration-150 hover:border-[var(--primary)] hover:bg-[color-mix(in_srgb,var(--primary)_14%,var(--bg-card))] hover:text-[var(--primary)] focus:scale-100 focus:border-[var(--primary)] focus:bg-[color-mix(in_srgb,var(--primary)_14%,var(--bg-card))] focus:text-[var(--primary)] focus:opacity-100 group-hover:scale-100 group-hover:opacity-100 ${R&&he===d.key?"scale-100 border-[var(--primary)] bg-[color-mix(in_srgb,var(--primary)_14%,var(--bg-card))] text-[var(--primary)] opacity-100":"border-[var(--border)]"}`,style:{zIndex:4},children:e.jsx(S.HiEllipsisVertical,{className:"h-3.5 w-3.5"})}),e.jsx("span",{role:"separator","aria-orientation":"vertical",title:"Arrastrar para redimensionar",onPointerDown:ie=>{ie.preventDefault(),ie.stopPropagation(),ar.current={colKey:d.key,startX:ie.clientX,startWidth:je[d.key]??150},document.body.style.cursor="col-resize",document.body.style.userSelect="none"},onClick:ie=>ie.stopPropagation(),className:"absolute top-0 flex h-full items-center justify-center opacity-0 transition-opacity duration-150 group-hover:opacity-100",style:{right:0,width:8,cursor:"col-resize",zIndex:6},children:e.jsx("span",{style:{width:3,height:"calc(100% - 8px)",borderRadius:2,background:"var(--primary)",display:"block"}})})]},d.key)})]}),Mt=()=>{if(!Z||!R||typeof document>"u")return null;const d=_.length;return $e.createPortal(e.jsxs("div",{ref:Ge,role:"menu",className:"overflow-hidden rounded-lg border p-1 shadow-xl",style:{...Ue,borderColor:"var(--border)",background:"var(--bg-card)"},children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-[var(--border)] px-2 py-1.5",children:[e.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase text-[var(--text-muted)]",children:d>0?`${Ee.length} de ${r.length} visibles`:`${r.length} visibles`}),e.jsx("button",{type:"button",onClick:sl,disabled:d===0,className:"rounded px-1.5 py-0.5 text-xs font-medium text-[var(--primary)] transition-colors hover:bg-[var(--bg-input)] disabled:opacity-40",children:"Mostrar todas"})]}),e.jsx("div",{className:"max-h-72 overflow-auto py-1",children:mt.map(w=>{const O=!_.includes(w.key),X=!(w.hideable!==!1)||O&&Ee.length<=1;return e.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":O,disabled:X,onClick:()=>ll(w.key),className:"flex w-full min-w-0 items-center gap-2 rounded-md px-2.5 py-1.5 text-left transition-colors hover:bg-[var(--bg-input)] disabled:cursor-not-allowed disabled:opacity-50",style:{color:"var(--text-main)"},children:[e.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded border",style:{borderColor:O?"var(--primary)":"var(--border)",background:O?"var(--primary)":"var(--bg-input)",color:"var(--primary-fg)"},children:O&&e.jsx(S.HiCheck,{className:"h-3 w-3"})}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:w.header})]},w.key)})})]}),document.body)},$t=()=>{if(!wt||n)return null;const d=wa(xe,Cr);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 ${j?"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:We===0?"0 filas":`${vl}–${gl} de ${We}`}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{style:{color:"var(--text-muted)"},children:"Filas:"}),e.jsx(Ye,{value:String(Te),onChange:w=>xl(Number(w)),options:N.map(w=>({value:String(w),label:String(w)})),placeholder:"Filas",searchable:!1,height:H,padding:I,className:"shrink-0 [&>button]:rounded-md [&>button]:text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",style:{width:T}})]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-0.5",children:[e.jsx("button",{disabled:xe<=1,onClick:()=>Er(xe-1),className:"rounded p-0.5 transition-colors disabled:opacity-30",style:{color:"var(--text-muted)",background:"transparent"},children:e.jsx(S.HiChevronLeft,{className:"h-3.5 w-3.5"})}),d.map((w,O)=>w==="..."?e.jsx("span",{className:"px-1",style:{color:"var(--text-muted)"},children:"…"},`e${O}`):e.jsx("button",{onClick:()=>Er(w),className:"h-5 w-5 rounded text-[11px] font-medium transition-colors",style:{background:w===xe?"var(--primary)":"transparent",color:w===xe?"var(--primary-fg)":"var(--text-muted)"},children:w},w)),e.jsx("button",{disabled:xe>=Cr,onClick:()=>Er(xe+1),className:"rounded p-0.5 transition-colors disabled:opacity-30",style:{color:"var(--text-muted)",background:"transparent"},children:e.jsx(S.HiChevronRight,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{"aria-hidden":"true"})]})},Dt=()=>e.jsx("div",{className:"w-full min-w-0 max-w-full flex flex-col rounded-xl overflow-hidden",style:{border:"1px solid var(--border)"},children:e.jsxs("div",{ref:Ce,className:"min-w-0 max-w-full",style:{maxHeight:fe,background:"var(--bg-card)"},children:[e.jsx("div",{className:"border-b px-3 py-2",style:{borderColor:"var(--border)",background:"color-mix(in srgb, var(--bg-input) 72%, transparent)"},children:e.jsx("div",{className:"h-3.5 w-40 animate-pulse rounded-full",style:{background:"var(--border)"}})}),e.jsx("div",{className:"space-y-2 p-3",children:Array.from({length:Math.min(6,s)}).map((d,w)=>e.jsx("div",{className:"grid grid-cols-[1.2fr_1fr_0.8fr_0.7fr] gap-3",children:Array.from({length:4}).map((O,J)=>e.jsx("div",{className:"h-3.5 animate-pulse rounded-full",style:{background:"var(--border)",width:`${Ke(w,J)}%`,minWidth:32}},J))},w))})]})}),Lt=`min-w-0 max-w-full overflow-hidden ${wt?"rounded-t-xl":"rounded-xl"}`;return k&&!W||!n&&t.length===0&&!_e?Dt():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:[Mt(),e.jsx("div",{ref:Ce,className:Lt,children:e.jsx(Lr.OverlayScrollbarsComponent,{options:{scrollbars:{autoHide:"leave",autoHideDelay:200}},className:"w-full",style:{maxHeight:fe,maxWidth:"100%"},defer:!0,children:e.jsxs("div",{role:"table",className:"text-sm",style:{width:lr,minWidth:St},children:[e.jsx("div",{role:"rowgroup",style:m?{position:"sticky",top:0,zIndex:10,backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"}:void 0,children:Et()}),e.jsx("div",{role:"rowgroup",children:Array.from({length:s}).map((d,w)=>e.jsxs("div",{role:"row",className:"grid",style:{gridTemplateColumns:sr},children:[Me&&e.jsx("div",{role:"cell",className:`${j?"px-2 py-1.5":"px-3 py-2"} w-10`,style:{borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)"}}),Ee.map((O,J)=>{const X=D&&!be&&J===0;return e.jsx("div",{role:"cell",className:j?"px-2 py-1.5":"px-3 py-2",style:X?{position:"sticky",left:kr,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:`${Ke(w,J)}%`,minWidth:32}})},O.key)})]},w))})]})})}),$t()]}):!n&&t.length===0?e.jsxs("div",{className:"flex min-h-[220px] flex-col items-center justify-center gap-3 rounded-xl border px-6 py-14 text-center",style:{borderColor:"var(--border)",background:"linear-gradient(180deg, color-mix(in srgb, var(--bg-input) 58%, transparent), var(--bg-card))"},children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full border",style:{borderColor:"color-mix(in srgb, var(--primary) 24%, var(--border))",background:"color-mix(in srgb, var(--primary) 8%, var(--bg-card))",color:"var(--primary)"},children:u??e.jsx(S.HiMagnifyingGlass,{className:"h-5 w-5"})}),e.jsx("p",{className:"max-w-sm text-sm font-medium",style:{color:"var(--text-main)"},children:i}),e.jsx("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Ajusta la busqueda o cambia los filtros para ver mas informacion."})]}):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:[Mt(),e.jsx("div",{ref:Ce,className:Lt,children:e.jsx(Lr.OverlayScrollbarsComponent,{options:{scrollbars:{autoHide:"leave",autoHideDelay:200}},className:"w-full",style:{maxHeight:fe,maxWidth:"100%"},defer:!0,children:e.jsxs("div",{role:"table",className:"text-sm",style:{width:lr,minWidth:St},children:[e.jsx("div",{role:"rowgroup",style:m?{position:"sticky",top:0,zIndex:10,backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"}:void 0,children:Et()}),e.jsx("div",{role:"rowgroup",children:yt.map((d,w)=>{const O=a(d),J=Ct(f==null?void 0:f(d)),X=w>0?Ct(f==null?void 0:f(yt[w-1])):null,se=J&&J.key!==(X==null?void 0:X.key),ce=Me&&h.has(O),Pe=!!b,ie=ce&&v?"color-mix(in srgb, var(--primary) 8%, var(--bg-card))":w%2===1?"color-mix(in srgb, var(--bg-input) 50%, var(--bg-card))":"var(--bg-card)";return e.jsxs(l.Fragment,{children:[se&&e.jsx("div",{role:"row",className:`grid ${J.className??""}`,style:{gridTemplateColumns:sr},children:e.jsx("div",{role:"cell",className:j?"px-2 py-2":"px-3 py-3",style:{gridColumn:"1 / -1",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:J.label}),J.description&&e.jsx("div",{className:"mt-0.5 truncate text-xs text-[var(--text-muted)]",children:J.description})]})})})}),e.jsxs("div",{role:"row",onClick:Pe?()=>b(d):void 0,className:`grid transition-colors ${Pe?"cursor-pointer":""} ${x?x(d):""}`,style:{gridTemplateColumns:sr,"--dt-row-bg":ie,"--dt-sticky-bg":ie,background:"var(--dt-row-bg)"},onMouseEnter:me=>{ce||(me.currentTarget.style.setProperty("--dt-row-bg","var(--bg-hover)"),me.currentTarget.style.setProperty("--dt-sticky-bg",yl))},onMouseLeave:me=>{me.currentTarget.style.setProperty("--dt-row-bg",ie),me.currentTarget.style.setProperty("--dt-sticky-bg",ie)},children:[Me&&e.jsx("div",{role:"cell",className:`${j?"px-2 py-1.5":"px-3 py-2"} w-10`,style:D?{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:me=>{me.stopPropagation(),E(O)},children:e.jsx("input",{type:"checkbox",checked:ce,onClick:me=>me.stopPropagation(),onChange:()=>E(O),className:"rounded cursor-pointer accent-[var(--primary)]"})}),Ee.map((me,$r)=>{const or=D&&!be&&$r===0;return e.jsx("div",{role:"cell",className:`${j?"px-2 py-1.5":"px-3 py-2"} ${xa} ${Nt(me.align)} ${me.className??""}`,style:{overflow:"hidden",whiteSpace:"nowrap",...or?{position:"sticky",left:kr,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(qr,{children:me.cell(d)})},me.key)})]})]},O)})})]})})}),$t()]})}function qe(r){return r?new Date(`${r}T12:00:00`):void 0}function Ur(r){return r.toISOString().slice(0,10)}function ka({calendarMonth:r,displayIndex:t}){const{previousMonth:a,nextMonth:n,goToMonth:s,months:u,labels:i,formatters:c}=Tr.useDayPicker(),b=!!a&&t===0,h=!!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:c.formatCaption(r.date)}),e.jsx("button",{type:"button","aria-label":i.labelPrevious(a),onClick:()=>a&&s(a),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(S.HiChevronLeft,{size:16})}),e.jsx("button",{type:"button","aria-label":i.labelNext(n),onClick:()=>n&&s(n),disabled:!h,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:h?1:.45,cursor:h?"pointer":"not-allowed"},children:e.jsx(S.HiChevronRight,{size:16})})]})}function Sa(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Ca({startDate:r,endDate:t,onChange:a,minDate:n,viewMonth:s,numberOfMonths:u=1,showSummary:i=!0,startLabel:c="Inicio",endLabel:b="Regreso"}){const h={from:qe(r),to:qe(t)},E=qe(n),[C,v]=l.useState(qe(s||r));return l.useEffect(()=>{v(qe(s||r))},[s,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:h,month:C,onMonthChange:v,onSelect:x=>{const f=x!=null&&x.from?Ur(x.from):r,m=x!=null&&x.to?Ur(x.to):"";a({startDate:f,endDate:m})},numberOfMonths:u,hideNavigation:!0,disabled:E?{before:E}:void 0,showOutsideDays:!1,components:{MonthCaption:ka},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:x=>Sa(new Intl.DateTimeFormat("es-MX",{month:"long",year:"numeric"}).format(x)),formatWeekdayName:x=>new Intl.DateTimeFormat("es-MX",{weekday:"short"}).format(x)},labels:{labelMonthDropdown:()=>"Mes",labelYearDropdown:()=>"Año"}})}),i&&r&&e.jsxs("div",{style:{marginTop:8,fontSize:12,color:"var(--text-muted)",display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsxs("span",{children:[c,":"," ",e.jsx("strong",{style:{color:"var(--text-main)"},children:r})]}),t&&e.jsxs("span",{children:[b,":"," ",e.jsx("strong",{style:{color:"var(--text-main)"},children:t})]})]})]})}function Ea(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}function Ma({trigger:r,items:t,align:a="end",width:n=220,disabled:s=!1,className:u="",menuClassName:i="",onOpenChange:c}){const[b,h]=l.useState(!1),[E,C]=l.useState(!1),[v,x]=l.useState({}),f=l.useRef(null),m=l.useRef(null),p=l.useCallback(y=>{h(y),c==null||c(y)},[c]),N=l.useCallback(()=>{const y=f.current;if(!y)return;const M=y.getBoundingClientRect(),A=typeof n=="number"?n:M.width,P=typeof n=="number"?n:Math.max(M.width,180),k=a==="end"?Math.max(8,M.right-P):Math.min(M.left,window.innerWidth-P-8),D=window.innerHeight-M.bottom,G=D<240&&M.top>D?void 0:M.bottom+6,j=G===void 0?window.innerHeight-M.top+6:void 0;x({position:"fixed",zIndex:9999,left:k,top:G,bottom:j,width:Ea(typeof n=="number"?A:n)})},[a,n]);l.useEffect(()=>C(!0),[]),l.useEffect(()=>{if(!b)return;N();const y=A=>{var k,D;const P=A.target;!((k=f.current)!=null&&k.contains(P))&&!((D=m.current)!=null&&D.contains(P))&&p(!1)},M=A=>{A.key==="Escape"&&p(!1)};return document.addEventListener("mousedown",y),window.addEventListener("keydown",M),window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),()=>{document.removeEventListener("mousedown",y),window.removeEventListener("keydown",M),window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0)}},[b,p,N]);const T=y=>{s||(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),p(!b))},H=l.isValidElement(r)?l.cloneElement(r,{onClick:()=>!s&&p(!b)}):r,I=b?e.jsx("div",{ref:m,role:"menu",className:`overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)] p-1 shadow-xl ${i}`,style:v,children:t.map(y=>e.jsxs("div",{children:[y.separatorBefore&&e.jsx("div",{className:"my-1 border-t border-[var(--border)]"}),e.jsxs("button",{type:"button",role:"menuitem",disabled:y.disabled,onClick:()=>{var M;y.disabled||((M=y.onSelect)==null||M.call(y),p(!1))},className:"flex w-full min-w-0 items-start gap-2 rounded-md px-2.5 py-1.5 text-left transition-colors hover:bg-[var(--bg-input)] disabled:cursor-not-allowed disabled:opacity-50",style:{color:y.danger?"var(--danger)":"var(--text-main)"},children:[y.icon&&e.jsx("span",{className:"mt-0.5 shrink-0",children:y.icon}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-sm font-medium",children:y.label}),y.description&&e.jsx("span",{className:"block truncate text-xs text-[var(--text-muted)]",children:y.description})]})]})]},y.id))}):null;return e.jsxs("span",{ref:f,role:"button",tabIndex:s?-1:0,"aria-haspopup":"menu","aria-expanded":b,onKeyDown:T,className:`inline-flex ${s?"pointer-events-none opacity-60":""} ${u}`,children:[H,E&&I?$e.createPortal(I,document.body):null]})}const $a=180;function Da({open:r,onClose:t,title:a,subtitle:n,leadingIcon:s,confirmLabel:u="Guardar",onConfirm:i,loading:c=!1,confirmDisabled:b=!1,headerActions:h,bodyClassName:E="flex-1 overflow-y-auto px-6 py-5",width:C=440,hasUnsavedChanges:v=!1,unsavedChangesTitle:x="Descartar cambios",unsavedChangesDescription:f="Hay cambios sin guardar. Si cierras el drawer se perderán.",unsavedChangesConfirmLabel:m="Descartar",unsavedChangesCancelLabel:p="Seguir editando",onDiscardChanges:N,children:T}){const[H,I]=l.useState(!1),[y,M]=l.useState(!1),[A,P]=l.useState(!1),k=l.useCallback(()=>{M(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>P(!0))})},[]),D=l.useCallback(()=>{P(!1),window.setTimeout(()=>M(!1),$a)},[]),G=l.useCallback(()=>{if(v){k();return}t()},[v,t,k]),j=l.useCallback(()=>{P(!1),M(!1),N==null||N(),t()},[t,N]);return l.useEffect(()=>{I(!0)},[]),l.useEffect(()=>(document.body.style.overflow=r?"hidden":"",r||(P(!1),M(!1)),()=>{document.body.style.overflow=""}),[r]),l.useEffect(()=>{if(!r)return;const V=q=>{if(q.key==="Escape"){if(y){D();return}G()}};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[D,y,r,G]),H?$e.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:G}),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:G,title:"Cerrar",children:e.jsx(S.HiXMark,{className:"w-5 h-5"})}),s&&e.jsx("div",{className:"flex-shrink-0",children:s}),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})]})]}),(h||i)&&e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[h,i&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{variant:"secondary",size:"sm",onClick:G,style:{background:"var(--bg-input)"},children:"Cancelar"}),e.jsx(ue,{variant:"primary",size:"sm",icon:e.jsx(Pt.FiSave,{className:"w-4 h-4"}),onClick:i,loading:c,disabled:b,title:u})]})]})]}),e.jsx("div",{"data-drawer-scroll":"true",className:E,children:T})]}),y&&e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":x,className:"fixed inset-0 z-[1001] flex items-center justify-center p-4",children:[e.jsx("div",{className:`absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity duration-200 ease-out ${A?"opacity-100":"opacity-0"}`,onClick:D}),e.jsxs("div",{className:`relative z-10 w-full max-w-sm rounded-2xl border p-6 shadow-2xl transition-[opacity,transform] duration-200 ease-out ${A?"translate-y-0 scale-100 opacity-100":"translate-y-2 scale-[0.96] opacity-0"}`,style:{background:"var(--bg-card, #ffffff)",borderColor:"var(--border, #d8e1dc)"},children:[e.jsx(ue,{variant:"icon",onClick:D,className:"absolute right-3 top-3 h-7 w-7 hover:opacity-70",style:{color:"var(--text-muted, #6b7f78)"},"aria-label":p,children:e.jsx(S.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:"var(--warning-bg, #fff7ed)"},children:e.jsx(S.HiExclamationTriangle,{className:"h-5 w-5",style:{color:"var(--warning, #d97706)"}})}),e.jsx("h2",{className:"mb-1 text-base font-semibold",style:{color:"var(--text-main, #0f2f2c)"},children:x}),e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted, #6b7f78)"},children:f}),e.jsxs("div",{className:"mt-6 flex gap-2",children:[e.jsx(ue,{variant:"secondary",onClick:D,className:"flex-1 border",style:{background:"var(--bg-input, #f7faf8)",borderColor:"var(--border, #d8e1dc)",color:"var(--text-main, #0f2f2c)"},children:p}),e.jsx(ue,{variant:"secondary",onClick:j,className:"flex-1 border",style:{background:"var(--warning, #d97706)",borderColor:"transparent",color:"#fff",boxShadow:"0 10px 22px rgba(217, 119, 6, 0.22)"},children:m})]})]})]})]}),document.body):null}const La=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ta=/^\+?[0-9\s().-]+$/,Ia=7,Aa=15;function ye(r){return r==null||String(r).trim()===""}function Gr(r){return typeof r=="number"?r:typeof r=="string"&&r.trim()!==""?Number(r):Number.NaN}function fr(r){return ye(r)?!1:La.test(String(r))}function pr(r){if(ye(r))return!1;const t=String(r),a=t.replace(/\D/g,"");return Ta.test(t)&&a.length>=Ia&&a.length<=Aa}function Ba(r="Este campo es requerido."){return t=>ye(t)?r:void 0}function Ha(r="Ingresa un correo valido."){return t=>ye(t)||fr(t)?void 0:r}function Oa(r="Ingresa un telefono valido."){return t=>ye(t)||pr(t)?void 0:r}function Pa(r,t){return a=>ye(a)||String(a).length>=r?void 0:t??`Debe tener al menos ${r} caracteres.`}function za(r,t){return a=>ye(a)||String(a).length<=r?void 0:t??`Debe tener ${r} caracteres o menos.`}function _a(r,t){return a=>{if(ye(a))return;const n=Gr(a);return Number.isFinite(n)&&n>=r?void 0:t??`Debe ser mayor o igual a ${r}.`}}function ja(r,t){return a=>{if(ye(a))return;const n=Gr(a);return Number.isFinite(n)&&n<=r?void 0:t??`Debe ser menor o igual a ${r}.`}}function Fa(r,t="El formato no es valido."){return a=>ye(a)||r.test(String(a))?void 0:t}function Wa(r,t){const a={};for(const n of Object.keys(t)){const s=t[n];if(!s)continue;const u=Array.isArray(s)?s:[s];for(const i of u){const c=i(r[n],r);if(c){a[n]=c;break}}}return{valid:Object.keys(a).length===0,errors:a}}var Vr={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Kr=l.createContext&&l.createContext(Vr),qa=["attr","size","title"];function Ua(r,t){if(r==null)return{};var a,n,s=Ga(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)&&(s[a]=r[a])}return s}function Ga(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 Je(){return Je=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},Je.apply(null,arguments)}function Yr(r,t){var a=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),a.push.apply(a,n)}return a}function Qe(r){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?Yr(Object(a),!0).forEach(function(n){Va(r,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):Yr(Object(a)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(a,n))})}return r}function Va(r,t,a){return(t=Ka(t))in r?Object.defineProperty(r,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[t]=a,r}function Ka(r){var t=Ya(r,"string");return typeof t=="symbol"?t:t+""}function Ya(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 Xr(r){return r&&r.map((t,a)=>l.createElement(t.tag,Qe({key:a},t.attr),Xr(t.child)))}function mr(r){return t=>l.createElement(Xa,Je({attr:Qe({},r.attr)},t),Xr(r.child))}function Xa(r){var t=a=>{var{attr:n,size:s,title:u}=r,i=Ua(r,qa),c=s||a.size||"1em",b;return a.className&&(b=a.className),r.className&&(b=(b?b+" ":"")+r.className),l.createElement("svg",Je({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,n,i,{className:b,style:Qe(Qe({color:r.color||a.color},a.style),r.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),u&&l.createElement("title",null,u),r.children)};return Kr!==void 0?l.createElement(Kr.Consumer,null,a=>t(a)):t(Vr)}function Zr(r){return mr({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"},child:[]}]})(r)}function Za(r){return mr({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 Ja(r){return mr({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 Re({className:r="",...t}){return e.jsx("input",{...t,className:`h-10 rounded-lg border border-[var(--border)] bg-[var(--bg-input)] px-2.5 py-1.5 text-sm text-[var(--text-main)] outline-none placeholder:text-[var(--text-muted)] transition-colors focus:border-[var(--primary)] ${r}`})}function hr({label:r,containerClassName:t="",helperText:a,error:n,errorDisplay:s="inline",errorTooltipLabel:u="Error de validacion",labelAction:i,floatingLabel:c=!1,showPasswordToggle:b=!0,nativeValidation:h=!1,className:E="",required:C,...v}){const[x,f]=l.useState(()=>!!v.autoFocus),[m,p]=l.useState(!1),N=v.type==="password"&&b,T=N&&m?"text":v.type,H=!!n,I=H&&s!=="tooltip",y=H&&s!=="inline",M=h?C:void 0,A=H?"border-[var(--danger)] focus:border-[var(--danger)]":"",P=y?N?"pr-20":"pr-10":N?"pr-10":"",k=v.value!==void 0?String(v.value).length>0:v.defaultValue!==void 0&&String(v.defaultValue).length>0,D=x||k,G={top:D?7:12,color:x?"var(--primary)":"var(--text-muted)",fontSize:D?10:13,fontWeight:D?600:400,textTransform:D?"uppercase":"none"},j=Z=>{var L;f(!0),(L=v.onFocus)==null||L.call(v,Z)},V=Z=>{var L;f(!1),(L=v.onBlur)==null||L.call(v,Z)},q=N?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:()=>p(Z=>!Z),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(Za,{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(Ja,{className:"h-[18px] w-[18px]"})})]}):null,Y=y?e.jsx(ze,{as:"span",content:n,className:`absolute top-1/2 flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-md text-[var(--danger)] outline-none transition-colors hover:bg-[var(--danger-bg)] focus-visible:bg-[var(--danger-bg)] ${N?"right-10":"right-2.5"}`,children:e.jsx("span",{tabIndex:0,role:"img","aria-label":u,className:"flex h-full w-full items-center justify-center outline-none",children:e.jsx(Zr,{className:"h-[18px] w-[18px]"})})}):null;return c?e.jsxs("label",{className:`flex flex-col gap-2 ${t}`,children:[e.jsxs("span",{className:"relative block",children:[e.jsx(Re,{...v,type:T,required:M,placeholder:" ","aria-invalid":H||v["aria-invalid"],"data-has-value":k?"true":void 0,className:`h-11 w-full pt-5 ${P} ${A} ${E}`,onFocus:j,onBlur:V}),e.jsxs("span",{className:"pointer-events-none absolute left-3 transition-all duration-150",style:G,children:[r,C&&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?7:12},children:i}),Y,q]}),I?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}),C&&e.jsx("span",{className:"text-[var(--danger)]",children:"*"}),i&&e.jsx("span",{className:"ml-auto normal-case",children:i})]}),N?e.jsxs("span",{className:"relative block",children:[e.jsx(Re,{...v,type:T,required:M,"aria-invalid":H||v["aria-invalid"],className:`w-full ${P} ${A} ${E}`,onFocus:j,onBlur:V}),Y,q]}):e.jsxs("span",{className:"relative block",children:[e.jsx(Re,{...v,required:M,"aria-invalid":H||v["aria-invalid"],className:`w-full ${P} ${A} ${E}`}),Y]}),I?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 Jr(r){return r==null?"":String(r)}function Qa({autoComplete:r="email",inputMode:t="email",validate:a=!0,invalidMessage:n="Ingresa un correo valido.",errorDisplay:s="tooltip",error:u,value:i,defaultValue:c,onChange:b,...h}){const[E,C]=l.useState(()=>Jr(c)),v=i!==void 0?Jr(i):E,x=a&&v.length>0&&!fr(v)?n:void 0,f=m=>{i===void 0&&C(m.currentTarget.value),b==null||b(m)};return e.jsx(hr,{...h,value:i,defaultValue:c,type:"text",inputMode:t,autoComplete:r,error:u??x,errorDisplay:s,onChange:f})}const Ra={sm:"min-h-[160px] p-4",md:"min-h-[220px] p-6",lg:"min-h-[300px] p-8"};function en({title:r="Sin resultados",description:t,icon:a=e.jsx(S.HiInbox,{className:"h-5 w-5"}),action:n,secondaryAction:s,size:u="md",className:i=""}){return e.jsx("div",{className:`flex items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-card)] text-center ${Ra[u]} ${i}`,children:e.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-3",children:[a&&e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-input)] text-[var(--text-muted)]",children:a}),e.jsxs("div",{className:"space-y-1",children:[r&&e.jsx("h3",{className:"text-sm font-semibold text-[var(--text-main)]",children:r}),t&&e.jsx("div",{className:"text-sm leading-5 text-[var(--text-muted)]",children:t})]}),(n||s)&&e.jsxs("div",{className:"mt-1 flex flex-wrap items-center justify-center gap-2",children:[s,n]})]})})}const rn={sm:"min-h-[112px] p-4",md:"min-h-[148px] p-5",lg:"min-h-[184px] p-6"};function tn(r){if(r===0)return"0 B";const t=["B","KB","MB","GB"],a=Math.min(Math.floor(Math.log(r)/Math.log(1024)),t.length-1),n=r/1024**a;return`${n>=10||a===0?n.toFixed(0):n.toFixed(1)} ${t[a]}`}function Qr(r,t){return t?t.split(",").map(a=>a.trim().toLowerCase()).filter(Boolean).some(a=>{const n=r.name.toLowerCase(),s=r.type.toLowerCase();return a.startsWith(".")?n.endsWith(a):a.endsWith("/*")?s.startsWith(a.slice(0,-1)):s===a}):!0}function an(r,t,a){return t?a===void 0?r:r.slice(0,Math.max(0,a)):r.slice(0,1)}function nn({label:r,helperText:t,error:a,labelAction:n,value:s,defaultValue:u=[],onFilesChange:i,onRejectedFiles:c,multiple:b=!1,maxFiles:h,appendFiles:E=!1,showFileList:C=!0,clearable:v=!0,browseLabel:x="Buscar archivos",dropLabel:f="Suelta los archivos aqui",emptyLabel:m="Arrastra y suelta archivos",emptyDescription:p="o haz click para buscarlos en tu equipo",selectedLabel:N="Archivos seleccionados",size:T="md",containerClassName:H="",dropzoneClassName:I="",fileListClassName:y="",className:M="",id:A,accept:P,disabled:k,required:D,...G}){const j=l.useId(),V=A??j,q=l.useRef(null),[Y,Z]=l.useState(!1),[L,g]=l.useState(u),B=s??L,K=!!a,Q=v&&B.length>0&&!k,re=(_,R)=>{s===void 0&&g(_),i==null||i(_,R)},oe=(_,R)=>{const U=_.filter(Se=>Qr(Se,P)),he=_.filter(Se=>!Qr(Se,P)),ke=E?[...B,...U]:U,Ue=an(ke,b,h);he.length>0&&(c==null||c(he)),re(Ue,R)},o=()=>{var _;k||(_=q.current)==null||_.click()},W=_=>{oe(Array.from(_.target.files??[]),_),_.target.value=""},le=_=>{_.preventDefault(),k||Z(!0)},ee=_=>{_.currentTarget.contains(_.relatedTarget)||Z(!1)},te=_=>{_.preventDefault(),Z(!1),!k&&oe(Array.from(_.dataTransfer.files),_)},z=_=>{_.key!=="Enter"&&_.key!==" "||(_.preventDefault(),o())},ae=_=>{re(B.filter((R,U)=>U!==_))},ne=()=>{re([])};return e.jsxs("div",{className:`flex flex-col gap-2 ${H}`,children:[(r||n)&&e.jsxs("div",{className:"inline-flex items-center gap-1 text-xs font-semibold uppercase text-[var(--text-muted)]",children:[r&&e.jsx("span",{children:r}),D&&e.jsx("span",{className:"text-[var(--danger)]",children:"*"}),n&&e.jsx("span",{className:"ml-auto normal-case",children:n})]}),e.jsx("input",{...G,ref:q,id:V,type:"file",accept:P,multiple:b,disabled:k,required:D&&B.length===0,"aria-invalid":K||G["aria-invalid"],className:"sr-only",onChange:W}),e.jsxs("div",{role:"button",tabIndex:k?-1:0,"aria-controls":V,"aria-disabled":k||void 0,"aria-invalid":K||void 0,className:`flex cursor-pointer flex-col items-center justify-center gap-3 rounded-lg border border-dashed bg-[var(--bg-card)] text-center outline-none transition-colors focus:border-[var(--primary)] focus:bg-[var(--bg-input)] ${rn[T]} ${Y?"border-[var(--primary)] bg-[var(--bg-input)]":K?"border-[var(--danger)]":"border-[var(--border)]"} ${k?"cursor-not-allowed opacity-60":"hover:border-[var(--primary)] hover:bg-[var(--bg-input)]"} ${I} ${M}`,onClick:o,onDragOver:le,onDragLeave:ee,onDrop:te,onKeyDown:z,children:[e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-input)] text-[var(--text-muted)]",children:e.jsx(S.HiArrowUpTray,{className:"h-5 w-5"})}),e.jsxs("span",{className:"space-y-1",children:[e.jsx("span",{className:"block text-sm font-semibold text-[var(--text-main)]",children:Y?f:m}),p&&e.jsx("span",{className:"block text-sm text-[var(--text-muted)]",children:p})]}),x&&e.jsx("span",{className:"inline-flex h-9 items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-card)] px-3 text-xs font-semibold text-[var(--text-main)] shadow-sm shadow-black/5 transition-colors",children:x})]}),C&&B.length>0&&e.jsxs("div",{className:`rounded-lg border border-[var(--border)] bg-[var(--bg-card)] ${y}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[var(--border)] px-3 py-2",children:[e.jsx("span",{className:"text-xs font-semibold uppercase text-[var(--text-muted)]",children:N}),Q&&e.jsx("button",{type:"button",className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-[var(--text-muted)] transition-colors hover:bg-[var(--bg-input)] hover:text-[var(--danger)] focus:outline-none","aria-label":"Quitar todos los archivos",onClick:ne,children:e.jsx(S.HiTrash,{className:"h-4 w-4"})})]}),e.jsx("ul",{className:"divide-y divide-[var(--border)]",children:B.map((_,R)=>e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2",children:[e.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-[var(--bg-input)] text-[var(--text-muted)]",children:e.jsx(S.HiDocument,{className:"h-4 w-4"})}),e.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[e.jsx("span",{className:"block truncate text-sm font-medium text-[var(--text-main)]",children:_.name}),e.jsx("span",{className:"block text-xs text-[var(--text-muted)]",children:tn(_.size)})]}),!k&&e.jsx("button",{type:"button",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[var(--text-muted)] transition-colors hover:bg-[var(--bg-input)] hover:text-[var(--danger)] focus:outline-none","aria-label":`Quitar ${_.name}`,onClick:()=>ae(R),children:e.jsx(S.HiXMark,{className:"h-4 w-4"})})]},`${_.name}-${_.lastModified}-${R}`))})]}),a?e.jsx("span",{className:"text-xs font-medium normal-case text-[var(--danger)]",children:a}):t?e.jsx("span",{className:"text-xs font-medium normal-case text-[var(--text-muted)]",children:t}):null]})}function Rr({label:r,children:t,helperText:a,error:n,labelAction:s,required:u=!1,className:i="",contentClassName:c=""}){return e.jsxs("label",{className:`flex flex-col gap-2 ${i}`,children:[(r||s)&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-semibold uppercase text-[var(--text-muted)]",children:[r&&e.jsx("span",{children:r}),u&&e.jsx("span",{className:"text-[var(--danger)]",children:"*"}),s&&e.jsx("span",{className:"ml-auto normal-case",children:s})]}),e.jsx("span",{className:`block ${c}`,children: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]})}function et(r){if(r!==void 0)return typeof r=="number"?`${r}px`:r}function ln(r,t){return r.length!==t.length?!1:r.every((a,n)=>a===t[n])}function sn({value:r,onChange:t,options:a,placeholder:n="Seleccionar…",disabled:s=!1,className:u="",style:i,height:c=40,padding:b="0 10px",searchable:h=!0,minOptionsForSearch:E=6,maxVisibleValues:C=2,emptyText:v="Sin resultados",clearLabel:x="Limpiar seleccion"}){const[f,m]=l.useState(!1),[p,N]=l.useState(""),[T,H]=l.useState(0),[I,y]=l.useState(!1),[M,A]=l.useState({}),P=l.useRef(null),k=l.useRef(null),D=l.useRef(null),G=l.useRef(null),j=h&&a.length>=E,V=l.useMemo(()=>new Set(r),[r]),q=l.useMemo(()=>a.filter(o=>V.has(o.value)),[a,V]),Y=q.slice(0,C),Z=Math.max(0,q.length-Y.length),L=j&&p.trim()?a.filter(o=>{var W;return o.label.toLowerCase().includes(p.toLowerCase())||((W=o.sublabel)==null?void 0:W.toLowerCase().includes(p.toLowerCase()))}):a,g=l.useCallback(()=>{const o=P.current;if(!o)return;const W=o.getBoundingClientRect(),le=j?304:244,ee=window.innerHeight-W.bottom,te=ee<le&&W.top>ee;A({position:"fixed",left:W.left,top:te?void 0:W.bottom+4,bottom:te?window.innerHeight-W.top+4:void 0,width:W.width,zIndex:9999})},[j]),B=l.useCallback(o=>{ln(r,o)||t(o)},[t,r]),K=l.useCallback(o=>{const W=a.find(ee=>ee.value===o);if(W!=null&&W.disabled)return;const le=V.has(o)?r.filter(ee=>ee!==o):[...r,o];B(le)},[B,a,r,V]),Q=l.useCallback(()=>B([]),[B]);l.useEffect(()=>y(!0),[]),l.useEffect(()=>{if(!f)return;function o(W){var ee,te;const le=W.target;!((ee=P.current)!=null&&ee.contains(le))&&!((te=k.current)!=null&&te.contains(le))&&(m(!1),N(""))}return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[f]),l.useEffect(()=>{f&&(H(0),g(),j&&setTimeout(()=>{var o;return(o=D.current)==null?void 0:o.focus()},0))},[f,j,g]),l.useEffect(()=>{if(f)return window.addEventListener("resize",g),window.addEventListener("scroll",g,!0),()=>{window.removeEventListener("resize",g),window.removeEventListener("scroll",g,!0)}},[f,g]),l.useEffect(()=>{if(T<0||!G.current)return;const o=G.current.children[T];o==null||o.scrollIntoView({block:"nearest"})},[T]);function re(o){if(!f){(o.key==="Enter"||o.key===" "||o.key==="ArrowDown")&&(o.preventDefault(),m(!0));return}o.key==="Escape"&&(o.preventDefault(),m(!1),N("")),o.key==="ArrowDown"&&(o.preventDefault(),H(W=>Math.min(W+1,L.length-1))),o.key==="ArrowUp"&&(o.preventDefault(),H(W=>Math.max(W-1,0))),o.key==="Enter"&&L[T]&&(o.preventDefault(),K(L[T].value)),o.key==="Backspace"&&!p&&r.length&&(o.preventDefault(),B(r.slice(0,-1)))}const oe=e.jsxs("div",{ref:k,className:"overflow-hidden rounded-xl shadow-xl",style:{...M,background:"var(--bg-card)",border:"1px solid var(--border)"},children:[j&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",style:{borderBottom:"1px solid var(--border)"},children:[e.jsx(S.HiMagnifyingGlass,{className:"h-3.5 w-3.5 flex-shrink-0",style:{color:"var(--text-muted)"}}),e.jsx("input",{ref:D,value:p,onChange:o=>{N(o.target.value),H(0)},placeholder:"Buscar…",className:"min-w-0 flex-1 bg-transparent text-sm outline-none",style:{color:"var(--text-main)"}}),p&&e.jsx("button",{type:"button",onMouseDown:o=>{o.preventDefault(),N("")},children:e.jsx(S.HiXMark,{className:"h-3.5 w-3.5",style:{color:"var(--text-muted)"}})})]}),q.length>0&&e.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2 text-xs",style:{borderBottom:"1px solid var(--border)",color:"var(--text-muted)"},children:[e.jsxs("span",{children:[q.length," seleccionados"]}),e.jsx("button",{type:"button",onMouseDown:o=>{o.preventDefault(),Q()},className:"font-semibold transition-colors hover:text-[var(--primary)]",children:x})]}),e.jsxs("ul",{ref:G,role:"listbox","aria-multiselectable":"true",className:"overflow-y-auto",style:{maxHeight:j?220:200,scrollbarWidth:"thin",scrollbarColor:"var(--border) transparent",overscrollBehavior:"contain"},children:[L.map((o,W)=>{const le=W===T,ee=V.has(o.value);return e.jsxs("li",{role:"option","aria-selected":ee,onMouseDown:te=>{te.preventDefault(),K(o.value)},onMouseEnter:()=>!o.disabled&&H(W),className:"flex cursor-pointer items-center gap-2 px-3 py-2 text-sm transition-colors",style:{background:le?"var(--bg-hover)":ee?"color-mix(in srgb, var(--primary) 6%, transparent)":"transparent",color:o.disabled?"var(--text-muted)":"var(--text-main)",cursor:o.disabled?"not-allowed":"pointer",opacity:o.disabled?.58:1},children:[e.jsx("span",{className:"flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border",style:{borderColor:ee?"var(--primary)":"var(--border)",background:ee?"var(--primary)":"var(--bg-input)",color:"var(--primary-fg)"},children:ee&&e.jsx(S.HiCheck,{className:"h-3 w-3"})}),o.color&&e.jsx("span",{className:"h-2.5 w-2.5 flex-shrink-0 rounded-full",style:{background:o.color}}),e.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-1 overflow-hidden",children:[e.jsx("span",{className:"truncate",children:o.label}),o.sublabel&&e.jsx("span",{className:"min-w-0 flex-shrink truncate",style:{color:"var(--text-muted)",fontSize:12},children:o.sublabel})]}),o.badge&&e.jsx("span",{className:"flex-shrink-0 text-xs",style:{color:"var(--text-muted)"},children:o.badge})]},o.value)}),L.length===0&&e.jsx("li",{className:"px-3 py-4 text-center text-sm",style:{color:"var(--text-muted)"},children:v})]})]});return e.jsxs("div",{ref:P,className:`relative ${u||"w-full"}`,style:i,onKeyDown:re,children:[e.jsxs("button",{type:"button",disabled:s,onClick:()=>!s&&m(o=>!o),className:"flex w-full items-center gap-2 rounded-lg text-left text-sm transition-colors focus:outline-none",style:{minHeight:et(c),padding:et(b),background:"var(--bg-input)",color:q.length?"var(--text-main)":"var(--text-muted)",border:f?"1px solid var(--primary)":"1px solid var(--border)",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"},"aria-haspopup":"listbox","aria-expanded":f,children:[e.jsx("span",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1.5 overflow-hidden",children:Y.length?e.jsxs(e.Fragment,{children:[Y.map(o=>e.jsxs("span",{className:"inline-flex max-w-[160px] items-center gap-1 rounded-md border px-1.5 py-0.5 text-xs font-semibold",style:{background:"var(--bg-card)",borderColor:"var(--border)",color:"var(--text-main)"},children:[o.color&&e.jsx("span",{className:"h-1.5 w-1.5 flex-shrink-0 rounded-full",style:{background:o.color}}),e.jsx("span",{className:"truncate",children:o.label})]},o.value)),Z>0&&e.jsxs("span",{className:"inline-flex items-center rounded-md px-1.5 py-0.5 text-xs font-semibold",style:{background:"color-mix(in srgb, var(--primary) 10%, transparent)",color:"var(--primary)"},children:["+",Z]})]}):e.jsx("span",{className:"truncate",children:n})}),q.length?e.jsx("span",{role:"button",tabIndex:-1,"aria-label":x,onMouseDown:o=>{o.preventDefault(),o.stopPropagation(),Q()},className:"flex-shrink-0 rounded-full p-0.5 transition-colors hover:bg-black/10",style:{color:"var(--text-muted)"},children:e.jsx(S.HiXMark,{className:"h-3 w-3"})}):e.jsx(S.HiChevronDown,{className:"h-4 w-4 flex-shrink-0 transition-transform",style:{color:"var(--text-muted)",transform:f?"rotate(180deg)":"rotate(0deg)"}})]}),f&&I&&$e.createPortal(oe,document.body)]})}function on({inputMode:r="decimal",...t}){return e.jsx(hr,{...t,type:"number",inputMode:r})}function cn(r,t,a){const n=[],s=Math.max(2,r-a),u=Math.min(t-1,r+a);n.push(1),s>2&&n.push("...");for(let i=s;i<=u;i+=1)n.push(i);return u<t-1&&n.push("..."),t>1&&n.push(t),n}function dn({page:r,totalPages:t,onPageChange:a,disabled:n=!1,siblingCount:s=1,className:u=""}){const i=Math.max(1,t),c=Math.min(Math.max(1,r),i),b=cn(c,i,s);return e.jsxs("nav",{"aria-label":"Paginacion",className:`inline-flex items-center gap-1 ${u}`,children:[e.jsx(ue,{variant:"icon",size:"xs","aria-label":"Pagina anterior",disabled:n||c<=1,onClick:()=>a(c-1),children:e.jsx(S.HiChevronLeft,{className:"h-4 w-4"})}),b.map((h,E)=>h==="..."?e.jsx("span",{className:"flex h-8 min-w-8 items-center justify-center text-xs font-semibold text-[var(--text-muted)]",children:"..."},`ellipsis-${E}`):e.jsx("button",{type:"button","aria-current":h===c?"page":void 0,disabled:n,onClick:()=>a(h),className:"flex h-8 min-w-8 items-center justify-center rounded-md border px-2 text-xs font-semibold transition-colors disabled:cursor-not-allowed disabled:opacity-50",style:{borderColor:h===c?"var(--primary)":"var(--border)",background:h===c?"var(--primary)":"var(--bg-card)",color:h===c?"var(--primary-fg)":"var(--text-secondary)"},children:h},h)),e.jsx(ue,{variant:"icon",size:"xs","aria-label":"Pagina siguiente",disabled:n||c>=i,onClick:()=>a(c+1),children:e.jsx(S.HiChevronRight,{className:"h-4 w-4"})})]})}const rt=[{value:"+1",label:"+1",sublabel:"Estados Unidos, Canada, Caribe"},{value:"+7",label:"+7",sublabel:"Rusia, Kazajistan"},{value:"+20",label:"+20",sublabel:"Egipto"},{value:"+27",label:"+27",sublabel:"Sudafrica"},{value:"+30",label:"+30",sublabel:"Grecia"},{value:"+31",label:"+31",sublabel:"Paises Bajos"},{value:"+32",label:"+32",sublabel:"Belgica"},{value:"+33",label:"+33",sublabel:"Francia"},{value:"+34",label:"+34",sublabel:"Espana"},{value:"+36",label:"+36",sublabel:"Hungria"},{value:"+39",label:"+39",sublabel:"Italia, Vaticano"},{value:"+40",label:"+40",sublabel:"Rumania"},{value:"+41",label:"+41",sublabel:"Suiza"},{value:"+43",label:"+43",sublabel:"Austria"},{value:"+44",label:"+44",sublabel:"Reino Unido"},{value:"+45",label:"+45",sublabel:"Dinamarca"},{value:"+46",label:"+46",sublabel:"Suecia"},{value:"+47",label:"+47",sublabel:"Noruega"},{value:"+48",label:"+48",sublabel:"Polonia"},{value:"+49",label:"+49",sublabel:"Alemania"},{value:"+51",label:"+51",sublabel:"Peru"},{value:"+52",label:"+52",sublabel:"Mexico"},{value:"+53",label:"+53",sublabel:"Cuba"},{value:"+54",label:"+54",sublabel:"Argentina"},{value:"+55",label:"+55",sublabel:"Brasil"},{value:"+56",label:"+56",sublabel:"Chile"},{value:"+57",label:"+57",sublabel:"Colombia"},{value:"+58",label:"+58",sublabel:"Venezuela"},{value:"+60",label:"+60",sublabel:"Malasia"},{value:"+61",label:"+61",sublabel:"Australia"},{value:"+62",label:"+62",sublabel:"Indonesia"},{value:"+63",label:"+63",sublabel:"Filipinas"},{value:"+64",label:"+64",sublabel:"Nueva Zelanda"},{value:"+65",label:"+65",sublabel:"Singapur"},{value:"+66",label:"+66",sublabel:"Tailandia"},{value:"+81",label:"+81",sublabel:"Japon"},{value:"+82",label:"+82",sublabel:"Corea del Sur"},{value:"+84",label:"+84",sublabel:"Vietnam"},{value:"+86",label:"+86",sublabel:"China"},{value:"+90",label:"+90",sublabel:"Turquia"},{value:"+91",label:"+91",sublabel:"India"},{value:"+92",label:"+92",sublabel:"Pakistan"},{value:"+93",label:"+93",sublabel:"Afganistan"},{value:"+94",label:"+94",sublabel:"Sri Lanka"},{value:"+95",label:"+95",sublabel:"Myanmar"},{value:"+98",label:"+98",sublabel:"Iran"},{value:"+211",label:"+211",sublabel:"Sudan del Sur"},{value:"+212",label:"+212",sublabel:"Marruecos, Sahara Occidental"},{value:"+213",label:"+213",sublabel:"Argelia"},{value:"+216",label:"+216",sublabel:"Tunez"},{value:"+218",label:"+218",sublabel:"Libia"},{value:"+220",label:"+220",sublabel:"Gambia"},{value:"+221",label:"+221",sublabel:"Senegal"},{value:"+222",label:"+222",sublabel:"Mauritania"},{value:"+223",label:"+223",sublabel:"Mali"},{value:"+224",label:"+224",sublabel:"Guinea"},{value:"+225",label:"+225",sublabel:"Costa de Marfil"},{value:"+226",label:"+226",sublabel:"Burkina Faso"},{value:"+227",label:"+227",sublabel:"Niger"},{value:"+228",label:"+228",sublabel:"Togo"},{value:"+229",label:"+229",sublabel:"Benin"},{value:"+230",label:"+230",sublabel:"Mauricio"},{value:"+231",label:"+231",sublabel:"Liberia"},{value:"+232",label:"+232",sublabel:"Sierra Leona"},{value:"+233",label:"+233",sublabel:"Ghana"},{value:"+234",label:"+234",sublabel:"Nigeria"},{value:"+235",label:"+235",sublabel:"Chad"},{value:"+236",label:"+236",sublabel:"Republica Centroafricana"},{value:"+237",label:"+237",sublabel:"Camerun"},{value:"+238",label:"+238",sublabel:"Cabo Verde"},{value:"+239",label:"+239",sublabel:"Santo Tome y Principe"},{value:"+240",label:"+240",sublabel:"Guinea Ecuatorial"},{value:"+241",label:"+241",sublabel:"Gabon"},{value:"+242",label:"+242",sublabel:"Republica del Congo"},{value:"+243",label:"+243",sublabel:"Republica Democratica del Congo"},{value:"+244",label:"+244",sublabel:"Angola"},{value:"+245",label:"+245",sublabel:"Guinea-Bisau"},{value:"+246",label:"+246",sublabel:"Territorio Britanico del Oceano Indico"},{value:"+248",label:"+248",sublabel:"Seychelles"},{value:"+249",label:"+249",sublabel:"Sudan"},{value:"+250",label:"+250",sublabel:"Ruanda"},{value:"+251",label:"+251",sublabel:"Etiopia"},{value:"+252",label:"+252",sublabel:"Somalia"},{value:"+253",label:"+253",sublabel:"Yibuti"},{value:"+254",label:"+254",sublabel:"Kenia"},{value:"+255",label:"+255",sublabel:"Tanzania"},{value:"+256",label:"+256",sublabel:"Uganda"},{value:"+257",label:"+257",sublabel:"Burundi"},{value:"+258",label:"+258",sublabel:"Mozambique"},{value:"+260",label:"+260",sublabel:"Zambia"},{value:"+261",label:"+261",sublabel:"Madagascar"},{value:"+262",label:"+262",sublabel:"Reunion, Mayotte"},{value:"+263",label:"+263",sublabel:"Zimbabue"},{value:"+264",label:"+264",sublabel:"Namibia"},{value:"+265",label:"+265",sublabel:"Malaui"},{value:"+266",label:"+266",sublabel:"Lesoto"},{value:"+267",label:"+267",sublabel:"Botsuana"},{value:"+268",label:"+268",sublabel:"Esuatini"},{value:"+269",label:"+269",sublabel:"Comoras"},{value:"+290",label:"+290",sublabel:"Santa Elena"},{value:"+291",label:"+291",sublabel:"Eritrea"},{value:"+297",label:"+297",sublabel:"Aruba"},{value:"+298",label:"+298",sublabel:"Islas Feroe"},{value:"+299",label:"+299",sublabel:"Groenlandia"},{value:"+350",label:"+350",sublabel:"Gibraltar"},{value:"+351",label:"+351",sublabel:"Portugal"},{value:"+352",label:"+352",sublabel:"Luxemburgo"},{value:"+353",label:"+353",sublabel:"Irlanda"},{value:"+354",label:"+354",sublabel:"Islandia"},{value:"+355",label:"+355",sublabel:"Albania"},{value:"+356",label:"+356",sublabel:"Malta"},{value:"+357",label:"+357",sublabel:"Chipre"},{value:"+358",label:"+358",sublabel:"Finlandia, Aland"},{value:"+359",label:"+359",sublabel:"Bulgaria"},{value:"+370",label:"+370",sublabel:"Lituania"},{value:"+371",label:"+371",sublabel:"Letonia"},{value:"+372",label:"+372",sublabel:"Estonia"},{value:"+373",label:"+373",sublabel:"Moldavia"},{value:"+374",label:"+374",sublabel:"Armenia"},{value:"+375",label:"+375",sublabel:"Bielorrusia"},{value:"+376",label:"+376",sublabel:"Andorra"},{value:"+377",label:"+377",sublabel:"Monaco"},{value:"+378",label:"+378",sublabel:"San Marino"},{value:"+380",label:"+380",sublabel:"Ucrania"},{value:"+381",label:"+381",sublabel:"Serbia"},{value:"+382",label:"+382",sublabel:"Montenegro"},{value:"+383",label:"+383",sublabel:"Kosovo"},{value:"+385",label:"+385",sublabel:"Croacia"},{value:"+386",label:"+386",sublabel:"Eslovenia"},{value:"+387",label:"+387",sublabel:"Bosnia y Herzegovina"},{value:"+389",label:"+389",sublabel:"Macedonia del Norte"},{value:"+420",label:"+420",sublabel:"Chequia"},{value:"+421",label:"+421",sublabel:"Eslovaquia"},{value:"+423",label:"+423",sublabel:"Liechtenstein"},{value:"+500",label:"+500",sublabel:"Islas Malvinas"},{value:"+501",label:"+501",sublabel:"Belice"},{value:"+502",label:"+502",sublabel:"Guatemala"},{value:"+503",label:"+503",sublabel:"El Salvador"},{value:"+504",label:"+504",sublabel:"Honduras"},{value:"+505",label:"+505",sublabel:"Nicaragua"},{value:"+506",label:"+506",sublabel:"Costa Rica"},{value:"+507",label:"+507",sublabel:"Panama"},{value:"+508",label:"+508",sublabel:"San Pedro y Miquelon"},{value:"+509",label:"+509",sublabel:"Haiti"},{value:"+590",label:"+590",sublabel:"Guadalupe, San Bartolome"},{value:"+591",label:"+591",sublabel:"Bolivia"},{value:"+592",label:"+592",sublabel:"Guyana"},{value:"+593",label:"+593",sublabel:"Ecuador"},{value:"+594",label:"+594",sublabel:"Guayana Francesa"},{value:"+595",label:"+595",sublabel:"Paraguay"},{value:"+596",label:"+596",sublabel:"Martinica"},{value:"+597",label:"+597",sublabel:"Surinam"},{value:"+598",label:"+598",sublabel:"Uruguay"},{value:"+599",label:"+599",sublabel:"Caribe Neerlandes, Curazao"},{value:"+670",label:"+670",sublabel:"Timor Oriental"},{value:"+672",label:"+672",sublabel:"Antartida, Isla Norfolk"},{value:"+673",label:"+673",sublabel:"Brunei"},{value:"+674",label:"+674",sublabel:"Nauru"},{value:"+675",label:"+675",sublabel:"Papua Nueva Guinea"},{value:"+676",label:"+676",sublabel:"Tonga"},{value:"+677",label:"+677",sublabel:"Islas Salomon"},{value:"+678",label:"+678",sublabel:"Vanuatu"},{value:"+679",label:"+679",sublabel:"Fiyi"},{value:"+680",label:"+680",sublabel:"Palaos"},{value:"+681",label:"+681",sublabel:"Wallis y Futuna"},{value:"+682",label:"+682",sublabel:"Islas Cook"},{value:"+683",label:"+683",sublabel:"Niue"},{value:"+685",label:"+685",sublabel:"Samoa"},{value:"+686",label:"+686",sublabel:"Kiribati"},{value:"+687",label:"+687",sublabel:"Nueva Caledonia"},{value:"+688",label:"+688",sublabel:"Tuvalu"},{value:"+689",label:"+689",sublabel:"Polinesia Francesa"},{value:"+690",label:"+690",sublabel:"Tokelau"},{value:"+691",label:"+691",sublabel:"Micronesia"},{value:"+692",label:"+692",sublabel:"Islas Marshall"},{value:"+850",label:"+850",sublabel:"Corea del Norte"},{value:"+852",label:"+852",sublabel:"Hong Kong"},{value:"+853",label:"+853",sublabel:"Macao"},{value:"+855",label:"+855",sublabel:"Camboya"},{value:"+856",label:"+856",sublabel:"Laos"},{value:"+880",label:"+880",sublabel:"Banglades"},{value:"+886",label:"+886",sublabel:"Taiwan"},{value:"+960",label:"+960",sublabel:"Maldivas"},{value:"+961",label:"+961",sublabel:"Libano"},{value:"+962",label:"+962",sublabel:"Jordania"},{value:"+963",label:"+963",sublabel:"Siria"},{value:"+964",label:"+964",sublabel:"Irak"},{value:"+965",label:"+965",sublabel:"Kuwait"},{value:"+966",label:"+966",sublabel:"Arabia Saudita"},{value:"+967",label:"+967",sublabel:"Yemen"},{value:"+968",label:"+968",sublabel:"Oman"},{value:"+970",label:"+970",sublabel:"Palestina"},{value:"+971",label:"+971",sublabel:"Emiratos Arabes Unidos"},{value:"+972",label:"+972",sublabel:"Israel"},{value:"+973",label:"+973",sublabel:"Barein"},{value:"+974",label:"+974",sublabel:"Catar"},{value:"+975",label:"+975",sublabel:"Butan"},{value:"+976",label:"+976",sublabel:"Mongolia"},{value:"+977",label:"+977",sublabel:"Nepal"},{value:"+992",label:"+992",sublabel:"Tayikistan"},{value:"+993",label:"+993",sublabel:"Turkmenistan"},{value:"+994",label:"+994",sublabel:"Azerbaiyan"},{value:"+995",label:"+995",sublabel:"Georgia"},{value:"+996",label:"+996",sublabel:"Kirguistan"},{value:"+998",label:"+998",sublabel:"Uzbekistan"}];function tt(r){return r==null?"":String(r)}function er(r){return r?r.startsWith("+")?r:`+${r}`:"+1"}function un(r){return typeof r=="number"?`${r}px`:r}function bn({autoComplete:r="tel",inputMode:t="tel",validate:a=!0,invalidMessage:n="Ingresa un telefono valido.",errorDisplay:s="tooltip",error:u,value:i,defaultValue:c,onChange:b,countryCode:h,defaultCountryCode:E="+1",onCountryCodeChange:C,allowedCountryCodes:v,countryCodeOptions:x,countryCodePlaceholder:f="Codigo",countryCodeClassName:m="",countryCodeWidth:p=84,onPhoneValueChange:N,label:T,containerClassName:H="",helperText:I,labelAction:y,className:M="",required:A,disabled:P,floatingLabel:k,showPasswordToggle:D,nativeValidation:G,errorTooltipLabel:j="Error de validacion",...V}){var _;const[q,Y]=l.useState(()=>tt(c)),[Z,L]=l.useState(()=>er(E)),g=l.useMemo(()=>{const R=x??rt,U=v==null?void 0:v.map(er);return U!=null&&U.length?R.filter(he=>U.includes(he.value)):R},[v,x]),B=((_=g[0])==null?void 0:_.value)??"+1",K=g.some(R=>R.value===er(h??Z))?er(h??Z):B,Q=i!==void 0?tt(i):q,re=`${K} ${Q}`.trim(),oe=a&&Q.length>0&&!pr(re)?n:void 0,o=u??oe,W=!!o,le=W&&s!=="tooltip",ee=W&&s!=="inline",te=W?"border-[var(--danger)] focus-within:border-[var(--danger)]":"border-[var(--border)] focus-within:border-[var(--primary)]",z=R=>{const U=R.currentTarget.value;i===void 0&&Y(U),N==null||N(U,{countryCode:K,nationalNumber:U,fullNumber:`${K} ${U}`.trim()}),b==null||b(R)},ae=R=>{h===void 0&&L(R),C==null||C(R),N==null||N(Q,{countryCode:R,nationalNumber:Q,fullNumber:`${R} ${Q}`.trim()})},ne=ee?e.jsx(ze,{as:"span",content:o,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(--danger)] outline-none transition-colors hover:bg-[var(--danger-bg)] focus-visible:bg-[var(--danger-bg)]",children:e.jsx("span",{tabIndex:0,role:"img","aria-label":j,className:"flex h-full w-full items-center justify-center outline-none",children:e.jsx(Zr,{className:"h-[18px] w-[18px]"})})}):null;return e.jsxs("div",{className:`flex flex-col gap-2 ${H}`,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:T}),A&&e.jsx("span",{className:"text-[var(--danger)]",children:"*"}),y&&e.jsx("span",{className:"ml-auto normal-case",children:y})]}),e.jsxs("span",{className:`flex h-10 min-w-0 items-center overflow-hidden rounded-lg border bg-[var(--bg-input)] transition-colors ${te}`,children:[e.jsx(Ye,{value:K,onChange:ae,options:g,placeholder:f,disabled:P,ariaLabel:"Codigo telefonico",triggerVariant:"ghost",showSelectedSublabel:!1,searchable:!0,minOptionsForSearch:0,dropdownMinWidth:300,className:`shrink-0 ${m}`,style:{width:un(p)},height:38,padding:"0 8px 0 10px"}),e.jsx("span",{className:"h-5 w-px shrink-0 bg-[var(--border)]"}),e.jsxs("span",{className:"relative min-w-0 flex-1 self-stretch",children:[e.jsx("input",{...V,value:i,defaultValue:c,type:"tel",inputMode:t,autoComplete:r,disabled:P,required:void 0,"aria-label":V["aria-label"]??(typeof T=="string"?T:void 0),"aria-invalid":W||V["aria-invalid"],className:`h-full w-full min-w-0 bg-transparent px-2 py-1.5 text-sm text-[var(--text-main)] outline-none placeholder:text-[var(--text-muted)] disabled:cursor-not-allowed disabled:opacity-60 ${ee?"pr-10":""} ${M}`,onChange:z}),ne]})]}),le?e.jsx("span",{className:"text-xs font-medium normal-case text-[var(--danger)]",children:o}):I?e.jsx("span",{className:"text-xs font-medium normal-case text-[var(--text-muted)]",children:I}):null]})}function fn({value:r,onChange:t,options:a,name:n,label:s,orientation:u="vertical",disabled:i=!1,className:c="",optionClassName:b=""}){return e.jsxs("fieldset",{className:`min-w-0 ${c}`,disabled:i,children:[s&&e.jsx("legend",{className:"mb-2 text-xs font-semibold uppercase text-[var(--text-muted)]",children:s}),e.jsx("div",{className:u==="horizontal"?"flex flex-wrap gap-2":"flex flex-col gap-2",children:a.map(h=>{const E=h.value===r,C=i||h.disabled;return e.jsxs("label",{className:`inline-flex min-w-0 items-start gap-2 rounded-lg border px-2.5 py-1.5 transition-colors ${C?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-[var(--bg-input)]"} ${b}`,style:{borderColor:E?"color-mix(in srgb, var(--primary) 48%, var(--border))":"var(--border)",background:E?"color-mix(in srgb, var(--primary) 8%, transparent)":"var(--bg-card)"},children:[e.jsxs("span",{className:"relative mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border border-[var(--border)] bg-[var(--bg-input)]",children:[e.jsx("input",{type:"radio",name:n,value:h.value,checked:E,disabled:C,onChange:()=>t(h.value),className:"absolute inset-0 opacity-0"}),e.jsx("span",{className:`h-2 w-2 rounded-full transition ${E?"scale-100 opacity-100":"scale-50 opacity-0"}`,style:{background:"var(--primary)"}})]}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-sm font-medium leading-5 text-[var(--text-main)]",children:h.label}),h.description&&e.jsx("span",{className:"block text-xs leading-5 text-[var(--text-muted)]",children:h.description})]})]},h.value)})})]})}function pn({title:r,subtitle:t,icon:a,actions:n,children:s,footer:u,className:i="",bodyClassName:c="p-4"}){const b=r||t||a||n;return e.jsxs("section",{className:`overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)] ${i}`,children:[b&&e.jsxs("header",{className:"flex items-center justify-between gap-3 border-b border-[var(--border)] px-4 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[a&&e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-[var(--border)] bg-[var(--bg-input)] text-[var(--primary)]",children:a}),e.jsxs("div",{className:"min-w-0",children:[r&&e.jsx("h3",{className:"truncate text-sm font-semibold text-[var(--text-main)]",children:r}),t&&e.jsx("div",{className:"truncate text-xs text-[var(--text-muted)]",children:t})]})]}),n&&e.jsx("div",{className:"shrink-0",children:n})]}),e.jsx("div",{className:c,children:s}),u&&e.jsx("footer",{className:"border-t border-[var(--border)] px-4 py-3",children:u})]})}const mn={neutral:{text:"var(--text-secondary)",bg:"var(--bg-input)",border:"var(--border)"},primary:{text:"var(--primary)",bg:"color-mix(in srgb, var(--primary) 10%, transparent)",border:"color-mix(in srgb, var(--primary) 24%, var(--border))"},success:{text:"#047857",bg:"rgba(16, 185, 129, 0.11)",border:"rgba(16, 185, 129, 0.24)"},warning:{text:"#b45309",bg:"rgba(245, 158, 11, 0.12)",border:"rgba(245, 158, 11, 0.26)"},danger:{text:"var(--danger)",bg:"var(--danger-bg)",border:"color-mix(in srgb, var(--danger) 20%, var(--border))"},info:{text:"#2563eb",bg:"rgba(59, 130, 246, 0.11)",border:"rgba(59, 130, 246, 0.24)"}},hn={xs:"min-h-5 px-1.5 text-[10px]",sm:"min-h-6 px-2 text-xs",md:"min-h-7 px-2.5 text-sm"};function vn({children:r,tone:t="neutral",size:a="sm",icon:n,dot:s=!1,className:u=""}){const i=mn[t];return e.jsxs("span",{className:`inline-flex max-w-full shrink-0 items-center gap-1.5 rounded-full border font-semibold leading-none ${hn[a]} ${u}`,style:{color:i.text,background:i.bg,borderColor:i.border},children:[s&&e.jsx("span",{"aria-hidden":"true",className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{background:i.text}}),n&&e.jsx("span",{className:"shrink-0",children:n}),e.jsx("span",{className:"min-w-0 truncate",children:r})]})}const at={neutral:{color:"var(--text-secondary)",background:"var(--bg-input)"},primary:{color:"var(--primary)",background:"color-mix(in srgb, var(--primary) 10%, transparent)"},success:{color:"#047857",background:"rgba(16, 185, 129, 0.11)"},warning:{color:"#b45309",background:"rgba(245, 158, 11, 0.12)"},danger:{color:"var(--danger)",background:"var(--danger-bg)"},info:{color:"#2563eb",background:"rgba(59, 130, 246, 0.11)"}},gn={xs:"min-h-5 px-1.5 pr-6 text-[10px]",sm:"min-h-6 px-2 pr-7 text-xs",md:"min-h-7 px-2.5 pr-8 text-sm"},xn={xs:"right-1 h-3 w-3",sm:"right-1.5 h-3 w-3",md:"right-2 h-3.5 w-3.5"},yn={xs:148,sm:164,md:184},wn={xs:"px-2.5 py-1.5 text-xs",sm:"px-3 py-2 text-sm",md:"px-3.5 py-2.5 text-sm"};function Nn({value:r,options:t,onChange:a,size:n="sm",disabled:s=!1,loading:u=!1,stopPropagation:i=!1,ariaLabel:c="Cambiar estado",title:b="Cambiar estado",className:h,selectClassName:E,menuClassName:C,optionClassName:v,spinnerClassName:x}){const[f,m]=l.useState(!1),[p,N]=l.useState(!1),[T,H]=l.useState(-1),[I,y]=l.useState({}),M=l.useRef(null),A=l.useRef(null),P=l.useRef(null),k=t.find(g=>g.value===r)??t[0],D={...k!=null&&k.tone?at[k.tone]:void 0,...k==null?void 0:k.style},G=s||u||t.length===0,j=g=>{i&&g.stopPropagation()},V=l.useCallback(()=>{m(!1),H(-1)},[]),q=l.useCallback(()=>{const g=M.current;if(!g)return;const B=g.getBoundingClientRect(),K=Math.max(B.width,yn[n]),Q=Math.min(Math.max(t.length,1)*38+12,260),re=window.innerHeight-B.bottom,oe=re<Q&&B.top>re,o=Math.min(Math.max(8,B.left+B.width/2-K/2),window.innerWidth-K-8);y({position:"fixed",left:o,top:oe?void 0:B.bottom+6,bottom:oe?window.innerHeight-B.top+6:void 0,width:K,zIndex:9999})},[t.length,n]),Y=l.useCallback(g=>{g.disabled||(a(g.value),V())},[V,a]);l.useEffect(()=>N(!0),[]),l.useEffect(()=>{if(!f)return;q();const g=t.findIndex(B=>B.value===r);H(g>=0?g:0)},[f,t,q,r]),l.useEffect(()=>{if(!f)return;function g(B){var Q,re;const K=B.target;!((Q=M.current)!=null&&Q.contains(K))&&!((re=A.current)!=null&&re.contains(K))&&V()}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[V,f]),l.useEffect(()=>{if(f)return window.addEventListener("resize",q),window.addEventListener("scroll",q,!0),()=>{window.removeEventListener("resize",q),window.removeEventListener("scroll",q,!0)}},[f,q]),l.useEffect(()=>{if(T<0||!P.current)return;const g=P.current.children[T];g==null||g.scrollIntoView({block:"nearest"})},[T]);function Z(g){if(!G){if(!f){["Enter"," ","ArrowDown","ArrowUp"].includes(g.key)&&(g.preventDefault(),m(!0));return}if(g.key==="Escape"){g.preventDefault(),V();return}if(g.key==="ArrowDown"){g.preventDefault(),H(B=>Math.min(B+1,t.length-1));return}if(g.key==="ArrowUp"){g.preventDefault(),H(B=>Math.max(B-1,0));return}if(g.key==="Enter"||g.key===" "){g.preventDefault();const B=t[T];B&&Y(B)}}}const L=e.jsx("div",{ref:A,role:"listbox","aria-label":c,className:De("overflow-hidden rounded-xl border shadow-xl backdrop-blur-md",C),style:{...I,background:"color-mix(in srgb, var(--bg-card) 92%, transparent)",borderColor:"var(--border)",color:"var(--text-main)"},onClick:j,onMouseDown:j,onPointerDown:j,children:e.jsx("div",{ref:P,className:"max-h-64 overflow-y-auto p-1",style:{scrollbarWidth:"thin",scrollbarColor:"var(--border) transparent",overscrollBehavior:"contain"},children:t.map((g,B)=>{const K=g.value===r,Q=B===T,re={...g.tone?at[g.tone]:void 0,...g.style};return e.jsxs("button",{type:"button",role:"option","aria-selected":K,disabled:g.disabled,onMouseEnter:()=>!g.disabled&&H(B),onMouseDown:oe=>{oe.preventDefault(),Y(g)},className:De("flex w-full items-center gap-2 rounded-lg font-medium text-left transition-colors disabled:cursor-not-allowed disabled:opacity-45",wn[n],K?g.className:void 0,v),style:{...K?re:void 0,background:K?re.background??"color-mix(in srgb, var(--primary) 12%, transparent)":Q?"var(--bg-hover)":"transparent",color:K?re.color??"var(--primary)":"var(--text-main)"},children:[e.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:K?e.jsx(S.HiCheck,{className:"h-4 w-4"}):null}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:g.label})]},g.value)})})});return e.jsxs("span",{ref:M,className:De("relative inline-flex shrink-0 items-center",h),onKeyDown:Z,onClick:j,onPointerDown:j,children:[e.jsx("button",{type:"button",disabled:G,"aria-label":c,"aria-haspopup":"listbox","aria-expanded":f,title:b,onClick:()=>!G&&m(g=>!g),className:De("inline-flex items-center rounded-full border border-transparent font-medium leading-none outline-none transition-colors hover:border-current focus:border-current disabled:cursor-wait disabled:opacity-70",gn[n],k==null?void 0:k.className,E),style:D,children:e.jsx("span",{className:"min-w-0 truncate",children:(k==null?void 0:k.label)??r})}),e.jsx(S.HiChevronDown,{"aria-hidden":"true",className:De("pointer-events-none absolute opacity-70 transition-transform",xn[n],f?"rotate-180":"rotate-0")}),u&&e.jsx("span",{"aria-hidden":"true",className:De("absolute -right-1 -top-1 h-2.5 w-2.5 rounded-full border border-current border-t-transparent animate-spin",x)}),f&&p&&$e.createPortal(L,document.body)]})}function kn({tabs:r,activeTabId:t,defaultActiveTabId:a,onTabChange:n,ariaLabel:s="Pestanas",variant:u="underline",className:i="",listClassName:c="",panelClassName:b=""}){const h=r.find(f=>!f.disabled)??r[0],E=t??a??(h==null?void 0:h.id),C=r.find(f=>f.id===E)??h,v=f=>{f.disabled||n==null||n(f.id)},x=f=>{const m=r.filter(N=>!N.disabled);if(!m.length||!C)return;const p=m.findIndex(N=>N.id===C.id);(f.key==="ArrowRight"||f.key==="ArrowDown")&&(f.preventDefault(),v(m[(p+1)%m.length])),(f.key==="ArrowLeft"||f.key==="ArrowUp")&&(f.preventDefault(),v(m[(p-1+m.length)%m.length])),f.key==="Home"&&(f.preventDefault(),v(m[0])),f.key==="End"&&(f.preventDefault(),v(m[m.length-1]))};return e.jsxs("div",{className:i,children:[e.jsx("div",{role:"tablist","aria-label":s,onKeyDown:x,className:`flex min-w-0 gap-1 overflow-x-auto ${u==="underline"?"border-b border-[var(--border)]":"rounded-lg border border-[var(--border)] bg-[var(--bg-input)] p-1"} ${c}`,children:r.map(f=>{const m=f.id===(C==null?void 0:C.id);return e.jsxs("button",{type:"button",role:"tab","aria-selected":m,"aria-controls":`${f.id}-panel`,id:`${f.id}-tab`,disabled:f.disabled,tabIndex:m?0:-1,onClick:()=>v(f),className:`inline-flex min-h-8 shrink-0 items-center justify-center gap-1.5 whitespace-nowrap px-2.5 text-sm font-semibold transition-colors focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 ${u==="underline"?"border-b-2":"rounded-md border"}`,style:{color:m?"var(--primary)":"var(--text-muted)",borderColor:m?"var(--primary)":"transparent",background:u==="pills"&&m?"var(--bg-card)":"transparent"},children:[f.icon&&e.jsx("span",{className:"shrink-0",children:f.icon}),e.jsx("span",{children:f.label}),f.badge&&e.jsx("span",{className:"shrink-0",children:f.badge})]},f.id)})}),(C==null?void 0:C.content)!==void 0&&e.jsx("div",{role:"tabpanel",id:`${C.id}-panel`,"aria-labelledby":`${C.id}-tab`,className:`pt-4 ${b}`,children:C.content})]})}function Le(...r){return r.filter(Boolean).join(" ")}function Sn({steps:r,activeStepId:t,initialStepId:a,completedStepIds:n,defaultCompletedStepIds:s=[],onActiveStepChange:u,onCompletedStepIdsChange:i,onBlockedStep:c,allowBackNavigation:b=!0,showFooter:h=!0,previousLabel:E="Anterior",nextLabel:C="Siguiente",blockedNextLabel:v="Completa este paso",className:x="",headerClassName:f="",contentClassName:m="",footerClassName:p=""}){var te;const N=((te=r[0])==null?void 0:te.id)??"",[T,H]=l.useState(a??N),[I,y]=l.useState(s),M=t??T,A=n??I,P=l.useMemo(()=>new Set(A),[A]),k=Math.max(0,r.findIndex(z=>z.id===M)),D=r[k]??r[0],G=r.length<=1?100:k/(r.length-1)*100,j=z=>{n||y(z),i==null||i(z)},V=z=>{const ae=r.find(ne=>ne.id===z);ae&&(t||H(z),u==null||u(z,ae))},q=z=>P.has(z),Y=z=>r.slice(0,z).find(ae=>!ae.optional&&!P.has(ae.id)),Z=z=>{const ae=r[z];return!ae||ae.disabled?!1:z===k||b&&z<k?!0:!Y(z)},L=z=>{const ae=r.findIndex(ne=>ne.id===z);return ae>=0&&Z(ae)},g=z=>{const ae=r.findIndex(ne=>ne.id===z);if(ae<0)return!1;if(!Z(ae)){const ne=Y(ae);return ne&&(c==null||c(r[ae],ne)),!1}return V(z),!0},B=(z=D==null?void 0:D.id)=>{!z||P.has(z)||j([...A,z])},K=(z=D==null?void 0:D.id)=>{if(!z)return;const ae=r.findIndex(_=>_.id===z),ne=A.filter(_=>{const R=r.findIndex(U=>U.id===_);return R>=0&&R<ae});j(ne),ae>=0&&k>ae&&V(z)},Q=()=>k<=0?!1:g(r[k-1].id),re=()=>{const z=r[k+1];return z?g(z.id):!1},oe={activeStep:D,activeIndex:k,completedStepIds:A,isCompleted:q,isUnlocked:L,completeStep:B,uncompleteStep:K,goToStep:g,goNext:re,goPrevious:Q};if(!D)return null;const o=r[k+1],W=k>0,le=o?L(o.id):!1,ee=typeof D.content=="function"?D.content(oe):D.content;return e.jsxs("section",{className:Le("overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--bg-card)]",x),children:[e.jsxs("div",{className:Le("border-b border-[var(--border)] bg-[var(--bg-input)]",f),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:`${G}%`}})}),e.jsx("div",{className:"grid gap-2 p-2",style:{gridTemplateColumns:`repeat(${r.length}, minmax(0, 1fr))`},children:r.map((z,ae)=>{const ne=z.id===D.id,_=q(z.id),R=Z(ae),U=Y(ae);return e.jsxs("button",{type:"button",disabled:!R,"aria-current":ne?"step":void 0,"aria-disabled":!R,title:!R&&U?`Completa ${U.title}`:z.title,onClick:()=>g(z.id),className:Le("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",ne&&"border-[var(--primary)] bg-[var(--bg-card)] shadow-sm",_&&!ne&&"border-[var(--primary)]/35 bg-[var(--bg-card)]",!ne&&!_&&R&&"border-transparent bg-[var(--bg-card)]/45 hover:border-[var(--border)] hover:bg-[var(--bg-card)]",!R&&"border-transparent bg-[var(--bg-card)]/35 opacity-60"),children:[e.jsx("span",{className:Le("absolute inset-x-0 top-0 h-0.5 origin-left scale-x-0 bg-[var(--primary)] transition-transform duration-300",ne&&"scale-x-100")}),e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:Le("grid h-7 w-7 shrink-0 place-items-center rounded-full border text-xs font-bold transition-all duration-200",ne&&"border-[var(--primary)] bg-[var(--primary)] text-[var(--primary-fg)]",_&&!ne&&"border-[var(--primary)] bg-[var(--primary)]/12 text-[var(--primary)]",!_&&!ne&&R&&"border-[var(--border)] text-[var(--text-muted)]",!R&&"border-[var(--border)] text-[var(--text-muted)]"),children:_?e.jsx(S.HiCheck,{className:"h-4 w-4"}):R?ae+1:e.jsx(S.HiLockClosed,{className:"h-3.5 w-3.5"})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:Le("block truncate text-xs font-semibold transition-colors duration-200",ne?"text-[var(--text-main)]":"text-[var(--text-secondary)]"),children:[ae+1,". ",z.title]}),z.description&&e.jsx("span",{className:"mt-1 block truncate text-[11px] text-[var(--text-muted)]",children:z.description})]}),z.badge&&e.jsx("span",{className:"shrink-0",children:z.badge})]})]},z.id)})})]}),e.jsx("div",{className:Le("min-h-72 animate-[stepWizardIn_220ms_ease-out] p-5",m),children:ee},D.id),h&&e.jsxs("div",{className:Le("flex flex-wrap items-center justify-between gap-3 border-t border-[var(--border)] bg-[var(--bg-input)] px-4 py-3",p),children:[e.jsx(ue,{variant:"secondary",height:38,padding:"0 14px",icon:e.jsx(S.HiChevronLeft,{}),disabled:!W,onClick:Q,children:E}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-[var(--text-muted)]",children:[e.jsxs("span",{children:["Paso ",k+1," de ",r.length]}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-[var(--border)]"}),e.jsxs("span",{children:[A.length," completados"]})]}),e.jsx(ue,{height:38,padding:"0 14px",icon:e.jsx(S.HiChevronRight,{}),disabled:!o||!le,onClick:re,children:o&&!le?v:C})]})]})}const Cn={sm:"min-h-20 px-2.5 py-1.5 text-xs leading-5",md:"min-h-24 px-2.5 py-2 text-sm leading-5",lg:"min-h-32 px-3 py-2.5 text-sm leading-6"},En={none:"resize-none",vertical:"resize-y",horizontal:"resize-x",both:"resize"};function Mn(r,t){if(r){if(typeof r=="function"){r(t);return}r.current=t}}function $n(r,t){return r!==void 0?String(r).length:t!==void 0?String(t).length:0}const nt=l.forwardRef(function({className:t="",wrapperClassName:a="",size:n="md",resize:s="vertical",autoResize:u=!1,minRows:i,maxRows:c,showCount:b=!1,maxCount:h,status:E="default",icon:C,action:v,style:x,value:f,defaultValue:m,maxLength:p,onInput:N,...T},H){const I=l.useRef(null),y=$n(f,m),M=h??p,A=!!(C||v||b),P=E==="error"?"var(--danger)":E==="success"?"#16a34a":"var(--border)",k={...x??{},...i?{minHeight:`${i*24+18}px`}:null,...c?{maxHeight:`${c*24+18}px`}:null},D=()=>{const j=I.current;!j||!u||(j.style.height="auto",j.style.height=`${j.scrollHeight}px`)};l.useEffect(D,[u,f]);const G=e.jsx("textarea",{...T,ref:j=>{I.current=j,Mn(H,j)},value:f,defaultValue:m,maxLength:p,"aria-invalid":E==="error"||T["aria-invalid"],onInput:j=>{D(),N==null||N(j)},style:{...k,borderColor:P},className:`w-full rounded-lg border bg-[var(--bg-input)] text-[var(--text-main)] outline-none placeholder:text-[var(--text-muted)] transition-colors focus:border-[var(--primary)] disabled:cursor-not-allowed disabled:opacity-60 ${Cn[n]} ${En[u?"none":s]} ${C?"pl-8":""} ${v?"pr-10":""} ${t}`});return A?e.jsxs("span",{className:`relative block ${a}`,children:[C&&e.jsx("span",{className:"pointer-events-none absolute left-2.5 top-2.5 flex h-4 w-4 items-center justify-center text-[var(--text-muted)]",children:C}),G,v&&e.jsx("span",{className:"absolute right-2 top-2 flex items-center justify-center",children:v}),b&&e.jsxs("span",{className:"absolute bottom-1.5 right-2 rounded bg-[var(--bg-input)] px-1.5 text-[10px] font-semibold text-[var(--text-muted)]",children:[y,M?`/${M}`:""]})]}):G});function Dn({label:r,containerClassName:t="",helperText:a,error:n,labelAction:s,required:u,className:i="",status:c,...b}){return e.jsx(Rr,{label:r,required:u,helperText:a,error:n,labelAction:s,className:t,children:e.jsx(nt,{...b,required:u,status:n?"error":c,className:`w-full ${i}`})})}const Ln={xs:{width:28,height:16,thumb:12,padding:2},sm:{width:36,height:20,thumb:16,padding:2}};function Tn({checked:r,disabled:t,onCheckedChange:a,size:n="sm",className:s="",...u}){const i=Ln[n],c=r?i.width-i.thumb-i.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 ${s}`,style:{width:i.width,height:i.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:i.thumb,height:i.thumb,left:i.padding,top:"50%",transform:`translate(${c}px, -50%)`,background:r?"var(--primary-fg)":"var(--text-muted)"}})})}const lt=[".sidebar-scroll","[data-overlay-scroll='true']"].join(",");function In(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 st(r){return r.classList.contains("sidebar-scroll")}function ot(r){st(r)&&r.querySelectorAll(".os-scrollbar-horizontal").forEach(t=>{t.style.display="none",t.style.height="0",t.style.pointerEvents="none"})}function it(){return l.useEffect(()=>{const r=new WeakMap;let t=0;const a=()=>{t=0,document.querySelectorAll(lt).forEach(u=>{if(!In(u))return;if(Dr.OverlayScrollbars(u)){ot(u);return}const c=Dr.OverlayScrollbars(u,{overflow:st(u)?{x:"hidden",y:"scroll"}:void 0,scrollbars:{autoHide:"leave",autoHideDelay:180}});ot(u),r.set(u,c)})},n=()=>{t||(t=window.requestAnimationFrame(a))};a();const s=new MutationObserver(n);return s.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","data-overlay-scroll"]}),window.addEventListener("resize",n),()=>{t&&window.cancelAnimationFrame(t),s.disconnect(),window.removeEventListener("resize",n),document.querySelectorAll(lt).forEach(u=>{var i;u instanceof HTMLElement&&((i=r.get(u))==null||i.destroy())})}},[]),null}const An={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"}},ct=["bg-indigo-500","bg-blue-500","bg-emerald-500","bg-violet-500","bg-amber-500","bg-teal-500","bg-rose-500","bg-cyan-500"],Bn={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg"},Hn="bonsaif.bot",On="Bonsaif Bot",Pn={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2",xl:"p-2.5"};function dt(r){return typeof r=="string"?r.trim():""}function zn(r){let t=0;for(const a of r)t=t*31+a.charCodeAt(0)&65535;return ct[t%ct.length]}function _n(r,t){return r===Hn||t===On}function jn(r,t){return`${r.replace(/\/$/,"")}${t}`}function ut({userId:r,username:t,name:a,size:n="md",showName:s=!1,showTooltip:u,tooltipContent:i,fallbackLabel:c="Usuario",wrapperClassName:b="",labelClassName:h="",labelSize:E="xs",avatarVersion:C=0,className:v="",style:x}){var q;const[f,m]=l.useState(!1),p=typeof r=="string"&&r.trim()&&r!=="undefined"&&r!=="null"?r.trim():"";l.useEffect(()=>{m(!1)},[p,C]);const{wh:N,text:T}=An[n],H=dt(a)||dt(t)||c,I=H.trim()[0]||"?",y=typeof process<"u"&&((q=process.env)==null?void 0:q.NEXT_PUBLIC_BASE_PATH)||"",M=_n(t,a),A=jn(y,"/favicon.svg"),P=p?`${y}/api/user/avatar/${p}${C?`?v=${C}`:""}`:"",D={xs:20,sm:28,md:36,lg:48,xl:64}[n],G=M?e.jsx("span",{className:`${N} ${Pn[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 ${v}`,style:x,children:e.jsx("img",{src:A,alt:H,width:D,height:D,className:"h-full w-full object-contain"})}):P&&!f?e.jsx("img",{src:P,alt:H,width:D,height:D,className:`${N} rounded-full object-cover flex-shrink-0 ${v}`,style:x,onError:()=>m(!0)},`${p}-${C}`):e.jsx("span",{className:`${N} ${zn(H)} ${T} rounded-full flex items-center justify-center font-black text-white uppercase flex-shrink-0 ${v}`,style:x,title:H,children:I});if(s)return e.jsxs("span",{className:`inline-flex min-w-0 items-center gap-2 ${b}`,children:[G,e.jsx("span",{className:`min-w-0 truncate ${Bn[E]} font-medium text-[var(--text-main)] ${h}`,title:H,children:H})]});const j=u??!0,V=i??H;return j&&V?e.jsx(ze,{as:"span",content:V,className:`inline-flex flex-shrink-0 ${b}`,children:G}):G}function Fn({href:r,className:t,children:a}){return e.jsx("a",{href:r,className:t,children:a})}function Wn(r){return r.reduce((t,a)=>{const n=a.section??"Principal";return t[n]=[...t[n]??[],a],t},{})}function bt({children:r,navItems:t=[],currentPath:a=typeof window>"u"?"/":window.location.pathname,user:n,appName:s="Bonsaif",appLogo:u,header:i,footer:c,onLogout:b,LinkComponent:h=Fn}){const[E,C]=l.useState(!1),v=Wn(t);return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-main)] text-[var(--text-main)]",children:[e.jsx(it,{}),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(S.HiBars3,{className:"h-5 w-5"})}),E&&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 ${E?"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(S.HiHome,{className:"h-5 w-5"})}),e.jsx("div",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:s}),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(S.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(v).map(([x,f])=>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(S.HiChevronDown,{className:"h-3.5 w-3.5"}),x]}),e.jsx("div",{className:"space-y-1",children:f.map(m=>{const p=a===m.href||a.startsWith(`${m.href}/`);return e.jsxs(h,{href:m.href,className:`flex min-w-0 items-center gap-2 rounded-md px-2 py-2 text-sm transition-colors ${p?"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:m.icon??e.jsx(S.HiHome,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate",children:m.label})]},m.href)})})]},x))}),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(ut,{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})]})]}),b&&e.jsxs(ue,{variant:"ghost",className:"w-full justify-start text-white hover:bg-white/10",onClick:b,children:[e.jsx(S.HiArrowRightOnRectangle,{className:"h-4 w-4"})," Salir"]}),c]})]}),e.jsxs("div",{className:"min-h-screen lg:pl-72",children:[i,e.jsx("main",{className:"min-h-screen",children:r})]})]})}const qn={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"},vr={dashboard:e.jsx(S.HiChartBar,{className:"h-5 w-5"}),tickets:e.jsx(S.HiTicket,{className:"h-5 w-5"}),teams:e.jsx(S.HiUsers,{className:"h-5 w-5"}),projects:e.jsx(S.HiRectangleGroup,{className:"h-5 w-5"}),clients:e.jsx(S.HiBuildingOffice2,{className:"h-5 w-5"}),surveys:e.jsx(S.HiClipboardDocumentList,{className:"h-5 w-5"}),profile:e.jsx(S.HiUser,{className:"h-5 w-5"}),settings:e.jsx(S.HiCog6Tooth,{className:"h-5 w-5"}),notifications:e.jsx(S.HiBell,{className:"h-5 w-5"}),changelog:e.jsx(S.HiDocumentText,{className:"h-5 w-5"}),admin:e.jsx(S.HiShieldCheck,{className:"h-5 w-5"}),users:e.jsx(S.HiUsers,{className:"h-5 w-5"}),roles:e.jsx(S.HiShieldCheck,{className:"h-5 w-5"}),menus:e.jsx(S.HiCog6Tooth,{className:"h-5 w-5"}),guards:e.jsx(S.HiCalendarDays,{className:"h-5 w-5"}),vacations:e.jsx(S.HiCalendarDays,{className:"h-5 w-5"}),audit:e.jsx(S.HiListBullet,{className:"h-5 w-5"}),positions:e.jsx(S.HiBriefcase,{className:"h-5 w-5"}),ranks:e.jsx(S.HiListBullet,{className:"h-5 w-5"}),"email-inbox":e.jsx(S.HiInbox,{className:"h-5 w-5"}),"security-incidents":e.jsx(S.HiShieldCheck,{className:"h-5 w-5"})};function Un({href:r,className:t,style:a,children:n}){return e.jsx("a",{href:r,className:t,style:a,children:n})}function Gn(r){return r.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Vn(r){return/^\d+$/.test(r)||/^[a-f0-9]{8,}$/i.test(r)}function Kn(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,s=Vn(a)&&n?n:a,u=qn[s]??Gn(s);return[{label:"Inicio",href:"/"},{label:u}]}function gr(r){return(r==null?void 0:r.querySelector(":scope > .os-viewport"))??(r==null?void 0:r.querySelector(":scope > [data-overlayscrollbars-viewport]"))}function Yn(r){const t=r.split("/").filter(Boolean),a=t[t.length-1];if(!a)return e.jsx(S.HiHome,{className:"h-5 w-5"});if(vr[a])return vr[a];const n=t.length>1?t[t.length-2]:"";return vr[n]??e.jsx(S.HiHome,{className:"h-5 w-5"})}function Xn({title:r,subtitle:t,action:a,meta:n,icon:s,className:u="",contentClassName:i="",breadcrumbs:c,currentPath:b=typeof window>"u"?"/":window.location.pathname,showBreadcrumbs:h=!0,contained:E=!1,LinkComponent:C=Un}){const v=l.useRef(null),[x,f]=l.useState(!1),[m,p]=l.useState(null),N=c??Kn(b),T=s??Yn(b),H=h&&N.length>1;return l.useEffect(()=>{if(E){f(!1);return}let I=null,y=0,M=0;const A=()=>{const D=v.current,G=document.querySelector("[data-app-scroll='true']");return(D==null?void 0:D.closest(".os-viewport"))??(D==null?void 0:D.closest("[data-overlayscrollbars-viewport]"))??gr(G)??G??window},P=()=>{const D=I&&I!==window?I.scrollTop:window.scrollY;f(G=>G?D>24:D>72)},k=()=>{I==null||I.removeEventListener("scroll",P),I=A(),I.addEventListener("scroll",P,{passive:!0}),P()};return k(),y=window.requestAnimationFrame(k),M=window.setTimeout(k,120),()=>{window.cancelAnimationFrame(y),window.clearTimeout(M),I==null||I.removeEventListener("scroll",P)}},[E]),l.useEffect(()=>{if(E){p(null);return}let I=0;const y=[],M=()=>{const V=v.current,q=V==null?void 0:V.parentElement,Y=document.querySelector("[data-app-scroll='true']"),Z=gr(Y)??Y;if(!V||!q||!Z){p(null);return}const L=q.getBoundingClientRect(),g=window.getComputedStyle(q),B=Z.getBoundingClientRect(),K=Z instanceof HTMLElement&&Z.clientWidth>0?Z.clientWidth:B.width,Q=L.left+parseFloat(g.paddingLeft||"0"),re={marginLeft:Math.round(B.left-Q),width:Math.round(K)};p(oe=>oe&&oe.marginLeft===re.marginLeft&&oe.width===re.width?oe:re)},A=()=>{window.cancelAnimationFrame(I),I=window.requestAnimationFrame(M)};A(),window.addEventListener("resize",A);const P=new ResizeObserver(A),k=v.current,D=k==null?void 0:k.parentElement,G=document.querySelector("[data-app-scroll='true']"),j=gr(G)??G;return[D,G,j].forEach(V=>{V&&P.observe(V)}),y.push(window.setTimeout(A,120)),y.push(window.setTimeout(A,280)),()=>{window.cancelAnimationFrame(I),window.removeEventListener("resize",A),P.disconnect(),y.forEach(V=>window.clearTimeout(V))}},[E]),e.jsx("div",{ref:v,"data-page-header":"true","data-compact":x?"true":"false",className:`sticky top-0 z-30 overflow-visible py-0 transition-[background-color,box-shadow,border-color] duration-300 ease-out ${E?"mb-0 flex-shrink-0":"mb-4 sm:mb-0"} ${u}`,style:{...m?{marginLeft:m.marginLeft,width:m.width}:null,background:E?"var(--bg-card)":x?"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:E||x?"1px solid var(--border)":"1px solid transparent",boxShadow:x?"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 ${x?"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"} ${i}`,children:[e.jsxs("div",{className:`min-w-0 flex flex-1 flex-col justify-center transition-[gap,transform] duration-300 ease-out ${x?"gap-1":"gap-1.5 sm:gap-2"}`,children:[H&&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 ${x?"text-[10px]":"text-[10px] sm:text-[11px]"}`,children:N.map((I,y)=>{const M=y===N.length-1;return e.jsxs("li",{className:"flex min-w-0 items-center gap-1.5",children:[y>0&&e.jsx(S.HiChevronRight,{className:"h-3.5 w-3.5 transition-[color,transform] duration-300 ease-out",style:{color:"var(--text-muted)"}}),I.href&&!M?e.jsx(C,{href:I.href,className:"truncate transition-colors duration-300 hover:underline",style:{color:"var(--text-muted)"},children:I.label}):e.jsx("span",{"aria-current":M?"page":void 0,className:M?"truncate font-semibold":"truncate",style:{color:M?"var(--text-main)":"var(--text-muted)"},children:I.label})]},`${I.label}-${y}`)})})}),e.jsxs("div",{className:`flex min-w-0 items-center transition-[gap,transform] duration-300 ease-out ${x?"gap-2":"gap-2.5 sm:gap-3"}`,children:[e.jsx("span",{className:`flex-shrink-0 transition-[color,transform,opacity] duration-300 ease-out ${x?"scale-75 opacity-80":"scale-90 opacity-100"}`,style:{color:H?"var(--text-secondary)":"var(--text-muted)"},children:T}),e.jsxs("div",{className:`flex min-w-0 flex-1 flex-wrap items-center transition-[gap] duration-300 ease-out ${x?"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 ${x?"text-base sm:text-lg":"text-lg sm:text-xl"}`,style:{color:"var(--text-main)"},children:r}),t&&e.jsx("p",{"aria-hidden":x,className:`overflow-hidden text-xs transition-[max-height,opacity,transform,margin] duration-300 ease-out ${x?"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 ${x?"translate-y-0 gap-1.5 opacity-95":"gap-2 opacity-100"}`,children:n})]})]})]}),a&&e.jsx("div",{className:`page-header-actions ml-auto flex max-w-full flex-shrink-0 flex-wrap items-center justify-end self-center overflow-visible transition-[gap,min-height,opacity,transform] duration-300 ease-out ${x?"min-h-10 gap-1 opacity-95":"min-h-10 gap-1.5 opacity-100"}`,children:e.jsx(Ar.Provider,{value:{compact:!0,headerAction:!0},children:a})})]})})}function Zn({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(bt,{currentPath:t,...n,children:r})}function ft(){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 Jn(r,t,a){try{const n=new URL(r),s=n.searchParams.get("callbackUrl");if(s){const u=new URL(s,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 Qn({name:r,src:t,projectKey:a}){const[n,s]=l.useState(()=>ft()),u=l.useRef(null);l.useEffect(()=>{const b=new MutationObserver(()=>s(ft()));return b.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>b.disconnect()},[]);const i=l.useMemo(()=>Jn(t,n,a),[a,t,n]),c=l.useMemo(()=>{try{return new URL(i).origin}catch{return""}},[i]);return l.useEffect(()=>{if(!a)return;const b=a;function h(E){var x,f,m;if(E.source!==((x=u.current)==null?void 0:x.contentWindow)||c&&E.origin!==c)return;if(((f=E.data)==null?void 0:f.type)==="prime-microservice:overlay"){window.dispatchEvent(new CustomEvent("prime-auth:microservice-overlay",{detail:{active:!!E.data.active}}));return}if(((m=E.data)==null?void 0:m.type)!=="prime-microservice:navigation")return;const C=E.data.path;if(!C||!C.startsWith("/")||C.startsWith("//"))return;const v=`/apps/${encodeURIComponent(b)}${C}`;`${window.location.pathname}${window.location.search}${window.location.hash}`!==v&&(window.history.replaceState(window.history.state,"",v),window.dispatchEvent(new CustomEvent("prime-auth:microservice-navigation")))}return window.addEventListener("message",h),()=>{window.removeEventListener("message",h),window.dispatchEvent(new CustomEvent("prime-auth:microservice-overlay",{detail:{active:!1}}))}},[c,a]),e.jsx("div",{className:"flex h-full min-h-screen flex-col bg-[var(--bg-main)]",children:e.jsx("iframe",{ref:u,src:i,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 Rn(){const[r,t]=l.useState(""),[a,n]=l.useState(!1),[s,u]=l.useState({width:96,height:96});return l.useEffect(()=>{let i=!1;return fetch("/api/microservices/prime-suite/chat-url",{cache:"no-store"}).then(c=>c.ok?c.json():null).then(c=>{!i&&(c!=null&&c.src)&&t(c.src)}).catch(()=>{}),()=>{i=!0}},[]),l.useEffect(()=>{const i=c=>{var h;if(((h=c.data)==null?void 0:h.type)!=="prime-suite-chat:state")return;const b=!!c.data.active;n(b),u({width:pt(c.data.width,96,720),height:pt(c.data.height,96,560)})};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[]),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(${s.width}px, 100vw)`:96,height:a?`min(${s.height}px, 100vh)`:96,background:"transparent",backgroundColor:"transparent",colorScheme:"normal"}}):null}function pt(r,t,a){const n=typeof r=="number"&&Number.isFinite(r)?r:t;return Math.max(t,Math.min(a,Math.ceil(n)))}function el(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 rl(){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 tl(){return"light"}function al(){const r=l.useSyncExternalStore(el,rl,tl);return e.jsx(zt.Toaster,{position:"bottom-center",theme:r,richColors:!0,closeButton:!0})}function nl(r){const[t,a]=l.useState({}),[n,s]=l.useState(!1),u=l.useCallback(h=>n||t[h]?r[h]:void 0,[r,n,t]),i=l.useCallback(h=>{a(E=>({...E,[h]:!0}))},[]),c=l.useCallback(()=>{s(!0)},[]),b=l.useCallback(()=>{a({}),s(!1)},[]);return{submitted:n,touchedFields:t,getFieldError:u,touchField:i,submit:c,reset:b}}$.Alert=ra,$.AuthShell=bt,$.BonsaifButton=_t,$.Button=ue,$.CalendarPicker=sa,$.Checkbox=ia,$.CodeBlock=ua,$.CompactFilterSelect=fa,$.CompactSearchInput=ba,$.ConfirmDialog=ha,$.CopyButton=ur,$.CopyLinkButton=ga,$.DataTable=Na,$.DateRangePicker=Ca,$.Drawer=Da,$.DropdownMenu=Ma,$.DynamicDetailTabs=Rt,$.EmailField=Qa,$.EmptyState=en,$.FileUpload=nn,$.FormField=Rr,$.GlobalScrollbars=it,$.InputField=hr,$.LoadingState=Hr,$.MicroserviceFrame=Qn,$.Modal=Wr,$.MouseTooltip=ze,$.MultiSelect=sn,$.NumberField=on,$.PageHeader=Xn,$.PageSearchInput=Ir,$.Pagination=dn,$.PhoneField=bn,$.PrimeAuthRouteShell=Zn,$.PrimeAuthToaster=al,$.PrimeSuiteChatFrame=Rn,$.RadioGroup=fn,$.SearchableSelect=Ye,$.SectionPanel=pn,$.StatusBadge=vn,$.StatusSelect=Nn,$.StepWizard=Sn,$.Tabs=kn,$.TextInput=Re,$.Textarea=nt,$.TextareaField=Dn,$.Toggle=Tn,$.UserAvatar=ut,$.cn=De,$.emailFormat=Ha,$.isValidEmail=fr,$.isValidPhone=pr,$.matches=Fa,$.maxLength=za,$.maxValue=ja,$.minLength=Pa,$.minValue=_a,$.phoneCountryCodeOptions=rt,$.phoneFormat=Oa,$.required=Ba,$.useValidationVisibility=nl,$.validateForm=Wa,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})}));
|