tekivex-ui 2.5.11 → 2.5.12

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.
Files changed (46) hide show
  1. package/dist/TkxForm-1KDzoniV.cjs +12 -0
  2. package/dist/TkxForm-9-W3Nl6m.js +314 -0
  3. package/dist/charts.cjs +1 -1
  4. package/dist/charts.js +543 -507
  5. package/dist/chunk-Bmb41Sf3.cjs +1 -0
  6. package/dist/headless.cjs +1 -1
  7. package/dist/headless.js +428 -447
  8. package/dist/hooks-6pRsPOyG.js +58 -0
  9. package/dist/hooks-mivgRljH.cjs +1 -0
  10. package/dist/i18n.cjs +1 -1
  11. package/dist/i18n.js +728 -752
  12. package/dist/index.cjs +26 -26
  13. package/dist/index.js +16102 -16619
  14. package/dist/quantum.cjs +14 -16
  15. package/dist/quantum.js +2473 -2279
  16. package/dist/realtime.cjs +4 -10
  17. package/dist/realtime.js +804 -958
  18. package/dist/src/components/TkxClock.d.ts.map +1 -1
  19. package/dist/src/components/TkxForm.d.ts.map +1 -1
  20. package/dist/src/components/TkxLiveFeed.d.ts +1 -1
  21. package/dist/src/components/TkxLiveLog.d.ts +1 -1
  22. package/dist/src/components/TkxRealTimeChart.d.ts +1 -1
  23. package/dist/src/components/TkxTooltip.d.ts.map +1 -1
  24. package/dist/src/components/TkxTypography.d.ts +5 -5
  25. package/dist/src/components/TkxTypography.d.ts.map +1 -1
  26. package/dist/tekivex-ui.css +2 -0
  27. package/dist/themes-BbJanqiC.js +498 -0
  28. package/dist/themes-CMq2vWXj.cjs +2 -0
  29. package/dist/tkx-0oAwZqgL.cjs +4 -0
  30. package/dist/tkx-DQkvHdE5.js +1172 -0
  31. package/package.json +16 -16
  32. package/src/components/TkxClock.tsx +2 -2
  33. package/src/components/TkxForm.tsx +4 -2
  34. package/src/components/TkxTooltip.tsx +7 -5
  35. package/src/components/TkxTypography.tsx +2 -2
  36. package/dist/TkxForm-2tGLCPH6.js +0 -326
  37. package/dist/TkxForm-C2VqR2wC.cjs +0 -12
  38. package/dist/index-BgHMZe4Z.js +0 -66
  39. package/dist/index-Bt5y50Qa.cjs +0 -1
  40. package/dist/index-DnqXtpwV.cjs +0 -2
  41. package/dist/index-iUUHRxqJ.js +0 -515
  42. package/dist/security-C-ZPGoyG.js +0 -97
  43. package/dist/security-Uf0mjv8o.cjs +0 -1
  44. package/dist/style.css +0 -1
  45. package/dist/tkx-BtHzWKTl.js +0 -1112
  46. package/dist/tkx-C7GvVUE9.cjs +0 -4
package/dist/index.cjs CHANGED
@@ -1,14 +1,14 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("./index-DnqXtpwV.cjs"),e=require("react/jsx-runtime"),i=require("react"),A=require("./security-Uf0mjv8o.cjs"),J=require("./index-Bt5y50Qa.cjs"),x=require("./tkx-C7GvVUE9.cjs"),Re=require("react-dom"),_t=require("./TkxForm-C2VqR2wC.cjs"),nt=require("./i18n.cjs"),Or={sm:"text-xs font-semibold",md:"text-sm font-semibold",lg:"text-base font-semibold",xl:"text-lg font-semibold"},_r={sm:"py-1.5 px-3",md:"py-2 px-4",lg:"py-2.5 px-5",xl:"py-3 px-6"},Zt={sm:"min-h-[32px]",md:"min-h-[40px]",lg:"min-h-[48px]",xl:"min-h-[56px]"},Yr={sm:14,md:16,lg:18,xl:20};function Kr({size:t}){const n=Yr[t];return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:x.tkx("animate-spin shrink-0"),children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeOpacity:"0.25"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}const Yn=i.forwardRef(({variant:t="solid",size:n="md",colorScheme:r="primary",isLoading:o=!1,loadingText:s,leftIcon:a,rightIcon:l,isFullWidth:d=!1,glow:f=!1,disabled:u,children:c,className:h,style:p,...m},b)=>{const k=O.useTheme(),y=J.useReducedMotion(),g=u||o,j={primary:k.primary,secondary:k.secondary,danger:k.danger,warning:k.warning,success:k.success}[r],v=O.getAccessibleForeground(j,["#ffffff","#000000",k.bg]),$=typeof c=="string"?A.sanitizeString(c):c,w=s?A.sanitizeString(s):void 0,N=t==="solid"?{backgroundColor:j,color:v,border:"none",boxShadow:f&&!y?`0 0 20px ${j}55`:void 0}:t==="outline"?{backgroundColor:"transparent",color:j,border:`2px solid ${j}`}:t==="ghost"?{backgroundColor:"transparent",color:j,border:"none"}:{backgroundColor:"transparent",color:j,border:"none",textDecoration:"underline"},I=x.tkx("inline-flex items-center justify-center gap-2","rounded-lg font-sans font-semibold","select-none relative overflow-hidden",Or[n],_r[n],Zt[n],t!=="link"&&Zt[n],d&&"w-full",g?"cursor-not-allowed opacity-60":"cursor-pointer",!y&&"transition-all duration-200","focus-visible:focus-ring");return e.jsx("button",{ref:b,"aria-busy":o,"aria-disabled":g,disabled:g,className:x.cx(I,h),style:{...N,...p},...m,children:o?e.jsxs(e.Fragment,{children:[e.jsx(Kr,{size:n}),w??$]}):e.jsxs(e.Fragment,{children:[a&&e.jsx("span",{"aria-hidden":"true",children:a}),$,l&&e.jsx("span",{"aria-hidden":"true",children:l})]})})});Yn.displayName="TkxButton";const Ur={none:"",sm:"p-3",md:"p-5",lg:"p-7"},Kn=i.forwardRef(({variant:t="default",isHoverable:n,isClickable:r,padding:o="md",as:s,children:a,className:l,style:d,...f},u)=>{const c=O.useTheme(),h=J.useReducedMotion(),p=s??(r?"button":"div"),m={default:{backgroundColor:c.surface,border:`1px solid ${c.border}`},glass:{backgroundColor:`${c.surface}cc`,backdropFilter:"blur(12px)",border:`1px solid ${c.border}55`,boxShadow:`0 4px 24px ${c.bg}40`},quantum:{backgroundColor:c.surfaceAlt,border:`1px solid ${c.primary}33`,boxShadow:`0 0 24px ${c.primary}18`},elevated:{backgroundColor:c.surface,boxShadow:`0 4px 20px ${c.bg}60`},outlined:{backgroundColor:"transparent",border:`2px solid ${c.border}`}}[t],b=x.tkx("rounded-xl w-full text-left block font-sans focus-visible:focus-ring",Ur[o],(n||r)&&!h&&"transition-transform duration-150 hover:scale-[1.01]",r?"cursor-pointer":"cursor-default");return e.jsx(p,{ref:u,className:x.cx("tkx-card",b,l),style:{color:c.text,...m,...d},...f,children:a})});Kn.displayName="TkxCard";function Xr({title:t,subtitle:n,action:r,children:o,className:s,...a}){const l=O.useTheme();return e.jsxs("div",{className:x.cx(x.tkx("flex justify-between items-start mb-4"),s),...a,children:[e.jsxs("div",{className:x.tkx("flex-1 min-w-0"),children:[t&&e.jsx("h3",{className:x.tkx("text-base font-semibold m-0"),style:{color:l.text},children:t}),n&&e.jsx("p",{className:x.tkx("text-sm mt-1 mb-0"),style:{color:l.textMuted},children:n}),o]}),r&&e.jsx("div",{className:x.tkx("ml-3 shrink-0"),children:r})]})}function Zr({children:t,className:n,...r}){return e.jsx("div",{className:x.cx(x.tkx(""),n),...r,children:t})}function Gr({children:t,className:n,style:r,...o}){const s=O.useTheme();return e.jsx("div",{className:x.cx(x.tkx("flex items-center justify-end gap-2 mt-4 pt-4"),n),style:{borderTop:`1px solid ${s.border}`,...r},...o,children:t})}const Un=i.forwardRef(({label:t,id:n,error:r,hint:o,leftAddon:s,rightAddon:a,isInvalid:l,isRequired:d,disabled:f,className:u,style:c,...h},p)=>{const m=O.useTheme(),b=i.useId(),k=n??b,y=`${k}-hint`,g=`${k}-error`,S=l||!!r,j=[o&&y,S&&g].filter(Boolean).join(" ")||void 0,v=A.sanitizeString(t),$=r?A.sanitizeString(r):void 0,w=o?A.sanitizeString(o):void 0,N=S?m.danger:m.border;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1 w-full"),u),style:c,children:[e.jsxs("label",{htmlFor:k,className:x.tkx("text-sm font-medium font-sans"),style:{color:m.text},children:[v,d&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("ml-1"),style:{color:m.danger},children:"*"})]}),e.jsxs("div",{className:x.tkx("flex items-center rounded-lg overflow-hidden","transition-colors duration-150",f?"opacity-60":""),style:{border:`1.5px solid ${N}`,backgroundColor:m.surface},children:[s&&e.jsx("div",{className:x.tkx("px-2.5 self-stretch flex items-center text-sm shrink-0"),style:{backgroundColor:m.surfaceAlt,color:m.textMuted,borderRight:`1px solid ${m.border}`},children:s}),e.jsx("input",{ref:p,id:k,"aria-invalid":S,"aria-required":d,"aria-describedby":j,disabled:f,className:x.cx(x.tkx("flex-1 border-none bg-transparent text-sm font-sans py-2.5 px-3 outline-none min-w-0 focus-visible:focus-ring")),style:{color:m.text},...h}),a&&e.jsx("div",{className:x.tkx("px-2.5 self-stretch flex items-center text-sm shrink-0"),style:{backgroundColor:m.surfaceAlt,color:m.textMuted,borderLeft:`1px solid ${m.border}`},children:a})]}),w&&!$&&e.jsx("span",{id:y,className:x.tkx("text-xs"),style:{color:m.textMuted},children:w}),$&&e.jsxs("span",{id:g,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:m.danger},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),$]})]})});Un.displayName="TkxInput";const qr={sm:"text-xs px-1.5 py-[2px] min-h-[16px]",md:"text-xs px-2 py-[3px] min-h-[20px]",lg:"text-sm px-3 py-1 min-h-[24px]"},Qr={sm:"size-[6px]",md:"size-2",lg:"size-2.5"},Xn=i.forwardRef(({variant:t="default",size:n="md",dot:r=!1,pulse:o=!1,outlined:s=!1,children:a,className:l,style:d,...f},u)=>{const c=O.useTheme(),p={default:c.border,primary:c.primary,secondary:c.secondary,danger:c.danger,warning:c.warning,success:c.success,info:c.info}[t]||"#666666",m=O.getAccessibleForeground(p,["#ffffff","#000000",c.bg||"#000000"]),b=typeof a=="string"?A.sanitizeString(a):a;return r?e.jsx("span",{ref:u,"aria-label":typeof a=="string"?A.sanitizeString(a):void 0,className:x.cx(x.tkx("inline-block rounded-full",Qr[n],o&&"animate-pulse"),l),style:{backgroundColor:p,...d},...f}):e.jsx("span",{ref:u,className:x.cx(x.tkx("inline-flex items-center justify-center rounded-full font-semibold font-sans tracking-wide",qr[n],o&&"animate-pulse"),l),style:{backgroundColor:s?"transparent":p,color:s?p:m,border:s?`1px solid ${p}`:"none",...d},...f,children:b})});Xn.displayName="TkxBadge";const Jr={sm:"4px",md:"8px",lg:"12px"},es={sm:32,md:48,lg:64},Zn=i.forwardRef(({value:t,variant:n="linear",size:r="md",label:o,showValue:s,color:a,className:l,style:d,...f},u)=>{const c=O.useTheme(),h=J.useReducedMotion(),p=a??c.primary,m=t===void 0,b=t!==void 0?Math.min(100,Math.max(0,t)):0;if(t!==void 0){const{errors:y}=A.validateProps({value:t},{value:{type:"number",min:0,max:100}});y.length>0&&console.warn("[TkxProgress]",y.join(", "))}if(n==="circular"){const y=es[r],g=r==="sm"?3:r==="md"?4:5,S=(y-g*2)/2,j=2*Math.PI*S,v=m?0:j-b/100*j;return e.jsxs("div",{ref:u,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m?void 0:b,"aria-label":o??(m?"Loading":`${b}%`),className:x.cx(x.tkx("inline-flex flex-col items-center gap-1"),l),style:d,children:[e.jsxs("svg",{width:y,height:y,viewBox:`0 0 ${y} ${y}`,"aria-hidden":"true",children:[e.jsx("circle",{cx:y/2,cy:y/2,r:S,fill:"none",stroke:c.border,strokeWidth:g}),e.jsx("circle",{cx:y/2,cy:y/2,r:S,fill:"none",stroke:p,strokeWidth:g,strokeLinecap:"round",strokeDasharray:j,strokeDashoffset:v,transform:`rotate(-90 ${y/2} ${y/2})`,style:{transition:h?"none":"stroke-dashoffset 300ms ease",animation:m&&!h?"tkx-spin 1s linear infinite":void 0}})]}),s&&!m&&e.jsxs("span",{className:x.tkx("text-xs"),style:{color:c.textMuted},children:[b,"%"]})]})}const k=Jr[r];return e.jsxs("div",{ref:u,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m?void 0:b,"aria-label":o??(m?"Loading":`${b}%`),className:x.cx(x.tkx("flex flex-col gap-1 w-full"),l),style:d,children:[o&&e.jsxs("div",{className:x.tkx("flex justify-between text-sm"),style:{color:c.text},children:[e.jsx("span",{children:o}),s&&!m&&e.jsxs("span",{children:[b,"%"]})]}),e.jsx("div",{className:x.tkx("w-full overflow-hidden"),style:{height:k,borderRadius:k,backgroundColor:c.border},children:e.jsx("div",{style:{height:"100%",borderRadius:k,backgroundColor:p,width:m?"40%":`${b}%`,transition:h?"none":"width 300ms ease",animation:m&&!h?"tkx-shimmer 1.5s ease-in-out infinite":void 0}})})]})});Zn.displayName="TkxProgress";const ts={sm:{tw:28,th:16,td:10,gap:3},md:{tw:40,th:22,td:14,gap:4},lg:{tw:52,th:28,td:18,gap:5}},Gn=i.forwardRef(({checked:t,onChange:n,label:r,size:o="md",hideLabel:s,disabled:a,className:l,style:d,...f},u)=>{const c=O.useTheme(),h=J.useReducedMotion(),p=i.useId();A.validateProps({label:r,checked:t},{label:{type:"string",required:!0},checked:{type:"boolean",required:!0}});const{tw:m,th:b,td:k,gap:y}=ts[o],g=t?m-k-y:y,S=t?c.primary:c.border;return e.jsxs("div",{className:x.cx(x.tkx("inline-flex items-center gap-2",a?"opacity-50":""),l),style:d,children:[!s&&e.jsx("label",{htmlFor:p,className:x.tkx("text-sm font-sans",a?"cursor-not-allowed":"cursor-pointer","select-none"),style:{color:c.text},children:r}),e.jsx("button",{ref:u,id:p,role:"switch","aria-checked":t,"aria-label":s?r:void 0,disabled:a,onClick:()=>!a&&n(!t),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&!a&&(j.preventDefault(),n(!t))},className:x.cx(x.tkx("relative border-none p-0 outline-none shrink-0 focus-visible:focus-ring",a?"cursor-not-allowed":"cursor-pointer",!h&&"transition-colors duration-200")),style:{width:m,height:b,borderRadius:b,backgroundColor:S},...f,children:e.jsx("span",{"aria-hidden":"true",className:x.tkx("absolute rounded-full"),style:{top:"50%",left:g,width:k,height:k,transform:"translateY(-50%)",backgroundColor:"#ffffff",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",transition:h?"none":"left 200ms ease"}})})]})});Gn.displayName="TkxToggle";const ns={info:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),success:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),warning:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),danger:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})})};function rs({variant:t,title:n,children:r,dismissible:o,onDismiss:s,icon:a,style:l,className:d}){const f=O.useTheme(),u=J.useAnnounce(),c=n?A.sanitizeString(n):void 0;i.useEffect(()=>{c&&u(c,t==="danger"||t==="warning"?"assertive":"polite")},[c,t]);const p={info:f.info,success:f.success,warning:f.warning,danger:f.danger}[t],m=t==="danger"||t==="warning"?"alert":"status";return e.jsxs("div",{role:m,className:x.tkx("flex items-start gap-3 px-4 py-3 rounded-lg border animate-fade-in font-sans",d??""),style:{backgroundColor:`${p}18`,borderColor:p,color:f.text,...l},children:[e.jsx("span",{className:x.tkx("shrink-0 mt-[1px]"),style:{color:p},children:a??ns[t]}),e.jsxs("div",{className:x.tkx("flex-1 min-w-0"),children:[c&&e.jsx("p",{className:x.tkx("m-0 font-semibold text-sm mb-1"),children:c}),e.jsx("div",{className:x.tkx("text-sm leading-relaxed"),children:r})]}),o&&s&&e.jsx("button",{"aria-label":"Dismiss alert",onClick:s,className:x.tkx("bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring"),style:{color:f.textMuted},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}const ss={sm:"400px",md:"560px",lg:"720px",full:"100vw"};let Wt=0;function os(){++Wt===1&&(document.body.style.overflow="hidden")}function Gt(){--Wt<=0&&(Wt=0,document.body.style.overflow="")}function is({isOpen:t,onClose:n,title:r,size:o="md",closeOnOverlayClick:s=!0,closeOnEscape:a=!0,children:l,footer:d}){const f=O.useTheme(),u=i.useId(),c=J.useFocusTrap(t),h=J.useReducedMotion(),p=J.useAnnounce(),m=A.sanitizeString(r),b=o==="full";return J.useEscapeKey(n,a&&t),i.useEffect(()=>(t?(os(),p(m,"polite")):Gt(),()=>{t&&Gt()}),[t,m,p]),!t||typeof document>"u"?null:Re.createPortal(e.jsxs("div",{role:"presentation",className:x.tkx("fixed inset-0 z-[9000] flex",b?"items-stretch":"items-center justify-center",b?"":"p-4"),children:[e.jsx("div",{"aria-hidden":"true",onClick:s?n:void 0,className:x.tkx("absolute inset-0",!h&&"animate-fade-in"),style:{backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)"}}),e.jsxs("div",{ref:c,role:"dialog","aria-modal":"true","aria-labelledby":u,className:x.tkx("relative z-10 flex flex-col overflow-hidden",!h&&"animate-slide-up",b?"":"rounded-xl"),style:{backgroundColor:f.surface,border:`1px solid ${f.border}`,width:ss[o],maxWidth:"100%",maxHeight:b?"100vh":"90vh",boxShadow:`0 20px 60px ${f.bg}80`},children:[e.jsxs("div",{className:x.tkx("flex items-center justify-between px-6 py-5 shrink-0"),style:{borderBottom:`1px solid ${f.border}`},children:[e.jsx("h2",{id:u,className:x.tkx("m-0 text-lg font-semibold font-sans"),style:{color:f.text},children:m}),e.jsx("button",{onClick:n,"aria-label":"Close dialog",className:x.tkx("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:f.textMuted},children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("div",{className:x.tkx("flex-1 overflow-y-auto px-6 py-6 font-sans"),style:{color:f.text},children:l}),d&&e.jsx("div",{className:x.tkx("flex justify-end gap-2 px-6 py-4 shrink-0"),style:{borderTop:`1px solid ${f.border}`},children:d})]})]}),document.body)}const qn=i.createContext(null);function Qn(){const t=i.useContext(qn);if(!t)throw new Error("TkxTab must be used inside TkxTabs");return t}function as({defaultIndex:t=0,activeIndex:n,onChange:r,children:o,tabCount:s=0,style:a,className:l}){const[d,f]=i.useState(t),u=i.useId(),c=n!==void 0?n:d,h=p=>{n===void 0&&f(p),r==null||r(p)};return e.jsx(qn.Provider,{value:{activeIndex:c,setActiveIndex:h,baseId:u,tabCount:s},children:e.jsx("div",{className:l,style:a,children:o})})}function ls({children:t,className:n,style:r,...o}){const s=O.useTheme();return e.jsx("div",{role:"tablist",className:x.cx(x.tkx("flex gap-1"),n),style:{borderBottom:`2px solid ${s.border}`,...r},...o,children:t})}function cs({index:t,children:n,disabled:r=!1,className:o,style:s}){const a=O.useTheme(),{activeIndex:l,setActiveIndex:d,baseId:f,tabCount:u}=Qn(),c=i.useRef(null),h=l===t;return e.jsx("button",{ref:c,role:"tab",id:`${f}-tab-${t}`,"aria-controls":`${f}-panel-${t}`,"aria-selected":h,tabIndex:h?0:-1,disabled:r,className:x.cx(x.tkx("border-none bg-transparent font-sans text-sm rounded-t cursor-pointer select-none","py-2.5 px-4 transition-colors duration-150 focus-visible:focus-ring",r?"opacity-50 cursor-not-allowed":""),o),style:{color:h?a.primary:a.textMuted,fontWeight:h?600:400,borderBottom:h?`2px solid ${a.primary}`:"2px solid transparent",marginBottom:"-2px",...s},onClick:()=>!r&&d(t),onKeyDown:p=>O.handleTabsKeyboard(p,t,u,m=>{var b;d(m),(b=document.getElementById(`${f}-tab-${m}`))==null||b.focus()}),children:n})}function ds({children:t,className:n,...r}){return e.jsx("div",{className:n,...r,children:t})}function us({index:t,children:n,style:r,className:o}){const{activeIndex:s,baseId:a}=Qn();return s!==t?null:e.jsx("div",{role:"tabpanel",id:`${a}-panel-${t}`,"aria-labelledby":`${a}-tab-${t}`,tabIndex:0,className:x.cx(x.tkx("pt-4"),o),style:r,children:n})}const fs={top:{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:6},bottom:{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:6},left:{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:6},right:{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:6}};function xs({content:t,children:n,placement:r="top",delay:o=300}){const s=O.useTheme(),[a,l]=i.useState(!1),d=i.useRef(null),f=i.useId(),u=i.useRef(null),c=J.useReducedMotion(),h=A.sanitizeString(t),p=O.getAccessibleForeground(s.surfaceAlt,[s.text,"#ffffff","#000000"]);function m(){u.current=setTimeout(()=>l(!0),o)}function b(){u.current&&clearTimeout(u.current),l(!1)}J.useEscapeKey(b,a),J.useClickOutside(d,b);const k=i.cloneElement(n,{"aria-describedby":a?f:void 0,onMouseEnter:y=>{var g,S;(S=(g=n.props).onMouseEnter)==null||S.call(g,y),m()},onMouseLeave:y=>{var g,S;(S=(g=n.props).onMouseLeave)==null||S.call(g,y),b()},onFocus:y=>{var g,S;(S=(g=n.props).onFocus)==null||S.call(g,y),m()},onBlur:y=>{var g,S;(S=(g=n.props).onBlur)==null||S.call(g,y),b()}});return e.jsxs("span",{ref:d,className:x.tkx("relative inline-flex"),children:[k,a&&e.jsx("span",{id:f,role:"tooltip",className:x.tkx("absolute z-[9000] text-xs font-sans py-1.5 px-2.5 rounded-md whitespace-nowrap pointer-events-none",!c&&"animate-fade-in"),style:{backgroundColor:s.surfaceAlt,color:p,border:`1px solid ${s.border}`,boxShadow:`0 4px 12px ${s.bg}40`,maxWidth:280,...fs[r]},children:h})]})}function qt({variant:t,width:n,height:r,animation:o,bgColor:s,accentColor:a}){const l=n!==void 0?typeof n=="number"?`${n}px`:n:"100%",f=r!==void 0?typeof r=="number"?`${r}px`:r:{text:"1em",circular:l,rectangular:"80px"}[t],u=x.tkx(t==="circular"?"rounded-full":t==="text"?"rounded":"rounded-lg"),c=o==="pulse"?x.tkx("animate-pulse"):o==="wave"?x.tkx("animate-shimmer"):"",h=o==="wave"?{background:`linear-gradient(90deg,${s} 25%,${a} 50%,${s} 75%)`,backgroundSize:"200% 100%"}:{backgroundColor:s};return e.jsx("div",{className:x.cx(u,c),style:{width:l,height:f,...h}})}const xt=i.forwardRef(({variant:t="rectangular",width:n,height:r,lines:o,animation:s="pulse",className:a,style:l,...d},f)=>{const u=O.useTheme(),h=J.useReducedMotion()?!1:s;return t==="text"&&o&&o>1?e.jsx("div",{ref:f,role:"progressbar","aria-busy":"true","aria-label":"Loading...",className:x.cx(x.tkx("flex flex-col gap-2"),a),style:l,...d,children:Array.from({length:o},(p,m)=>e.jsx(qt,{variant:"text",width:m===o-1?"75%":n,height:r,animation:h,bgColor:u.surfaceAlt,accentColor:u.border},m))}):e.jsx("div",{ref:f,role:"progressbar","aria-busy":"true","aria-label":"Loading...",className:a,style:l,...d,children:e.jsx(qt,{variant:t,width:n,height:r,animation:h,bgColor:u.surfaceAlt,accentColor:u.border})})});xt.displayName="TkxSkeleton";const ps={xs:24,sm:32,md:40,lg:56,xl:72},hs={online:"#06d6a0",offline:"#8888aa",away:"#ffbe0b",busy:"#f72585"},Jn=i.forwardRef(({src:t,alt:n,initials:r,size:o="md",shape:s="circle",status:a,className:l,style:d,...f},u)=>{const c=O.useTheme(),[h,p]=i.useState(!1),m=ps[o],b=s==="circle",k=c.surfaceAlt,y=O.getAccessibleForeground(k,[c.text,c.textMuted]),g=t&&!h,S=!g&&r,j=Math.max(8,m*.22),v=x.tkx("relative inline-flex shrink-0",b?"rounded-full":"rounded-lg"),$=x.tkx("block object-cover",b?"rounded-full":"rounded-lg"),w=x.tkx("flex items-center justify-center font-semibold font-sans select-none",b?"rounded-full":"rounded-lg");return e.jsxs("div",{ref:u,className:x.cx(v,l),style:{width:m,height:m,...d},...f,children:[g?e.jsx("img",{src:A.sanitizeString(t),alt:A.sanitizeString(n),onError:()=>p(!0),className:$,style:{width:m,height:m}}):e.jsx("div",{role:"img","aria-label":A.sanitizeString(n),className:w,style:{width:m,height:m,backgroundColor:k,color:y,fontSize:m*.38},children:S?A.sanitizeString(r).slice(0,2).toUpperCase():e.jsxs("svg",{width:m*.5,height:m*.5,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}),a&&e.jsx("span",{"aria-label":`Status: ${a}`,className:x.tkx("absolute bottom-0 right-0 rounded-full"),style:{width:j,height:j,backgroundColor:hs[a],border:`2px solid ${c.bg}`}})]})});Jn.displayName="TkxAvatar";function ms({dir:t}){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:x.tkx("shrink-0"),children:t==="asc"?e.jsx("path",{d:"M7 14l5-5 5 5H7z"}):t==="desc"?e.jsx("path",{d:"M7 10l5 5 5-5H7z"}):e.jsx("path",{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.4"})})}function gs({columns:t,data:n,caption:r,sortable:o,stickyHeader:s,isLoading:a,emptyState:l,style:d,className:f,striped:u,maxHeight:c,rowHeight:h=44,virtualScroll:p,onLoadMore:m,hasMore:b,loadingMore:k=!1,onRowClick:y,selectedRows:g,bordered:S,compact:j}){const v=O.useTheme(),[$,w]=i.useState(null),[N,I]=i.useState("asc"),M=i.useMemo(()=>!$||!o?n:[...n].sort((te,ce)=>{const Y=te[$],se=ce[$];let ae=0;return typeof Y=="string"&&typeof se=="string"?ae=Y.localeCompare(se):typeof Y=="number"&&typeof se=="number"&&(ae=Y-se),N==="asc"?ae:-ae}),[n,$,N,o]),T=i.useCallback(te=>{$===te?I(ce=>ce==="asc"?"desc":"asc"):(w(te),I("asc"))},[$]);function E(te){return $!==te?"none":N}const C=5,H=p!==void 0?p:c!==void 0&&M.length>=50,z=i.useRef(null),[L,B]=i.useState(0),[V,D]=i.useState(400),_=i.useCallback(()=>{z.current&&B(z.current.scrollTop)},[]);i.useEffect(()=>{if(!H||!z.current)return;const te=z.current;D(te.clientHeight);const ce=new ResizeObserver(()=>D(te.clientHeight));return ce.observe(te),()=>ce.disconnect()},[H]);const R=H?Math.max(0,Math.floor(L/h)-C):0,F=H?Math.min(M.length,Math.ceil((L+V)/h)+C):M.length,W=H?M.slice(R,F):M,K=i.useRef(null),ne=i.useRef(!1);i.useEffect(()=>{ne.current=!1},[n.length]),i.useEffect(()=>{if(!m)return;const te=K.current;if(!te)return;const ce=new IntersectionObserver(Y=>{Y[0].isIntersecting&&!ne.current&&b!==!1&&(ne.current=!0,m())},{root:z.current,rootMargin:"0px 0px 200px 0px",threshold:0});return ce.observe(te),()=>ce.disconnect()},[m,b]);const Z=j?"4px":"12px",ie=j?"8px":"16px",fe=S?`1px solid ${v.border}`:"none",pe=i.useMemo(()=>new Set(g??[]),[g]);return e.jsx("div",{className:x.tkx("w-full rounded-lg",f??""),style:{border:`1px solid ${v.border}`,overflow:"hidden",...d},children:e.jsxs("div",{ref:z,onScroll:H?_:void 0,style:{overflowX:"auto",overflowY:c?"auto":"visible",maxHeight:c??"none"},children:[e.jsxs("table",{className:x.tkx("w-full font-sans text-sm"),style:{borderCollapse:"collapse",color:v.text},children:[r&&e.jsx("caption",{className:x.tkx("text-sm text-left p-2"),style:{color:v.textMuted},children:A.sanitizeString(r)}),e.jsx("thead",{style:s?{position:"sticky",top:0,backgroundColor:v.surfaceAlt,zIndex:1}:{backgroundColor:v.surfaceAlt},children:e.jsx("tr",{children:t.map(te=>{const ce=o&&te.sortable!==!1,Y=E(te.key);return e.jsx("th",{scope:"col","aria-sort":ce?Y==="none"?"none":Y==="asc"?"ascending":"descending":void 0,className:x.tkx("text-left font-semibold whitespace-nowrap",ce?"cursor-pointer select-none":""),style:{padding:`${Z} ${ie}`,color:v.textMuted,borderBottom:`2px solid ${v.border}`,borderRight:fe,width:te.width},onClick:()=>ce&&T(te.key),onKeyDown:se=>{ce&&(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),T(te.key))},tabIndex:ce?0:void 0,children:e.jsxs("span",{className:x.tkx("inline-flex items-center gap-1.5"),children:[A.sanitizeString(te.header),ce&&e.jsx(ms,{dir:Y})]})},String(te.key))})})}),e.jsx("tbody",{children:a?Array.from({length:5},(te,ce)=>e.jsx("tr",{children:t.map(Y=>e.jsx("td",{style:{padding:`${Z} ${ie}`},children:e.jsx(xt,{variant:"text",height:"16px"})},String(Y.key)))},ce)):M.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:x.tkx("text-center"),style:{padding:"32px 16px",color:v.textMuted},children:l??"No data available"})}):e.jsxs(e.Fragment,{children:[H&&R>0&&e.jsx("tr",{"aria-hidden":"true",style:{height:R*h},children:e.jsx("td",{colSpan:t.length,style:{padding:0,border:"none"}})}),W.map((te,ce)=>{const Y=R+ce,se=pe.has(Y);return e.jsx("tr",{"aria-rowindex":Y+1,"aria-selected":se||void 0,onClick:y?()=>y(te,Y):void 0,onKeyDown:y?ae=>{(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),y(te,Y))}:void 0,tabIndex:y?0:void 0,className:x.tkx(y?"cursor-pointer":""),style:{backgroundColor:se?`${v.primary}22`:u&&Y%2===1?v.surfaceAlt:"transparent",borderBottom:`1px solid ${v.border}`,...H?{height:h,boxSizing:"border-box"}:{}},children:t.map(ae=>{const ge=te[ae.key],he=ae.render?ae.render(ge,te):typeof ge=="string"?A.sanitizeString(ge):String(ge??"");return e.jsx("td",{style:{padding:`${Z} ${ie}`,color:v.text,borderRight:fe},children:he},String(ae.key))})},Y)}),H&&F<M.length&&e.jsx("tr",{"aria-hidden":"true",style:{height:(M.length-F)*h},children:e.jsx("td",{colSpan:t.length,style:{padding:0,border:"none"}})})]})})]}),(b||k)&&e.jsx("div",{ref:K,style:{height:1,width:"100%"},children:k&&e.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:e.jsx("tbody",{children:Array.from({length:3},(te,ce)=>e.jsx("tr",{children:t.map(Y=>e.jsx("td",{style:{padding:"10px 16px"},children:e.jsx(xt,{variant:"text",height:"16px"})},String(Y.key)))},ce))})})}),!b&&m&&e.jsx("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:v.textMuted},children:"✓ All rows loaded"})]})})}const er=i.forwardRef(({orientation:t="horizontal",label:n,variant:r="solid",className:o,style:s,...a},l)=>{const d=O.useTheme(),f=n?A.sanitizeString(n):void 0,u=t==="vertical",c=u?"borderLeft":"borderTop",h=`1px ${r} ${d.border}`;return f?e.jsxs("div",{role:"separator","aria-orientation":t,className:x.cx(x.tkx("flex items-center gap-3 text-xs"),o),style:{color:d.textMuted,...s},...a,children:[e.jsx("hr",{className:x.tkx("flex-1 m-0 border-none"),style:{[c]:h}}),e.jsx("span",{children:f}),e.jsx("hr",{className:x.tkx("flex-1 m-0 border-none"),style:{[c]:h}})]}):e.jsx("hr",{ref:l,role:"separator","aria-orientation":t,className:x.cx(x.tkx(u?"inline-block self-stretch border-none w-0 h-full":"w-full border-none m-0"),o),style:{[c]:h,...s},...a})});er.displayName="TkxDivider";const bs={sm:{py:"6px",px:"10px",fontSize:"13px",iconSize:14,tagPy:"1px",tagPx:"6px"},md:{py:"9px",px:"12px",fontSize:"14px",iconSize:16,tagPy:"2px",tagPx:"8px"},lg:{py:"12px",px:"14px",fontSize:"15px",iconSize:18,tagPy:"3px",tagPx:"10px"}};function Qt(t){return t===void 0?[]:Array.isArray(t)?t:[t]}function ys(t,n){const r=t.getBoundingClientRect(),o=window.innerHeight,s=6,a=o-r.bottom-s,l=r.top-s,d=a>=Math.min(n,200)||a>=l?"below":"above";return{top:d==="below"?r.bottom+window.scrollY+s:r.top+window.scrollY-s-Math.min(n,280),left:r.left+window.scrollX,width:r.width,placement:d}}function ks({size:t,color:n}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",style:{animation:"tkx-spin 0.7s linear infinite"},children:[e.jsx("style",{children:"@keyframes tkx-spin{to{transform:rotate(360deg)}}"}),e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10"})]})}function tr({options:t,value:n,defaultValue:r,placeholder:o="Select an option…",size:s="md",isDisabled:a=!1,isInvalid:l=!1,label:d,hint:f,errorMessage:u,multiple:c=!1,searchable:h=!1,clearable:p=!1,isLoading:m=!1,onChange:b,renderOption:k,maxMenuHeight:y=280,virtualScroll:g,optionHeight:S=36,id:j,className:v,style:$}){const w=O.useTheme(),N=i.useId(),I=j??N,M=`${I}-listbox`,T=`${I}-hint`,E=`${I}-error`,C=n!==void 0,[H,z]=i.useState(Qt(r)),L=C?Qt(n):H,[B,V]=i.useState(!1),[D,_]=i.useState(""),[R,F]=i.useState(-1),[W,K]=i.useState(null),[ne,Z]=i.useState(""),ie=i.useRef(null),fe=i.useRef(null),pe=i.useRef(null),te=i.useRef(null),ce=i.useRef(null),Y=bs[s],se=l||!!u,ae=i.useRef(null),[ge,he]=i.useState(0),[ye,de]=i.useState(0),xe=i.useCallback(()=>{ae.current&&he(ae.current.scrollTop)},[]);i.useEffect(()=>{if(!B){he(0);return}const P=ae.current;if(!P)return;de(P.clientHeight);const Q=new ResizeObserver(()=>{de(P.clientHeight)});return Q.observe(P),()=>Q.disconnect()},[B]);const oe=h&&D?t.filter(P=>P.label.toLowerCase().includes(D.toLowerCase())):t,G=oe.filter(P=>!P.disabled),ue=oe.some(P=>!!P.group),ve=(g!==void 0?g:oe.length>=100)&&!ue,Me=8,Ie=oe.length*S,We=ve?Math.max(0,Math.floor(ge/S)-Me):0,Te=ve?Math.min(oe.length,Math.ceil((ge+ye)/S)+Me):oe.length,ze=ve?oe.slice(We,Te):oe,Ke=We*S,Ze=oe.reduce((P,Q)=>{const re=Q.group??"";return P[re]||(P[re]=[]),P[re].push(Q),P},{}),Fe=i.useCallback(P=>{var re;let Q;c?Q=L.includes(P)?L.filter(le=>le!==P):[...L,P]:Q=[P],C||z(Q),b==null||b(c?Q:Q[0]??""),c||(V(!1),_(""),F(-1),(re=fe.current)==null||re.focus())},[C,c,b,L]),Oe=i.useCallback((P,Q)=>{Q.stopPropagation();const re=L.filter(le=>le!==P);C||z(re),b==null||b(c?re:re[0]??"")},[C,c,b,L]),Ge=i.useCallback(P=>{P.stopPropagation(),C||z([]),b==null||b(c?[]:"")},[C,c,b]),Ee=i.useCallback(()=>{!fe.current||!B||K(ys(fe.current,y))},[B,y]);i.useEffect(()=>{if(B)return Ee(),window.addEventListener("scroll",Ee,!0),window.addEventListener("resize",Ee),()=>{window.removeEventListener("scroll",Ee,!0),window.removeEventListener("resize",Ee)}},[B,Ee]),i.useEffect(()=>{if(!B)return;const P=Q=>{var le,Ce;const re=Q.target;(le=fe.current)!=null&&le.contains(re)||(Ce=te.current)!=null&&Ce.contains(re)||(V(!1),_(""))};return document.addEventListener("pointerdown",P),()=>document.removeEventListener("pointerdown",P)},[B]),i.useEffect(()=>{B&&h&&setTimeout(()=>{var P;return(P=pe.current)==null?void 0:P.focus()},0)},[B,h]),i.useEffect(()=>{var P;if(!(!B||R<0))if(ve&&ae.current){const Q=R*S,re=Q+S,le=ae.current;Q<le.scrollTop?le.scrollTop=Q:re>le.scrollTop+le.clientHeight&&(le.scrollTop=re-le.clientHeight)}else{const Q=(P=ce.current)==null?void 0:P.querySelector(`[data-idx="${R}"]`);Q==null||Q.scrollIntoView({block:"nearest"})}},[R,B,ve,S]);const qe=P=>{switch(P.key){case"Enter":case" ":P.preventDefault(),B?R>=0&&G[R]&&Fe(G[R].value):Le();break;case"Escape":P.preventDefault(),V(!1),_("");break;case"ArrowDown":P.preventDefault(),B?F(Q=>Math.min(Q+1,G.length-1)):Le();break;case"ArrowUp":P.preventDefault(),B?F(Q=>Math.max(Q-1,0)):Le();break;case"Home":P.preventDefault(),B&&F(0);break;case"End":P.preventDefault(),B&&F(G.length-1);break;default:P.key.length===1&&!P.ctrlKey&&!P.metaKey&&(B||Le(),Qe(P.key))}},rt=P=>{var Q;switch(P.key){case"Escape":P.preventDefault(),V(!1),_(""),(Q=fe.current)==null||Q.focus();break;case"ArrowDown":P.preventDefault(),F(re=>Math.min(re+1,G.length-1));break;case"ArrowUp":P.preventDefault(),F(re=>Math.max(re-1,0));break;case"Home":P.preventDefault(),F(0);break;case"End":P.preventDefault(),F(G.length-1);break;case"Enter":P.preventDefault(),R>=0&&G[R]&&Fe(G[R].value);break}};function Qe(P){ie.current&&clearTimeout(ie.current);const Q=ne+P.toLowerCase();Z(Q);const re=G.findIndex(le=>le.label.toLowerCase().startsWith(Q));re>=0&&F(re),ie.current=setTimeout(()=>Z(""),800)}function Le(){if(a||m)return;V(!0);const P=G.findIndex(Q=>L.includes(Q.value));F(P>=0?P:0)}const Pe=se?w.danger:B?w.primary:w.border,Ae=R>=0&&G[R]?`${I}-opt-${G[R].value}`:void 0,Je=[f&&T,se&&E].filter(Boolean).join(" ")||void 0,Ue=L.map(P=>t.find(Q=>Q.value===P)).filter(Boolean),at=B&&W?Re.createPortal(e.jsxs("div",{ref:te,role:"listbox",id:M,"aria-label":d?A.sanitizeString(d):"Options","aria-multiselectable":c,style:{position:"absolute",top:W.top,left:W.left,width:W.width,zIndex:9999,backgroundColor:w.surface,border:`1.5px solid ${w.border}`,borderRadius:10,boxShadow:"0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)",overflow:"hidden",minWidth:W.width,maxHeight:y,display:"flex",flexDirection:"column"},children:[h&&e.jsxs("div",{style:{padding:"8px 10px",borderBottom:`1px solid ${w.border}`,flexShrink:0,display:"flex",alignItems:"center",gap:6},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:w.textMuted,strokeWidth:"2","aria-hidden":"true",style:{flexShrink:0},children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]}),e.jsx("input",{ref:pe,type:"text",value:D,onChange:P=>{_(P.target.value),F(0)},onKeyDown:rt,placeholder:"Search…","aria-label":"Search options",style:{border:"none",outline:"none",background:"transparent",color:w.text,fontSize:Y.fontSize,fontFamily:"inherit",width:"100%"}})]}),e.jsx("div",{ref:P=>{ce.current=P,ae.current=P},onScroll:ve?xe:void 0,style:{overflowY:"auto",flexGrow:1,maxHeight:y-(h?48:0)},children:ve?e.jsxs("div",{style:{height:Ie,position:"relative"},children:[e.jsx("div",{style:{position:"absolute",top:Ke,left:0,right:0},children:ze.map(P=>{const Q=G.indexOf(P),re=Q===R,le=L.includes(P.value),Ce=k?k(P,le):e.jsxs("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[P.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:P.icon}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(P.label)})]}),P.description&&e.jsx("span",{style:{fontSize:"12px",color:w.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(P.description)})]});return e.jsxs("div",{id:`${I}-opt-${P.value}`,"data-idx":Q>=0?Q:void 0,role:"option","aria-selected":le,"aria-disabled":P.disabled||void 0,onClick:()=>!P.disabled&&Fe(P.value),onMouseEnter:()=>!P.disabled&&Q>=0&&F(Q),style:{height:S,boxSizing:"border-box",padding:`0 ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:P.disabled?w.textMuted:w.text,backgroundColor:re?`${w.primary}22`:le?`${w.primary}12`:"transparent",cursor:P.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:P.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[Ce,le&&!k&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:w.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})]},P.value)})}),oe.length===0&&e.jsx("div",{style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:w.textMuted,textAlign:"center",position:"absolute",top:0,left:0,right:0},children:m?"Loading…":"No options found"})]}):e.jsxs(e.Fragment,{children:[Object.entries(Ze).map(([P,Q])=>e.jsxs("div",{children:[P&&e.jsx("div",{"aria-hidden":"true",style:{padding:"8px 12px 4px",fontSize:"11px",fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:w.textMuted,fontFamily:"inherit",position:"sticky",top:0,backgroundColor:w.surface,zIndex:1,borderBottom:`1px solid ${w.border}`},children:A.sanitizeString(P)}),Q.map(re=>{const le=G.indexOf(re),Ce=le===R,$e=L.includes(re.value),we=k?k(re,$e):e.jsxs("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[re.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:re.icon}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(re.label)})]}),re.description&&e.jsx("span",{style:{fontSize:"12px",color:w.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(re.description)})]});return e.jsxs("div",{id:`${I}-opt-${re.value}`,"data-idx":le>=0?le:void 0,role:"option","aria-selected":$e,"aria-disabled":re.disabled||void 0,onClick:()=>!re.disabled&&Fe(re.value),onMouseEnter:()=>!re.disabled&&le>=0&&F(le),style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:re.disabled?w.textMuted:w.text,backgroundColor:Ce?`${w.primary}22`:$e?`${w.primary}12`:"transparent",cursor:re.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:re.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[we,$e&&!k&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:w.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})]},re.value)})]},P)),oe.length===0&&e.jsx("div",{style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:w.textMuted,textAlign:"center"},children:m?"Loading…":"No options found"})]})})]}),document.body):null,q=p&&L.length>0&&!a&&!m;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1 w-full"),v),style:$,children:[d&&e.jsx("label",{htmlFor:I,style:{fontSize:"14px",fontWeight:500,fontFamily:"inherit",color:w.text,userSelect:"none"},children:A.sanitizeString(d)}),e.jsx("div",{style:{position:"relative",width:"100%",opacity:a?.55:1},children:e.jsxs("button",{ref:fe,id:I,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":B,"aria-controls":M,"aria-activedescendant":Ae,"aria-invalid":se||void 0,"aria-describedby":Je,"aria-multiselectable":c,disabled:a,onClick:()=>B?V(!1):Le(),onKeyDown:qe,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:c&&L.length>0?`4px ${Y.px}`:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",backgroundColor:w.surface,color:L.length>0?w.text:w.textMuted,border:`1.5px solid ${Pe}`,borderRadius:8,boxSizing:"border-box",transition:"border-color 150ms",textAlign:"left",cursor:a?"not-allowed":"pointer",outline:"none",minHeight:s==="sm"?34:s==="lg"?50:42,flexWrap:"wrap",touchAction:"manipulation"},children:[e.jsx("span",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:4,flex:1,minWidth:0},children:c&&Ue.length>0?Ue.map(P=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:`${Y.tagPy} ${Y.tagPx}`,fontSize:`calc(${Y.fontSize} - 1px)`,fontFamily:"inherit",backgroundColor:`${w.primary}22`,color:w.primary,borderRadius:6,border:`1px solid ${w.primary}44`,lineHeight:1.4,maxWidth:150,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:110},children:A.sanitizeString(P.label)}),e.jsx("span",{role:"button","aria-label":`Remove ${A.sanitizeString(P.label)}`,tabIndex:-1,onClick:Q=>Oe(P.value,Q),style:{cursor:"pointer",flexShrink:0,display:"flex",alignItems:"center",opacity:.8},children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]},P.value)):!c&&L.length>0?(()=>{const P=t.find(Q=>Q.value===L[0]);return e.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:6},children:[(P==null?void 0:P.icon)&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:P.icon}),P?A.sanitizeString(P.label):""]})})():e.jsx("span",{style:{opacity:.6},children:A.sanitizeString(o)})}),e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0,color:w.textMuted},children:[m&&e.jsx(ks,{size:Y.iconSize,color:w.primary}),q&&!m&&e.jsx("span",{role:"button","aria-label":"Clear selection",tabIndex:-1,onClick:Ge,style:{cursor:"pointer",display:"flex",alignItems:"center",lineHeight:1,opacity:.7,transition:"opacity 120ms"},onMouseEnter:P=>P.currentTarget.style.opacity="1",onMouseLeave:P=>P.currentTarget.style.opacity="0.7",children:e.jsx("svg",{width:Y.iconSize,height:Y.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}),e.jsx("svg",{width:Y.iconSize,height:Y.iconSize,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",style:{transform:B?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms",flexShrink:0},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]})]})}),f&&!se&&e.jsx("span",{id:T,style:{fontSize:"12px",color:w.textMuted,fontFamily:"inherit"},children:A.sanitizeString(f)}),se&&u&&e.jsxs("span",{id:E,role:"alert",style:{fontSize:"12px",color:w.danger,display:"flex",alignItems:"center",gap:4,fontFamily:"inherit"},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),A.sanitizeString(u)]}),at]})}tr.displayName="TkxSelect";const vs={sm:{box:16,fontSize:"13px",iconStroke:2.5},md:{box:20,fontSize:"14px",iconStroke:2.5},lg:{box:24,fontSize:"15px",iconStroke:2}},nr=i.forwardRef(({label:t,hint:n,isInvalid:r,errorMessage:o,isIndeterminate:s=!1,size:a="md",colorScheme:l="primary",checked:d,defaultChecked:f,onChange:u,disabled:c,className:h,style:p,id:m,...b},k)=>{const y=O.useTheme(),g=J.useReducedMotion(),S=i.useId(),j=m??S,v=`${j}-hint`,$=`${j}-error`,w=i.useRef(null),[N,I]=i.useState(!1),M=vs[a],T=r||!!o,C={primary:y.primary,success:y.success,danger:y.danger,warning:y.warning}[l]??y.primary,H=d!==void 0?d:void 0;i.useEffect(()=>{const F=(k==null?void 0:k.current)??w.current;F&&(F.indeterminate=s)},[s,k]);const z=s||(H??!1),L=z?C:y.surface,B=T?y.danger:z?C:y.border,V=O.getAccessibleForeground(C),D=N?{outline:`2px solid ${C}`,outlineOffset:"2px"}:{},_=[n&&v,T&&$].filter(Boolean).join(" ")||void 0,R=!g&&z?{animation:"tkx-check-scale-in 120ms ease forwards"}:{};return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1"),h),style:{opacity:c?.5:1,...p},children:[e.jsx("style",{children:`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./themes-CMq2vWXj.cjs`),n=require(`./tkx-0oAwZqgL.cjs`),r=require(`./hooks-mivgRljH.cjs`),i=require(`./TkxForm-1KDzoniV.cjs`),a=require(`./i18n.cjs`);let o=require(`react`);o=e.t(o,1);let s=require(`react/jsx-runtime`),c=require(`react-dom`);var l={sm:`text-xs font-semibold`,md:`text-sm font-semibold`,lg:`text-base font-semibold`,xl:`text-lg font-semibold`},u={sm:`py-1.5 px-3`,md:`py-2 px-4`,lg:`py-2.5 px-5`,xl:`py-3 px-6`},d={sm:`min-h-[32px]`,md:`min-h-[40px]`,lg:`min-h-[48px]`,xl:`min-h-[56px]`},f={sm:14,md:16,lg:18,xl:20};function p({size:e}){let t=f[e];return(0,s.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,className:n.a(`animate-spin shrink-0`),children:[(0,s.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`3`,strokeOpacity:`0.25`}),(0,s.jsx)(`path`,{d:`M12 2a10 10 0 0 1 10 10`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`})]})}var m=(0,o.forwardRef)(({variant:e=`solid`,size:i=`md`,colorScheme:a=`primary`,isLoading:o=!1,loadingText:c,leftIcon:f,rightIcon:m,isFullWidth:h=!1,glow:g=!1,disabled:_,children:v,className:y,style:b,...x},S)=>{let C=t.f(),w=r.o(),T=_||o,E={primary:C.primary,secondary:C.secondary,danger:C.danger,warning:C.warning,success:C.success}[a],D=t.v(E,[`#ffffff`,`#000000`,C.bg]),O=typeof v==`string`?n.m(v):v,k=c?n.m(c):void 0,A=e===`solid`?{backgroundColor:E,color:D,border:`none`,boxShadow:g&&!w?`0 0 20px ${E}55`:void 0}:e===`outline`?{backgroundColor:`transparent`,color:E,border:`2px solid ${E}`}:e===`ghost`?{backgroundColor:`transparent`,color:E,border:`none`}:{backgroundColor:`transparent`,color:E,border:`none`,textDecoration:`underline`};return(0,s.jsx)(`button`,{ref:S,"aria-busy":o,"aria-disabled":T,disabled:T,className:n.t(n.a(`inline-flex items-center justify-center gap-2`,`rounded-lg font-sans font-semibold`,`select-none relative overflow-hidden`,l[i],u[i],d[i],e!==`link`&&d[i],h&&`w-full`,T?`cursor-not-allowed opacity-60`:`cursor-pointer`,!w&&`transition-all duration-200`,`focus-visible:focus-ring`),y),style:{...A,...b},...x,children:o?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p,{size:i}),k??O]}):(0,s.jsxs)(s.Fragment,{children:[f&&(0,s.jsx)(`span`,{"aria-hidden":`true`,children:f}),O,m&&(0,s.jsx)(`span`,{"aria-hidden":`true`,children:m})]})})});m.displayName=`TkxButton`;var h={none:``,sm:`p-3`,md:`p-5`,lg:`p-7`},g=(0,o.forwardRef)(({variant:e=`default`,isHoverable:i,isClickable:a,padding:o=`md`,as:c,children:l,className:u,style:d,...f},p)=>{let m=t.f(),g=r.o(),_=c??(a?`button`:`div`),v={default:{backgroundColor:m.surface,border:`1px solid ${m.border}`},glass:{backgroundColor:`${m.surface}cc`,backdropFilter:`blur(12px)`,border:`1px solid ${m.border}55`,boxShadow:`0 4px 24px ${m.bg}40`},quantum:{backgroundColor:m.surfaceAlt,border:`1px solid ${m.primary}33`,boxShadow:`0 0 24px ${m.primary}18`},elevated:{backgroundColor:m.surface,boxShadow:`0 4px 20px ${m.bg}60`},outlined:{backgroundColor:`transparent`,border:`2px solid ${m.border}`}}[e];return(0,s.jsx)(_,{ref:p,className:n.t(`tkx-card`,n.a(`rounded-xl w-full text-left block font-sans focus-visible:focus-ring`,h[o],(i||a)&&!g&&`transition-transform duration-150 hover:scale-[1.01]`,a?`cursor-pointer`:`cursor-default`),u),style:{color:m.text,...v,...d},...f,children:l})});g.displayName=`TkxCard`;function _({title:e,subtitle:r,action:i,children:a,className:o,...c}){let l=t.f();return(0,s.jsxs)(`div`,{className:n.t(n.a(`flex justify-between items-start mb-4`),o),...c,children:[(0,s.jsxs)(`div`,{className:n.a(`flex-1 min-w-0`),children:[e&&(0,s.jsx)(`h3`,{className:n.a(`text-base font-semibold m-0`),style:{color:l.text},children:e}),r&&(0,s.jsx)(`p`,{className:n.a(`text-sm mt-1 mb-0`),style:{color:l.textMuted},children:r}),a]}),i&&(0,s.jsx)(`div`,{className:n.a(`ml-3 shrink-0`),children:i})]})}function v({children:e,className:t,...r}){return(0,s.jsx)(`div`,{className:n.t(n.a(``),t),...r,children:e})}function y({children:e,className:r,style:i,...a}){let o=t.f();return(0,s.jsx)(`div`,{className:n.t(n.a(`flex items-center justify-end gap-2 mt-4 pt-4`),r),style:{borderTop:`1px solid ${o.border}`,...i},...a,children:e})}var b=(0,o.forwardRef)(({label:e,id:r,error:i,hint:a,leftAddon:c,rightAddon:l,isInvalid:u,isRequired:d,disabled:f,className:p,style:m,...h},g)=>{let _=t.f(),v=(0,o.useId)(),y=r??v,b=`${y}-hint`,x=`${y}-error`,S=u||!!i,C=[a&&b,S&&x].filter(Boolean).join(` `)||void 0,w=n.m(e),T=i?n.m(i):void 0,E=a?n.m(a):void 0,D=S?_.danger:_.border;return(0,s.jsxs)(`div`,{className:n.t(n.a(`flex flex-col gap-1 w-full`),p),style:m,children:[(0,s.jsxs)(`label`,{htmlFor:y,className:n.a(`text-sm font-medium font-sans`),style:{color:_.text},children:[w,d&&(0,s.jsx)(`span`,{"aria-hidden":`true`,className:n.a(`ml-1`),style:{color:_.danger},children:`*`})]}),(0,s.jsxs)(`div`,{className:n.a(`flex items-center rounded-lg overflow-hidden`,`transition-colors duration-150`,f?`opacity-60`:``),style:{border:`1.5px solid ${D}`,backgroundColor:_.surface},children:[c&&(0,s.jsx)(`div`,{className:n.a(`px-2.5 self-stretch flex items-center text-sm shrink-0`),style:{backgroundColor:_.surfaceAlt,color:_.textMuted,borderRight:`1px solid ${_.border}`},children:c}),(0,s.jsx)(`input`,{ref:g,id:y,"aria-invalid":S,"aria-required":d,"aria-describedby":C,disabled:f,className:n.t(n.a(`flex-1 border-none bg-transparent text-sm font-sans py-2.5 px-3 outline-none min-w-0 focus-visible:focus-ring`)),style:{color:_.text},...h}),l&&(0,s.jsx)(`div`,{className:n.a(`px-2.5 self-stretch flex items-center text-sm shrink-0`),style:{backgroundColor:_.surfaceAlt,color:_.textMuted,borderLeft:`1px solid ${_.border}`},children:l})]}),E&&!T&&(0,s.jsx)(`span`,{id:b,className:n.a(`text-xs`),style:{color:_.textMuted},children:E}),T&&(0,s.jsxs)(`span`,{id:x,role:`alert`,className:n.a(`text-xs flex items-center gap-1`),style:{color:_.danger},children:[(0,s.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z`})}),T]})]})});b.displayName=`TkxInput`;var x={sm:`text-xs px-1.5 py-[2px] min-h-[16px]`,md:`text-xs px-2 py-[3px] min-h-[20px]`,lg:`text-sm px-3 py-1 min-h-[24px]`},S={sm:`size-[6px]`,md:`size-2`,lg:`size-2.5`},C=(0,o.forwardRef)(({variant:e=`default`,size:r=`md`,dot:i=!1,pulse:a=!1,outlined:o=!1,children:c,className:l,style:u,...d},f)=>{let p=t.f(),m={default:p.border,primary:p.primary,secondary:p.secondary,danger:p.danger,warning:p.warning,success:p.success,info:p.info}[e]||`#666666`,h=t.v(m,[`#ffffff`,`#000000`,p.bg||`#000000`]),g=typeof c==`string`?n.m(c):c;return i?(0,s.jsx)(`span`,{ref:f,"aria-label":typeof c==`string`?n.m(c):void 0,className:n.t(n.a(`inline-block rounded-full`,S[r],a&&`animate-pulse`),l),style:{backgroundColor:m,...u},...d}):(0,s.jsx)(`span`,{ref:f,className:n.t(n.a(`inline-flex items-center justify-center rounded-full font-semibold font-sans tracking-wide`,x[r],a&&`animate-pulse`),l),style:{backgroundColor:o?`transparent`:m,color:o?m:h,border:o?`1px solid ${m}`:`none`,...u},...d,children:g})});C.displayName=`TkxBadge`;var w={sm:`4px`,md:`8px`,lg:`12px`},T={sm:32,md:48,lg:64},E=(0,o.forwardRef)(({value:e,variant:i=`linear`,size:a=`md`,label:o,showValue:c,color:l,className:u,style:d,...f},p)=>{let m=t.f(),h=r.o(),g=l??m.primary,_=e===void 0,v=e===void 0?0:Math.min(100,Math.max(0,e));if(e!==void 0){let{errors:t}=n.h({value:e},{value:{type:`number`,min:0,max:100}});t.length>0&&console.warn(`[TkxProgress]`,t.join(`, `))}if(i===`circular`){let e=T[a],t=a===`sm`?3:a===`md`?4:5,r=(e-t*2)/2,i=2*Math.PI*r,l=_?0:i-v/100*i;return(0,s.jsxs)(`div`,{ref:p,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":_?void 0:v,"aria-label":o??(_?`Loading`:`${v}%`),className:n.t(n.a(`inline-flex flex-col items-center gap-1`),u),style:d,children:[(0,s.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 ${e} ${e}`,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:e/2,cy:e/2,r,fill:`none`,stroke:m.border,strokeWidth:t}),(0,s.jsx)(`circle`,{cx:e/2,cy:e/2,r,fill:`none`,stroke:g,strokeWidth:t,strokeLinecap:`round`,strokeDasharray:i,strokeDashoffset:l,transform:`rotate(-90 ${e/2} ${e/2})`,style:{transition:h?`none`:`stroke-dashoffset 300ms ease`,animation:_&&!h?`tkx-spin 1s linear infinite`:void 0}})]}),c&&!_&&(0,s.jsxs)(`span`,{className:n.a(`text-xs`),style:{color:m.textMuted},children:[v,`%`]})]})}let y=w[a];return(0,s.jsxs)(`div`,{ref:p,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":_?void 0:v,"aria-label":o??(_?`Loading`:`${v}%`),className:n.t(n.a(`flex flex-col gap-1 w-full`),u),style:d,children:[o&&(0,s.jsxs)(`div`,{className:n.a(`flex justify-between text-sm`),style:{color:m.text},children:[(0,s.jsx)(`span`,{children:o}),c&&!_&&(0,s.jsxs)(`span`,{children:[v,`%`]})]}),(0,s.jsx)(`div`,{className:n.a(`w-full overflow-hidden`),style:{height:y,borderRadius:y,backgroundColor:m.border},children:(0,s.jsx)(`div`,{style:{height:`100%`,borderRadius:y,backgroundColor:g,width:_?`40%`:`${v}%`,transition:h?`none`:`width 300ms ease`,animation:_&&!h?`tkx-shimmer 1.5s ease-in-out infinite`:void 0}})})]})});E.displayName=`TkxProgress`;var D={sm:{tw:28,th:16,td:10,gap:3},md:{tw:40,th:22,td:14,gap:4},lg:{tw:52,th:28,td:18,gap:5}},O=(0,o.forwardRef)(({checked:e,onChange:i,label:a,size:c=`md`,hideLabel:l,disabled:u,className:d,style:f,...p},m)=>{let h=t.f(),g=r.o(),_=(0,o.useId)();n.h({label:a,checked:e},{label:{type:`string`,required:!0},checked:{type:`boolean`,required:!0}});let{tw:v,th:y,td:b,gap:x}=D[c],S=e?v-b-x:x,C=e?h.primary:h.border;return(0,s.jsxs)(`div`,{className:n.t(n.a(`inline-flex items-center gap-2`,u?`opacity-50`:``),d),style:f,children:[!l&&(0,s.jsx)(`label`,{htmlFor:_,className:n.a(`text-sm font-sans`,u?`cursor-not-allowed`:`cursor-pointer`,`select-none`),style:{color:h.text},children:a}),(0,s.jsx)(`button`,{ref:m,id:_,role:`switch`,"aria-checked":e,"aria-label":l?a:void 0,disabled:u,onClick:()=>!u&&i(!e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&!u&&(t.preventDefault(),i(!e))},className:n.t(n.a(`relative border-none p-0 outline-none shrink-0 focus-visible:focus-ring`,u?`cursor-not-allowed`:`cursor-pointer`,!g&&`transition-colors duration-200`)),style:{width:v,height:y,borderRadius:y,backgroundColor:C},...p,children:(0,s.jsx)(`span`,{"aria-hidden":`true`,className:n.a(`absolute rounded-full`),style:{top:`50%`,left:S,width:b,height:b,transform:`translateY(-50%)`,backgroundColor:`#ffffff`,boxShadow:`0 1px 3px rgba(0,0,0,0.3)`,transition:g?`none`:`left 200ms ease`}})})]})});O.displayName=`TkxToggle`;var k={info:(0,s.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z`})}),success:(0,s.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z`})}),warning:(0,s.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z`})}),danger:(0,s.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z`})})};function A({variant:e,title:i,children:a,dismissible:c,onDismiss:l,icon:u,style:d,className:f}){let p=t.f(),m=r.t(),h=i?n.m(i):void 0;(0,o.useEffect)(()=>{h&&m(h,e===`danger`||e===`warning`?`assertive`:`polite`)},[h,e]);let g={info:p.info,success:p.success,warning:p.warning,danger:p.danger}[e];return(0,s.jsxs)(`div`,{role:e===`danger`||e===`warning`?`alert`:`status`,className:n.a(`flex items-start gap-3 px-4 py-3 rounded-lg border animate-fade-in font-sans`,f??``),style:{backgroundColor:`${g}18`,borderColor:g,color:p.text,...d},children:[(0,s.jsx)(`span`,{className:n.a(`shrink-0 mt-[1px]`),style:{color:g},children:u??k[e]}),(0,s.jsxs)(`div`,{className:n.a(`flex-1 min-w-0`),children:[h&&(0,s.jsx)(`p`,{className:n.a(`m-0 font-semibold text-sm mb-1`),children:h}),(0,s.jsx)(`div`,{className:n.a(`text-sm leading-relaxed`),children:a})]}),c&&l&&(0,s.jsx)(`button`,{"aria-label":`Dismiss alert`,onClick:l,className:n.a(`bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring`),style:{color:p.textMuted},children:(0,s.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:[(0,s.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,s.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}var j={sm:`400px`,md:`560px`,lg:`720px`,full:`100vw`},M=0;function N(){++M===1&&(document.body.style.overflow=`hidden`)}function P(){--M<=0&&(M=0,document.body.style.overflow=``)}function F({isOpen:e,onClose:i,title:a,size:l=`md`,closeOnOverlayClick:u=!0,closeOnEscape:d=!0,children:f,footer:p}){let m=t.f(),h=(0,o.useId)(),g=r.i(e),_=r.o(),v=r.t(),y=n.m(a),b=l===`full`;return r.r(i,d&&e),(0,o.useEffect)(()=>(e?(N(),v(y,`polite`)):P(),()=>{e&&P()}),[e,y,v]),!e||typeof document>`u`?null:(0,c.createPortal)((0,s.jsxs)(`div`,{role:`presentation`,className:n.a(`fixed inset-0 z-[9000] flex`,b?`items-stretch`:`items-center justify-center`,b?``:`p-4`),children:[(0,s.jsx)(`div`,{"aria-hidden":`true`,onClick:u?i:void 0,className:n.a(`absolute inset-0`,!_&&`animate-fade-in`),style:{backgroundColor:`rgba(0,0,0,0.6)`,backdropFilter:`blur(4px)`}}),(0,s.jsxs)(`div`,{ref:g,role:`dialog`,"aria-modal":`true`,"aria-labelledby":h,className:n.a(`relative z-10 flex flex-col overflow-hidden`,!_&&`animate-slide-up`,b?``:`rounded-xl`),style:{backgroundColor:m.surface,border:`1px solid ${m.border}`,width:j[l],maxWidth:`100%`,maxHeight:b?`100vh`:`90vh`,boxShadow:`0 20px 60px ${m.bg}80`},children:[(0,s.jsxs)(`div`,{className:n.a(`flex items-center justify-between px-6 py-5 shrink-0`),style:{borderBottom:`1px solid ${m.border}`},children:[(0,s.jsx)(`h2`,{id:h,className:n.a(`m-0 text-lg font-semibold font-sans`),style:{color:m.text},children:y}),(0,s.jsx)(`button`,{onClick:i,"aria-label":`Close dialog`,className:n.a(`bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring`),style:{color:m.textMuted},children:(0,s.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:[(0,s.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,s.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),(0,s.jsx)(`div`,{className:n.a(`flex-1 overflow-y-auto px-6 py-6 font-sans`),style:{color:m.text},children:f}),p&&(0,s.jsx)(`div`,{className:n.a(`flex justify-end gap-2 px-6 py-4 shrink-0`),style:{borderTop:`1px solid ${m.border}`},children:p})]})]}),document.body)}var I=(0,o.createContext)(null);function L(){let e=(0,o.useContext)(I);if(!e)throw Error(`TkxTab must be used inside TkxTabs`);return e}function R({defaultIndex:e=0,activeIndex:t,onChange:n,children:r,tabCount:i=0,style:a,className:c}){let[l,u]=(0,o.useState)(e),d=(0,o.useId)(),f=t===void 0?l:t;return(0,s.jsx)(I.Provider,{value:{activeIndex:f,setActiveIndex:e=>{t===void 0&&u(e),n?.(e)},baseId:d,tabCount:i},children:(0,s.jsx)(`div`,{className:c,style:a,children:r})})}function z({children:e,className:r,style:i,...a}){let o=t.f();return(0,s.jsx)(`div`,{role:`tablist`,className:n.t(n.a(`flex gap-1`),r),style:{borderBottom:`2px solid ${o.border}`,...i},...a,children:e})}function B({index:e,children:r,disabled:i=!1,className:a,style:c}){let l=t.f(),{activeIndex:u,setActiveIndex:d,baseId:f,tabCount:p}=L(),m=(0,o.useRef)(null),h=u===e;return(0,s.jsx)(`button`,{ref:m,role:`tab`,id:`${f}-tab-${e}`,"aria-controls":`${f}-panel-${e}`,"aria-selected":h,tabIndex:h?0:-1,disabled:i,className:n.t(n.a(`border-none bg-transparent font-sans text-sm rounded-t cursor-pointer select-none`,`py-2.5 px-4 transition-colors duration-150 focus-visible:focus-ring`,i?`opacity-50 cursor-not-allowed`:``),a),style:{color:h?l.primary:l.textMuted,fontWeight:h?600:400,borderBottom:h?`2px solid ${l.primary}`:`2px solid transparent`,marginBottom:`-2px`,...c},onClick:()=>!i&&d(e),onKeyDown:n=>t.y(n,e,p,e=>{d(e),document.getElementById(`${f}-tab-${e}`)?.focus()}),children:r})}function V({children:e,className:t,...n}){return(0,s.jsx)(`div`,{className:t,...n,children:e})}function H({index:e,children:t,style:r,className:i}){let{activeIndex:a,baseId:o}=L();return a===e?(0,s.jsx)(`div`,{role:`tabpanel`,id:`${o}-panel-${e}`,"aria-labelledby":`${o}-tab-${e}`,tabIndex:0,className:n.t(n.a(`pt-4`),i),style:r,children:t}):null}var U={top:{bottom:`100%`,left:`50%`,transform:`translateX(-50%)`,marginBottom:6},bottom:{top:`100%`,left:`50%`,transform:`translateX(-50%)`,marginTop:6},left:{right:`100%`,top:`50%`,transform:`translateY(-50%)`,marginRight:6},right:{left:`100%`,top:`50%`,transform:`translateY(-50%)`,marginLeft:6}};function W({content:e,children:i,placement:a=`top`,delay:c=300}){let l=t.f(),[u,d]=(0,o.useState)(!1),f=(0,o.useRef)(null),p=(0,o.useId)(),m=(0,o.useRef)(null),h=r.o(),g=n.m(e),_=t.v(l.surfaceAlt,[l.text,`#ffffff`,`#000000`]);function v(){m.current=setTimeout(()=>d(!0),c)}function y(){m.current&&clearTimeout(m.current),d(!1)}r.r(y,u),r.n(f,y);let b=i,x=(0,o.cloneElement)(b,{"aria-describedby":u?p:void 0,onMouseEnter:e=>{b.props.onMouseEnter?.(e),v()},onMouseLeave:e=>{b.props.onMouseLeave?.(e),y()},onFocus:e=>{b.props.onFocus?.(e),v()},onBlur:e=>{b.props.onBlur?.(e),y()}});return(0,s.jsxs)(`span`,{ref:f,className:n.a(`relative inline-flex`),children:[x,u&&(0,s.jsx)(`span`,{id:p,role:`tooltip`,className:n.a(`absolute z-[9000] text-xs font-sans py-1.5 px-2.5 rounded-md whitespace-nowrap pointer-events-none`,!h&&`animate-fade-in`),style:{backgroundColor:l.surfaceAlt,color:_,border:`1px solid ${l.border}`,boxShadow:`0 4px 12px ${l.bg}40`,maxWidth:280,...U[a]},children:g})]})}function ee({variant:e,width:t,height:r,animation:i,bgColor:a,accentColor:o}){let c=t===void 0?`100%`:typeof t==`number`?`${t}px`:t,l=r===void 0?{text:`1em`,circular:c,rectangular:`80px`}[e]:typeof r==`number`?`${r}px`:r,u=n.a(e===`circular`?`rounded-full`:e===`text`?`rounded`:`rounded-lg`),d=i===`pulse`?n.a(`animate-pulse`):i===`wave`?n.a(`animate-shimmer`):``,f=i===`wave`?{background:`linear-gradient(90deg,${a} 25%,${o} 50%,${a} 75%)`,backgroundSize:`200% 100%`}:{backgroundColor:a};return(0,s.jsx)(`div`,{className:n.t(u,d),style:{width:c,height:l,...f}})}var te=(0,o.forwardRef)(({variant:e=`rectangular`,width:i,height:a,lines:o,animation:c=`pulse`,className:l,style:u,...d},f)=>{let p=t.f(),m=r.o()?!1:c;return e===`text`&&o&&o>1?(0,s.jsx)(`div`,{ref:f,role:`progressbar`,"aria-busy":`true`,"aria-label":`Loading...`,className:n.t(n.a(`flex flex-col gap-2`),l),style:u,...d,children:Array.from({length:o},(e,t)=>(0,s.jsx)(ee,{variant:`text`,width:t===o-1?`75%`:i,height:a,animation:m,bgColor:p.surfaceAlt,accentColor:p.border},t))}):(0,s.jsx)(`div`,{ref:f,role:`progressbar`,"aria-busy":`true`,"aria-label":`Loading...`,className:l,style:u,...d,children:(0,s.jsx)(ee,{variant:e,width:i,height:a,animation:m,bgColor:p.surfaceAlt,accentColor:p.border})})});te.displayName=`TkxSkeleton`;var G={xs:24,sm:32,md:40,lg:56,xl:72},K={online:`#06d6a0`,offline:`#8888aa`,away:`#ffbe0b`,busy:`#f72585`},ne=(0,o.forwardRef)(({src:e,alt:r,initials:i,size:a=`md`,shape:c=`circle`,status:l,className:u,style:d,...f},p)=>{let m=t.f(),[h,g]=(0,o.useState)(!1),_=G[a],v=c===`circle`,y=m.surfaceAlt,b=t.v(y,[m.text,m.textMuted]),x=e&&!h,S=!x&&i,C=Math.max(8,_*.22),w=n.a(`relative inline-flex shrink-0`,v?`rounded-full`:`rounded-lg`),T=n.a(`block object-cover`,v?`rounded-full`:`rounded-lg`),E=n.a(`flex items-center justify-center font-semibold font-sans select-none`,v?`rounded-full`:`rounded-lg`);return(0,s.jsxs)(`div`,{ref:p,className:n.t(w,u),style:{width:_,height:_,...d},...f,children:[x?(0,s.jsx)(`img`,{src:n.m(e),alt:n.m(r),onError:()=>g(!0),className:T,style:{width:_,height:_}}):(0,s.jsx)(`div`,{role:`img`,"aria-label":n.m(r),className:E,style:{width:_,height:_,backgroundColor:y,color:b,fontSize:_*.38},children:S?n.m(i).slice(0,2).toUpperCase():(0,s.jsxs)(`svg`,{width:_*.5,height:_*.5,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:[(0,s.jsx)(`path`,{d:`M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2`}),(0,s.jsx)(`circle`,{cx:`12`,cy:`7`,r:`4`})]})}),l&&(0,s.jsx)(`span`,{"aria-label":`Status: ${l}`,className:n.a(`absolute bottom-0 right-0 rounded-full`),style:{width:C,height:C,backgroundColor:K[l],border:`2px solid ${m.bg}`}})]})});ne.displayName=`TkxAvatar`;function q({dir:e}){return(0,s.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,className:n.a(`shrink-0`),children:e===`asc`?(0,s.jsx)(`path`,{d:`M7 14l5-5 5 5H7z`}):e===`desc`?(0,s.jsx)(`path`,{d:`M7 10l5 5 5-5H7z`}):(0,s.jsx)(`path`,{d:`M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z`,opacity:`0.4`})})}function J({columns:e,data:r,caption:i,sortable:a,stickyHeader:c,isLoading:l,emptyState:u,style:d,className:f,striped:p,maxHeight:m,rowHeight:h=44,virtualScroll:g,onLoadMore:_,hasMore:v,loadingMore:y=!1,onRowClick:b,selectedRows:x,bordered:S,compact:C}){let w=t.f(),[T,E]=(0,o.useState)(null),[D,O]=(0,o.useState)(`asc`),k=(0,o.useMemo)(()=>!T||!a?r:[...r].sort((e,t)=>{let n=e[T],r=t[T],i=0;return typeof n==`string`&&typeof r==`string`?i=n.localeCompare(r):typeof n==`number`&&typeof r==`number`&&(i=n-r),D===`asc`?i:-i}),[r,T,D,a]),A=(0,o.useCallback)(e=>{T===e?O(e=>e===`asc`?`desc`:`asc`):(E(e),O(`asc`))},[T]);function j(e){return T===e?D:`none`}let M=g===void 0?m!==void 0&&k.length>=50:g,N=(0,o.useRef)(null),[P,F]=(0,o.useState)(0),[I,L]=(0,o.useState)(400),R=(0,o.useCallback)(()=>{N.current&&F(N.current.scrollTop)},[]);(0,o.useEffect)(()=>{if(!M||!N.current)return;let e=N.current;L(e.clientHeight);let t=new ResizeObserver(()=>L(e.clientHeight));return t.observe(e),()=>t.disconnect()},[M]);let z=M?Math.max(0,Math.floor(P/h)-5):0,B=M?Math.min(k.length,Math.ceil((P+I)/h)+5):k.length,V=M?k.slice(z,B):k,H=(0,o.useRef)(null),U=(0,o.useRef)(!1);(0,o.useEffect)(()=>{U.current=!1},[r.length]),(0,o.useEffect)(()=>{if(!_)return;let e=H.current;if(!e)return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&!U.current&&v!==!1&&(U.current=!0,_())},{root:N.current,rootMargin:`0px 0px 200px 0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[_,v]);let W=C?`4px`:`12px`,ee=C?`8px`:`16px`,G=S?`1px solid ${w.border}`:`none`,K=(0,o.useMemo)(()=>new Set(x??[]),[x]);return(0,s.jsx)(`div`,{className:n.a(`w-full rounded-lg`,f??``),style:{border:`1px solid ${w.border}`,overflow:`hidden`,...d},children:(0,s.jsxs)(`div`,{ref:N,onScroll:M?R:void 0,style:{overflowX:`auto`,overflowY:m?`auto`:`visible`,maxHeight:m??`none`},children:[(0,s.jsxs)(`table`,{className:n.a(`w-full font-sans text-sm`),style:{borderCollapse:`collapse`,color:w.text},children:[i&&(0,s.jsx)(`caption`,{className:n.a(`text-sm text-left p-2`),style:{color:w.textMuted},children:n.m(i)}),(0,s.jsx)(`thead`,{style:c?{position:`sticky`,top:0,backgroundColor:w.surfaceAlt,zIndex:1}:{backgroundColor:w.surfaceAlt},children:(0,s.jsx)(`tr`,{children:e.map(e=>{let t=a&&e.sortable!==!1,r=j(e.key);return(0,s.jsx)(`th`,{scope:`col`,"aria-sort":t?r===`none`?`none`:r===`asc`?`ascending`:`descending`:void 0,className:n.a(`text-left font-semibold whitespace-nowrap`,t?`cursor-pointer select-none`:``),style:{padding:`${W} ${ee}`,color:w.textMuted,borderBottom:`2px solid ${w.border}`,borderRight:G,width:e.width},onClick:()=>t&&A(e.key),onKeyDown:n=>{t&&(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),A(e.key))},tabIndex:t?0:void 0,children:(0,s.jsxs)(`span`,{className:n.a(`inline-flex items-center gap-1.5`),children:[n.m(e.header),t&&(0,s.jsx)(q,{dir:r})]})},String(e.key))})})}),(0,s.jsx)(`tbody`,{children:l?Array.from({length:5},(t,n)=>(0,s.jsx)(`tr`,{children:e.map(e=>(0,s.jsx)(`td`,{style:{padding:`${W} ${ee}`},children:(0,s.jsx)(te,{variant:`text`,height:`16px`})},String(e.key)))},n)):k.length===0?(0,s.jsx)(`tr`,{children:(0,s.jsx)(`td`,{colSpan:e.length,className:n.a(`text-center`),style:{padding:`32px 16px`,color:w.textMuted},children:u??`No data available`})}):(0,s.jsxs)(s.Fragment,{children:[M&&z>0&&(0,s.jsx)(`tr`,{"aria-hidden":`true`,style:{height:z*h},children:(0,s.jsx)(`td`,{colSpan:e.length,style:{padding:0,border:`none`}})}),V.map((t,r)=>{let i=z+r,a=K.has(i);return(0,s.jsx)(`tr`,{"aria-rowindex":i+1,"aria-selected":a||void 0,onClick:b?()=>b(t,i):void 0,onKeyDown:b?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),b(t,i))}:void 0,tabIndex:b?0:void 0,className:n.a(b?`cursor-pointer`:``),style:{backgroundColor:a?`${w.primary}22`:p&&i%2==1?w.surfaceAlt:`transparent`,borderBottom:`1px solid ${w.border}`,...M?{height:h,boxSizing:`border-box`}:{}},children:e.map(e=>{let r=t[e.key],i=e.render?e.render(r,t):typeof r==`string`?n.m(r):String(r??``);return(0,s.jsx)(`td`,{style:{padding:`${W} ${ee}`,color:w.text,borderRight:G},children:i},String(e.key))})},i)}),M&&B<k.length&&(0,s.jsx)(`tr`,{"aria-hidden":`true`,style:{height:(k.length-B)*h},children:(0,s.jsx)(`td`,{colSpan:e.length,style:{padding:0,border:`none`}})})]})})]}),(v||y)&&(0,s.jsx)(`div`,{ref:H,style:{height:1,width:`100%`},children:y&&(0,s.jsx)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:(0,s.jsx)(`tbody`,{children:Array.from({length:3},(t,n)=>(0,s.jsx)(`tr`,{children:e.map(e=>(0,s.jsx)(`td`,{style:{padding:`10px 16px`},children:(0,s.jsx)(te,{variant:`text`,height:`16px`})},String(e.key)))},n))})})}),!v&&_&&(0,s.jsx)(`div`,{style:{padding:`16px`,textAlign:`center`,fontSize:13,color:w.textMuted},children:`✓ All rows loaded`})]})})}var Y=(0,o.forwardRef)(({orientation:e=`horizontal`,label:r,variant:i=`solid`,className:a,style:o,...c},l)=>{let u=t.f(),d=r?n.m(r):void 0,f=e===`vertical`,p=f?`borderLeft`:`borderTop`,m=`1px ${i} ${u.border}`;return d?(0,s.jsxs)(`div`,{role:`separator`,"aria-orientation":e,className:n.t(n.a(`flex items-center gap-3 text-xs`),a),style:{color:u.textMuted,...o},...c,children:[(0,s.jsx)(`hr`,{className:n.a(`flex-1 m-0 border-none`),style:{[p]:m}}),(0,s.jsx)(`span`,{children:d}),(0,s.jsx)(`hr`,{className:n.a(`flex-1 m-0 border-none`),style:{[p]:m}})]}):(0,s.jsx)(`hr`,{ref:l,role:`separator`,"aria-orientation":e,className:n.t(n.a(f?`inline-block self-stretch border-none w-0 h-full`:`w-full border-none m-0`),a),style:{[p]:m,...o},...c})});Y.displayName=`TkxDivider`;var re={sm:{py:`6px`,px:`10px`,fontSize:`13px`,iconSize:14,tagPy:`1px`,tagPx:`6px`},md:{py:`9px`,px:`12px`,fontSize:`14px`,iconSize:16,tagPy:`2px`,tagPx:`8px`},lg:{py:`12px`,px:`14px`,fontSize:`15px`,iconSize:18,tagPy:`3px`,tagPx:`10px`}};function ie(e){return e===void 0?[]:Array.isArray(e)?e:[e]}function ae(e,t){let n=e.getBoundingClientRect(),r=window.innerHeight-n.bottom-6,i=n.top-6,a=r>=Math.min(t,200)||r>=i?`below`:`above`;return{top:a===`below`?n.bottom+window.scrollY+6:n.top+window.scrollY-6-Math.min(t,280),left:n.left+window.scrollX,width:n.width,placement:a}}function oe({size:e,color:t}){return(0,s.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:t,strokeWidth:`2.5`,strokeLinecap:`round`,"aria-hidden":`true`,style:{animation:`tkx-spin 0.7s linear infinite`},children:[(0,s.jsx)(`style`,{children:`@keyframes tkx-spin{to{transform:rotate(360deg)}}`}),(0,s.jsx)(`path`,{d:`M12 2a10 10 0 0 1 10 10`})]})}function X({options:e,value:r,defaultValue:i,placeholder:a=`Select an option…`,size:l=`md`,isDisabled:u=!1,isInvalid:d=!1,label:f,hint:p,errorMessage:m,multiple:h=!1,searchable:g=!1,clearable:_=!1,isLoading:v=!1,onChange:y,renderOption:b,maxMenuHeight:x=280,virtualScroll:S,optionHeight:C=36,id:w,className:T,style:E}){let D=t.f(),O=(0,o.useId)(),k=w??O,A=`${k}-listbox`,j=`${k}-hint`,M=`${k}-error`,N=r!==void 0,[P,F]=(0,o.useState)(ie(i)),I=N?ie(r):P,[L,R]=(0,o.useState)(!1),[z,B]=(0,o.useState)(``),[V,H]=(0,o.useState)(-1),[U,W]=(0,o.useState)(null),[ee,te]=(0,o.useState)(``),G=(0,o.useRef)(null),K=(0,o.useRef)(null),ne=(0,o.useRef)(null),q=(0,o.useRef)(null),J=(0,o.useRef)(null),Y=re[l],X=d||!!m,Z=(0,o.useRef)(null),[se,ce]=(0,o.useState)(0),[le,ue]=(0,o.useState)(0),de=(0,o.useCallback)(()=>{Z.current&&ce(Z.current.scrollTop)},[]);(0,o.useEffect)(()=>{if(!L){ce(0);return}let e=Z.current;if(!e)return;ue(e.clientHeight);let t=new ResizeObserver(()=>{ue(e.clientHeight)});return t.observe(e),()=>t.disconnect()},[L]);let fe=g&&z?e.filter(e=>e.label.toLowerCase().includes(z.toLowerCase())):e,pe=fe.filter(e=>!e.disabled),Q=fe.some(e=>!!e.group),$=(S===void 0?fe.length>=100:S)&&!Q,me=fe.length*C,he=$?Math.max(0,Math.floor(se/C)-8):0,ge=$?Math.min(fe.length,Math.ceil((se+le)/C)+8):fe.length,_e=$?fe.slice(he,ge):fe,ve=he*C,ye=fe.reduce((e,t)=>{let n=t.group??``;return e[n]||(e[n]=[]),e[n].push(t),e},{}),be=(0,o.useCallback)(e=>{let t;t=h?I.includes(e)?I.filter(t=>t!==e):[...I,e]:[e],N||F(t),y?.(h?t:t[0]??``),h||(R(!1),B(``),H(-1),K.current?.focus())},[N,h,y,I]),xe=(0,o.useCallback)((e,t)=>{t.stopPropagation();let n=I.filter(t=>t!==e);N||F(n),y?.(h?n:n[0]??``)},[N,h,y,I]),Se=(0,o.useCallback)(e=>{e.stopPropagation(),N||F([]),y?.(h?[]:``)},[N,h,y]),Ce=(0,o.useCallback)(()=>{!K.current||!L||W(ae(K.current,x))},[L,x]);(0,o.useEffect)(()=>{if(L)return Ce(),window.addEventListener(`scroll`,Ce,!0),window.addEventListener(`resize`,Ce),()=>{window.removeEventListener(`scroll`,Ce,!0),window.removeEventListener(`resize`,Ce)}},[L,Ce]),(0,o.useEffect)(()=>{if(!L)return;let e=e=>{let t=e.target;K.current?.contains(t)||q.current?.contains(t)||(R(!1),B(``))};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[L]),(0,o.useEffect)(()=>{L&&g&&setTimeout(()=>ne.current?.focus(),0)},[L,g]),(0,o.useEffect)(()=>{if(!(!L||V<0))if($&&Z.current){let e=V*C,t=e+C,n=Z.current;e<n.scrollTop?n.scrollTop=e:t>n.scrollTop+n.clientHeight&&(n.scrollTop=t-n.clientHeight)}else (J.current?.querySelector(`[data-idx="${V}"]`))?.scrollIntoView({block:`nearest`})},[V,L,$,C]);let we=e=>{switch(e.key){case`Enter`:case` `:e.preventDefault(),L?V>=0&&pe[V]&&be(pe[V].value):De();break;case`Escape`:e.preventDefault(),R(!1),B(``);break;case`ArrowDown`:e.preventDefault(),L?H(e=>Math.min(e+1,pe.length-1)):De();break;case`ArrowUp`:e.preventDefault(),L?H(e=>Math.max(e-1,0)):De();break;case`Home`:e.preventDefault(),L&&H(0);break;case`End`:e.preventDefault(),L&&H(pe.length-1);break;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&(L||De(),Ee(e.key))}},Te=e=>{switch(e.key){case`Escape`:e.preventDefault(),R(!1),B(``),K.current?.focus();break;case`ArrowDown`:e.preventDefault(),H(e=>Math.min(e+1,pe.length-1));break;case`ArrowUp`:e.preventDefault(),H(e=>Math.max(e-1,0));break;case`Home`:e.preventDefault(),H(0);break;case`End`:e.preventDefault(),H(pe.length-1);break;case`Enter`:e.preventDefault(),V>=0&&pe[V]&&be(pe[V].value);break}};function Ee(e){G.current&&clearTimeout(G.current);let t=ee+e.toLowerCase();te(t);let n=pe.findIndex(e=>e.label.toLowerCase().startsWith(t));n>=0&&H(n),G.current=setTimeout(()=>te(``),800)}function De(){if(u||v)return;R(!0);let e=pe.findIndex(e=>I.includes(e.value));H(e>=0?e:0)}let Oe=X?D.danger:L?D.primary:D.border,ke=V>=0&&pe[V]?`${k}-opt-${pe[V].value}`:void 0,Ae=[p&&j,X&&M].filter(Boolean).join(` `)||void 0,je=I.map(t=>e.find(e=>e.value===t)).filter(Boolean),Me=L&&U?(0,c.createPortal)((0,s.jsxs)(`div`,{ref:q,role:`listbox`,id:A,"aria-label":f?n.m(f):`Options`,"aria-multiselectable":h,style:{position:`absolute`,top:U.top,left:U.left,width:U.width,zIndex:9999,backgroundColor:D.surface,border:`1.5px solid ${D.border}`,borderRadius:10,boxShadow:`0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)`,overflow:`hidden`,minWidth:U.width,maxHeight:x,display:`flex`,flexDirection:`column`},children:[g&&(0,s.jsxs)(`div`,{style:{padding:`8px 10px`,borderBottom:`1px solid ${D.border}`,flexShrink:0,display:`flex`,alignItems:`center`,gap:6},children:[(0,s.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:D.textMuted,strokeWidth:`2`,"aria-hidden":`true`,style:{flexShrink:0},children:[(0,s.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,s.jsx)(`path`,{d:`M21 21l-4.35-4.35`})]}),(0,s.jsx)(`input`,{ref:ne,type:`text`,value:z,onChange:e=>{B(e.target.value),H(0)},onKeyDown:Te,placeholder:`Search…`,"aria-label":`Search options`,style:{border:`none`,outline:`none`,background:`transparent`,color:D.text,fontSize:Y.fontSize,fontFamily:`inherit`,width:`100%`}})]}),(0,s.jsx)(`div`,{ref:e=>{J.current=e,Z.current=e},onScroll:$?de:void 0,style:{overflowY:`auto`,flexGrow:1,maxHeight:x-(g?48:0)},children:$?(0,s.jsxs)(`div`,{style:{height:me,position:`relative`},children:[(0,s.jsx)(`div`,{style:{position:`absolute`,top:ve,left:0,right:0},children:_e.map(e=>{let t=pe.indexOf(e),r=t===V,i=I.includes(e.value),a=b?b(e,i):(0,s.jsxs)(`span`,{style:{display:`flex`,flexDirection:`column`,flex:1,minWidth:0},children:[(0,s.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[e.icon&&(0,s.jsx)(`span`,{style:{flexShrink:0,display:`flex`},children:e.icon}),(0,s.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n.m(e.label)})]}),e.description&&(0,s.jsx)(`span`,{style:{fontSize:`12px`,color:D.textMuted,marginTop:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n.m(e.description)})]});return(0,s.jsxs)(`div`,{id:`${k}-opt-${e.value}`,"data-idx":t>=0?t:void 0,role:`option`,"aria-selected":i,"aria-disabled":e.disabled||void 0,onClick:()=>!e.disabled&&be(e.value),onMouseEnter:()=>!e.disabled&&t>=0&&H(t),style:{height:C,boxSizing:`border-box`,padding:`0 ${Y.px}`,fontSize:Y.fontSize,fontFamily:`inherit`,color:e.disabled?D.textMuted:D.text,backgroundColor:r?`${D.primary}22`:i?`${D.primary}12`:`transparent`,cursor:e.disabled?`not-allowed`:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,transition:`background-color 80ms`,opacity:e.disabled?.5:1,userSelect:`none`,touchAction:`manipulation`},children:[a,i&&!b&&(0,s.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:D.primary,strokeWidth:`2.5`,"aria-hidden":`true`,style:{flexShrink:0},children:(0,s.jsx)(`path`,{d:`M20 6L9 17l-5-5`})})]},e.value)})}),fe.length===0&&(0,s.jsx)(`div`,{style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:`inherit`,color:D.textMuted,textAlign:`center`,position:`absolute`,top:0,left:0,right:0},children:v?`Loading…`:`No options found`})]}):(0,s.jsxs)(s.Fragment,{children:[Object.entries(ye).map(([e,t])=>(0,s.jsxs)(`div`,{children:[e&&(0,s.jsx)(`div`,{"aria-hidden":`true`,style:{padding:`8px 12px 4px`,fontSize:`11px`,fontWeight:700,letterSpacing:`0.08em`,textTransform:`uppercase`,color:D.textMuted,fontFamily:`inherit`,position:`sticky`,top:0,backgroundColor:D.surface,zIndex:1,borderBottom:`1px solid ${D.border}`},children:n.m(e)}),t.map(e=>{let t=pe.indexOf(e),r=t===V,i=I.includes(e.value),a=b?b(e,i):(0,s.jsxs)(`span`,{style:{display:`flex`,flexDirection:`column`,flex:1,minWidth:0},children:[(0,s.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[e.icon&&(0,s.jsx)(`span`,{style:{flexShrink:0,display:`flex`},children:e.icon}),(0,s.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n.m(e.label)})]}),e.description&&(0,s.jsx)(`span`,{style:{fontSize:`12px`,color:D.textMuted,marginTop:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n.m(e.description)})]});return(0,s.jsxs)(`div`,{id:`${k}-opt-${e.value}`,"data-idx":t>=0?t:void 0,role:`option`,"aria-selected":i,"aria-disabled":e.disabled||void 0,onClick:()=>!e.disabled&&be(e.value),onMouseEnter:()=>!e.disabled&&t>=0&&H(t),style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:`inherit`,color:e.disabled?D.textMuted:D.text,backgroundColor:r?`${D.primary}22`:i?`${D.primary}12`:`transparent`,cursor:e.disabled?`not-allowed`:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,transition:`background-color 80ms`,opacity:e.disabled?.5:1,userSelect:`none`,touchAction:`manipulation`},children:[a,i&&!b&&(0,s.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:D.primary,strokeWidth:`2.5`,"aria-hidden":`true`,style:{flexShrink:0},children:(0,s.jsx)(`path`,{d:`M20 6L9 17l-5-5`})})]},e.value)})]},e)),fe.length===0&&(0,s.jsx)(`div`,{style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:`inherit`,color:D.textMuted,textAlign:`center`},children:v?`Loading…`:`No options found`})]})})]}),document.body):null,Ne=_&&I.length>0&&!u&&!v;return(0,s.jsxs)(`div`,{className:n.t(n.a(`flex flex-col gap-1 w-full`),T),style:E,children:[f&&(0,s.jsx)(`label`,{htmlFor:k,style:{fontSize:`14px`,fontWeight:500,fontFamily:`inherit`,color:D.text,userSelect:`none`},children:n.m(f)}),(0,s.jsx)(`div`,{style:{position:`relative`,width:`100%`,opacity:u?.55:1},children:(0,s.jsxs)(`button`,{ref:K,id:k,type:`button`,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":L,"aria-controls":A,"aria-activedescendant":ke,"aria-invalid":X||void 0,"aria-describedby":Ae,"aria-multiselectable":h,disabled:u,onClick:()=>L?R(!1):De(),onKeyDown:we,style:{width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,padding:h&&I.length>0?`4px ${Y.px}`:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:`inherit`,backgroundColor:D.surface,color:I.length>0?D.text:D.textMuted,border:`1.5px solid ${Oe}`,borderRadius:8,boxSizing:`border-box`,transition:`border-color 150ms`,textAlign:`left`,cursor:u?`not-allowed`:`pointer`,outline:`none`,minHeight:l===`sm`?34:l===`lg`?50:42,flexWrap:`wrap`,touchAction:`manipulation`},children:[(0,s.jsx)(`span`,{style:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:4,flex:1,minWidth:0},children:h&&je.length>0?je.map(e=>(0,s.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:4,padding:`${Y.tagPy} ${Y.tagPx}`,fontSize:`calc(${Y.fontSize} - 1px)`,fontFamily:`inherit`,backgroundColor:`${D.primary}22`,color:D.primary,borderRadius:6,border:`1px solid ${D.primary}44`,lineHeight:1.4,maxWidth:150,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[(0,s.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:110},children:n.m(e.label)}),(0,s.jsx)(`span`,{role:`button`,"aria-label":`Remove ${n.m(e.label)}`,tabIndex:-1,onClick:t=>xe(e.value,t),style:{cursor:`pointer`,flexShrink:0,display:`flex`,alignItems:`center`,opacity:.8},children:(0,s.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M18 6L6 18M6 6l12 12`})})})]},e.value)):!h&&I.length>0?(()=>{let t=e.find(e=>e.value===I[0]);return(0,s.jsxs)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,display:`flex`,alignItems:`center`,gap:6},children:[t?.icon&&(0,s.jsx)(`span`,{style:{flexShrink:0,display:`flex`},children:t.icon}),t?n.m(t.label):``]})})():(0,s.jsx)(`span`,{style:{opacity:.6},children:n.m(a)})}),(0,s.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:4,flexShrink:0,color:D.textMuted},children:[v&&(0,s.jsx)(oe,{size:Y.iconSize,color:D.primary}),Ne&&!v&&(0,s.jsx)(`span`,{role:`button`,"aria-label":`Clear selection`,tabIndex:-1,onClick:Se,style:{cursor:`pointer`,display:`flex`,alignItems:`center`,lineHeight:1,opacity:.7,transition:`opacity 120ms`},onMouseEnter:e=>e.currentTarget.style.opacity=`1`,onMouseLeave:e=>e.currentTarget.style.opacity=`0.7`,children:(0,s.jsx)(`svg`,{width:Y.iconSize,height:Y.iconSize,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M18 6L6 18M6 6l12 12`})})}),(0,s.jsx)(`svg`,{width:Y.iconSize,height:Y.iconSize,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,"aria-hidden":`true`,style:{transform:L?`rotate(180deg)`:`rotate(0deg)`,transition:`transform 150ms`,flexShrink:0},children:(0,s.jsx)(`path`,{d:`M6 9l6 6 6-6`})})]})]})}),p&&!X&&(0,s.jsx)(`span`,{id:j,style:{fontSize:`12px`,color:D.textMuted,fontFamily:`inherit`},children:n.m(p)}),X&&m&&(0,s.jsxs)(`span`,{id:M,role:`alert`,style:{fontSize:`12px`,color:D.danger,display:`flex`,alignItems:`center`,gap:4,fontFamily:`inherit`},children:[(0,s.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z`})}),n.m(m)]}),Me]})}X.displayName=`TkxSelect`;var Z={sm:{box:16,fontSize:`13px`,iconStroke:2.5},md:{box:20,fontSize:`14px`,iconStroke:2.5},lg:{box:24,fontSize:`15px`,iconStroke:2}},se=(0,o.forwardRef)(({label:e,hint:i,isInvalid:a,errorMessage:c,isIndeterminate:l=!1,size:u=`md`,colorScheme:d=`primary`,checked:f,defaultChecked:p,onChange:m,disabled:h,className:g,style:_,id:v,...y},b)=>{let x=t.f(),S=r.o(),C=(0,o.useId)(),w=v??C,T=`${w}-hint`,E=`${w}-error`,D=(0,o.useRef)(null),[O,k]=(0,o.useState)(!1),A=Z[u],j=a||!!c,M={primary:x.primary,success:x.success,danger:x.danger,warning:x.warning}[d]??x.primary,N=f===void 0?void 0:f;(0,o.useEffect)(()=>{let e=b?.current??D.current;e&&(e.indeterminate=l)},[l,b]);let P=l||(N??!1),F=P?M:x.surface,I=j?x.danger:P?M:x.border,L=t.v(M),R=O?{outline:`2px solid ${M}`,outlineOffset:`2px`}:{},z=[i&&T,j&&E].filter(Boolean).join(` `)||void 0,B=!S&&P?{animation:`tkx-check-scale-in 120ms ease forwards`}:{};return(0,s.jsxs)(`div`,{className:n.t(n.a(`flex flex-col gap-1`),g),style:{opacity:h?.5:1,..._},children:[(0,s.jsx)(`style`,{children:`
2
2
  @keyframes tkx-check-scale-in {
3
3
  from { transform: scale(0.4); opacity: 0; }
4
4
  to { transform: scale(1); opacity: 1; }
5
5
  }
6
- `}),e.jsxs("label",{htmlFor:j,className:x.tkx("flex items-center gap-2 select-none"),style:{cursor:c?"not-allowed":"pointer",fontFamily:"inherit"},children:[e.jsx("input",{ref:F=>{w.current=F,typeof k=="function"?k(F):k&&(k.current=F)},id:j,type:"checkbox",checked:d,defaultChecked:f,onChange:u,disabled:c,"aria-invalid":T,"aria-describedby":_,onFocus:F=>{F.target.matches(":focus-visible")&&I(!0)},onBlur:()=>I(!1),className:x.tkx("sr-only"),...b}),e.jsx("span",{"aria-hidden":"true",style:{width:M.box,height:M.box,minWidth:M.box,borderRadius:"4px",border:`2px solid ${B}`,backgroundColor:L,display:"flex",alignItems:"center",justifyContent:"center",transition:g?"none":"background-color 120ms, border-color 120ms",boxSizing:"border-box",...D},children:s?e.jsx("span",{"aria-hidden":"true",style:{display:"block",width:M.box*.5,height:2,backgroundColor:V,borderRadius:"1px",...R}}):z?e.jsx("svg",{width:M.box*.6,height:M.box*.6,viewBox:"0 0 24 24",fill:"none",stroke:V,strokeWidth:M.iconStroke,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:R,children:e.jsx("path",{d:"M20 6L9 17l-5-5"})}):null}),t&&e.jsx("span",{style:{fontSize:M.fontSize,color:y.text,lineHeight:1.4},children:typeof t=="string"?A.sanitizeString(t):t})]}),n&&!T&&e.jsx("span",{id:v,className:x.tkx("text-xs ml-7"),style:{color:y.textMuted,marginLeft:M.box+8},children:A.sanitizeString(n)}),T&&o&&e.jsxs("span",{id:$,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:y.danger,marginLeft:M.box+8},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),A.sanitizeString(o)]})]})});nr.displayName="TkxCheckbox";const rr=i.createContext(null);function ws(){return i.useContext(rr)}const js={sm:{outer:16,inner:7,fontSize:"13px"},md:{outer:20,inner:9,fontSize:"14px"},lg:{outer:24,inner:11,fontSize:"15px"}},sr=i.forwardRef(({label:t,hint:n,size:r="md",colorScheme:o="primary",value:s,checked:a,onChange:l,disabled:d,name:f,className:u,style:c,id:h,...p},m)=>{const b=O.useTheme(),k=J.useReducedMotion(),y=i.useId(),g=h??y,S=ws(),j=S?S.value===String(s??""):a??!1,v=d??(S==null?void 0:S.isDisabled)??!1,$=f??(S==null?void 0:S.name)??"",w=()=>{v||(S?S.onChange(String(s??"")):l==null||l({target:{value:String(s??"")}}))},N=js[r],M={primary:b.primary,success:b.success,danger:b.danger}[o]??b.primary;O.getAccessibleForeground(M);const T=j?M:b.border,E=b.surface;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-0.5"),u),style:{opacity:v?.5:1,...c},children:[e.jsx("style",{children:`
6
+ `}),(0,s.jsxs)(`label`,{htmlFor:w,className:n.a(`flex items-center gap-2 select-none`),style:{cursor:h?`not-allowed`:`pointer`,fontFamily:`inherit`},children:[(0,s.jsx)(`input`,{ref:e=>{D.current=e,typeof b==`function`?b(e):b&&(b.current=e)},id:w,type:`checkbox`,checked:f,defaultChecked:p,onChange:m,disabled:h,"aria-invalid":j,"aria-describedby":z,onFocus:e=>{e.target.matches(`:focus-visible`)&&k(!0)},onBlur:()=>k(!1),className:n.a(`sr-only`),...y}),(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{width:A.box,height:A.box,minWidth:A.box,borderRadius:`4px`,border:`2px solid ${I}`,backgroundColor:F,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:S?`none`:`background-color 120ms, border-color 120ms`,boxSizing:`border-box`,...R},children:l?(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{display:`block`,width:A.box*.5,height:2,backgroundColor:L,borderRadius:`1px`,...B}}):P?(0,s.jsx)(`svg`,{width:A.box*.6,height:A.box*.6,viewBox:`0 0 24 24`,fill:`none`,stroke:L,strokeWidth:A.iconStroke,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:B,children:(0,s.jsx)(`path`,{d:`M20 6L9 17l-5-5`})}):null}),e&&(0,s.jsx)(`span`,{style:{fontSize:A.fontSize,color:x.text,lineHeight:1.4},children:typeof e==`string`?n.m(e):e})]}),i&&!j&&(0,s.jsx)(`span`,{id:T,className:n.a(`text-xs ml-7`),style:{color:x.textMuted,marginLeft:A.box+8},children:n.m(i)}),j&&c&&(0,s.jsxs)(`span`,{id:E,role:`alert`,className:n.a(`text-xs flex items-center gap-1`),style:{color:x.danger,marginLeft:A.box+8},children:[(0,s.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z`})}),n.m(c)]})]})});se.displayName=`TkxCheckbox`;var ce=(0,o.createContext)(null);function le(){return(0,o.useContext)(ce)}var ue={sm:{outer:16,inner:7,fontSize:`13px`},md:{outer:20,inner:9,fontSize:`14px`},lg:{outer:24,inner:11,fontSize:`15px`}},de=(0,o.forwardRef)(({label:e,hint:i,size:a=`md`,colorScheme:c=`primary`,value:l,checked:u,onChange:d,disabled:f,name:p,className:m,style:h,id:g,..._},v)=>{let y=t.f(),b=r.o(),x=(0,o.useId)(),S=g??x,C=le(),w=C?C.value===String(l??``):u??!1,T=f??C?.isDisabled??!1,E=p??C?.name??``,D=()=>{T||(C?C.onChange(String(l??``)):d?.({target:{value:String(l??``)}}))},O=ue[a],k={primary:y.primary,success:y.success,danger:y.danger}[c]??y.primary;t.v(k);let A=w?k:y.border,j=y.surface;return(0,s.jsxs)(`div`,{className:n.t(n.a(`flex flex-col gap-0.5`),m),style:{opacity:T?.5:1,...h},children:[(0,s.jsx)(`style`,{children:`
7
7
  @keyframes tkx-radio-dot-in {
8
8
  from { transform: scale(0) translate(-50%, -50%); opacity: 0; }
9
9
  to { transform: scale(1) translate(-50%, -50%); opacity: 1; }
10
10
  }
11
- `}),e.jsxs("label",{htmlFor:g,className:x.tkx("flex items-center gap-2 select-none"),style:{cursor:v?"not-allowed":"pointer",fontFamily:"inherit"},children:[e.jsx("input",{ref:m,id:g,type:"radio",name:$,value:s,checked:j,onChange:w,disabled:v,"aria-invalid":S==null?void 0:S.isInvalid,className:x.tkx("sr-only"),...p}),e.jsx("span",{"aria-hidden":"true",style:{position:"relative",width:N.outer,height:N.outer,minWidth:N.outer,borderRadius:"50%",border:`2px solid ${T}`,backgroundColor:E,display:"inline-block",boxSizing:"border-box",transition:k?"none":"border-color 120ms"},children:j&&e.jsx("span",{"aria-hidden":"true",style:{position:"absolute",top:"50%",left:"50%",width:N.inner,height:N.inner,borderRadius:"50%",backgroundColor:M,transform:"translate(-50%, -50%)",transformOrigin:"center",...k?{}:{animation:"tkx-radio-dot-in 130ms ease forwards"}}})}),t&&e.jsx("span",{style:{fontSize:N.fontSize,color:b.text,lineHeight:1.4},children:typeof t=="string"?A.sanitizeString(t):t})]}),n&&e.jsx("span",{className:x.tkx("text-xs"),style:{color:b.textMuted,marginLeft:N.outer+8},children:A.sanitizeString(n)})]})});sr.displayName="TkxRadio";function Ss({name:t,value:n,defaultValue:r="",onChange:o,label:s,orientation:a="vertical",isDisabled:l=!1,isInvalid:d=!1,errorMessage:f,children:u}){const c=O.useTheme(),p=`${i.useId()}-error`,[m,b]=i.useState(r),k=n!==void 0,y=k?n:m,g=j=>{k||b(j),o==null||o(j)},S=d||!!f;return e.jsx(rr.Provider,{value:{name:t,value:y,onChange:g,isDisabled:l,isInvalid:d},children:e.jsxs("div",{role:"radiogroup","aria-label":s?A.sanitizeString(s):void 0,"aria-describedby":S?p:void 0,"aria-invalid":S,children:[s&&e.jsx("div",{className:x.tkx("text-sm font-medium font-sans mb-2"),style:{color:c.text},children:A.sanitizeString(s)}),e.jsx("div",{className:x.tkx(a==="horizontal"?"flex flex-row flex-wrap gap-4":"flex flex-col gap-2"),children:u}),S&&f&&e.jsxs("span",{id:p,role:"alert",className:x.tkx("text-xs flex items-center gap-1 mt-1"),style:{color:c.danger},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),A.sanitizeString(f)]})]})})}const or=5;let ft=[],Ve=[];const Ft=new Set,yt=new Map;function Yt(){const t=[...Ve];Ft.forEach(n=>n(t))}function ir(t,n){n!==0&&yt.set(t,setTimeout(()=>Kt(t),n))}function Kt(t){clearTimeout(yt.get(t)),yt.delete(t);const n=Ve.some(r=>r.id===t);if(Ve=Ve.filter(r=>r.id!==t),ft=ft.filter(r=>r.id!==t),n&&ft.length>0&&Ve.length<or){const r=ft.shift();Ve=[...Ve,r],ir(r.id,r.duration??4e3)}Yt()}function Ms(t){const n=`tkx-toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,r={...t,id:n,duration:t.duration??4e3};return Ve.length<or?(Ve=[...Ve,r],ir(n,r.duration)):ft=[...ft,r],Yt(),n}function Ts(){yt.forEach(t=>clearTimeout(t)),yt.clear(),Ve=[],ft=[],Yt()}function Cs(){const t=i.useCallback(o=>Ms(o),[]),n=i.useCallback(o=>Kt(o),[]),r=i.useCallback(()=>Ts(),[]);return{toast:t,dismiss:n,dismissAll:r}}const Is={default:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),success:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),danger:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),warning:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),info:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})})},$s={"top-right":{top:16,right:16,alignItems:"flex-end"},"top-left":{top:16,left:16,alignItems:"flex-start"},"top-center":{top:16,left:"50%",transform:"translateX(-50%)",alignItems:"center"},"bottom-right":{bottom:16,right:16,alignItems:"flex-end"},"bottom-left":{bottom:16,left:16,alignItems:"flex-start"},"bottom-center":{bottom:16,left:"50%",transform:"translateX(-50%)",alignItems:"center"}};function zs(t,n){return n?{}:{animation:`tkx-toast-slide-${t.startsWith("top")?"down":"up"} 220ms cubic-bezier(0.16,1,0.3,1) both`}}function Es({toast:t,position:n,onDismiss:r,reduced:o}){const s=O.useTheme(),a=i.useId(),l={default:s.textMuted,success:s.success,danger:s.danger,warning:s.warning,info:s.info},d=t.variant??"default",f=l[d],u=d==="danger",c=t.title?A.sanitizeString(t.title):void 0,h=t.description?A.sanitizeString(t.description):void 0;return e.jsxs("div",{role:u?"alert":"status","aria-live":u?"assertive":"polite","aria-atomic":"true","aria-labelledby":c?a:void 0,className:x.tkx("flex items-start gap-3 px-4 py-3 rounded-lg shadow-lg font-sans min-w-[280px] max-w-[380px]"),style:{backgroundColor:s.surface,border:`1px solid ${f}55`,boxShadow:`0 8px 24px ${s.bg}cc`,color:s.text,...zs(n,o)},children:[e.jsx("span",{className:x.tkx("shrink-0 mt-[2px]"),style:{color:f},children:Is[d]}),e.jsxs("div",{className:x.tkx("flex-1 min-w-0"),children:[c&&e.jsx("p",{id:a,className:x.tkx("m-0 font-semibold text-sm leading-snug"),children:c}),h&&e.jsx("p",{className:x.tkx("m-0 text-xs mt-[2px] leading-relaxed"),style:{color:s.textMuted},children:h}),t.action&&e.jsx("button",{onClick:()=>{t.action.onClick(),r(t.id)},className:x.tkx("border-none bg-transparent cursor-pointer p-0 mt-2 text-xs font-semibold focus-visible:focus-ring"),style:{color:f},children:A.sanitizeString(t.action.label)})]}),e.jsx("button",{"aria-label":"Dismiss notification",onClick:()=>r(t.id),className:x.tkx("bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring"),style:{color:s.textMuted},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}function Ns({position:t="top-right",children:n}){const[r,o]=i.useState([...Ve]),s=J.useReducedMotion();i.useEffect(()=>{o([...Ve]);const u=c=>o([...c]);return Ft.add(u),()=>{Ft.delete(u)}},[]);const a=t.startsWith("bottom"),l=$s[t],d=i.useRef(!1);if(i.useEffect(()=>{if(!(d.current||typeof document>"u")&&(d.current=!0,!document.getElementById("tkx-toast-kf"))){const u=document.createElement("style");u.id="tkx-toast-kf",u.textContent=`
11
+ `}),(0,s.jsxs)(`label`,{htmlFor:S,className:n.a(`flex items-center gap-2 select-none`),style:{cursor:T?`not-allowed`:`pointer`,fontFamily:`inherit`},children:[(0,s.jsx)(`input`,{ref:v,id:S,type:`radio`,name:E,value:l,checked:w,onChange:D,disabled:T,"aria-invalid":C?.isInvalid,className:n.a(`sr-only`),..._}),(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{position:`relative`,width:O.outer,height:O.outer,minWidth:O.outer,borderRadius:`50%`,border:`2px solid ${A}`,backgroundColor:j,display:`inline-block`,boxSizing:`border-box`,transition:b?`none`:`border-color 120ms`},children:w&&(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{position:`absolute`,top:`50%`,left:`50%`,width:O.inner,height:O.inner,borderRadius:`50%`,backgroundColor:k,transform:`translate(-50%, -50%)`,transformOrigin:`center`,...b?{}:{animation:`tkx-radio-dot-in 130ms ease forwards`}}})}),e&&(0,s.jsx)(`span`,{style:{fontSize:O.fontSize,color:y.text,lineHeight:1.4},children:typeof e==`string`?n.m(e):e})]}),i&&(0,s.jsx)(`span`,{className:n.a(`text-xs`),style:{color:y.textMuted,marginLeft:O.outer+8},children:n.m(i)})]})});de.displayName=`TkxRadio`;function fe({name:e,value:r,defaultValue:i=``,onChange:a,label:c,orientation:l=`vertical`,isDisabled:u=!1,isInvalid:d=!1,errorMessage:f,children:p}){let m=t.f(),h=`${(0,o.useId)()}-error`,[g,_]=(0,o.useState)(i),v=r!==void 0,y=v?r:g,b=e=>{v||_(e),a?.(e)},x=d||!!f;return(0,s.jsx)(ce.Provider,{value:{name:e,value:y,onChange:b,isDisabled:u,isInvalid:d},children:(0,s.jsxs)(`div`,{role:`radiogroup`,"aria-label":c?n.m(c):void 0,"aria-describedby":x?h:void 0,"aria-invalid":x,children:[c&&(0,s.jsx)(`div`,{className:n.a(`text-sm font-medium font-sans mb-2`),style:{color:m.text},children:n.m(c)}),(0,s.jsx)(`div`,{className:n.a(l===`horizontal`?`flex flex-row flex-wrap gap-4`:`flex flex-col gap-2`),children:p}),x&&f&&(0,s.jsxs)(`span`,{id:h,role:`alert`,className:n.a(`text-xs flex items-center gap-1 mt-1`),style:{color:m.danger},children:[(0,s.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z`})}),n.m(f)]})]})})}var pe=5,Q=[],$=[],me=new Set,he=new Map;function ge(){let e=[...$];me.forEach(t=>t(e))}function _e(e,t){t!==0&&he.set(e,setTimeout(()=>ve(e),t))}function ve(e){clearTimeout(he.get(e)),he.delete(e);let t=$.some(t=>t.id===e);if($=$.filter(t=>t.id!==e),Q=Q.filter(t=>t.id!==e),t&&Q.length>0&&$.length<pe){let e=Q.shift();$=[...$,e],_e(e.id,e.duration??4e3)}ge()}function ye(e){let t=`tkx-toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,n={...e,id:t,duration:e.duration??4e3};return $.length<pe?($=[...$,n],_e(t,n.duration)):Q=[...Q,n],ge(),t}function be(){he.forEach(e=>clearTimeout(e)),he.clear(),$=[],Q=[],ge()}function xe(){return{toast:(0,o.useCallback)(e=>ye(e),[]),dismiss:(0,o.useCallback)(e=>ve(e),[]),dismissAll:(0,o.useCallback)(()=>be(),[])}}var Se={default:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z`})}),success:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z`})}),danger:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z`})}),warning:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z`})}),info:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z`})})},Ce={"top-right":{top:16,right:16,alignItems:`flex-end`},"top-left":{top:16,left:16,alignItems:`flex-start`},"top-center":{top:16,left:`50%`,transform:`translateX(-50%)`,alignItems:`center`},"bottom-right":{bottom:16,right:16,alignItems:`flex-end`},"bottom-left":{bottom:16,left:16,alignItems:`flex-start`},"bottom-center":{bottom:16,left:`50%`,transform:`translateX(-50%)`,alignItems:`center`}};function we(e,t){return t?{}:{animation:`tkx-toast-slide-${e.startsWith(`top`)?`down`:`up`} 220ms cubic-bezier(0.16,1,0.3,1) both`}}function Te({toast:e,position:r,onDismiss:i,reduced:a}){let c=t.f(),l=(0,o.useId)(),u={default:c.textMuted,success:c.success,danger:c.danger,warning:c.warning,info:c.info},d=e.variant??`default`,f=u[d],p=d===`danger`,m=e.title?n.m(e.title):void 0,h=e.description?n.m(e.description):void 0;return(0,s.jsxs)(`div`,{role:p?`alert`:`status`,"aria-live":p?`assertive`:`polite`,"aria-atomic":`true`,"aria-labelledby":m?l:void 0,className:n.a(`flex items-start gap-3 px-4 py-3 rounded-lg shadow-lg font-sans min-w-[280px] max-w-[380px]`),style:{backgroundColor:c.surface,border:`1px solid ${f}55`,boxShadow:`0 8px 24px ${c.bg}cc`,color:c.text,...we(r,a)},children:[(0,s.jsx)(`span`,{className:n.a(`shrink-0 mt-[2px]`),style:{color:f},children:Se[d]}),(0,s.jsxs)(`div`,{className:n.a(`flex-1 min-w-0`),children:[m&&(0,s.jsx)(`p`,{id:l,className:n.a(`m-0 font-semibold text-sm leading-snug`),children:m}),h&&(0,s.jsx)(`p`,{className:n.a(`m-0 text-xs mt-[2px] leading-relaxed`),style:{color:c.textMuted},children:h}),e.action&&(0,s.jsx)(`button`,{onClick:()=>{e.action.onClick(),i(e.id)},className:n.a(`border-none bg-transparent cursor-pointer p-0 mt-2 text-xs font-semibold focus-visible:focus-ring`),style:{color:f},children:n.m(e.action.label)})]}),(0,s.jsx)(`button`,{"aria-label":`Dismiss notification`,onClick:()=>i(e.id),className:n.a(`bg-transparent border-none cursor-pointer rounded p-[2px] shrink-0 flex items-center justify-center focus-visible:focus-ring`),style:{color:c.textMuted},children:(0,s.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.5,"aria-hidden":`true`,children:[(0,s.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,s.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}function Ee({position:e=`top-right`,children:t}){let[i,a]=(0,o.useState)([...$]),l=r.o();(0,o.useEffect)(()=>{a([...$]);let e=e=>a([...e]);return me.add(e),()=>{me.delete(e)}},[]);let u=e.startsWith(`bottom`),d=Ce[e],f=(0,o.useRef)(!1);if((0,o.useEffect)(()=>{if(!(f.current||typeof document>`u`)&&(f.current=!0,!document.getElementById(`tkx-toast-kf`))){let e=document.createElement(`style`);e.id=`tkx-toast-kf`,e.textContent=`
12
12
  @keyframes tkx-toast-slide-down {
13
13
  from { opacity: 0; transform: translateY(-16px); }
14
14
  to { opacity: 1; transform: translateY(0); }
@@ -17,21 +17,21 @@
17
17
  from { opacity: 0; transform: translateY(16px); }
18
18
  to { opacity: 1; transform: translateY(0); }
19
19
  }
20
- `,document.head.appendChild(u)}},[]),typeof document>"u")return e.jsx(e.Fragment,{children:n});const f=a?[...r].reverse():r;return e.jsxs(e.Fragment,{children:[n,Re.createPortal(e.jsx("div",{"aria-label":"Notifications",className:x.tkx("fixed z-[9999] flex flex-col gap-2 pointer-events-none"),style:l,children:f.map(u=>e.jsx("div",{className:x.tkx("pointer-events-auto"),children:e.jsx(Es,{toast:u,position:t,onDismiss:Kt,reduced:s})},u.id))}),document.body)]})}const Rs={sm:{triggerPadding:"10px 12px",contentPadding:"0 12px 10px 12px",fontSize:"13px",subtitleSize:"11px",iconSize:14},md:{triggerPadding:"14px 16px",contentPadding:"0 16px 14px 16px",fontSize:"14px",subtitleSize:"12px",iconSize:16},lg:{triggerPadding:"18px 20px",contentPadding:"0 20px 18px 20px",fontSize:"16px",subtitleSize:"13px",iconSize:18}};function Jt({open:t,reduced:n,iconStyle:r,size:o,color:s}){const a=n?"none":"transform 240ms cubic-bezier(0.4, 0, 0.2, 1)";return r==="chevron"?e.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:s,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:t?"rotate(180deg)":"rotate(0deg)",transition:a,flexShrink:0},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}):r==="plus"?e.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:s,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:t?"rotate(45deg)":"rotate(0deg)",transition:a,flexShrink:0},children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):e.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:s,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:t?"rotate(90deg)":"rotate(0deg)",transition:a,flexShrink:0},children:[e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),e.jsx("polyline",{points:"12 5 19 12 12 19"})]})}function Ls({isOpen:t,reduced:n,children:r,id:o,triggerId:s}){const a=i.useRef(null),l=i.useRef(null),d=i.useRef(t),f=i.useRef(!1);i.useEffect(()=>{const c=a.current;c&&(t?(c.style.height="auto",c.style.overflow="visible"):(c.style.height="0px",c.style.overflow="hidden"))},[]),i.useEffect(()=>{if(d.current===t)return;d.current=t;const c=a.current,h=l.current;if(!(!c||!h)){if(n){c.style.height=t?"auto":"0px",c.style.overflow=t?"visible":"hidden";return}if(f.current){const p=c.getBoundingClientRect().height;c.style.transition="none",c.style.height=`${p}px`,c.offsetHeight}f.current=!0,c.style.overflow="hidden",t?(c.style.height="0px",c.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{c.style.height=`${h.scrollHeight}px`})})):(c.style.height=`${h.scrollHeight}px`,c.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{c.style.height="0px"})}))}},[t,n]);const u=c=>{if(c.propertyName!=="height")return;f.current=!1;const h=a.current;h&&(t?(h.style.height="auto",h.style.overflow="visible"):h.style.overflow="hidden")};return e.jsx("div",{ref:a,id:o,role:"region","aria-labelledby":s,onTransitionEnd:u,style:{willChange:"height"},children:e.jsx("div",{ref:l,children:r})})}function ar({items:t,multiple:n=!1,defaultOpen:r,value:o,onChange:s,variant:a="default",size:l="md",iconPosition:d="right",iconStyle:f="chevron",flush:u=!1,className:c,style:h}){const p=O.useTheme(),m=J.useReducedMotion(),b=i.useId(),k=o!==void 0,y=T=>T?Array.isArray(T)?new Set(T):new Set([T]):new Set,[g,S]=i.useState(()=>y(r)),j=k?y(o):g,v=i.useCallback((T,E)=>{if(E)return;let C;if(k){const z=y(o);C=new Set(z),C.has(T)?C.delete(T):(n||C.clear(),C.add(T))}else{S(z=>{C=new Set(z),C.has(T)?C.delete(T):(n||C.clear(),C.add(T));const L=[...C];return s==null||s(n?L:L[0]??""),C});return}const H=[...C];s==null||s(n?H:H[0]??"")},[n,s,k,o]),$=Rs[l],w=()=>{if(u)return{};switch(a){case"bordered":return{border:`1px solid ${p.border}`,borderRadius:"10px",overflow:"hidden"};case"separated":return{};case"ghost":case"flush":return{};default:return{}}},N=(T,E,C)=>{if(u)return{};switch(a){case"default":return{borderBottom:C?"none":`1px solid ${p.border}`};case"bordered":return{borderBottom:C?"none":`1px solid ${p.border}`};case"separated":return{border:`1px solid ${p.border}`,borderRadius:"10px",overflow:"hidden",boxShadow:"0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04)"};case"ghost":return{};default:return{}}},I=T=>a==="ghost"||a==="flush"?T?`${p.primary}10`:`${p.surfaceAlt}80`:T?`${p.primary}0d`:`${p.surfaceAlt}60`,M=a==="separated";return e.jsx("div",{className:x.tkx(c??""),style:{...w(),display:M?"flex":void 0,flexDirection:M?"column":void 0,gap:M?"8px":void 0,...h},children:t.map((T,E)=>{const C=j.has(T.id),H=E===t.length-1,z=`${b}-trigger-${T.id}`,L=`${b}-panel-${T.id}`;return e.jsxs("div",{className:T.className,style:N(E,C,H),children:[e.jsxs("button",{id:z,type:"button",role:"button","aria-expanded":C,"aria-controls":L,disabled:T.disabled,onClick:()=>v(T.id,T.disabled),style:{width:"100%",display:"flex",alignItems:T.subtitle?"flex-start":"center",gap:"8px",padding:$.triggerPadding,border:"none",background:"transparent",cursor:T.disabled?"not-allowed":"pointer",textAlign:"left",fontFamily:"inherit",fontSize:$.fontSize,fontWeight:500,color:T.disabled?p.textMuted:p.text,opacity:T.disabled?.5:1,transition:m?"none":"background-color 160ms ease",outline:"none"},onMouseEnter:B=>{T.disabled||(B.currentTarget.style.backgroundColor=I(C))},onMouseLeave:B=>{B.currentTarget.style.backgroundColor=C?`${p.primary}0d`:"transparent"},onFocus:B=>{T.disabled||(B.currentTarget.style.outline=`2px solid ${p.primary}`,B.currentTarget.style.outlineOffset="2px")},onBlur:B=>{B.currentTarget.style.outline="none"},children:[T.icon&&e.jsx("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:p.primary,marginTop:T.subtitle?"1px":void 0},children:T.icon}),d==="left"&&e.jsx("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:C?p.primary:p.textMuted,marginTop:T.subtitle?"1px":void 0},children:e.jsx(Jt,{open:C,reduced:m,iconStyle:f,size:$.iconSize,color:C?p.primary:p.textMuted})}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("span",{style:{display:"block",lineHeight:1.4},children:T.title}),T.subtitle&&e.jsx("span",{style:{display:"block",fontSize:$.subtitleSize,color:p.textMuted,fontWeight:400,marginTop:"2px",lineHeight:1.3},children:T.subtitle})]}),T.badge&&e.jsx("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0},children:T.badge}),d==="right"&&e.jsx("span",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",flexShrink:0,color:C?p.primary:p.textMuted,marginTop:T.subtitle?"1px":void 0},children:e.jsx(Jt,{open:C,reduced:m,iconStyle:f,size:$.iconSize,color:C?p.primary:p.textMuted})})]}),e.jsx(Ls,{isOpen:C,reduced:m,id:L,triggerId:z,children:e.jsx("div",{style:{padding:$.contentPadding,fontSize:$.fontSize,lineHeight:1.6,color:p.textMuted,fontFamily:"inherit"},children:T.content})})]},T.id)})})}ar.displayName="TkxAccordion";const As={sm:"280px",md:"380px",lg:"480px",xl:"600px",full:"100%"};let Pt=0;function Ds(){++Pt===1&&(document.body.style.overflow="hidden")}function en(){--Pt<=0&&(Pt=0,document.body.style.overflow="")}function Bs(t){switch(t){case"left":return"translateX(-100%)";case"right":return"translateX(100%)";case"top":return"translateY(-100%)";case"bottom":return"translateY(100%)"}}function Ws(t,n){const r=As[n],o=t==="left"||t==="right",s={position:"absolute"};return o?{...s,top:0,bottom:0,[t]:0,width:r,maxWidth:"100vw",height:"100%"}:{...s,left:0,right:0,[t]:0,height:r,maxHeight:"100vh",width:"100%"}}function tn(){return e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Fs({isOpen:t,onClose:n,placement:r="right",size:o="md",title:s,children:a,footer:l,closeOnOverlayClick:d=!0,closeOnEsc:f=!0}){const u=O.useTheme(),c=J.useReducedMotion(),h=i.useId(),p=J.useFocusTrap(t);if(J.useEscapeKey(n,f&&t),i.useEffect(()=>(t?Ds():en(),()=>{t&&en()}),[t]),typeof document>"u")return null;const m=Ws(r,o),b=Bs(r),k=c?"none":"transform 280ms cubic-bezier(0.4,0,0.2,1), opacity 280ms ease",y=typeof s=="string"?A.sanitizeString(s):s;return Re.createPortal(e.jsxs("div",{role:"presentation",className:x.tkx("fixed inset-0 z-[9000]"),style:{pointerEvents:t?"auto":"none",visibility:t?"visible":"hidden"},children:[e.jsx("div",{"aria-hidden":"true",onClick:d?n:void 0,className:x.tkx("absolute inset-0"),style:{backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(3px)",opacity:t?1:0,transition:c?"none":"opacity 280ms ease",cursor:d?"pointer":"default"}}),e.jsxs("div",{ref:p,role:"dialog","aria-modal":"true","aria-labelledby":s?h:void 0,className:x.tkx("absolute flex flex-col font-sans"),style:{...m,backgroundColor:u.surface,borderLeft:r==="right"?`1px solid ${u.border}`:void 0,borderRight:r==="left"?`1px solid ${u.border}`:void 0,borderTop:r==="bottom"?`1px solid ${u.border}`:void 0,borderBottom:r==="top"?`1px solid ${u.border}`:void 0,boxShadow:`0 20px 60px ${u.bg}99`,transform:t?"translate(0,0)":b,opacity:t?1:0,transition:k,willChange:"transform"},children:[s!==void 0&&e.jsxs("div",{className:x.tkx("flex items-center justify-between px-5 py-4 shrink-0"),style:{borderBottom:`1px solid ${u.border}`},children:[e.jsx("h2",{id:h,className:x.tkx("m-0 text-base font-semibold leading-snug"),style:{color:u.text},children:y}),e.jsx("button",{onClick:n,"aria-label":"Close drawer",className:x.tkx("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:u.textMuted},children:e.jsx(tn,{})})]}),s===void 0&&e.jsx("div",{className:x.tkx("flex justify-end px-3 pt-3 shrink-0"),children:e.jsx("button",{onClick:n,"aria-label":"Close drawer",className:x.tkx("bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring"),style:{color:u.textMuted},children:e.jsx(tn,{})})}),e.jsx("div",{className:x.tkx("flex-1 overflow-y-auto px-5 py-4"),style:{color:u.text},children:a}),l&&e.jsx("div",{className:x.tkx("flex items-center justify-end gap-2 px-5 py-4 shrink-0"),style:{borderTop:`1px solid ${u.border}`},children:l})]})]}),document.body)}const Ps=["Su","Mo","Tu","We","Th","Fr","Sa"],nn=["January","February","March","April","May","June","July","August","September","October","November","December"],Hs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ye(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function Be(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function Vs(t,n,r){if(!n||!r)return!1;const o=Be(t).getTime(),s=Be(n).getTime(),a=Be(r).getTime(),l=Math.min(s,a),d=Math.max(s,a);return o>l&&o<d}function rn(t,n,r){return!!(n&&Ye(t,n)||r&&Ye(t,r))}function ot(t,n="en-US"){return t?t.toLocaleDateString(n,{month:"2-digit",day:"2-digit",year:"numeric"}):""}function Os(t){const n=t.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(!n)return null;const[,r,o,s]=n.map(Number);if(r<1||r>12||o<1||o>31)return null;const a=new Date(s,r-1,o);return a.getMonth()!==r-1?null:a}function sn(t,n){return new Date(t,n+1,0).getDate()}function _s(t,n){const r=new Date(t,n,1).getDay(),o=sn(t,n),s=[],a=sn(t,n-1);for(let d=r-1;d>=0;d--)s.push(new Date(t,n-1,a-d));for(let d=1;d<=o;d++)s.push(new Date(t,n,d));let l=1;for(;s.length<42;)s.push(new Date(t,n+1,l++));return s}function $t(t){return Math.floor(t/10)*10}function Ys(){return[{label:"Today",getValue:()=>{const t=Be(new Date);return[t,t]}},{label:"Yesterday",getValue:()=>{const t=Be(new Date);return t.setDate(t.getDate()-1),[t,t]}},{label:"Last 7 days",getValue:()=>{const t=Be(new Date),n=new Date(t);return n.setDate(n.getDate()-6),[n,t]}},{label:"Last 30 days",getValue:()=>{const t=Be(new Date),n=new Date(t);return n.setDate(n.getDate()-29),[n,t]}},{label:"Last 90 days",getValue:()=>{const t=Be(new Date),n=new Date(t);return n.setDate(n.getDate()-89),[n,t]}},{label:"This week",getValue:()=>{const t=Be(new Date),n=new Date(t);n.setDate(n.getDate()-n.getDay());const r=new Date(n);return r.setDate(r.getDate()+6),[n,r]}},{label:"Last week",getValue:()=>{const t=Be(new Date),n=new Date(t);n.setDate(n.getDate()-n.getDay()-1);const r=new Date(n);return r.setDate(r.getDate()-6),[r,n]}},{label:"This month",getValue:()=>{const t=new Date;return[new Date(t.getFullYear(),t.getMonth(),1),new Date(t.getFullYear(),t.getMonth()+1,0)]}},{label:"Last month",getValue:()=>{const t=new Date;return[new Date(t.getFullYear(),t.getMonth()-1,1),new Date(t.getFullYear(),t.getMonth(),0)]}},{label:"This quarter",getValue:()=>{const t=new Date,n=Math.floor(t.getMonth()/3);return[new Date(t.getFullYear(),n*3,1),new Date(t.getFullYear(),n*3+3,0)]}},{label:"Last quarter",getValue:()=>{const t=new Date,n=Math.floor(t.getMonth()/3),r=n===0?3:n-1,o=n===0?t.getFullYear()-1:t.getFullYear();return[new Date(o,r*3,1),new Date(o,r*3+3,0)]}},{label:"This year",getValue:()=>{const t=new Date().getFullYear();return[new Date(t,0,1),new Date(t,11,31)]}},{label:"Last year",getValue:()=>{const t=new Date().getFullYear()-1;return[new Date(t,0,1),new Date(t,11,31)]}}]}function Ks(t,n){const r=t.getBoundingClientRect(),o=window.innerHeight,s=window.scrollY,a=window.scrollX,d=o-r.bottom<n+8&&r.top>n+8;return{top:d?s+r.top-n-4:s+r.bottom+4,left:a+r.left,flipUp:d}}function on({values:t,selected:n,onSelect:r,label:o,theme:s,format:a}){const l=i.useRef([]),d=i.useRef(null);i.useEffect(()=>{const u=l.current[n];u&&d.current&&u.scrollIntoView({block:"nearest"})},[n]);const f=a??(u=>String(u).padStart(2,"0"));return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:s.textMuted,textTransform:"uppercase",letterSpacing:"0.05em"},children:o}),e.jsx("div",{ref:d,style:{height:"160px",overflowY:"auto",width:"52px",scrollbarWidth:"thin",border:`1px solid ${s.border}`,borderRadius:"8px",padding:"4px"},children:t.map(u=>{const c=u===n;return e.jsx("button",{ref:h=>{l.current[u]=h},type:"button",onClick:()=>r(u),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"32px",borderRadius:"6px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:c?600:400,backgroundColor:c?s.primary:"transparent",color:c?s.bg:s.text,fontFamily:"monospace",transition:"background-color 100ms ease"},children:f(u)},u)})})]})}function an({year:t,month:n,today:r,mode:o,selectedDate:s,selectedRange:a,multiDates:l,hoverDate:d,focusedDate:f,isDateDisabled:u,onSelectDate:c,onHoverDate:h,onSetFocused:p,theme:m,locale:b}){const k=_s(t,n);return e.jsxs("div",{children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},children:Ps.map(y=>e.jsx("div",{style:{textAlign:"center",fontSize:"11px",fontWeight:600,color:m.textMuted,padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:y},y))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},children:k.map((y,g)=>{const S=y.getMonth()===n,j=Ye(y,r),v=y.getDay()===0||y.getDay()===6,$=u(y),w=o==="single"&&s!=null&&Ye(y,s),N=o==="multiple"&&l.some(F=>Ye(F,y)),I=o==="range"&&rn(y,a[0],null),M=o==="range"&&rn(y,null,a[1]),T=I||M,E=o==="range"&&a[0]&&!a[1]&&d?d:a[1],C=o==="range"&&Vs(y,a[0],E),H=o==="range"&&a[0]&&!a[1]&&d&&Ye(y,d),z=w||N||T,L=f!=null&&Ye(y,f);let B="transparent",V=S?v?`${m.text}cc`:m.text:`${m.textMuted}60`,D="none",_=400;z||H?(B=m.primary,V=m.bg,_=600):C&&(B=`${m.primary}18`),j&&!z&&(D=`2px solid ${m.primary}`,_=600),$&&(V=`${m.textMuted}50`),L&&!z&&(D=`2px solid ${m.secondary}`);const R=y.toLocaleDateString(b,{weekday:"long",year:"numeric",month:"long",day:"numeric"});return e.jsx("button",{type:"button","aria-label":R,"aria-pressed":z,"aria-disabled":$,disabled:$,onClick:()=>!$&&c(y),onMouseEnter:()=>h(y),onMouseLeave:()=>h(null),onFocus:()=>p(y),style:{width:"34px",height:"34px",borderRadius:"8px",backgroundColor:B,color:V,border:D,fontSize:"13px",fontWeight:_,cursor:$?"not-allowed":"pointer",opacity:$?.35:1,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit",position:"relative",outline:"none",textDecoration:$?"line-through":"none",transition:"background-color 80ms ease"},children:y.getDate()},g)})})]})}function lr({value:t,onChange:n,rangeValue:r,onRangeChange:o,multiValue:s,onMultiChange:a,mode:l="single",minDate:d,maxDate:f,disabledDates:u,locale:c="en-US",showTime:h=!1,timeValue:p,onTimeChange:m,showPresets:b=!1,customPresets:k,label:y,placeholder:g="MM/DD/YYYY",hint:S,isDisabled:j=!1,isInvalid:v=!1,errorMessage:$,numberOfMonths:w=1,id:N,className:I,style:M}){const T=O.useTheme(),E=i.useId(),C=N??E,H=J.useReducedMotion(),z=Be(new Date),L=t!==void 0,[B,V]=i.useState(null),D=L?t??null:B,_=r!==void 0,[R,F]=i.useState([null,null]),W=_?r:R,K=s!==void 0,[ne,Z]=i.useState([]),ie=K?s:ne,[fe,pe]=i.useState("start"),te=l==="range"||l==="single"&&h,[ce,Y]=i.useState([null,null]),[se,ae]=i.useState(null),ge=D??W[0]??z,[he,ye]=i.useState(ge.getFullYear()),[de,xe]=i.useState(ge.getMonth()),[oe,G]=i.useState("day"),[ue,ke]=i.useState({h:0,m:0}),ve=p??ue,[Me,Ie]=i.useState(!1),[We,Te]=i.useState(()=>{if(l==="single")return ot(D,c);if(l==="range"){const[X,ee]=W;if(X&&ee)return`${ot(X,c)} – ${ot(ee,c)}`}return""}),[ze,Ke]=i.useState(null),[Ze,Fe]=i.useState(null),[Oe,Ge]=i.useState({top:0,left:0,flipUp:!1}),[,Ee]=i.useReducer(X=>X+1,0),qe=i.useRef(null),rt=i.useRef(null),Qe=i.useRef(null),Le=b?420:h?480:360;i.useEffect(()=>{if(l==="single")Te(ot(D,c));else if(l==="range"){const[X,ee]=W;Te(X&&ee?`${ot(X,c)} – ${ot(ee,c)}`:X?ot(X,c):"")}else l==="multiple"&&Te(ie.length>0?`${ie.length} date${ie.length!==1?"s":""} selected`:"")},[D,W,ie,l,c]);const Pe=i.useCallback(()=>{qe.current&&Ge(Ks(qe.current,Le))},[Le]);i.useEffect(()=>{if(Me)return Pe(),window.addEventListener("scroll",Pe,!0),window.addEventListener("resize",Pe),()=>{window.removeEventListener("scroll",Pe,!0),window.removeEventListener("resize",Pe)}},[Me,Pe]),i.useEffect(()=>{if(!Me)return;const X=ee=>{var me,Se;(me=qe.current)!=null&&me.contains(ee.target)||(Se=rt.current)!=null&&Se.contains(ee.target)||Ie(!1)};return document.addEventListener("pointerdown",X),()=>document.removeEventListener("pointerdown",X)},[Me]),i.useEffect(()=>{if(!Me)return;const X=ee=>{var me;ee.key==="Escape"&&(Ie(!1),(me=Qe.current)==null||me.focus())};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[Me]);const Ae=i.useCallback(X=>d&&Be(X)<Be(d)||f&&Be(X)>Be(f)?!0:u?typeof u=="function"?u(X):u.some(ee=>Ye(ee,X)):!1,[d,f,u]),Je=i.useCallback(X=>{if(!Ae(X)){if(l==="single")te?ae(X):(L||V(X),n==null||n(X),Te(ot(X,c)),Ie(!1));else if(l==="range")if(fe==="start"){const ee=[X,null];Y(ee),_||F(ee),o==null||o(ee),pe("end")}else{const ee=ce[0]??W[0],me=ee&&X<ee?[X,ee]:[ee,X];Y(me),te?pe("start"):(_||F(me),o==null||o(me),pe("start"),Ie(!1))}else if(l==="multiple"){const me=ie.some(Se=>Ye(Se,X))?ie.filter(Se=>!Ye(Se,X)):[...ie,X];K||Z(me),a==null||a(me)}Ee()}},[l,Ae,L,_,K,n,o,a,fe,ce,W,ie,te,c]),Ue=i.useCallback(()=>{if(l==="single"){const X=se??D;L||V(X),n==null||n(X)}else l==="range"&&(_||F(ce),o==null||o(ce));Ie(!1),pe("start")},[l,se,ce,D,L,_,n,o]),at=i.useCallback(()=>{ae(null),Y([null,null]),pe("start"),Ie(!1)},[]),q=()=>{de===0?(xe(11),ye(X=>X-1)):xe(X=>X-1),G("day")},P=()=>{de===11?(xe(0),ye(X=>X+1)):xe(X=>X+1),G("day")},Q=()=>ye(X=>X-1),re=()=>ye(X=>X+1),le=()=>ye(X=>X-10),Ce=()=>ye(X=>X+10),$e=X=>{if(Te(X),l==="single"){const ee=Os(X);ee&&!Ae(ee)&&(L||V(ee),n==null||n(ee),ye(ee.getFullYear()),xe(ee.getMonth()))}},we=X=>{if(X.stopPropagation(),l==="single")L||V(null),n==null||n(null),Te("");else if(l==="range"){const ee=[null,null];_||F(ee),o==null||o(ee),Y(ee),Te(""),pe("start")}else l==="multiple"&&(K||Z([]),a==null||a([]),Te(""))},_e=X=>{if(oe!=="day")return;const ee=ze??D??z;let me=null;if(X.key==="ArrowRight")me=new Date(ee.getFullYear(),ee.getMonth(),ee.getDate()+1);else if(X.key==="ArrowLeft")me=new Date(ee.getFullYear(),ee.getMonth(),ee.getDate()-1);else if(X.key==="ArrowDown")me=new Date(ee.getFullYear(),ee.getMonth(),ee.getDate()+7);else if(X.key==="ArrowUp")me=new Date(ee.getFullYear(),ee.getMonth(),ee.getDate()-7);else if(X.key==="Enter"&&ze){Je(ze);return}me&&(X.preventDefault(),Ke(me),(me.getMonth()!==de||me.getFullYear()!==he)&&(xe(me.getMonth()),ye(me.getFullYear())))},U=()=>{ye(z.getFullYear()),xe(z.getMonth()),G("day"),Je(z)},be=k??Ys(),je=X=>{const[ee,me]=X.getValue(),Se=[ee,me];Y(Se),_||F(Se),o==null||o(Se),ye(ee.getFullYear()),xe(ee.getMonth()),pe("start"),te||Ie(!1)},Ne=de===11?0:de+1,lt=de===11?he+1:he,st=w>=2,pt=y?A.sanitizeString(y):void 0,ht=S?A.sanitizeString(S):void 0,mt=$?A.sanitizeString($):void 0,wt=A.sanitizeString(g),jt=l==="single"&&D!=null||l==="range"&&(W[0]!=null||W[1]!=null)||l==="multiple"&&ie.length>0,et=l==="range"?te?ce:W:[null,null],Fr=v?T.danger:Me?T.primary:T.border,Pr=Array.from({length:24},(X,ee)=>ee),Hr=Array.from({length:60},(X,ee)=>ee),Vr=e.jsxs("div",{ref:rt,role:"dialog","aria-label":"Date picker","aria-modal":"false",onKeyDown:_e,style:{position:"absolute",top:Oe.top,left:Oe.left,zIndex:9999,backgroundColor:T.surface,border:`1px solid ${T.border}`,borderRadius:"14px",boxShadow:"0 8px 30px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)",display:"flex",overflow:"hidden",minWidth:st?"580px":"300px",maxWidth:st&&b?"780px":st?"620px":b?"520px":"300px",opacity:Me?1:0,transform:Me?"translateY(0) scale(1)":Oe.flipUp?"translateY(4px) scale(0.98)":"translateY(-4px) scale(0.98)",transition:H?"none":"opacity 120ms ease, transform 120ms ease",fontFamily:"inherit"},children:[b&&l==="range"&&e.jsxs("div",{style:{width:"148px",flexShrink:0,borderRight:`1px solid ${T.border}`,padding:"8px 6px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"1px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:600,color:T.textMuted,textTransform:"uppercase",letterSpacing:"0.07em",padding:"4px 8px 8px"},children:"Quick select"}),be.map(X=>{const[ee,me]=X.getValue(),Se=et[0]&&et[1]&&Ye(et[0],ee)&&Ye(et[1],me);return e.jsx("button",{type:"button",onClick:()=>je(X),style:{width:"100%",textAlign:"left",padding:"7px 10px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",backgroundColor:Se?`${T.primary}20`:"transparent",color:Se?T.primary:T.text,fontWeight:Se?600:400,fontFamily:"inherit",transition:"background-color 80ms ease"},onMouseEnter:gt=>{Se||(gt.currentTarget.style.backgroundColor=`${T.surfaceAlt}`)},onMouseLeave:gt=>{Se||(gt.currentTarget.style.backgroundColor="transparent")},children:X.label},X.label)})]}),e.jsxs("div",{style:{flex:1,padding:"16px",display:"flex",flexDirection:"column",gap:"12px",minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("button",{type:"button","aria-label":oe==="day"?"Previous month":oe==="month"?"Previous year":"Previous decade",onClick:()=>{oe==="day"?q():oe==="month"?Q():le()},style:{border:"none",background:"transparent",cursor:"pointer",color:T.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[oe==="day"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>G("month"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:T.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:nn[de]}),e.jsx("button",{type:"button",onClick:()=>G("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:T.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:he}),st&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:T.textMuted,fontSize:"14px"},children:"–"}),e.jsxs("span",{style:{fontSize:"14px",fontWeight:600,color:T.text},children:[nn[Ne]," ",lt]})]})]}),oe==="month"&&e.jsx("button",{type:"button",onClick:()=>G("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:T.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:he}),oe==="year"&&e.jsxs("span",{style:{fontSize:"14px",fontWeight:600,color:T.text},children:[$t(he),"–",$t(he)+9]})]}),e.jsx("button",{type:"button","aria-label":oe==="day"?"Next month":oe==="month"?"Next year":"Next decade",onClick:()=>{oe==="day"?P():oe==="month"?re():Ce()},style:{border:"none",background:"transparent",cursor:"pointer",color:T.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),oe==="day"&&e.jsxs("div",{style:{display:"flex",gap:"20px"},children:[e.jsx(an,{year:he,month:de,today:z,mode:l,selectedDate:D,selectedRange:et,multiDates:ie,hoverDate:Ze,focusedDate:ze,isDateDisabled:Ae,onSelectDate:Je,onHoverDate:Fe,onSetFocused:Ke,theme:T,locale:c}),st&&e.jsx(an,{year:lt,month:Ne,today:z,mode:l,selectedDate:D,selectedRange:et,multiDates:ie,hoverDate:Ze,focusedDate:ze,isDateDisabled:Ae,onSelectDate:Je,onHoverDate:Fe,onSetFocused:Ke,theme:T,locale:c})]}),oe==="month"&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"6px"},children:Hs.map((X,ee)=>{const me=ee===de,Se=ee===z.getMonth()&&he===z.getFullYear();return e.jsx("button",{type:"button",onClick:()=>{xe(ee),G("day")},style:{padding:"10px",borderRadius:"8px",border:Se&&!me?`2px solid ${T.primary}`:"none",cursor:"pointer",fontSize:"13px",fontWeight:me?600:400,backgroundColor:me?T.primary:"transparent",color:me?T.bg:T.text,fontFamily:"inherit",transition:"background-color 80ms ease"},children:X},X)})}),oe==="year"&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"6px"},children:Array.from({length:12},(X,ee)=>{const me=$t(he)-1+ee,Se=me===he,gt=me===z.getFullYear(),Xt=ee===0||ee===11;return e.jsx("button",{type:"button",onClick:()=>{ye(me),G("month")},style:{padding:"10px 6px",borderRadius:"8px",border:gt&&!Se?`2px solid ${T.primary}`:"none",cursor:"pointer",fontSize:"13px",fontWeight:Se?600:400,backgroundColor:Se?T.primary:"transparent",color:Se?T.bg:Xt?T.textMuted:T.text,fontFamily:"inherit",transition:"background-color 80ms ease",opacity:Xt?.5:1},children:me},me)})}),h&&oe==="day"&&e.jsxs("div",{style:{borderTop:`1px solid ${T.border}`,paddingTop:"12px",display:"flex",alignItems:"flex-start",gap:"8px",justifyContent:"center"},children:[e.jsx(on,{values:Pr,selected:ve.h,onSelect:X=>{p||ke(ee=>({...ee,h:X})),m==null||m({...ve,h:X})},label:"Hour",theme:T}),e.jsx("div",{style:{display:"flex",alignItems:"center",height:"40px",marginTop:"28px",fontSize:"16px",fontWeight:700,color:T.textMuted},children:":"}),e.jsx(on,{values:Hr,selected:ve.m,onSelect:X=>{p||ke(ee=>({...ee,m:X})),m==null||m({...ve,m:X})},label:"Min",theme:T})]}),l==="multiple"&&oe==="day"&&ie.length>0&&e.jsxs("div",{style:{borderTop:`1px solid ${T.border}`,paddingTop:"8px",fontSize:"12px",color:T.textMuted,textAlign:"center"},children:[ie.length," date",ie.length!==1?"s":""," selected"]}),e.jsxs("div",{style:{borderTop:`1px solid ${T.border}`,paddingTop:"10px",display:"flex",alignItems:"center",justifyContent:te?"space-between":"flex-start",gap:"8px"},children:[e.jsx("button",{type:"button",onClick:U,style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"13px",color:T.primary,fontWeight:500,padding:"6px 10px",borderRadius:"6px",fontFamily:"inherit"},children:"Today"}),te&&e.jsxs("div",{style:{display:"flex",gap:"6px"},children:[e.jsx("button",{type:"button",onClick:at,style:{padding:"6px 14px",borderRadius:"7px",border:`1px solid ${T.border}`,cursor:"pointer",fontSize:"13px",fontWeight:500,backgroundColor:"transparent",color:T.text,fontFamily:"inherit"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:Ue,style:{padding:"6px 14px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:600,backgroundColor:T.primary,color:T.bg,fontFamily:"inherit"},children:"Apply"})]})]})]})]});return e.jsxs("div",{className:I,style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",position:"relative",...M},children:[pt&&e.jsx("label",{htmlFor:C,style:{fontSize:"13px",fontWeight:500,color:T.text,marginBottom:"2px"},children:pt}),e.jsxs("div",{ref:qe,style:{display:"flex",alignItems:"center",border:`1.5px solid ${Fr}`,borderRadius:"8px",backgroundColor:T.surface,overflow:"hidden",transition:H?"none":"border-color 120ms ease",opacity:j?.5:1},children:[e.jsx("span",{style:{display:"flex",alignItems:"center",paddingLeft:"10px",color:T.textMuted,flexShrink:0},children:e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),e.jsx("input",{ref:Qe,id:C,type:"text",value:We,placeholder:wt,disabled:j,"aria-invalid":v,"aria-haspopup":"dialog","aria-expanded":Me,readOnly:l==="range"||l==="multiple",onChange:X=>$e(X.target.value),onFocus:()=>{j||Ie(!0)},style:{flex:1,backgroundColor:"transparent",border:"none",outline:"none",fontSize:"14px",padding:"9px 8px",color:T.text,cursor:l!=="single"?"pointer":"text",fontFamily:"inherit",minWidth:0}}),jt&&!j&&e.jsx("button",{type:"button","aria-label":"Clear selection",onClick:we,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",background:"transparent",cursor:"pointer",color:T.textMuted,flexShrink:0,borderRadius:"4px",marginRight:"4px"},children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("button",{type:"button","aria-label":Me?"Close calendar":"Open calendar",tabIndex:-1,disabled:j,onClick:()=>{j||Ie(X=>!X)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"34px",height:"36px",border:"none",background:"transparent",cursor:j?"not-allowed":"pointer",color:T.textMuted,flexShrink:0},children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:Me?"rotate(180deg)":"rotate(0deg)",transition:H?"none":"transform 160ms ease"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),ht&&!v&&e.jsx("span",{style:{fontSize:"12px",color:T.textMuted},children:ht}),v&&mt&&e.jsx("span",{role:"alert",style:{fontSize:"12px",color:T.danger},children:mt}),Me&&typeof document<"u"&&Re.createPortal(Vr,document.body)]})}lr.displayName="TkxDatePicker";const Us={sm:{track:4,thumb:14,fontSize:"0.75rem"},md:{track:6,thumb:18,fontSize:"0.875rem"},lg:{track:8,thumb:22,fontSize:"1rem"}};function ut(t,n,r){return Math.min(Math.max(t,n),r)}function Ht(t,n,r){return Math.round((t-n)/r)*r+n}function tt(t,n,r){return(t-n)/(r-n)*100}function zt({value:t,min:n,max:r,step:o,isDisabled:s,trackColor:a,thumbSize:l,ariaLabel:d,tooltipMode:f,formatValue:u,orientation:c,onChange:h,onChangeEnd:p}){const[m,b]=i.useState(!1),[k,y]=i.useState(!1),[g,S]=i.useState(!1),j=M=>{s||(M.key==="ArrowRight"||M.key==="ArrowUp"?(M.preventDefault(),h(ut(Ht(t+o,n,o),n,r))):M.key==="ArrowLeft"||M.key==="ArrowDown"?(M.preventDefault(),h(ut(Ht(t-o,n,o),n,r))):M.key==="Home"?(M.preventDefault(),h(n)):M.key==="End"&&(M.preventDefault(),h(r)))},v=c==="vertical",$=tt(t,n,r),w=f==="always"||f==="hover"&&(g||k||m),N=v?{position:"absolute",bottom:`${$}%`,transform:"translateY(50%)",left:"50%",marginLeft:`-${l/2}px`,zIndex:2,cursor:s?"not-allowed":"grab"}:{position:"absolute",left:`${$}%`,transform:"translateX(-50%)",top:"50%",marginTop:`-${l/2}px`,zIndex:2,cursor:s?"not-allowed":"grab"},I=v?{position:"absolute",left:l+6,top:"50%",transform:"translateY(-50%)",backgroundColor:a,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"}:{position:"absolute",bottom:l+6,left:"50%",transform:"translateX(-50%)",backgroundColor:a,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"};return e.jsxs("div",{style:N,children:[w&&e.jsx("div",{style:I,children:u(t)}),e.jsx("div",{role:"slider",tabIndex:s?-1:0,"aria-label":d,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":t,"aria-disabled":s,"aria-orientation":c,onKeyDown:j,onFocus:()=>b(!0),onBlur:()=>b(!1),onPointerEnter:()=>S(!0),onPointerLeave:()=>S(!1),onPointerDown:M=>{s||(y(!0),M.target.setPointerCapture(M.pointerId))},onPointerUp:()=>{y(!1),p==null||p()},style:{width:l,height:l,borderRadius:"50%",backgroundColor:s?"#888":a,border:"3px solid #fff",boxShadow:m?`0 0 0 3px ${a}44`:"0 1px 4px rgba(0,0,0,0.3)",outline:"none",display:"block",transition:"box-shadow 150ms ease"}})]})}function cr({value:t,defaultValue:n=0,onChange:r,rangeValue:o,onRangeChange:s,min:a=0,max:l=100,step:d=1,isRange:f=!1,label:u,showValue:c=!1,showTicks:h=!1,tickCount:p=5,isDisabled:m=!1,colorScheme:b="primary",size:k="md",marks:y,orientation:g="horizontal",showTooltip:S=!1,formatValue:j,onChangeEnd:v,onRangeChangeEnd:$,gradient:w=!1}){const N=O.useTheme(),I=i.useId(),M=J.useReducedMotion(),T=t!==void 0,[E,C]=i.useState(n),H=T?t:E,z=o!==void 0,[L,B]=i.useState([a,l]),V=z?o:L,D=i.useRef(null),_=i.useRef(H);_.current=H;const R=i.useRef(V);R.current=V;const F={primary:N.primary,success:N.success,danger:N.danger,warning:N.warning}[b],W=Us[k],K=g==="vertical",ne=S===!0?"hover":S===!1?!1:S,Z=j??(de=>String(de)),ie=F+"66",fe=i.useCallback((de,xe)=>{const oe=D.current;if(!oe)return a;const G=oe.getBoundingClientRect();let ue;K?ue=ut((G.bottom-(xe??0))/G.height,0,1):ue=ut((de-G.left)/G.width,0,1);const ke=ue*(l-a)+a;return ut(Ht(ke,a,d),a,l)},[a,l,d,K]),pe=i.useCallback(de=>{if(m)return;const xe=fe(de.clientX,de.clientY);if(!f)T||C(xe),r==null||r(xe);else{const[oe,G]=V,ue=Math.abs(xe-oe),ke=Math.abs(xe-G),ve=ue<=ke?[xe,G]:[oe,xe];z||B(ve),s==null||s(ve)}},[m,f,T,z,fe,r,s,V]),te=de=>{T||C(de),r==null||r(de)},ce=de=>{const xe=[ut(de,a,V[1]),V[1]];z||B(xe),s==null||s(xe)},Y=de=>{const xe=[V[0],ut(de,V[0],l)];z||B(xe),s==null||s(xe)},se=f?tt(V[0],a,l):0,ae=tt(f?V[1]:H,a,l),ge=h?Array.from({length:p},(de,xe)=>a+xe/(p-1)*(l-a)):[],he=u?A.sanitizeString(u):void 0,ye=M?"none":"background 150ms ease";return e.jsxs("div",{className:x.tkx("flex flex-col gap-2"),style:{opacity:m?.55:1,...K?{height:200,width:"auto",display:"inline-flex"}:{width:"100%"}},children:[(he||c)&&e.jsxs("div",{className:x.tkx("flex items-center justify-between"),children:[he&&e.jsx("label",{htmlFor:I,className:x.tkx("text-sm font-medium"),style:{color:N.text,fontSize:W.fontSize},children:he}),c&&!f&&e.jsx("span",{className:x.tkx("text-sm tabular-nums"),style:{color:N.textMuted,fontSize:W.fontSize},children:Z(H)}),c&&f&&e.jsxs("span",{className:x.tkx("text-sm tabular-nums"),style:{color:N.textMuted,fontSize:W.fontSize},children:[Z(V[0])," – ",Z(V[1])]})]}),e.jsxs("div",{style:{position:"relative",...K?{paddingLeft:W.thumb/2,paddingRight:W.thumb/2,flex:1}:{paddingTop:W.thumb/2,paddingBottom:W.thumb/2}},children:[e.jsxs("div",{ref:D,onPointerDown:pe,style:{position:"relative",...K?{width:W.track,height:"100%"}:{height:W.track},borderRadius:9999,backgroundColor:N.border,cursor:m?"not-allowed":"pointer",userSelect:"none",touchAction:"none"},children:[e.jsx("div",{style:{position:"absolute",...K?{left:0,bottom:`${se}%`,height:`${ae-se}%`,width:"100%"}:{top:0,left:`${se}%`,width:`${ae-se}%`,height:"100%"},borderRadius:9999,...m?{backgroundColor:N.textMuted}:w?{background:K?`linear-gradient(to top, ${ie}, ${F})`:`linear-gradient(to right, ${ie}, ${F})`}:{backgroundColor:F},transition:ye}}),ge.map((de,xe)=>e.jsx("div",{style:{position:"absolute",...K?{bottom:`${tt(de,a,l)}%`,left:"50%",transform:"translate(-50%, 50%)",height:3,width:W.track+4}:{left:`${tt(de,a,l)}%`,top:"50%",transform:"translate(-50%, -50%)",width:3,height:W.track+4},backgroundColor:N.surface,borderRadius:9999,pointerEvents:"none"}},xe)),f?e.jsxs(e.Fragment,{children:[e.jsx(zt,{value:V[0],min:a,max:V[1],step:d,isDisabled:m,trackColor:F,trackHeight:W.track,thumbSize:W.thumb,ariaLabel:`${he??"Range"} start`,tooltipMode:ne,formatValue:Z,orientation:g,onChange:ce,onChangeEnd:$?()=>$(R.current):void 0}),e.jsx(zt,{value:V[1],min:V[0],max:l,step:d,isDisabled:m,trackColor:F,trackHeight:W.track,thumbSize:W.thumb,ariaLabel:`${he??"Range"} end`,tooltipMode:ne,formatValue:Z,orientation:g,onChange:Y,onChangeEnd:$?()=>$(R.current):void 0})]}):e.jsx(zt,{value:H,min:a,max:l,step:d,isDisabled:m,trackColor:F,trackHeight:W.track,thumbSize:W.thumb,ariaLabel:he??"Slider",tooltipMode:ne,formatValue:Z,orientation:g,onChange:te,onChangeEnd:v?()=>v(_.current):void 0})]}),y&&y.length>0&&e.jsx("div",{style:{position:K?"absolute":"relative",...K?{left:"100%",top:0,bottom:0,marginLeft:8}:{marginTop:8}},children:y.map((de,xe)=>e.jsx("div",{style:{position:"absolute",...K?{bottom:`${tt(de.value,a,l)}%`,transform:"translateY(50%)",left:0}:{left:`${tt(de.value,a,l)}%`,transform:"translateX(-50%)"},fontSize:"0.6875rem",color:N.textMuted,whiteSpace:"nowrap"},children:A.sanitizeString(de.label)},xe))})]}),h&&!y&&!K&&e.jsx("div",{style:{position:"relative",height:"1rem"},children:ge.map((de,xe)=>e.jsx("span",{style:{position:"absolute",left:`${tt(de,a,l)}%`,transform:"translateX(-50%)",fontSize:"0.6875rem",color:N.textMuted},children:Z(Math.round(de))},xe))})]})}cr.displayName="TkxSlider";const Xs={sm:{height:28,minWidth:28,fontSize:"0.75rem",px:8},md:{height:36,minWidth:36,fontSize:"0.875rem",px:10},lg:{height:44,minWidth:44,fontSize:"1rem",px:12}};function Zs(t,n,r,o){if(n<=1)return[1];const s=(b,k)=>Array.from({length:Math.max(0,k-b+1)},(y,g)=>b+g),a=Math.max(t-r,1),l=Math.min(t+r,n);if(!o){const b=[];return a>1&&b.push("..."),b.push(...s(a,l)),l<n&&b.push("..."),b}const d=1,f=n,u=a>d+2,c=l<f-2,h=[];h.push(1),u?h.push("left-ellipsis"):h.push(...s(2,a-1)),h.push(...s(Math.max(a,2),Math.min(l,n-1))),c?h.push("right-ellipsis"):h.push(...s(l+1,n-1)),n>1&&h.push(n);const p=new Set,m=[];for(const b of h)typeof b=="number"?p.has(b)||(p.add(b),m.push(b)):m.push(b);return m}function dr({total:t,pageSize:n=10,page:r,defaultPage:o=1,onChange:s,siblingCount:a=1,showEdges:l=!0,showPageSize:d=!1,onPageSizeChange:f,pageSizeOptions:u=[10,25,50,100],size:c="md",variant:h="default"}){const p=O.useTheme(),m=i.useId(),b=r!==void 0,[k,y]=i.useState(o),g=b?r:k,[S,j]=i.useState(n),v=n,$=Math.max(1,Math.ceil(t/v)),w=z=>{const L=Math.min(Math.max(z,1),$);L!==g&&(b||y(L),s==null||s(L))},N=z=>{j(z),f==null||f(z),w(1)},I=Zs(g,$,a,l),M=Xs[c],T=Math.min((g-1)*v+1,t),E=Math.min(g*v,t),C=(z,L)=>{const B={height:M.height,minWidth:M.minWidth,paddingLeft:M.px,paddingRight:M.px,fontSize:M.fontSize,borderRadius:"8px",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:L?"not-allowed":"pointer",border:"none",outline:"none",fontFamily:"inherit",transition:"background 120ms ease, color 120ms ease",opacity:L?.4:1};return z?{...B,backgroundColor:p.primary,color:p.bg,fontWeight:600,boxShadow:`0 0 0 2px ${p.primary}44`}:h==="default"?{...B,backgroundColor:p.surface,color:p.text,border:`1px solid ${p.border}`}:h==="outline"?{...B,backgroundColor:"transparent",color:p.text,border:`1px solid ${p.border}`}:{...B,backgroundColor:"transparent",color:p.text}},H=({d:z})=>e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5","aria-hidden":"true",children:e.jsx("polyline",{points:z})});return e.jsxs("nav",{"aria-label":"Pagination",className:x.tkx("flex flex-col gap-2"),children:[t>0&&e.jsx("p",{className:x.tkx("text-sm"),style:{color:p.textMuted,fontSize:M.fontSize},children:A.sanitizeString(`Showing ${T}–${E} of ${t} items`)}),e.jsxs("div",{className:x.tkx("flex items-center gap-1 flex-wrap"),children:[l&&e.jsxs("button",{type:"button","aria-label":"First page",disabled:g===1,onClick:()=>w(1),style:C(!1,g===1),children:[e.jsx(H,{d:"15 18 9 12 15 6"}),e.jsx(H,{d:"20 18 14 12 20 6"})]}),e.jsx("button",{type:"button","aria-label":"Previous page",disabled:g===1,onClick:()=>w(g-1),style:C(!1,g===1),children:e.jsx(H,{d:"15 18 9 12 15 6"})}),I.map((z,L)=>{if(typeof z=="string")return e.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:M.minWidth,height:M.height,fontSize:M.fontSize,color:p.textMuted,userSelect:"none"},children:"…"},`${z}-${L}`);const V=z,D=V===g;return e.jsx("button",{type:"button","aria-label":`Page ${V}`,"aria-current":D?"page":void 0,onClick:()=>w(V),style:C(D,!1),children:V},V)}),e.jsx("button",{type:"button","aria-label":"Next page",disabled:g===$,onClick:()=>w(g+1),style:C(!1,g===$),children:e.jsx(H,{d:"9 18 15 12 9 6"})}),l&&e.jsxs("button",{type:"button","aria-label":"Last page",disabled:g===$,onClick:()=>w($),style:C(!1,g===$),children:[e.jsx(H,{d:"4 18 10 12 4 6"}),e.jsx(H,{d:"14 18 20 12 14 6"})]}),d&&e.jsxs("div",{className:x.tkx("flex items-center gap-2 ml-2"),children:[e.jsx("label",{htmlFor:m,className:x.tkx("text-sm"),style:{color:p.textMuted,fontSize:M.fontSize,whiteSpace:"nowrap"},children:"Rows per page"}),e.jsx("select",{id:m,value:S,onChange:z=>N(Number(z.target.value)),style:{height:M.height,paddingLeft:M.px,paddingRight:M.px,fontSize:M.fontSize,borderRadius:"8px",border:`1px solid ${p.border}`,backgroundColor:p.surface,color:p.text,cursor:"pointer",outline:"none",fontFamily:"inherit"},children:u.map(z=>e.jsx("option",{value:z,children:z},z))})]})]})]})}dr.displayName="TkxPagination";const Gs={"1/1":"100%","4/3":"75%","16/9":"56.25%","3/2":"66.666%","9/16":"177.777%"},qs={none:"0",sm:"4px",md:"8px",lg:"16px",full:"9999px"};function Qs({color:t,size:n}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.jsx("path",{d:"M21 15l-5-5L5 21"})]})}function Js({src:t,alt:n,fallback:r,placeholder:o="skeleton",fit:s="cover",ratio:a="auto",radius:l="none",caption:d,lazy:f=!0,preview:u=!1,className:c,style:h,...p}){const m=O.useTheme(),b=J.useReducedMotion(),[k,y]=i.useState(!1),[g,S]=i.useState(!1),[j,v]=i.useState(!1),$=i.useRef(null),w=A.sanitizeString(t),N=n?A.sanitizeString(n):"",I=d?A.sanitizeString(d):"",M=qs[l];i.useEffect(()=>{var K;(K=$.current)!=null&&K.complete&&y(!0)},[]);const T=i.useCallback(()=>y(!0),[]),E=i.useCallback(()=>S(!0),[]),C=i.useCallback(()=>{u&&!g&&v(!0)},[u,g]),H=i.useCallback(()=>v(!1),[]);i.useEffect(()=>{if(!j)return;const K=ne=>{ne.key==="Escape"&&H()};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[j,H]);const z=o==="skeleton"&&!k&&!g,L=z&&!b?{animation:"tkx-shimmer 1.5s ease-in-out infinite"}:{},B=g?null:e.jsx("img",{ref:$,src:w,alt:N||void 0,role:N?void 0:"img","aria-label":N?void 0:"Image",loading:f?"lazy":void 0,onLoad:T,onError:E,onClick:u?C:void 0,className:x.cx(x.tkx("block w-full h-full"),u&&!g?x.tkx("cursor-pointer"):""),style:{objectFit:s,borderRadius:M,opacity:k?1:0,transition:b?"none":"opacity 200ms ease",position:a==="auto"?void 0:"absolute",inset:a==="auto"?void 0:0},...p}),V=g?r?e.jsx(e.Fragment,{children:r}):e.jsxs("div",{role:"img","aria-label":N||"Image failed to load",className:x.tkx("flex flex-col items-center justify-center gap-2 w-full h-full"),style:{backgroundColor:m.surfaceAlt,borderRadius:M,color:m.textMuted,minHeight:"80px"},children:[e.jsx(Qs,{color:m.textMuted,size:32}),e.jsx("span",{className:x.tkx("text-xs"),style:{color:m.textMuted},children:"Failed to load"})]}):null,D=z?e.jsx("div",{"aria-hidden":"true",style:{position:a==="auto"?void 0:"absolute",inset:a==="auto"?void 0:0,width:"100%",height:a==="auto"?"100%":void 0,minHeight:a==="auto"?"80px":void 0,borderRadius:M,backgroundColor:m.surfaceAlt,...L}}):null,_=a==="auto"?e.jsxs("div",{className:x.tkx("relative w-full"),style:{borderRadius:M},children:[D,B,V]}):e.jsxs("div",{className:x.tkx("relative w-full overflow-hidden"),style:{paddingBottom:Gs[a],borderRadius:M},children:[D,B,V]}),R=I?e.jsxs("figure",{className:x.tkx("m-0 p-0 flex flex-col gap-2"),style:{borderRadius:M},children:[_,e.jsx("figcaption",{className:x.tkx("text-sm text-center"),style:{color:m.textMuted},children:I})]}):_,F=e.jsx("div",{className:x.cx(x.tkx("inline-block w-full"),c),style:h,children:R}),W=j&&typeof document<"u"?Re.createPortal(e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":N||"Image preview",className:x.tkx("fixed inset-0 z-[9500] flex items-center justify-center p-4"),onClick:H,children:[e.jsx("div",{"aria-hidden":"true",className:x.tkx("absolute inset-0"),style:{backgroundColor:"rgba(0,0,0,0.85)",backdropFilter:"blur(6px)"}}),e.jsx("img",{src:w,alt:N||"Full-size preview",onClick:K=>K.stopPropagation(),className:x.tkx("relative z-10 max-w-full max-h-full"),style:{objectFit:"contain",borderRadius:"8px",boxShadow:"0 25px 60px rgba(0,0,0,0.5)"}}),e.jsx("button",{"aria-label":"Close preview",onClick:H,className:x.tkx("absolute top-4 right-4 z-10 flex items-center justify-center","bg-transparent border-none cursor-pointer rounded-full p-2"),style:{color:"#fff",backgroundColor:"rgba(255,255,255,0.15)"},children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),document.body):null;return e.jsxs(e.Fragment,{children:[F,W]})}function ln(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function eo({mimeType:t,color:n}){return t.startsWith("image/")?e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.jsx("path",{d:"M21 15l-5-5L5 21"})]}):t==="application/pdf"?e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"9",y1:"13",x2:"15",y2:"13"}),e.jsx("line",{x1:"9",y1:"17",x2:"11",y2:"17"})]}):e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]})}let to=0;function no(){return`tkx-file-${++to}`}function ro({accept:t,multiple:n=!1,maxSize:r,maxFiles:o,onChange:s,onError:a,label:l="Upload files",hint:d,isDisabled:f=!1,preview:u=!0,dragDrop:c=!0,variant:h="dropzone"}){const p=O.useTheme(),m=J.useReducedMotion(),b=i.useId(),k=i.useRef(null),[y,g]=i.useState(!1),[S,j]=i.useState([]);i.useEffect(()=>()=>{S.forEach(D=>{D.objectUrl&&URL.revokeObjectURL(D.objectUrl)})},[]);const v=i.useCallback(D=>{let _=0;const R=setInterval(()=>{_+=Math.floor(Math.random()*20)+10,_>=100&&(_=100,clearInterval(R)),j(F=>F.map(W=>W.id===D?{...W,progress:_}:W))},100)},[]),$=i.useCallback(D=>{if(r&&D.size>r)return`"${A.sanitizeString(D.name)}" exceeds max size of ${ln(r)}`;if(t&&!t.split(",").map(F=>F.trim()).some(F=>F.startsWith(".")?D.name.toLowerCase().endsWith(F.toLowerCase()):F.endsWith("/*")?D.type.startsWith(F.slice(0,-1)):D.type===F))return`"${A.sanitizeString(D.name)}" is not an accepted file type`},[t,r]),w=i.useCallback(D=>{const _=o?o-S.length:1/0;if(_<=0){a==null||a(`Maximum of ${o} file${o===1?"":"s"} allowed`);return}const F=D.slice(0,_).map(W=>{const K=$(W),ne=u&&W.type.startsWith("image/")&&!K?URL.createObjectURL(W):void 0;return{file:W,id:no(),objectUrl:ne,progress:0,error:K}});j(W=>{const K=n?[...W,...F]:F,ne=K.filter(Z=>!Z.error).map(Z=>Z.file);return s==null||s(ne),K}),F.forEach(W=>{W.error&&(a==null||a(W.error))}),F.forEach(W=>{W.error||v(W.id)})},[S.length,o,n,s,a,u,v,$]),N=i.useCallback(D=>{const _=Array.from(D.target.files??[]);_.length&&w(_),D.target.value=""},[w]),I=i.useCallback(D=>{if(D.preventDefault(),g(!1),f)return;const _=Array.from(D.dataTransfer.files);_.length&&w(_)},[f,w]),M=i.useCallback(D=>{D.preventDefault(),f||g(!0)},[f]),T=i.useCallback(()=>g(!1),[]),E=i.useCallback(D=>{j(_=>{const R=_.find(W=>W.id===D);R!=null&&R.objectUrl&&URL.revokeObjectURL(R.objectUrl);const F=_.filter(W=>W.id!==D);return s==null||s(F.filter(W=>!W.error).map(W=>W.file)),F})},[s]),C=i.useCallback(()=>{var D;f||(D=k.current)==null||D.click()},[f]),H=y?p.primary:p.border,z=A.sanitizeString(l),L=d?A.sanitizeString(d):"",B=e.jsxs("div",{role:"button",tabIndex:f?-1:0,"aria-label":z,"aria-describedby":d?b:void 0,"aria-disabled":f,onClick:C,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),C())},onDrop:c?I:void 0,onDragOver:c?M:void 0,onDragLeave:c?T:void 0,className:x.tkx("flex flex-col items-center justify-center gap-3 w-full p-8 rounded-lg"),style:{border:`2px dashed ${H}`,backgroundColor:y?`${p.primary}10`:p.surface,cursor:f?"not-allowed":"pointer",opacity:f?.5:1,transition:m?"none":"border-color 150ms ease, background-color 150ms ease",outline:"none"},children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:y?p.primary:p.textMuted,strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),e.jsxs("div",{className:x.tkx("text-center"),children:[e.jsx("p",{className:x.tkx("m-0 text-sm font-medium"),style:{color:p.text},children:y?"Drop files here":z}),L&&e.jsx("p",{id:b,className:x.tkx("m-0 text-xs mt-1"),style:{color:p.textMuted},children:L})]})]}),V=e.jsxs("button",{type:"button",disabled:f,onClick:C,"aria-describedby":d?b:void 0,className:x.tkx("flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium font-sans border-none cursor-pointer"),style:{backgroundColor:p.primary,color:p.bg,opacity:f?.5:1,cursor:f?"not-allowed":"pointer"},children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),z,d&&e.jsx("span",{id:b,className:x.tkx("sr-only"),children:L})]});return e.jsxs("div",{className:x.tkx("flex flex-col gap-3 w-full font-sans"),children:[e.jsx("input",{ref:k,type:"file",accept:t,multiple:n,disabled:f,onChange:N,className:x.tkx("sr-only"),tabIndex:-1,"aria-hidden":"true"}),h==="dropzone"?B:V,S.length>0&&e.jsx("ul",{role:"status","aria-live":"polite","aria-label":"Uploaded files",className:x.tkx("m-0 p-0 flex flex-col gap-2"),style:{listStyle:"none"},children:S.map(D=>e.jsxs("li",{className:x.tkx("flex flex-col gap-1 rounded-md p-3"),style:{backgroundColor:p.surfaceAlt,border:`1px solid ${D.error?p.danger:p.border}`},children:[e.jsxs("div",{className:x.tkx("flex items-center gap-3"),children:[D.objectUrl&&u?e.jsx("img",{src:D.objectUrl,alt:A.sanitizeString(D.file.name),className:x.tkx("rounded"),style:{width:40,height:40,objectFit:"cover",flexShrink:0}}):e.jsx("span",{style:{flexShrink:0},children:e.jsx(eo,{mimeType:D.file.type,color:D.error?p.danger:p.textMuted})}),e.jsxs("div",{className:x.tkx("flex flex-col gap-0.5 flex-1 min-w-0"),children:[e.jsx("span",{className:x.tkx("text-sm font-medium truncate"),style:{color:D.error?p.danger:p.text},title:D.file.name,children:A.sanitizeString(D.file.name)}),e.jsxs("span",{className:x.tkx("text-xs"),style:{color:p.textMuted},children:[ln(D.file.size),D.error&&` — ${D.error}`]})]}),e.jsx("button",{type:"button","aria-label":`Remove ${A.sanitizeString(D.file.name)}`,onClick:()=>E(D.id),className:x.tkx("flex items-center justify-center bg-transparent border-none cursor-pointer rounded p-1"),style:{color:p.textMuted,flexShrink:0},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),!D.error&&D.progress<100&&e.jsx("div",{className:x.tkx("w-full overflow-hidden"),style:{height:"3px",borderRadius:"3px",backgroundColor:p.border},"aria-hidden":"true",children:e.jsx("div",{style:{height:"100%",borderRadius:"3px",backgroundColor:p.primary,width:`${D.progress}%`,transition:m?"none":"width 100ms ease"}})})]},D.id))})]})}const so={sm:16,md:24,lg:32,xl:40};function oo({size:t,filled:n,color:r,halfFilled:o,id:s}){const a=s?`hg-${s}`:void 0;return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[o&&a&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:a,x1:"0",x2:"1",y1:"0",y2:"0",children:[e.jsx("stop",{offset:"50%",stopColor:r}),e.jsx("stop",{offset:"50%",stopColor:"transparent"})]})}),e.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",fill:o&&a?`url(#${a})`:n?r:"none",stroke:r,strokeWidth:1.5,strokeLinejoin:"round"})]})}function io({size:t,filled:n,color:r,halfFilled:o,id:s}){const a=s?`hg-${s}`:void 0;return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[o&&a&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:a,x1:"0",x2:"1",y1:"0",y2:"0",children:[e.jsx("stop",{offset:"50%",stopColor:r}),e.jsx("stop",{offset:"50%",stopColor:"transparent"})]})}),e.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z",fill:o&&a?`url(#${a})`:n?r:"none",stroke:r,strokeWidth:1.5,strokeLinejoin:"round"})]})}function ao({size:t,filled:n,color:r,halfFilled:o,id:s}){const a=s?`hg-${s}`:void 0;return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24","aria-hidden":"true",style:{display:"block"},children:[o&&a&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:a,x1:"0",x2:"1",y1:"0",y2:"0",children:[e.jsx("stop",{offset:"50%",stopColor:r}),e.jsx("stop",{offset:"50%",stopColor:"transparent"})]})}),e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:o&&a?`url(#${a})`:n?r:"none",stroke:r,strokeWidth:1.5})]})}function lo({type:t,size:n,filled:r,color:o,halfFilled:s,uid:a}){const l={size:n,filled:r,color:o,halfFilled:s,id:a};return t==="heart"?e.jsx(io,{...l}):t==="circle"?e.jsx(ao,{...l}):e.jsx(oo,{...l})}function cn(t,n,r){return Math.min(r,Math.max(n,t))}function co(t,n){return n===1?Math.round(t):Math.round(t*2)/2}function dn(t,n,r){if(r===1)return n+1;const o=t.currentTarget.getBoundingClientRect(),s=o.left+o.width/2;return t.clientX<s?n+.5:n+1}function uo({value:t,defaultValue:n=0,onChange:r,max:o=5,precision:s=1,size:a="md",isReadOnly:l=!1,isDisabled:d=!1,label:f,showValue:u=!1,colorScheme:c="warning",emptyIcon:h="star",filledIcon:p="star"}){const m=O.useTheme(),b=J.useReducedMotion(),k=i.useId(),y=t!==void 0,[g,S]=i.useState(n),[j,v]=i.useState(null),$=i.useRef(null),w=y?t??0:g,N=j??w,M={warning:m.warning,primary:m.primary,danger:m.danger}[c]??m.warning,T=so[a],E=!l&&!d,C=i.useCallback(D=>{y||S(D),r==null||r(D)},[y,r]),H=i.useCallback((D,_)=>{E&&v(dn(D,_,s))},[E,s]),z=i.useCallback(()=>{E&&v(null)},[E]),L=i.useCallback((D,_)=>{if(!E)return;const R=dn(D,_,s);C(R===w?0:R)},[E,s,w,C]),B=i.useCallback(D=>{if(!E)return;const _=s;let R=w;if(D.key==="ArrowRight"||D.key==="ArrowUp")D.preventDefault(),R=cn(w+_,0,o);else if(D.key==="ArrowLeft"||D.key==="ArrowDown")D.preventDefault(),R=cn(w-_,0,o);else if(D.key==="Home")D.preventDefault(),R=0;else if(D.key==="End")D.preventDefault(),R=o;else return;R=co(R,s),C(R)},[E,w,o,s,C]),V=f?A.sanitizeString(f):"Rating";return e.jsxs("div",{className:x.cx(x.tkx("inline-flex items-center gap-2 font-sans"),d?x.tkx("opacity-50"):""),children:[e.jsx("div",{ref:$,role:"radiogroup","aria-label":V,"aria-disabled":d,"aria-readonly":l,tabIndex:E?0:-1,onKeyDown:B,onMouseLeave:z,className:x.tkx("flex items-center gap-0.5 outline-none"),style:{cursor:E?"pointer":"default"},children:Array.from({length:o},(D,_)=>{const R=_+1,F=_+.5,W=N>=R,K=!W&&s===.5&&N>=F,ne=`${k}-${_}`;return e.jsx("span",{role:"radio","aria-checked":s===.5&&w===F||w===R,"aria-label":s===.5?`${F} star${F!==1?"s":""} / ${R} star${R!==1?"s":""}`:`${R} star${R!==1?"s":""}`,tabIndex:-1,onMouseMove:Z=>H(Z,_),onClick:Z=>L(Z,_),style:{display:"inline-flex",alignItems:"center",lineHeight:0,transition:b?"none":"transform 120ms ease",transform:j!==null&&N>=F&&E?"scale(1.15)":"scale(1)"},children:e.jsx(lo,{type:W||K?p:h,size:T,filled:W,halfFilled:K,color:W||K?M:m.border,uid:K?ne:void 0})},_)})}),u&&e.jsxs("span",{className:x.tkx("text-sm tabular-nums"),style:{color:m.textMuted},"aria-live":"polite","aria-atomic":"true",children:[w%1===0?w.toFixed(0):w.toFixed(1)," / ",o]})]})}let un=!1;function fo(){if(un||typeof document>"u")return;un=!0;const t=document.createElement("style");t.textContent=`
20
+ `,document.head.appendChild(e)}},[]),typeof document>`u`)return(0,s.jsx)(s.Fragment,{children:t});let p=u?[...i].reverse():i;return(0,s.jsxs)(s.Fragment,{children:[t,(0,c.createPortal)((0,s.jsx)(`div`,{"aria-label":`Notifications`,className:n.a(`fixed z-[9999] flex flex-col gap-2 pointer-events-none`),style:d,children:p.map(t=>(0,s.jsx)(`div`,{className:n.a(`pointer-events-auto`),children:(0,s.jsx)(Te,{toast:t,position:e,onDismiss:ve,reduced:l})},t.id))}),document.body)]})}var De={sm:{triggerPadding:`10px 12px`,contentPadding:`0 12px 10px 12px`,fontSize:`13px`,subtitleSize:`11px`,iconSize:14},md:{triggerPadding:`14px 16px`,contentPadding:`0 16px 14px 16px`,fontSize:`14px`,subtitleSize:`12px`,iconSize:16},lg:{triggerPadding:`18px 20px`,contentPadding:`0 20px 18px 20px`,fontSize:`16px`,subtitleSize:`13px`,iconSize:18}};function Oe({open:e,reduced:t,iconStyle:n,size:r,color:i}){let a=t?`none`:`transform 240ms cubic-bezier(0.4, 0, 0.2, 1)`;return n===`chevron`?(0,s.jsx)(`svg`,{width:r,height:r,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:2.5,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{transform:e?`rotate(180deg)`:`rotate(0deg)`,transition:a,flexShrink:0},children:(0,s.jsx)(`polyline`,{points:`6 9 12 15 18 9`})}):n===`plus`?(0,s.jsxs)(`svg`,{width:r,height:r,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:2.5,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{transform:e?`rotate(45deg)`:`rotate(0deg)`,transition:a,flexShrink:0},children:[(0,s.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,s.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}):(0,s.jsxs)(`svg`,{width:r,height:r,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:2.5,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{transform:e?`rotate(90deg)`:`rotate(0deg)`,transition:a,flexShrink:0},children:[(0,s.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,s.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})}function ke({isOpen:e,reduced:t,children:n,id:r,triggerId:i}){let a=(0,o.useRef)(null),c=(0,o.useRef)(null),l=(0,o.useRef)(e),u=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{let t=a.current;t&&(e?(t.style.height=`auto`,t.style.overflow=`visible`):(t.style.height=`0px`,t.style.overflow=`hidden`))},[]),(0,o.useEffect)(()=>{if(l.current===e)return;l.current=e;let n=a.current,r=c.current;if(!(!n||!r)){if(t){n.style.height=e?`auto`:`0px`,n.style.overflow=e?`visible`:`hidden`;return}if(u.current){let e=n.getBoundingClientRect().height;n.style.transition=`none`,n.style.height=`${e}px`,n.offsetHeight}u.current=!0,n.style.overflow=`hidden`,e?(n.style.height=`0px`,n.style.transition=`height 280ms cubic-bezier(0.4, 0, 0.2, 1)`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n.style.height=`${r.scrollHeight}px`})})):(n.style.height=`${r.scrollHeight}px`,n.style.transition=`height 280ms cubic-bezier(0.4, 0, 0.2, 1)`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n.style.height=`0px`})}))}},[e,t]),(0,s.jsx)(`div`,{ref:a,id:r,role:`region`,"aria-labelledby":i,onTransitionEnd:t=>{if(t.propertyName!==`height`)return;u.current=!1;let n=a.current;n&&(e?(n.style.height=`auto`,n.style.overflow=`visible`):n.style.overflow=`hidden`)},style:{willChange:`height`},children:(0,s.jsx)(`div`,{ref:c,children:n})})}function Ae({items:e,multiple:i=!1,defaultOpen:a,value:c,onChange:l,variant:u=`default`,size:d=`md`,iconPosition:f=`right`,iconStyle:p=`chevron`,flush:m=!1,className:h,style:g}){let _=t.f(),v=r.o(),y=(0,o.useId)(),b=c!==void 0,x=e=>e?Array.isArray(e)?new Set(e):new Set([e]):new Set,[S,C]=(0,o.useState)(()=>x(a)),w=b?x(c):S,T=(0,o.useCallback)((e,t)=>{if(t)return;let n;if(b){let t=x(c);n=new Set(t),n.has(e)?n.delete(e):(i||n.clear(),n.add(e))}else{C(t=>{n=new Set(t),n.has(e)?n.delete(e):(i||n.clear(),n.add(e));let r=[...n];return l?.(i?r:r[0]??``),n});return}let r=[...n];l?.(i?r:r[0]??``)},[i,l,b,c]),E=De[d],D=()=>{if(m)return{};switch(u){case`bordered`:return{border:`1px solid ${_.border}`,borderRadius:`10px`,overflow:`hidden`};case`separated`:return{};case`ghost`:case`flush`:return{};default:return{}}},O=(e,t,n)=>{if(m)return{};switch(u){case`default`:return{borderBottom:n?`none`:`1px solid ${_.border}`};case`bordered`:return{borderBottom:n?`none`:`1px solid ${_.border}`};case`separated`:return{border:`1px solid ${_.border}`,borderRadius:`10px`,overflow:`hidden`,boxShadow:`0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04)`};case`ghost`:return{};default:return{}}},k=e=>u===`ghost`||u===`flush`?e?`${_.primary}10`:`${_.surfaceAlt}80`:e?`${_.primary}0d`:`${_.surfaceAlt}60`,A=u===`separated`;return(0,s.jsx)(`div`,{className:n.a(h??``),style:{...D(),display:A?`flex`:void 0,flexDirection:A?`column`:void 0,gap:A?`8px`:void 0,...g},children:e.map((t,n)=>{let r=w.has(t.id),i=n===e.length-1,a=`${y}-trigger-${t.id}`,o=`${y}-panel-${t.id}`;return(0,s.jsxs)(`div`,{className:t.className,style:O(n,r,i),children:[(0,s.jsxs)(`button`,{id:a,type:`button`,role:`button`,"aria-expanded":r,"aria-controls":o,disabled:t.disabled,onClick:()=>T(t.id,t.disabled),style:{width:`100%`,display:`flex`,alignItems:t.subtitle?`flex-start`:`center`,gap:`8px`,padding:E.triggerPadding,border:`none`,background:`transparent`,cursor:t.disabled?`not-allowed`:`pointer`,textAlign:`left`,fontFamily:`inherit`,fontSize:E.fontSize,fontWeight:500,color:t.disabled?_.textMuted:_.text,opacity:t.disabled?.5:1,transition:v?`none`:`background-color 160ms ease`,outline:`none`},onMouseEnter:e=>{t.disabled||(e.currentTarget.style.backgroundColor=k(r))},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=r?`${_.primary}0d`:`transparent`},onFocus:e=>{t.disabled||(e.currentTarget.style.outline=`2px solid ${_.primary}`,e.currentTarget.style.outlineOffset=`2px`)},onBlur:e=>{e.currentTarget.style.outline=`none`},children:[t.icon&&(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{display:`flex`,alignItems:`center`,flexShrink:0,color:_.primary,marginTop:t.subtitle?`1px`:void 0},children:t.icon}),f===`left`&&(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{display:`flex`,alignItems:`center`,flexShrink:0,color:r?_.primary:_.textMuted,marginTop:t.subtitle?`1px`:void 0},children:(0,s.jsx)(Oe,{open:r,reduced:v,iconStyle:p,size:E.iconSize,color:r?_.primary:_.textMuted})}),(0,s.jsxs)(`span`,{style:{flex:1,minWidth:0},children:[(0,s.jsx)(`span`,{style:{display:`block`,lineHeight:1.4},children:t.title}),t.subtitle&&(0,s.jsx)(`span`,{style:{display:`block`,fontSize:E.subtitleSize,color:_.textMuted,fontWeight:400,marginTop:`2px`,lineHeight:1.3},children:t.subtitle})]}),t.badge&&(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{display:`flex`,alignItems:`center`,flexShrink:0},children:t.badge}),f===`right`&&(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{display:`flex`,alignItems:`center`,flexShrink:0,color:r?_.primary:_.textMuted,marginTop:t.subtitle?`1px`:void 0},children:(0,s.jsx)(Oe,{open:r,reduced:v,iconStyle:p,size:E.iconSize,color:r?_.primary:_.textMuted})})]}),(0,s.jsx)(ke,{isOpen:r,reduced:v,id:o,triggerId:a,children:(0,s.jsx)(`div`,{style:{padding:E.contentPadding,fontSize:E.fontSize,lineHeight:1.6,color:_.textMuted,fontFamily:`inherit`},children:t.content})})]},t.id)})})}Ae.displayName=`TkxAccordion`;var je={sm:`280px`,md:`380px`,lg:`480px`,xl:`600px`,full:`100%`},Me=0;function Ne(){++Me===1&&(document.body.style.overflow=`hidden`)}function Pe(){--Me<=0&&(Me=0,document.body.style.overflow=``)}function Fe(e){switch(e){case`left`:return`translateX(-100%)`;case`right`:return`translateX(100%)`;case`top`:return`translateY(-100%)`;case`bottom`:return`translateY(100%)`}}function Ie(e,t){let n=je[t],r=e===`left`||e===`right`,i={position:`absolute`};return r?{...i,top:0,bottom:0,[e]:0,width:n,maxWidth:`100vw`,height:`100%`}:{...i,left:0,right:0,[e]:0,height:n,maxHeight:`100vh`,width:`100%`}}function Le(){return(0,s.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:[(0,s.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,s.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})}function Re({isOpen:e,onClose:i,placement:a=`right`,size:l=`md`,title:u,children:d,footer:f,closeOnOverlayClick:p=!0,closeOnEsc:m=!0}){let h=t.f(),g=r.o(),_=(0,o.useId)(),v=r.i(e);if(r.r(i,m&&e),(0,o.useEffect)(()=>(e?Ne():Pe(),()=>{e&&Pe()}),[e]),typeof document>`u`)return null;let y=Ie(a,l),b=Fe(a),x=g?`none`:`transform 280ms cubic-bezier(0.4,0,0.2,1), opacity 280ms ease`,S=typeof u==`string`?n.m(u):u;return(0,c.createPortal)((0,s.jsxs)(`div`,{role:`presentation`,className:n.a(`fixed inset-0 z-[9000]`),style:{pointerEvents:e?`auto`:`none`,visibility:e?`visible`:`hidden`},children:[(0,s.jsx)(`div`,{"aria-hidden":`true`,onClick:p?i:void 0,className:n.a(`absolute inset-0`),style:{backgroundColor:`rgba(0,0,0,0.55)`,backdropFilter:`blur(3px)`,opacity:+!!e,transition:g?`none`:`opacity 280ms ease`,cursor:p?`pointer`:`default`}}),(0,s.jsxs)(`div`,{ref:v,role:`dialog`,"aria-modal":`true`,"aria-labelledby":u?_:void 0,className:n.a(`absolute flex flex-col font-sans`),style:{...y,backgroundColor:h.surface,borderLeft:a===`right`?`1px solid ${h.border}`:void 0,borderRight:a===`left`?`1px solid ${h.border}`:void 0,borderTop:a===`bottom`?`1px solid ${h.border}`:void 0,borderBottom:a===`top`?`1px solid ${h.border}`:void 0,boxShadow:`0 20px 60px ${h.bg}99`,transform:e?`translate(0,0)`:b,opacity:+!!e,transition:x,willChange:`transform`},children:[u!==void 0&&(0,s.jsxs)(`div`,{className:n.a(`flex items-center justify-between px-5 py-4 shrink-0`),style:{borderBottom:`1px solid ${h.border}`},children:[(0,s.jsx)(`h2`,{id:_,className:n.a(`m-0 text-base font-semibold leading-snug`),style:{color:h.text},children:S}),(0,s.jsx)(`button`,{onClick:i,"aria-label":`Close drawer`,className:n.a(`bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring`),style:{color:h.textMuted},children:(0,s.jsx)(Le,{})})]}),u===void 0&&(0,s.jsx)(`div`,{className:n.a(`flex justify-end px-3 pt-3 shrink-0`),children:(0,s.jsx)(`button`,{onClick:i,"aria-label":`Close drawer`,className:n.a(`bg-transparent border-none cursor-pointer rounded p-1 flex items-center justify-center focus-visible:focus-ring`),style:{color:h.textMuted},children:(0,s.jsx)(Le,{})})}),(0,s.jsx)(`div`,{className:n.a(`flex-1 overflow-y-auto px-5 py-4`),style:{color:h.text},children:d}),f&&(0,s.jsx)(`div`,{className:n.a(`flex items-center justify-end gap-2 px-5 py-4 shrink-0`),style:{borderTop:`1px solid ${h.border}`},children:f})]})]}),document.body)}var ze=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],Be=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Ve=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function He(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Ue(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function We(e,t,n){if(!t||!n)return!1;let r=Ue(e).getTime(),i=Ue(t).getTime(),a=Ue(n).getTime();return r>Math.min(i,a)&&r<Math.max(i,a)}function Ge(e,t,n){return!!(t&&He(e,t)||n&&He(e,n))}function Ke(e,t=`en-US`){return e?e.toLocaleDateString(t,{month:`2-digit`,day:`2-digit`,year:`numeric`}):``}function qe(e){let t=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(!t)return null;let[,n,r,i]=t.map(Number);if(n<1||n>12||r<1||r>31)return null;let a=new Date(i,n-1,r);return a.getMonth()===n-1?a:null}function Je(e,t){return new Date(e,t+1,0).getDate()}function Ye(e,t){let n=new Date(e,t,1).getDay(),r=Je(e,t),i=[],a=Je(e,t-1);for(let r=n-1;r>=0;r--)i.push(new Date(e,t-1,a-r));for(let n=1;n<=r;n++)i.push(new Date(e,t,n));let o=1;for(;i.length<42;)i.push(new Date(e,t+1,o++));return i}function Xe(e){return Math.floor(e/10)*10}function Ze(){return[{label:`Today`,getValue:()=>{let e=Ue(new Date);return[e,e]}},{label:`Yesterday`,getValue:()=>{let e=Ue(new Date);return e.setDate(e.getDate()-1),[e,e]}},{label:`Last 7 days`,getValue:()=>{let e=Ue(new Date),t=new Date(e);return t.setDate(t.getDate()-6),[t,e]}},{label:`Last 30 days`,getValue:()=>{let e=Ue(new Date),t=new Date(e);return t.setDate(t.getDate()-29),[t,e]}},{label:`Last 90 days`,getValue:()=>{let e=Ue(new Date),t=new Date(e);return t.setDate(t.getDate()-89),[t,e]}},{label:`This week`,getValue:()=>{let e=Ue(new Date),t=new Date(e);t.setDate(t.getDate()-t.getDay());let n=new Date(t);return n.setDate(n.getDate()+6),[t,n]}},{label:`Last week`,getValue:()=>{let e=Ue(new Date),t=new Date(e);t.setDate(t.getDate()-t.getDay()-1);let n=new Date(t);return n.setDate(n.getDate()-6),[n,t]}},{label:`This month`,getValue:()=>{let e=new Date;return[new Date(e.getFullYear(),e.getMonth(),1),new Date(e.getFullYear(),e.getMonth()+1,0)]}},{label:`Last month`,getValue:()=>{let e=new Date;return[new Date(e.getFullYear(),e.getMonth()-1,1),new Date(e.getFullYear(),e.getMonth(),0)]}},{label:`This quarter`,getValue:()=>{let e=new Date,t=Math.floor(e.getMonth()/3);return[new Date(e.getFullYear(),t*3,1),new Date(e.getFullYear(),t*3+3,0)]}},{label:`Last quarter`,getValue:()=>{let e=new Date,t=Math.floor(e.getMonth()/3),n=t===0?3:t-1,r=t===0?e.getFullYear()-1:e.getFullYear();return[new Date(r,n*3,1),new Date(r,n*3+3,0)]}},{label:`This year`,getValue:()=>{let e=new Date().getFullYear();return[new Date(e,0,1),new Date(e,11,31)]}},{label:`Last year`,getValue:()=>{let e=new Date().getFullYear()-1;return[new Date(e,0,1),new Date(e,11,31)]}}]}function Qe(e,t){let n=e.getBoundingClientRect(),r=window.innerHeight,i=window.scrollY,a=window.scrollX,o=r-n.bottom<t+8&&n.top>t+8;return{top:o?i+n.top-t-4:i+n.bottom+4,left:a+n.left,flipUp:o}}function $e({values:e,selected:t,onSelect:n,label:r,theme:i,format:a}){let c=(0,o.useRef)([]),l=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=c.current[t];e&&l.current&&e.scrollIntoView({block:`nearest`})},[t]);let u=a??(e=>String(e).padStart(2,`0`));return(0,s.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:`4px`},children:[(0,s.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:600,color:i.textMuted,textTransform:`uppercase`,letterSpacing:`0.05em`},children:r}),(0,s.jsx)(`div`,{ref:l,style:{height:`160px`,overflowY:`auto`,width:`52px`,scrollbarWidth:`thin`,border:`1px solid ${i.border}`,borderRadius:`8px`,padding:`4px`},children:e.map(e=>{let r=e===t;return(0,s.jsx)(`button`,{ref:t=>{c.current[e]=t},type:`button`,onClick:()=>n(e),style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:`100%`,height:`32px`,borderRadius:`6px`,border:`none`,cursor:`pointer`,fontSize:`13px`,fontWeight:r?600:400,backgroundColor:r?i.primary:`transparent`,color:r?i.bg:i.text,fontFamily:`monospace`,transition:`background-color 100ms ease`},children:u(e)},e)})})]})}function et({year:e,month:t,today:n,mode:r,selectedDate:i,selectedRange:a,multiDates:o,hoverDate:c,focusedDate:l,isDateDisabled:u,onSelectDate:d,onHoverDate:f,onSetFocused:p,theme:m,locale:h}){let g=Ye(e,t);return(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(7, 1fr)`,gap:`2px`,marginBottom:`4px`},children:ze.map(e=>(0,s.jsx)(`div`,{style:{textAlign:`center`,fontSize:`11px`,fontWeight:600,color:m.textMuted,padding:`4px 0`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:e},e))}),(0,s.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(7, 1fr)`,gap:`2px`},children:g.map((e,g)=>{let _=e.getMonth()===t,v=He(e,n),y=e.getDay()===0||e.getDay()===6,b=u(e),x=r===`single`&&i!=null&&He(e,i),S=r===`multiple`&&o.some(t=>He(t,e)),C=r===`range`&&Ge(e,a[0],null),w=r===`range`&&Ge(e,null,a[1]),T=C||w,E=r===`range`&&a[0]&&!a[1]&&c?c:a[1],D=r===`range`&&We(e,a[0],E),O=r===`range`&&a[0]&&!a[1]&&c&&He(e,c),k=x||S||T,A=l!=null&&He(e,l),j=`transparent`,M=_?y?`${m.text}cc`:m.text:`${m.textMuted}60`,N=`none`,P=400;return k||O?(j=m.primary,M=m.bg,P=600):D&&(j=`${m.primary}18`),v&&!k&&(N=`2px solid ${m.primary}`,P=600),b&&(M=`${m.textMuted}50`),A&&!k&&(N=`2px solid ${m.secondary}`),(0,s.jsx)(`button`,{type:`button`,"aria-label":e.toLocaleDateString(h,{weekday:`long`,year:`numeric`,month:`long`,day:`numeric`}),"aria-pressed":k,"aria-disabled":b,disabled:b,onClick:()=>!b&&d(e),onMouseEnter:()=>f(e),onMouseLeave:()=>f(null),onFocus:()=>p(e),style:{width:`34px`,height:`34px`,borderRadius:`8px`,backgroundColor:j,color:M,border:N,fontSize:`13px`,fontWeight:P,cursor:b?`not-allowed`:`pointer`,opacity:b?.35:1,display:`flex`,alignItems:`center`,justifyContent:`center`,fontFamily:`inherit`,position:`relative`,outline:`none`,textDecoration:b?`line-through`:`none`,transition:`background-color 80ms ease`},children:e.getDate()},g)})})]})}function tt({value:e,onChange:i,rangeValue:a,onRangeChange:l,multiValue:u,onMultiChange:d,mode:f=`single`,minDate:p,maxDate:m,disabledDates:h,locale:g=`en-US`,showTime:_=!1,timeValue:v,onTimeChange:y,showPresets:b=!1,customPresets:x,label:S,placeholder:C=`MM/DD/YYYY`,hint:w,isDisabled:T=!1,isInvalid:E=!1,errorMessage:D,numberOfMonths:O=1,id:k,className:A,style:j}){let M=t.f(),N=(0,o.useId)(),P=k??N,F=r.o(),I=Ue(new Date),L=e!==void 0,[R,z]=(0,o.useState)(null),B=L?e??null:R,V=a!==void 0,[H,U]=(0,o.useState)([null,null]),W=V?a:H,ee=u!==void 0,[te,G]=(0,o.useState)([]),K=ee?u:te,[ne,q]=(0,o.useState)(`start`),J=f===`range`||f===`single`&&_,[Y,re]=(0,o.useState)([null,null]),[ie,ae]=(0,o.useState)(null),oe=B??W[0]??I,[X,Z]=(0,o.useState)(oe.getFullYear()),[se,ce]=(0,o.useState)(oe.getMonth()),[le,ue]=(0,o.useState)(`day`),[de,fe]=(0,o.useState)({h:0,m:0}),pe=v??de,[Q,$]=(0,o.useState)(!1),[me,he]=(0,o.useState)(()=>{if(f===`single`)return Ke(B,g);if(f===`range`){let[e,t]=W;if(e&&t)return`${Ke(e,g)} – ${Ke(t,g)}`}return``}),[ge,_e]=(0,o.useState)(null),[ve,ye]=(0,o.useState)(null),[be,xe]=(0,o.useState)({top:0,left:0,flipUp:!1}),[,Se]=(0,o.useReducer)(e=>e+1,0),Ce=(0,o.useRef)(null),we=(0,o.useRef)(null),Te=(0,o.useRef)(null),Ee=b?420:_?480:360;(0,o.useEffect)(()=>{if(f===`single`)he(Ke(B,g));else if(f===`range`){let[e,t]=W;he(e&&t?`${Ke(e,g)} – ${Ke(t,g)}`:e?Ke(e,g):``)}else f===`multiple`&&he(K.length>0?`${K.length} date${K.length===1?``:`s`} selected`:``)},[B,W,K,f,g]);let De=(0,o.useCallback)(()=>{Ce.current&&xe(Qe(Ce.current,Ee))},[Ee]);(0,o.useEffect)(()=>{if(Q)return De(),window.addEventListener(`scroll`,De,!0),window.addEventListener(`resize`,De),()=>{window.removeEventListener(`scroll`,De,!0),window.removeEventListener(`resize`,De)}},[Q,De]),(0,o.useEffect)(()=>{if(!Q)return;let e=e=>{Ce.current?.contains(e.target)||we.current?.contains(e.target)||$(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[Q]),(0,o.useEffect)(()=>{if(!Q)return;let e=e=>{e.key===`Escape`&&($(!1),Te.current?.focus())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[Q]);let Oe=(0,o.useCallback)(e=>p&&Ue(e)<Ue(p)||m&&Ue(e)>Ue(m)?!0:h?typeof h==`function`?h(e):h.some(t=>He(t,e)):!1,[p,m,h]),ke=(0,o.useCallback)(e=>{if(!Oe(e)){if(f===`single`)J?ae(e):(L||z(e),i?.(e),he(Ke(e,g)),$(!1));else if(f===`range`)if(ne===`start`){let t=[e,null];re(t),V||U(t),l?.(t),q(`end`)}else{let t=Y[0]??W[0],n=t&&e<t?[e,t]:[t,e];re(n),J?q(`start`):(V||U(n),l?.(n),q(`start`),$(!1))}else if(f===`multiple`){let t=K.some(t=>He(t,e))?K.filter(t=>!He(t,e)):[...K,e];ee||G(t),d?.(t)}Se()}},[f,Oe,L,V,ee,i,l,d,ne,Y,W,K,J,g]),Ae=(0,o.useCallback)(()=>{if(f===`single`){let e=ie??B;L||z(e),i?.(e)}else f===`range`&&(V||U(Y),l?.(Y));$(!1),q(`start`)},[f,ie,Y,B,L,V,i,l]),je=(0,o.useCallback)(()=>{ae(null),re([null,null]),q(`start`),$(!1)},[]),Me=()=>{se===0?(ce(11),Z(e=>e-1)):ce(e=>e-1),ue(`day`)},Ne=()=>{se===11?(ce(0),Z(e=>e+1)):ce(e=>e+1),ue(`day`)},Pe=()=>Z(e=>e-1),Fe=()=>Z(e=>e+1),Ie=()=>Z(e=>e-10),Le=()=>Z(e=>e+10),Re=e=>{if(he(e),f===`single`){let t=qe(e);t&&!Oe(t)&&(L||z(t),i?.(t),Z(t.getFullYear()),ce(t.getMonth()))}},ze=e=>{if(e.stopPropagation(),f===`single`)L||z(null),i?.(null),he(``);else if(f===`range`){let e=[null,null];V||U(e),l?.(e),re(e),he(``),q(`start`)}else f===`multiple`&&(ee||G([]),d?.([]),he(``))},We=e=>{if(le!==`day`)return;let t=ge??B??I,n=null;if(e.key===`ArrowRight`)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1);else if(e.key===`ArrowLeft`)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1);else if(e.key===`ArrowDown`)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+7);else if(e.key===`ArrowUp`)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-7);else if(e.key===`Enter`&&ge){ke(ge);return}n&&(e.preventDefault(),_e(n),(n.getMonth()!==se||n.getFullYear()!==X)&&(ce(n.getMonth()),Z(n.getFullYear())))},Ge=()=>{Z(I.getFullYear()),ce(I.getMonth()),ue(`day`),ke(I)},Je=x??Ze(),Ye=e=>{let[t,n]=e.getValue(),r=[t,n];re(r),V||U(r),l?.(r),Z(t.getFullYear()),ce(t.getMonth()),q(`start`),J||$(!1)},tt=se===11?0:se+1,nt=se===11?X+1:X,rt=O>=2,it=S?n.m(S):void 0,at=w?n.m(w):void 0,ot=D?n.m(D):void 0,st=n.m(C),ct=f===`single`&&B!=null||f===`range`&&(W[0]!=null||W[1]!=null)||f===`multiple`&&K.length>0,lt=f===`range`?J?Y:W:[null,null],ut=E?M.danger:Q?M.primary:M.border,dt=Array.from({length:24},(e,t)=>t),ft=Array.from({length:60},(e,t)=>t),pt=(0,s.jsxs)(`div`,{ref:we,role:`dialog`,"aria-label":`Date picker`,"aria-modal":`false`,onKeyDown:We,style:{position:`absolute`,top:be.top,left:be.left,zIndex:9999,backgroundColor:M.surface,border:`1px solid ${M.border}`,borderRadius:`14px`,boxShadow:`0 8px 30px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)`,display:`flex`,overflow:`hidden`,minWidth:rt?`580px`:`300px`,maxWidth:rt&&b?`780px`:rt?`620px`:b?`520px`:`300px`,opacity:+!!Q,transform:Q?`translateY(0) scale(1)`:be.flipUp?`translateY(4px) scale(0.98)`:`translateY(-4px) scale(0.98)`,transition:F?`none`:`opacity 120ms ease, transform 120ms ease`,fontFamily:`inherit`},children:[b&&f===`range`&&(0,s.jsxs)(`div`,{style:{width:`148px`,flexShrink:0,borderRight:`1px solid ${M.border}`,padding:`8px 6px`,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`1px`},children:[(0,s.jsx)(`div`,{style:{fontSize:`11px`,fontWeight:600,color:M.textMuted,textTransform:`uppercase`,letterSpacing:`0.07em`,padding:`4px 8px 8px`},children:`Quick select`}),Je.map(e=>{let[t,n]=e.getValue(),r=lt[0]&&lt[1]&&He(lt[0],t)&&He(lt[1],n);return(0,s.jsx)(`button`,{type:`button`,onClick:()=>Ye(e),style:{width:`100%`,textAlign:`left`,padding:`7px 10px`,borderRadius:`7px`,border:`none`,cursor:`pointer`,fontSize:`13px`,backgroundColor:r?`${M.primary}20`:`transparent`,color:r?M.primary:M.text,fontWeight:r?600:400,fontFamily:`inherit`,transition:`background-color 80ms ease`},onMouseEnter:e=>{r||(e.currentTarget.style.backgroundColor=`${M.surfaceAlt}`)},onMouseLeave:e=>{r||(e.currentTarget.style.backgroundColor=`transparent`)},children:e.label},e.label)})]}),(0,s.jsxs)(`div`,{style:{flex:1,padding:`16px`,display:`flex`,flexDirection:`column`,gap:`12px`,minWidth:0},children:[(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,s.jsx)(`button`,{type:`button`,"aria-label":le===`day`?`Previous month`:le===`month`?`Previous year`:`Previous decade`,onClick:()=>{le===`day`?Me():le===`month`?Pe():Ie()},style:{border:`none`,background:`transparent`,cursor:`pointer`,color:M.textMuted,padding:`6px`,borderRadius:`6px`,display:`flex`,alignItems:`center`},children:(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,s.jsx)(`polyline`,{points:`15 18 9 12 15 6`})})}),(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`6px`},children:[le===`day`&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`button`,{type:`button`,onClick:()=>ue(`month`),style:{border:`none`,background:`transparent`,cursor:`pointer`,fontSize:`14px`,fontWeight:600,color:M.text,padding:`4px 6px`,borderRadius:`6px`,fontFamily:`inherit`},children:Be[se]}),(0,s.jsx)(`button`,{type:`button`,onClick:()=>ue(`year`),style:{border:`none`,background:`transparent`,cursor:`pointer`,fontSize:`14px`,fontWeight:600,color:M.text,padding:`4px 6px`,borderRadius:`6px`,fontFamily:`inherit`},children:X}),rt&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`span`,{style:{color:M.textMuted,fontSize:`14px`},children:`–`}),(0,s.jsxs)(`span`,{style:{fontSize:`14px`,fontWeight:600,color:M.text},children:[Be[tt],` `,nt]})]})]}),le===`month`&&(0,s.jsx)(`button`,{type:`button`,onClick:()=>ue(`year`),style:{border:`none`,background:`transparent`,cursor:`pointer`,fontSize:`14px`,fontWeight:600,color:M.text,padding:`4px 6px`,borderRadius:`6px`,fontFamily:`inherit`},children:X}),le===`year`&&(0,s.jsxs)(`span`,{style:{fontSize:`14px`,fontWeight:600,color:M.text},children:[Xe(X),`–`,Xe(X)+9]})]}),(0,s.jsx)(`button`,{type:`button`,"aria-label":le===`day`?`Next month`:le===`month`?`Next year`:`Next decade`,onClick:()=>{le===`day`?Ne():le===`month`?Fe():Le()},style:{border:`none`,background:`transparent`,cursor:`pointer`,color:M.textMuted,padding:`6px`,borderRadius:`6px`,display:`flex`,alignItems:`center`},children:(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,s.jsx)(`polyline`,{points:`9 18 15 12 9 6`})})})]}),le===`day`&&(0,s.jsxs)(`div`,{style:{display:`flex`,gap:`20px`},children:[(0,s.jsx)(et,{year:X,month:se,today:I,mode:f,selectedDate:B,selectedRange:lt,multiDates:K,hoverDate:ve,focusedDate:ge,isDateDisabled:Oe,onSelectDate:ke,onHoverDate:ye,onSetFocused:_e,theme:M,locale:g}),rt&&(0,s.jsx)(et,{year:nt,month:tt,today:I,mode:f,selectedDate:B,selectedRange:lt,multiDates:K,hoverDate:ve,focusedDate:ge,isDateDisabled:Oe,onSelectDate:ke,onHoverDate:ye,onSetFocused:_e,theme:M,locale:g})]}),le===`month`&&(0,s.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(3, 1fr)`,gap:`6px`},children:Ve.map((e,t)=>{let n=t===se;return(0,s.jsx)(`button`,{type:`button`,onClick:()=>{ce(t),ue(`day`)},style:{padding:`10px`,borderRadius:`8px`,border:t===I.getMonth()&&X===I.getFullYear()&&!n?`2px solid ${M.primary}`:`none`,cursor:`pointer`,fontSize:`13px`,fontWeight:n?600:400,backgroundColor:n?M.primary:`transparent`,color:n?M.bg:M.text,fontFamily:`inherit`,transition:`background-color 80ms ease`},children:e},e)})}),le===`year`&&(0,s.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:`6px`},children:Array.from({length:12},(e,t)=>{let n=Xe(X)-1+t,r=n===X,i=n===I.getFullYear(),a=t===0||t===11;return(0,s.jsx)(`button`,{type:`button`,onClick:()=>{Z(n),ue(`month`)},style:{padding:`10px 6px`,borderRadius:`8px`,border:i&&!r?`2px solid ${M.primary}`:`none`,cursor:`pointer`,fontSize:`13px`,fontWeight:r?600:400,backgroundColor:r?M.primary:`transparent`,color:r?M.bg:a?M.textMuted:M.text,fontFamily:`inherit`,transition:`background-color 80ms ease`,opacity:a?.5:1},children:n},n)})}),_&&le===`day`&&(0,s.jsxs)(`div`,{style:{borderTop:`1px solid ${M.border}`,paddingTop:`12px`,display:`flex`,alignItems:`flex-start`,gap:`8px`,justifyContent:`center`},children:[(0,s.jsx)($e,{values:dt,selected:pe.h,onSelect:e=>{v||fe(t=>({...t,h:e})),y?.({...pe,h:e})},label:`Hour`,theme:M}),(0,s.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,height:`40px`,marginTop:`28px`,fontSize:`16px`,fontWeight:700,color:M.textMuted},children:`:`}),(0,s.jsx)($e,{values:ft,selected:pe.m,onSelect:e=>{v||fe(t=>({...t,m:e})),y?.({...pe,m:e})},label:`Min`,theme:M})]}),f===`multiple`&&le===`day`&&K.length>0&&(0,s.jsxs)(`div`,{style:{borderTop:`1px solid ${M.border}`,paddingTop:`8px`,fontSize:`12px`,color:M.textMuted,textAlign:`center`},children:[K.length,` date`,K.length===1?``:`s`,` selected`]}),(0,s.jsxs)(`div`,{style:{borderTop:`1px solid ${M.border}`,paddingTop:`10px`,display:`flex`,alignItems:`center`,justifyContent:J?`space-between`:`flex-start`,gap:`8px`},children:[(0,s.jsx)(`button`,{type:`button`,onClick:Ge,style:{border:`none`,background:`transparent`,cursor:`pointer`,fontSize:`13px`,color:M.primary,fontWeight:500,padding:`6px 10px`,borderRadius:`6px`,fontFamily:`inherit`},children:`Today`}),J&&(0,s.jsxs)(`div`,{style:{display:`flex`,gap:`6px`},children:[(0,s.jsx)(`button`,{type:`button`,onClick:je,style:{padding:`6px 14px`,borderRadius:`7px`,border:`1px solid ${M.border}`,cursor:`pointer`,fontSize:`13px`,fontWeight:500,backgroundColor:`transparent`,color:M.text,fontFamily:`inherit`},children:`Cancel`}),(0,s.jsx)(`button`,{type:`button`,onClick:Ae,style:{padding:`6px 14px`,borderRadius:`7px`,border:`none`,cursor:`pointer`,fontSize:`13px`,fontWeight:600,backgroundColor:M.primary,color:M.bg,fontFamily:`inherit`},children:`Apply`})]})]})]})]});return(0,s.jsxs)(`div`,{className:A,style:{display:`flex`,flexDirection:`column`,gap:`4px`,width:`100%`,position:`relative`,...j},children:[it&&(0,s.jsx)(`label`,{htmlFor:P,style:{fontSize:`13px`,fontWeight:500,color:M.text,marginBottom:`2px`},children:it}),(0,s.jsxs)(`div`,{ref:Ce,style:{display:`flex`,alignItems:`center`,border:`1.5px solid ${ut}`,borderRadius:`8px`,backgroundColor:M.surface,overflow:`hidden`,transition:F?`none`:`border-color 120ms ease`,opacity:T?.5:1},children:[(0,s.jsx)(`span`,{style:{display:`flex`,alignItems:`center`,paddingLeft:`10px`,color:M.textMuted,flexShrink:0},children:(0,s.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,s.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`}),(0,s.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,s.jsx)(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),(0,s.jsx)(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]})}),(0,s.jsx)(`input`,{ref:Te,id:P,type:`text`,value:me,placeholder:st,disabled:T,"aria-invalid":E,"aria-haspopup":`dialog`,"aria-expanded":Q,readOnly:f===`range`||f===`multiple`,onChange:e=>Re(e.target.value),onFocus:()=>{T||$(!0)},style:{flex:1,backgroundColor:`transparent`,border:`none`,outline:`none`,fontSize:`14px`,padding:`9px 8px`,color:M.text,cursor:f===`single`?`text`:`pointer`,fontFamily:`inherit`,minWidth:0}}),ct&&!T&&(0,s.jsx)(`button`,{type:`button`,"aria-label":`Clear selection`,onClick:ze,style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:`28px`,height:`28px`,border:`none`,background:`transparent`,cursor:`pointer`,color:M.textMuted,flexShrink:0,borderRadius:`4px`,marginRight:`4px`},children:(0,s.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,s.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,s.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})}),(0,s.jsx)(`button`,{type:`button`,"aria-label":Q?`Close calendar`:`Open calendar`,tabIndex:-1,disabled:T,onClick:()=>{T||$(e=>!e)},style:{display:`flex`,alignItems:`center`,justifyContent:`center`,width:`34px`,height:`36px`,border:`none`,background:`transparent`,cursor:T?`not-allowed`:`pointer`,color:M.textMuted,flexShrink:0},children:(0,s.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{transform:Q?`rotate(180deg)`:`rotate(0deg)`,transition:F?`none`:`transform 160ms ease`},children:(0,s.jsx)(`polyline`,{points:`6 9 12 15 18 9`})})})]}),at&&!E&&(0,s.jsx)(`span`,{style:{fontSize:`12px`,color:M.textMuted},children:at}),E&&ot&&(0,s.jsx)(`span`,{role:`alert`,style:{fontSize:`12px`,color:M.danger},children:ot}),Q&&typeof document<`u`&&(0,c.createPortal)(pt,document.body)]})}tt.displayName=`TkxDatePicker`;var nt={sm:{track:4,thumb:14,fontSize:`0.75rem`},md:{track:6,thumb:18,fontSize:`0.875rem`},lg:{track:8,thumb:22,fontSize:`1rem`}};function rt(e,t,n){return Math.min(Math.max(e,t),n)}function it(e,t,n){return Math.round((e-t)/n)*n+t}function at(e,t,n){return(e-t)/(n-t)*100}function ot({value:e,min:t,max:n,step:r,isDisabled:i,trackColor:a,thumbSize:c,ariaLabel:l,tooltipMode:u,formatValue:d,orientation:f,onChange:p,onChangeEnd:m}){let[h,g]=(0,o.useState)(!1),[_,v]=(0,o.useState)(!1),[y,b]=(0,o.useState)(!1),x=a=>{i||(a.key===`ArrowRight`||a.key===`ArrowUp`?(a.preventDefault(),p(rt(it(e+r,t,r),t,n))):a.key===`ArrowLeft`||a.key===`ArrowDown`?(a.preventDefault(),p(rt(it(e-r,t,r),t,n))):a.key===`Home`?(a.preventDefault(),p(t)):a.key===`End`&&(a.preventDefault(),p(n)))},S=f===`vertical`,C=at(e,t,n),w=u===`always`||u===`hover`&&(y||_||h),T=S?{position:`absolute`,bottom:`${C}%`,transform:`translateY(50%)`,left:`50%`,marginLeft:`-${c/2}px`,zIndex:2,cursor:i?`not-allowed`:`grab`}:{position:`absolute`,left:`${C}%`,transform:`translateX(-50%)`,top:`50%`,marginTop:`-${c/2}px`,zIndex:2,cursor:i?`not-allowed`:`grab`},E=S?{position:`absolute`,left:c+6,top:`50%`,transform:`translateY(-50%)`,backgroundColor:a,color:`#fff`,borderRadius:`4px`,padding:`2px 6px`,fontSize:`0.75rem`,whiteSpace:`nowrap`,pointerEvents:`none`}:{position:`absolute`,bottom:c+6,left:`50%`,transform:`translateX(-50%)`,backgroundColor:a,color:`#fff`,borderRadius:`4px`,padding:`2px 6px`,fontSize:`0.75rem`,whiteSpace:`nowrap`,pointerEvents:`none`};return(0,s.jsxs)(`div`,{style:T,children:[w&&(0,s.jsx)(`div`,{style:E,children:d(e)}),(0,s.jsx)(`div`,{role:`slider`,tabIndex:i?-1:0,"aria-label":l,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-disabled":i,"aria-orientation":f,onKeyDown:x,onFocus:()=>g(!0),onBlur:()=>g(!1),onPointerEnter:()=>b(!0),onPointerLeave:()=>b(!1),onPointerDown:e=>{i||(v(!0),e.target.setPointerCapture(e.pointerId))},onPointerUp:()=>{v(!1),m?.()},style:{width:c,height:c,borderRadius:`50%`,backgroundColor:i?`#888`:a,border:`3px solid #fff`,boxShadow:h?`0 0 0 3px ${a}44`:`0 1px 4px rgba(0,0,0,0.3)`,outline:`none`,display:`block`,transition:`box-shadow 150ms ease`}})]})}function st({value:e,defaultValue:i=0,onChange:a,rangeValue:c,onRangeChange:l,min:u=0,max:d=100,step:f=1,isRange:p=!1,label:m,showValue:h=!1,showTicks:g=!1,tickCount:_=5,isDisabled:v=!1,colorScheme:y=`primary`,size:b=`md`,marks:x,orientation:S=`horizontal`,showTooltip:C=!1,formatValue:w,onChangeEnd:T,onRangeChangeEnd:E,gradient:D=!1}){let O=t.f(),k=(0,o.useId)(),A=r.o(),j=e!==void 0,[M,N]=(0,o.useState)(i),P=j?e:M,F=c!==void 0,[I,L]=(0,o.useState)([u,d]),R=F?c:I,z=(0,o.useRef)(null),B=(0,o.useRef)(P);B.current=P;let V=(0,o.useRef)(R);V.current=R;let H={primary:O.primary,success:O.success,danger:O.danger,warning:O.warning}[y],U=nt[b],W=S===`vertical`,ee=C===!0?`hover`:C===!1?!1:C,te=w??(e=>String(e)),G=H+`66`,K=(0,o.useCallback)((e,t)=>{let n=z.current;if(!n)return u;let r=n.getBoundingClientRect(),i;return i=rt(W?(r.bottom-(t??0))/r.height:(e-r.left)/r.width,0,1),rt(it(i*(d-u)+u,u,f),u,d)},[u,d,f,W]),ne=(0,o.useCallback)(e=>{if(v)return;let t=K(e.clientX,e.clientY);if(!p)j||N(t),a?.(t);else{let[e,n]=R,r=Math.abs(t-e)<=Math.abs(t-n)?[t,n]:[e,t];F||L(r),l?.(r)}},[v,p,j,F,K,a,l,R]),q=e=>{j||N(e),a?.(e)},J=e=>{let t=[rt(e,u,R[1]),R[1]];F||L(t),l?.(t)},Y=e=>{let t=[R[0],rt(e,R[0],d)];F||L(t),l?.(t)},re=p?at(R[0],u,d):0,ie=at(p?R[1]:P,u,d),ae=g?Array.from({length:_},(e,t)=>u+t/(_-1)*(d-u)):[],oe=m?n.m(m):void 0,X=A?`none`:`background 150ms ease`;return(0,s.jsxs)(`div`,{className:n.a(`flex flex-col gap-2`),style:{opacity:v?.55:1,...W?{height:200,width:`auto`,display:`inline-flex`}:{width:`100%`}},children:[(oe||h)&&(0,s.jsxs)(`div`,{className:n.a(`flex items-center justify-between`),children:[oe&&(0,s.jsx)(`label`,{htmlFor:k,className:n.a(`text-sm font-medium`),style:{color:O.text,fontSize:U.fontSize},children:oe}),h&&!p&&(0,s.jsx)(`span`,{className:n.a(`text-sm tabular-nums`),style:{color:O.textMuted,fontSize:U.fontSize},children:te(P)}),h&&p&&(0,s.jsxs)(`span`,{className:n.a(`text-sm tabular-nums`),style:{color:O.textMuted,fontSize:U.fontSize},children:[te(R[0]),` – `,te(R[1])]})]}),(0,s.jsxs)(`div`,{style:{position:`relative`,...W?{paddingLeft:U.thumb/2,paddingRight:U.thumb/2,flex:1}:{paddingTop:U.thumb/2,paddingBottom:U.thumb/2}},children:[(0,s.jsxs)(`div`,{ref:z,onPointerDown:ne,style:{position:`relative`,...W?{width:U.track,height:`100%`}:{height:U.track},borderRadius:9999,backgroundColor:O.border,cursor:v?`not-allowed`:`pointer`,userSelect:`none`,touchAction:`none`},children:[(0,s.jsx)(`div`,{style:{position:`absolute`,...W?{left:0,bottom:`${re}%`,height:`${ie-re}%`,width:`100%`}:{top:0,left:`${re}%`,width:`${ie-re}%`,height:`100%`},borderRadius:9999,...v?{backgroundColor:O.textMuted}:D?{background:W?`linear-gradient(to top, ${G}, ${H})`:`linear-gradient(to right, ${G}, ${H})`}:{backgroundColor:H},transition:X}}),ae.map((e,t)=>(0,s.jsx)(`div`,{style:{position:`absolute`,...W?{bottom:`${at(e,u,d)}%`,left:`50%`,transform:`translate(-50%, 50%)`,height:3,width:U.track+4}:{left:`${at(e,u,d)}%`,top:`50%`,transform:`translate(-50%, -50%)`,width:3,height:U.track+4},backgroundColor:O.surface,borderRadius:9999,pointerEvents:`none`}},t)),p?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ot,{value:R[0],min:u,max:R[1],step:f,isDisabled:v,trackColor:H,trackHeight:U.track,thumbSize:U.thumb,ariaLabel:`${oe??`Range`} start`,tooltipMode:ee,formatValue:te,orientation:S,onChange:J,onChangeEnd:E?()=>E(V.current):void 0}),(0,s.jsx)(ot,{value:R[1],min:R[0],max:d,step:f,isDisabled:v,trackColor:H,trackHeight:U.track,thumbSize:U.thumb,ariaLabel:`${oe??`Range`} end`,tooltipMode:ee,formatValue:te,orientation:S,onChange:Y,onChangeEnd:E?()=>E(V.current):void 0})]}):(0,s.jsx)(ot,{value:P,min:u,max:d,step:f,isDisabled:v,trackColor:H,trackHeight:U.track,thumbSize:U.thumb,ariaLabel:oe??`Slider`,tooltipMode:ee,formatValue:te,orientation:S,onChange:q,onChangeEnd:T?()=>T(B.current):void 0})]}),x&&x.length>0&&(0,s.jsx)(`div`,{style:{position:W?`absolute`:`relative`,...W?{left:`100%`,top:0,bottom:0,marginLeft:8}:{marginTop:8}},children:x.map((e,t)=>(0,s.jsx)(`div`,{style:{position:`absolute`,...W?{bottom:`${at(e.value,u,d)}%`,transform:`translateY(50%)`,left:0}:{left:`${at(e.value,u,d)}%`,transform:`translateX(-50%)`},fontSize:`0.6875rem`,color:O.textMuted,whiteSpace:`nowrap`},children:n.m(e.label)},t))})]}),g&&!x&&!W&&(0,s.jsx)(`div`,{style:{position:`relative`,height:`1rem`},children:ae.map((e,t)=>(0,s.jsx)(`span`,{style:{position:`absolute`,left:`${at(e,u,d)}%`,transform:`translateX(-50%)`,fontSize:`0.6875rem`,color:O.textMuted},children:te(Math.round(e))},t))})]})}st.displayName=`TkxSlider`;var ct={sm:{height:28,minWidth:28,fontSize:`0.75rem`,px:8},md:{height:36,minWidth:36,fontSize:`0.875rem`,px:10},lg:{height:44,minWidth:44,fontSize:`1rem`,px:12}};function lt(e,t,n,r){if(t<=1)return[1];let i=(e,t)=>Array.from({length:Math.max(0,t-e+1)},(t,n)=>e+n),a=Math.max(e-n,1),o=Math.min(e+n,t);if(!r){let e=[];return a>1&&e.push(`...`),e.push(...i(a,o)),o<t&&e.push(`...`),e}let s=t,c=a>3,l=o<s-2,u=[];u.push(1),c?u.push(`left-ellipsis`):u.push(...i(2,a-1)),u.push(...i(Math.max(a,2),Math.min(o,t-1))),l?u.push(`right-ellipsis`):u.push(...i(o+1,t-1)),t>1&&u.push(t);let d=new Set,f=[];for(let e of u)typeof e==`number`?d.has(e)||(d.add(e),f.push(e)):f.push(e);return f}function ut({total:e,pageSize:r=10,page:i,defaultPage:a=1,onChange:c,siblingCount:l=1,showEdges:u=!0,showPageSize:d=!1,onPageSizeChange:f,pageSizeOptions:p=[10,25,50,100],size:m=`md`,variant:h=`default`}){let g=t.f(),_=(0,o.useId)(),v=i!==void 0,[y,b]=(0,o.useState)(a),x=v?i:y,[S,C]=(0,o.useState)(r),w=r,T=Math.max(1,Math.ceil(e/w)),E=e=>{let t=Math.min(Math.max(e,1),T);t!==x&&(v||b(t),c?.(t))},D=e=>{C(e),f?.(e),E(1)},O=lt(x,T,l,u),k=ct[m],A=Math.min((x-1)*w+1,e),j=Math.min(x*w,e),M=(e,t)=>{let n={height:k.height,minWidth:k.minWidth,paddingLeft:k.px,paddingRight:k.px,fontSize:k.fontSize,borderRadius:`8px`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,cursor:t?`not-allowed`:`pointer`,border:`none`,outline:`none`,fontFamily:`inherit`,transition:`background 120ms ease, color 120ms ease`,opacity:t?.4:1};return e?{...n,backgroundColor:g.primary,color:g.bg,fontWeight:600,boxShadow:`0 0 0 2px ${g.primary}44`}:h===`default`?{...n,backgroundColor:g.surface,color:g.text,border:`1px solid ${g.border}`}:h===`outline`?{...n,backgroundColor:`transparent`,color:g.text,border:`1px solid ${g.border}`}:{...n,backgroundColor:`transparent`,color:g.text}},N=({d:e})=>(0,s.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,"aria-hidden":`true`,children:(0,s.jsx)(`polyline`,{points:e})});return(0,s.jsxs)(`nav`,{"aria-label":`Pagination`,className:n.a(`flex flex-col gap-2`),children:[e>0&&(0,s.jsx)(`p`,{className:n.a(`text-sm`),style:{color:g.textMuted,fontSize:k.fontSize},children:n.m(`Showing ${A}–${j} of ${e} items`)}),(0,s.jsxs)(`div`,{className:n.a(`flex items-center gap-1 flex-wrap`),children:[u&&(0,s.jsxs)(`button`,{type:`button`,"aria-label":`First page`,disabled:x===1,onClick:()=>E(1),style:M(!1,x===1),children:[(0,s.jsx)(N,{d:`15 18 9 12 15 6`}),(0,s.jsx)(N,{d:`20 18 14 12 20 6`})]}),(0,s.jsx)(`button`,{type:`button`,"aria-label":`Previous page`,disabled:x===1,onClick:()=>E(x-1),style:M(!1,x===1),children:(0,s.jsx)(N,{d:`15 18 9 12 15 6`})}),O.map((e,t)=>{if(typeof e==`string`)return(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,minWidth:k.minWidth,height:k.height,fontSize:k.fontSize,color:g.textMuted,userSelect:`none`},children:`…`},`${e}-${t}`);let n=e,r=n===x;return(0,s.jsx)(`button`,{type:`button`,"aria-label":`Page ${n}`,"aria-current":r?`page`:void 0,onClick:()=>E(n),style:M(r,!1),children:n},n)}),(0,s.jsx)(`button`,{type:`button`,"aria-label":`Next page`,disabled:x===T,onClick:()=>E(x+1),style:M(!1,x===T),children:(0,s.jsx)(N,{d:`9 18 15 12 9 6`})}),u&&(0,s.jsxs)(`button`,{type:`button`,"aria-label":`Last page`,disabled:x===T,onClick:()=>E(T),style:M(!1,x===T),children:[(0,s.jsx)(N,{d:`4 18 10 12 4 6`}),(0,s.jsx)(N,{d:`14 18 20 12 14 6`})]}),d&&(0,s.jsxs)(`div`,{className:n.a(`flex items-center gap-2 ml-2`),children:[(0,s.jsx)(`label`,{htmlFor:_,className:n.a(`text-sm`),style:{color:g.textMuted,fontSize:k.fontSize,whiteSpace:`nowrap`},children:`Rows per page`}),(0,s.jsx)(`select`,{id:_,value:S,onChange:e=>D(Number(e.target.value)),style:{height:k.height,paddingLeft:k.px,paddingRight:k.px,fontSize:k.fontSize,borderRadius:`8px`,border:`1px solid ${g.border}`,backgroundColor:g.surface,color:g.text,cursor:`pointer`,outline:`none`,fontFamily:`inherit`},children:p.map(e=>(0,s.jsx)(`option`,{value:e,children:e},e))})]})]})]})}ut.displayName=`TkxPagination`;var dt={"1/1":`100%`,"4/3":`75%`,"16/9":`56.25%`,"3/2":`66.666%`,"9/16":`177.777%`},ft={none:`0`,sm:`4px`,md:`8px`,lg:`16px`,full:`9999px`};function pt({color:e,size:t}){return(0,s.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:e,strokeWidth:1.5,"aria-hidden":`true`,children:[(0,s.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),(0,s.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),(0,s.jsx)(`path`,{d:`M21 15l-5-5L5 21`})]})}function mt({src:e,alt:i,fallback:a,placeholder:l=`skeleton`,fit:u=`cover`,ratio:d=`auto`,radius:f=`none`,caption:p,lazy:m=!0,preview:h=!1,className:g,style:_,...v}){let y=t.f(),b=r.o(),[x,S]=(0,o.useState)(!1),[C,w]=(0,o.useState)(!1),[T,E]=(0,o.useState)(!1),D=(0,o.useRef)(null),O=n.m(e),k=i?n.m(i):``,A=p?n.m(p):``,j=ft[f];(0,o.useEffect)(()=>{D.current?.complete&&S(!0)},[]);let M=(0,o.useCallback)(()=>S(!0),[]),N=(0,o.useCallback)(()=>w(!0),[]),P=(0,o.useCallback)(()=>{h&&!C&&E(!0)},[h,C]),F=(0,o.useCallback)(()=>E(!1),[]);(0,o.useEffect)(()=>{if(!T)return;let e=e=>{e.key===`Escape`&&F()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[T,F]);let I=l===`skeleton`&&!x&&!C,L=I&&!b?{animation:`tkx-shimmer 1.5s ease-in-out infinite`}:{},R=C?null:(0,s.jsx)(`img`,{ref:D,src:O,alt:k||void 0,role:k?void 0:`img`,"aria-label":k?void 0:`Image`,loading:m?`lazy`:void 0,onLoad:M,onError:N,onClick:h?P:void 0,className:n.t(n.a(`block w-full h-full`),h&&!C?n.a(`cursor-pointer`):``),style:{objectFit:u,borderRadius:j,opacity:+!!x,transition:b?`none`:`opacity 200ms ease`,position:d===`auto`?void 0:`absolute`,inset:d===`auto`?void 0:0},...v}),z=C?a?(0,s.jsx)(s.Fragment,{children:a}):(0,s.jsxs)(`div`,{role:`img`,"aria-label":k||`Image failed to load`,className:n.a(`flex flex-col items-center justify-center gap-2 w-full h-full`),style:{backgroundColor:y.surfaceAlt,borderRadius:j,color:y.textMuted,minHeight:`80px`},children:[(0,s.jsx)(pt,{color:y.textMuted,size:32}),(0,s.jsx)(`span`,{className:n.a(`text-xs`),style:{color:y.textMuted},children:`Failed to load`})]}):null,B=I?(0,s.jsx)(`div`,{"aria-hidden":`true`,style:{position:d===`auto`?void 0:`absolute`,inset:d===`auto`?void 0:0,width:`100%`,height:d===`auto`?`100%`:void 0,minHeight:d===`auto`?`80px`:void 0,borderRadius:j,backgroundColor:y.surfaceAlt,...L}}):null,V=d===`auto`?(0,s.jsxs)(`div`,{className:n.a(`relative w-full`),style:{borderRadius:j},children:[B,R,z]}):(0,s.jsxs)(`div`,{className:n.a(`relative w-full overflow-hidden`),style:{paddingBottom:dt[d],borderRadius:j},children:[B,R,z]}),H=A?(0,s.jsxs)(`figure`,{className:n.a(`m-0 p-0 flex flex-col gap-2`),style:{borderRadius:j},children:[V,(0,s.jsx)(`figcaption`,{className:n.a(`text-sm text-center`),style:{color:y.textMuted},children:A})]}):V;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{className:n.t(n.a(`inline-block w-full`),g),style:_,children:H}),T&&typeof document<`u`?(0,c.createPortal)((0,s.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":k||`Image preview`,className:n.a(`fixed inset-0 z-[9500] flex items-center justify-center p-4`),onClick:F,children:[(0,s.jsx)(`div`,{"aria-hidden":`true`,className:n.a(`absolute inset-0`),style:{backgroundColor:`rgba(0,0,0,0.85)`,backdropFilter:`blur(6px)`}}),(0,s.jsx)(`img`,{src:O,alt:k||`Full-size preview`,onClick:e=>e.stopPropagation(),className:n.a(`relative z-10 max-w-full max-h-full`),style:{objectFit:`contain`,borderRadius:`8px`,boxShadow:`0 25px 60px rgba(0,0,0,0.5)`}}),(0,s.jsx)(`button`,{"aria-label":`Close preview`,onClick:F,className:n.a(`absolute top-4 right-4 z-10 flex items-center justify-center`,`bg-transparent border-none cursor-pointer rounded-full p-2`),style:{color:`#fff`,backgroundColor:`rgba(255,255,255,0.15)`},children:(0,s.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:[(0,s.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,s.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),document.body):null]})}function ht(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function gt({mimeType:e,color:t}){return e.startsWith(`image/`)?(0,s.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:t,strokeWidth:1.5,"aria-hidden":`true`,children:[(0,s.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),(0,s.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),(0,s.jsx)(`path`,{d:`M21 15l-5-5L5 21`})]}):e===`application/pdf`?(0,s.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:t,strokeWidth:1.5,"aria-hidden":`true`,children:[(0,s.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,s.jsx)(`polyline`,{points:`14 2 14 8 20 8`}),(0,s.jsx)(`line`,{x1:`9`,y1:`13`,x2:`15`,y2:`13`}),(0,s.jsx)(`line`,{x1:`9`,y1:`17`,x2:`11`,y2:`17`})]}):(0,s.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:t,strokeWidth:1.5,"aria-hidden":`true`,children:[(0,s.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,s.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]})}var _t=0;function vt(){return`tkx-file-${++_t}`}function yt({accept:e,multiple:i=!1,maxSize:a,maxFiles:c,onChange:l,onError:u,label:d=`Upload files`,hint:f,isDisabled:p=!1,preview:m=!0,dragDrop:h=!0,variant:g=`dropzone`}){let _=t.f(),v=r.o(),y=(0,o.useId)(),b=(0,o.useRef)(null),[x,S]=(0,o.useState)(!1),[C,w]=(0,o.useState)([]);(0,o.useEffect)(()=>()=>{C.forEach(e=>{e.objectUrl&&URL.revokeObjectURL(e.objectUrl)})},[]);let T=(0,o.useCallback)(e=>{let t=0,n=setInterval(()=>{t+=Math.floor(Math.random()*20)+10,t>=100&&(t=100,clearInterval(n)),w(n=>n.map(n=>n.id===e?{...n,progress:t}:n))},100)},[]),E=(0,o.useCallback)(t=>{if(a&&t.size>a)return`"${n.m(t.name)}" exceeds max size of ${ht(a)}`;if(e&&!e.split(`,`).map(e=>e.trim()).some(e=>e.startsWith(`.`)?t.name.toLowerCase().endsWith(e.toLowerCase()):e.endsWith(`/*`)?t.type.startsWith(e.slice(0,-1)):t.type===e))return`"${n.m(t.name)}" is not an accepted file type`},[e,a]),D=(0,o.useCallback)(e=>{let t=c?c-C.length:1/0;if(t<=0){u?.(`Maximum of ${c} file${c===1?``:`s`} allowed`);return}let n=e.slice(0,t).map(e=>{let t=E(e),n=m&&e.type.startsWith(`image/`)&&!t?URL.createObjectURL(e):void 0;return{file:e,id:vt(),objectUrl:n,progress:0,error:t}});w(e=>{let t=i?[...e,...n]:n,r=t.filter(e=>!e.error).map(e=>e.file);return l?.(r),t}),n.forEach(e=>{e.error&&u?.(e.error)}),n.forEach(e=>{e.error||T(e.id)})},[C.length,c,i,l,u,m,T,E]),O=(0,o.useCallback)(e=>{let t=Array.from(e.target.files??[]);t.length&&D(t),e.target.value=``},[D]),k=(0,o.useCallback)(e=>{if(e.preventDefault(),S(!1),p)return;let t=Array.from(e.dataTransfer.files);t.length&&D(t)},[p,D]),A=(0,o.useCallback)(e=>{e.preventDefault(),p||S(!0)},[p]),j=(0,o.useCallback)(()=>S(!1),[]),M=(0,o.useCallback)(e=>{w(t=>{let n=t.find(t=>t.id===e);n?.objectUrl&&URL.revokeObjectURL(n.objectUrl);let r=t.filter(t=>t.id!==e);return l?.(r.filter(e=>!e.error).map(e=>e.file)),r})},[l]),N=(0,o.useCallback)(()=>{p||b.current?.click()},[p]),P=x?_.primary:_.border,F=n.m(d),I=f?n.m(f):``,L=(0,s.jsxs)(`div`,{role:`button`,tabIndex:p?-1:0,"aria-label":F,"aria-describedby":f?y:void 0,"aria-disabled":p,onClick:N,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),N())},onDrop:h?k:void 0,onDragOver:h?A:void 0,onDragLeave:h?j:void 0,className:n.a(`flex flex-col items-center justify-center gap-3 w-full p-8 rounded-lg`),style:{border:`2px dashed ${P}`,backgroundColor:x?`${_.primary}10`:_.surface,cursor:p?`not-allowed`:`pointer`,opacity:p?.5:1,transition:v?`none`:`border-color 150ms ease, background-color 150ms ease`,outline:`none`},children:[(0,s.jsxs)(`svg`,{width:`40`,height:`40`,viewBox:`0 0 24 24`,fill:`none`,stroke:x?_.primary:_.textMuted,strokeWidth:1.5,"aria-hidden":`true`,children:[(0,s.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,s.jsx)(`polyline`,{points:`17 8 12 3 7 8`}),(0,s.jsx)(`line`,{x1:`12`,y1:`3`,x2:`12`,y2:`15`})]}),(0,s.jsxs)(`div`,{className:n.a(`text-center`),children:[(0,s.jsx)(`p`,{className:n.a(`m-0 text-sm font-medium`),style:{color:_.text},children:x?`Drop files here`:F}),I&&(0,s.jsx)(`p`,{id:y,className:n.a(`m-0 text-xs mt-1`),style:{color:_.textMuted},children:I})]})]}),R=(0,s.jsxs)(`button`,{type:`button`,disabled:p,onClick:N,"aria-describedby":f?y:void 0,className:n.a(`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium font-sans border-none cursor-pointer`),style:{backgroundColor:_.primary,color:_.bg,opacity:p?.5:1,cursor:p?`not-allowed`:`pointer`},children:[(0,s.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:[(0,s.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,s.jsx)(`polyline`,{points:`17 8 12 3 7 8`}),(0,s.jsx)(`line`,{x1:`12`,y1:`3`,x2:`12`,y2:`15`})]}),F,f&&(0,s.jsx)(`span`,{id:y,className:n.a(`sr-only`),children:I})]});return(0,s.jsxs)(`div`,{className:n.a(`flex flex-col gap-3 w-full font-sans`),children:[(0,s.jsx)(`input`,{ref:b,type:`file`,accept:e,multiple:i,disabled:p,onChange:O,className:n.a(`sr-only`),tabIndex:-1,"aria-hidden":`true`}),g===`dropzone`?L:R,C.length>0&&(0,s.jsx)(`ul`,{role:`status`,"aria-live":`polite`,"aria-label":`Uploaded files`,className:n.a(`m-0 p-0 flex flex-col gap-2`),style:{listStyle:`none`},children:C.map(e=>(0,s.jsxs)(`li`,{className:n.a(`flex flex-col gap-1 rounded-md p-3`),style:{backgroundColor:_.surfaceAlt,border:`1px solid ${e.error?_.danger:_.border}`},children:[(0,s.jsxs)(`div`,{className:n.a(`flex items-center gap-3`),children:[e.objectUrl&&m?(0,s.jsx)(`img`,{src:e.objectUrl,alt:n.m(e.file.name),className:n.a(`rounded`),style:{width:40,height:40,objectFit:`cover`,flexShrink:0}}):(0,s.jsx)(`span`,{style:{flexShrink:0},children:(0,s.jsx)(gt,{mimeType:e.file.type,color:e.error?_.danger:_.textMuted})}),(0,s.jsxs)(`div`,{className:n.a(`flex flex-col gap-0.5 flex-1 min-w-0`),children:[(0,s.jsx)(`span`,{className:n.a(`text-sm font-medium truncate`),style:{color:e.error?_.danger:_.text},title:e.file.name,children:n.m(e.file.name)}),(0,s.jsxs)(`span`,{className:n.a(`text-xs`),style:{color:_.textMuted},children:[ht(e.file.size),e.error&&` — ${e.error}`]})]}),(0,s.jsx)(`button`,{type:`button`,"aria-label":`Remove ${n.m(e.file.name)}`,onClick:()=>M(e.id),className:n.a(`flex items-center justify-center bg-transparent border-none cursor-pointer rounded p-1`),style:{color:_.textMuted,flexShrink:0},children:(0,s.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:[(0,s.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,s.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),!e.error&&e.progress<100&&(0,s.jsx)(`div`,{className:n.a(`w-full overflow-hidden`),style:{height:`3px`,borderRadius:`3px`,backgroundColor:_.border},"aria-hidden":`true`,children:(0,s.jsx)(`div`,{style:{height:`100%`,borderRadius:`3px`,backgroundColor:_.primary,width:`${e.progress}%`,transition:v?`none`:`width 100ms ease`}})})]},e.id))})]})}var bt={sm:16,md:24,lg:32,xl:40};function xt({size:e,filled:t,color:n,halfFilled:r,id:i}){let a=i?`hg-${i}`:void 0;return(0,s.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,style:{display:`block`},children:[r&&a&&(0,s.jsx)(`defs`,{children:(0,s.jsxs)(`linearGradient`,{id:a,x1:`0`,x2:`1`,y1:`0`,y2:`0`,children:[(0,s.jsx)(`stop`,{offset:`50%`,stopColor:n}),(0,s.jsx)(`stop`,{offset:`50%`,stopColor:`transparent`})]})}),(0,s.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`,fill:r&&a?`url(#${a})`:t?n:`none`,stroke:n,strokeWidth:1.5,strokeLinejoin:`round`})]})}function St({size:e,filled:t,color:n,halfFilled:r,id:i}){let a=i?`hg-${i}`:void 0;return(0,s.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,style:{display:`block`},children:[r&&a&&(0,s.jsx)(`defs`,{children:(0,s.jsxs)(`linearGradient`,{id:a,x1:`0`,x2:`1`,y1:`0`,y2:`0`,children:[(0,s.jsx)(`stop`,{offset:`50%`,stopColor:n}),(0,s.jsx)(`stop`,{offset:`50%`,stopColor:`transparent`})]})}),(0,s.jsx)(`path`,{d:`M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z`,fill:r&&a?`url(#${a})`:t?n:`none`,stroke:n,strokeWidth:1.5,strokeLinejoin:`round`})]})}function Ct({size:e,filled:t,color:n,halfFilled:r,id:i}){let a=i?`hg-${i}`:void 0;return(0,s.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,style:{display:`block`},children:[r&&a&&(0,s.jsx)(`defs`,{children:(0,s.jsxs)(`linearGradient`,{id:a,x1:`0`,x2:`1`,y1:`0`,y2:`0`,children:[(0,s.jsx)(`stop`,{offset:`50%`,stopColor:n}),(0,s.jsx)(`stop`,{offset:`50%`,stopColor:`transparent`})]})}),(0,s.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,fill:r&&a?`url(#${a})`:t?n:`none`,stroke:n,strokeWidth:1.5})]})}function wt({type:e,size:t,filled:n,color:r,halfFilled:i,uid:a}){let o={size:t,filled:n,color:r,halfFilled:i,id:a};return e===`heart`?(0,s.jsx)(St,{...o}):e===`circle`?(0,s.jsx)(Ct,{...o}):(0,s.jsx)(xt,{...o})}function Tt(e,t,n){return Math.min(n,Math.max(t,e))}function Et(e,t){return t===1?Math.round(e):Math.round(e*2)/2}function Dt(e,t,n){if(n===1)return t+1;let r=e.currentTarget.getBoundingClientRect(),i=r.left+r.width/2;return e.clientX<i?t+.5:t+1}function Ot({value:e,defaultValue:i=0,onChange:a,max:c=5,precision:l=1,size:u=`md`,isReadOnly:d=!1,isDisabled:f=!1,label:p,showValue:m=!1,colorScheme:h=`warning`,emptyIcon:g=`star`,filledIcon:_=`star`}){let v=t.f(),y=r.o(),b=(0,o.useId)(),x=e!==void 0,[S,C]=(0,o.useState)(i),[w,T]=(0,o.useState)(null),E=(0,o.useRef)(null),D=x?e??0:S,O=w??D,k={warning:v.warning,primary:v.primary,danger:v.danger}[h]??v.warning,A=bt[u],j=!d&&!f,M=(0,o.useCallback)(e=>{x||C(e),a?.(e)},[x,a]),N=(0,o.useCallback)((e,t)=>{j&&T(Dt(e,t,l))},[j,l]),P=(0,o.useCallback)(()=>{j&&T(null)},[j]),F=(0,o.useCallback)((e,t)=>{if(!j)return;let n=Dt(e,t,l);M(n===D?0:n)},[j,l,D,M]),I=(0,o.useCallback)(e=>{if(!j)return;let t=l,n=D;if(e.key===`ArrowRight`||e.key===`ArrowUp`)e.preventDefault(),n=Tt(D+t,0,c);else if(e.key===`ArrowLeft`||e.key===`ArrowDown`)e.preventDefault(),n=Tt(D-t,0,c);else if(e.key===`Home`)e.preventDefault(),n=0;else if(e.key===`End`)e.preventDefault(),n=c;else return;n=Et(n,l),M(n)},[j,D,c,l,M]),L=p?n.m(p):`Rating`;return(0,s.jsxs)(`div`,{className:n.t(n.a(`inline-flex items-center gap-2 font-sans`),f?n.a(`opacity-50`):``),children:[(0,s.jsx)(`div`,{ref:E,role:`radiogroup`,"aria-label":L,"aria-disabled":f,"aria-readonly":d,tabIndex:j?0:-1,onKeyDown:I,onMouseLeave:P,className:n.a(`flex items-center gap-0.5 outline-none`),style:{cursor:j?`pointer`:`default`},children:Array.from({length:c},(e,t)=>{let n=t+1,r=t+.5,i=O>=n,a=!i&&l===.5&&O>=r,o=`${b}-${t}`;return(0,s.jsx)(`span`,{role:`radio`,"aria-checked":l===.5&&D===r||D===n,"aria-label":l===.5?`${r} star${r===1?``:`s`} / ${n} star${n===1?``:`s`}`:`${n} star${n===1?``:`s`}`,tabIndex:-1,onMouseMove:e=>N(e,t),onClick:e=>F(e,t),style:{display:`inline-flex`,alignItems:`center`,lineHeight:0,transition:y?`none`:`transform 120ms ease`,transform:w!==null&&O>=r&&j?`scale(1.15)`:`scale(1)`},children:(0,s.jsx)(wt,{type:i||a?_:g,size:A,filled:i,halfFilled:a,color:i||a?k:v.border,uid:a?o:void 0})},t)})}),m&&(0,s.jsxs)(`span`,{className:n.a(`text-sm tabular-nums`),style:{color:v.textMuted},"aria-live":`polite`,"aria-atomic":`true`,children:[D%1==0?D.toFixed(0):D.toFixed(1),` / `,c]})]})}var kt=!1;function At(){if(kt||typeof document>`u`)return;kt=!0;let e=document.createElement(`style`);e.textContent=`
21
21
  @keyframes tkx-blink { 0%,100% { opacity:1 } 50% { opacity:0 } }
22
22
  @keyframes tkx-bounce { 0%,100% { transform:translateY(0) } 50% { transform:translateY(-5px) } }
23
23
  .tkx-cursor::after { content:'▋'; display:inline-block; animation:tkx-blink 1s step-start infinite; margin-left:1px; }
24
24
  .tkx-dot1 { animation:tkx-bounce 1s ease-in-out infinite; }
25
25
  .tkx-dot2 { animation:tkx-bounce 1s ease-in-out 0.2s infinite; }
26
26
  .tkx-dot3 { animation:tkx-bounce 1s ease-in-out 0.4s infinite; }
27
- `,document.head.appendChild(t)}function xo(){return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"14",cy:"14",r:"14",fill:"currentColor",fillOpacity:"0.15"}),e.jsx("circle",{cx:"14",cy:"11",r:"4",fill:"currentColor"}),e.jsx("path",{d:"M6 24c0-4.418 3.582-8 8-8s8 3.582 8 8",fill:"currentColor"})]})}function po(){return e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"14",cy:"14",r:"14",fill:"currentColor",fillOpacity:"0.15"}),e.jsx("path",{d:"M14 5l2.2 6.5H23l-5.6 4 2.2 6.5L14 18l-5.6 4 2.2-6.5L5 11.5h6.8z",fill:"currentColor"})]})}function ur(){const t=O.useTheme();return e.jsxs("div",{className:x.tkx("flex items-center gap-1.5 px-4 py-3 rounded-2xl w-fit"),style:{backgroundColor:t.surface,border:`1px solid ${t.border}`},"aria-label":"Assistant is thinking",children:[e.jsx("span",{className:"tkx-dot1 inline-block w-2 h-2 rounded-full",style:{backgroundColor:t.textMuted}}),e.jsx("span",{className:"tkx-dot2 inline-block w-2 h-2 rounded-full",style:{backgroundColor:t.textMuted}}),e.jsx("span",{className:"tkx-dot3 inline-block w-2 h-2 rounded-full",style:{backgroundColor:t.textMuted}})]})}function fr({message:t,showTimestamp:n,avatarUser:r,avatarAssistant:o}){const s=O.useTheme(),a=J.useReducedMotion(),{role:l,content:d,timestamp:f,isStreaming:u,error:c}=t,h=A.sanitizeString(d),p=f?new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}).format(f):null;if(l==="system")return e.jsx("div",{role:"listitem",className:x.tkx("flex justify-center my-2"),children:e.jsx("p",{className:x.tkx("text-xs italic px-3 py-1 rounded-full"),style:{color:s.textMuted,backgroundColor:s.surfaceAlt},children:h})});const m=l==="user",b=m?r??e.jsx(xo,{}):o??e.jsx(po,{}),k=m?{backgroundColor:s.primary,color:s.bg}:{backgroundColor:s.surface,color:s.text,border:`1px solid ${c?s.danger:s.border}`};return c&&(k.borderColor=s.danger,k.borderWidth="2px"),e.jsxs("div",{role:"listitem",className:x.tkx("flex gap-2 mb-4",m?"flex-row-reverse":"flex-row"),children:[e.jsx("div",{className:x.tkx("shrink-0 w-8 h-8 rounded-full flex items-center justify-center overflow-hidden"),style:{color:m?s.primary:s.secondary},children:b}),e.jsxs("div",{className:x.tkx("flex flex-col gap-1 max-w-[75%]",m?"items-end":"items-start"),children:[e.jsxs("div",{className:x.cx(x.tkx("px-4 py-2.5 rounded-2xl text-sm leading-relaxed break-words whitespace-pre-wrap"),u&&!a?"tkx-cursor":""),style:k,children:[h,c&&e.jsx("span",{"aria-label":"Error",style:{marginLeft:6,color:s.danger},children:"⚠"})]}),n&&p&&e.jsx("span",{className:x.tkx("text-[10px]"),style:{color:s.textMuted},children:p})]})]})}function ho({messages:t,onSend:n,isLoading:r=!1,placeholder:o="Type a message…",maxLength:s,showTimestamps:a=!1,avatarUser:l,avatarAssistant:d,height:f=480,inputPosition:u="bottom"}){const c=O.useTheme(),h=J.useReducedMotion(),[p,m]=i.useState(""),b=i.useRef(null),k=i.useRef(null);i.useEffect(()=>{fo()},[]),i.useEffect(()=>{const N=b.current;N&&N.scrollTo({top:N.scrollHeight,behavior:h?"auto":"smooth"})},[t,r,h]);const y=i.useCallback(()=>{const N=p.trim();!N||!n||(n(N),m(""),k.current&&(k.current.style.height="auto"))},[p,n]),g=i.useCallback(N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),y())},[y]),S=i.useCallback(N=>{const I=s?N.target.value.slice(0,s):N.target.value;m(I);const M=k.current;if(M){M.style.height="auto";const E=24*4+24;M.style.height=`${Math.min(M.scrollHeight,E)}px`}},[s]),j=p.trim().length>0&&!r,v=typeof f=="number"?`${f}px`:f,$=u==="floating",w=e.jsxs("div",{className:x.tkx("flex flex-col gap-1 p-3"),style:$?{position:"absolute",bottom:12,left:12,right:12,borderRadius:16,backgroundColor:c.surface,border:`1px solid ${c.border}`,boxShadow:"0 4px 24px rgba(0,0,0,0.18)"}:{borderTop:`1px solid ${c.border}`,backgroundColor:c.surface},children:[e.jsxs("div",{className:x.tkx("flex items-end gap-2"),children:[e.jsx("textarea",{ref:k,rows:1,value:p,onChange:S,onKeyDown:g,placeholder:A.sanitizeString(o),"aria-label":"Message input","aria-multiline":"true",disabled:r,className:x.tkx("flex-1 resize-none text-sm leading-6 bg-transparent outline-none py-1"),style:{color:c.text,caretColor:c.primary,minHeight:32,maxHeight:120}}),e.jsx("button",{onClick:y,disabled:!j,"aria-label":"Send message",className:x.tkx("shrink-0 w-9 h-9 rounded-xl flex items-center justify-center",!h&&"transition-opacity duration-150",j?"cursor-pointer opacity-100":"opacity-40 cursor-not-allowed"),style:{backgroundColor:c.primary,color:c.bg},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2 14L14 8 2 2v4.5l8 1.5-8 1.5V14z",fill:"currentColor"})})})]}),s&&e.jsxs("div",{className:x.tkx("text-right text-[10px]"),style:{color:c.textMuted},children:[p.length,"/",s]})]});return e.jsxs("div",{className:x.tkx("flex flex-col overflow-hidden rounded-2xl"),style:{height:v,backgroundColor:c.bg,border:`1px solid ${c.border}`,position:"relative"},children:[e.jsx("div",{ref:b,role:"log","aria-live":"polite","aria-label":"Chat messages",className:x.tkx("flex-1 overflow-y-auto p-4"),style:{paddingBottom:$?80:void 0},children:e.jsxs("div",{role:"list",children:[t.map(N=>e.jsx(fr,{message:N,showTimestamp:a,avatarUser:l,avatarAssistant:d},N.id)),r&&e.jsxs("div",{role:"listitem",className:x.tkx("flex gap-2 mb-4"),children:[e.jsx("div",{className:x.tkx("w-8 h-8 shrink-0")}),e.jsx(ur,{})]})]})}),w]})}const mo={sm:"text-[11px]",md:"text-xs",lg:"text-sm"},go={sm:"px-2 py-0.5",md:"px-2.5 py-1",lg:"px-3 py-1.5"},bo={sm:"gap-1",md:"gap-1.5",lg:"gap-2"},yo={sm:12,md:14,lg:16};function ko(t,n){const r=O.useTheme(),s={default:r.textMuted,primary:r.primary,secondary:r.secondary,success:r.success,danger:r.danger,warning:r.warning,info:r.info}[t];return n==="solid"?{bg:s,color:r.bg,border:"transparent"}:n==="subtle"?{bg:`${s}22`,color:s,border:"transparent"}:{bg:"transparent",color:s,border:s}}function xr({variant:t="subtle",size:n="md",colorScheme:r="default",onRemove:o,leftIcon:s,isDisabled:a=!1,clickable:l=!1,children:d,className:f,style:u,onClick:c,...h}){O.useTheme();const p=J.useReducedMotion(),m=ko(r,t),b=typeof d=="string"?A.sanitizeString(d):d,k=yo[n],y=x.tkx("inline-flex items-center font-medium rounded-full select-none",mo[n],go[n],bo[n],a?"opacity-50 cursor-not-allowed":l?"cursor-pointer":"cursor-default",l&&!p&&"transition-opacity duration-150");return e.jsxs("span",{role:l?"button":void 0,tabIndex:l&&!a?0:void 0,"aria-disabled":a||void 0,className:x.cx(y,f),style:{backgroundColor:m.bg,color:m.color,border:`1px solid ${m.border==="transparent"?"transparent":m.border}`,...u},onClick:a?void 0:c,onKeyDown:l&&!a&&c?g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),c(g))}:void 0,...h,children:[s&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("shrink-0 flex items-center"),children:s}),e.jsx("span",{children:b}),o&&!a&&e.jsx("button",{type:"button","aria-label":`Remove ${typeof d=="string"?d:"tag"}`,onClick:g=>{g.stopPropagation(),o()},className:x.tkx("shrink-0 flex items-center justify-center rounded-full cursor-pointer"),style:{width:k+4,height:k+4,color:m.color,backgroundColor:"transparent",border:"none",padding:0},tabIndex:0,children:e.jsx("svg",{width:k,height:k,viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2 2l8 8M10 2L2 10",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})})]})}function vo({value:t,defaultValue:n=[],onChange:r,placeholder:o="Add tag…",maxTags:s,allowDuplicates:a=!1,validate:l,colorScheme:d="primary",size:f="md",label:u,hint:c,isDisabled:h=!1}){const p=O.useTheme(),m=J.useReducedMotion(),[b,k]=i.useState(n),[y,g]=i.useState(""),[S,j]=i.useState(null),v=i.useRef(null),$=t!==void 0,w=$?t:b,N=i.useCallback(z=>{$||k(z),r==null||r(z)},[$,r]),I=i.useCallback(z=>{const L=z.trim();if(L){if(s!==void 0&&w.length>=s){j(`Maximum ${s} tags allowed`);return}if(!a&&w.includes(L)){j("Duplicate tags are not allowed");return}if(l){const B=l(L);if(B===!1){j("Invalid tag");return}if(typeof B=="string"){j(B);return}}j(null),N([...w,L]),g("")}},[w,s,a,l,N]),M=i.useCallback(z=>{const L=w.filter((B,V)=>V!==z);N(L),j(null)},[w,N]),T=i.useCallback(z=>{z.key==="Enter"||z.key===","?(z.preventDefault(),I(y)):z.key==="Backspace"&&y===""&&w.length>0&&M(w.length-1)},[y,w,I,M]),E=i.useCallback(z=>{const L=z.target.value;L.endsWith(",")?I(L.slice(0,-1)):(g(L),S&&j(null))},[I,S]),C=f==="sm"?"6px 8px":f==="lg"?"10px 12px":"8px 10px",H=f==="sm"?11:f==="lg"?14:12;return e.jsxs("div",{className:x.tkx("flex flex-col gap-1.5"),children:[u&&e.jsx("label",{className:x.tkx("text-sm font-medium"),style:{color:p.text},onClick:()=>{var z;return(z=v.current)==null?void 0:z.focus()},children:A.sanitizeString(u)}),e.jsxs("div",{className:x.tkx("flex flex-wrap items-center gap-1.5 rounded-lg cursor-text",!m&&"transition-colors duration-150"),style:{padding:C,backgroundColor:p.surface,border:`1.5px solid ${S?p.danger:p.border}`,opacity:h?.55:1,minHeight:f==="sm"?36:f==="lg"?48:40},onClick:()=>{var z;return!h&&((z=v.current)==null?void 0:z.focus())},children:[w.map((z,L)=>e.jsx(xr,{size:f,variant:"subtle",colorScheme:d,onRemove:h?void 0:()=>M(L),isDisabled:h,children:z},`${z}-${L}`)),(!s||w.length<s)&&!h&&e.jsx("input",{ref:v,type:"text",value:y,onChange:E,onKeyDown:T,placeholder:w.length===0?A.sanitizeString(o):"",disabled:h,className:x.tkx("flex-1 bg-transparent outline-none min-w-[80px]"),style:{fontSize:H,color:p.text,caretColor:p.primary},"aria-label":u??"Tag input"})]}),S&&e.jsx("p",{className:x.tkx("text-xs"),style:{color:p.danger},role:"alert",children:S}),c&&!S&&e.jsx("p",{className:x.tkx("text-xs"),style:{color:p.textMuted},children:A.sanitizeString(c)})]})}let fn=!1;function wo(){if(fn||typeof document>"u")return;fn=!0;const t=document.createElement("style");t.textContent=`
27
+ `,document.head.appendChild(e)}function jt(){return(0,s.jsxs)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 28 28`,fill:`none`,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:`14`,cy:`14`,r:`14`,fill:`currentColor`,fillOpacity:`0.15`}),(0,s.jsx)(`circle`,{cx:`14`,cy:`11`,r:`4`,fill:`currentColor`}),(0,s.jsx)(`path`,{d:`M6 24c0-4.418 3.582-8 8-8s8 3.582 8 8`,fill:`currentColor`})]})}function Mt(){return(0,s.jsxs)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 28 28`,fill:`none`,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:`14`,cy:`14`,r:`14`,fill:`currentColor`,fillOpacity:`0.15`}),(0,s.jsx)(`path`,{d:`M14 5l2.2 6.5H23l-5.6 4 2.2 6.5L14 18l-5.6 4 2.2-6.5L5 11.5h6.8z`,fill:`currentColor`})]})}function Nt(){let e=t.f();return(0,s.jsxs)(`div`,{className:n.a(`flex items-center gap-1.5 px-4 py-3 rounded-2xl w-fit`),style:{backgroundColor:e.surface,border:`1px solid ${e.border}`},"aria-label":`Assistant is thinking`,children:[(0,s.jsx)(`span`,{className:`tkx-dot1 inline-block w-2 h-2 rounded-full`,style:{backgroundColor:e.textMuted}}),(0,s.jsx)(`span`,{className:`tkx-dot2 inline-block w-2 h-2 rounded-full`,style:{backgroundColor:e.textMuted}}),(0,s.jsx)(`span`,{className:`tkx-dot3 inline-block w-2 h-2 rounded-full`,style:{backgroundColor:e.textMuted}})]})}function Pt({message:e,showTimestamp:i,avatarUser:a,avatarAssistant:o}){let c=t.f(),l=r.o(),{role:u,content:d,timestamp:f,isStreaming:p,error:m}=e,h=n.m(d),g=f?new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,minute:`2-digit`,hour12:!0}).format(f):null;if(u===`system`)return(0,s.jsx)(`div`,{role:`listitem`,className:n.a(`flex justify-center my-2`),children:(0,s.jsx)(`p`,{className:n.a(`text-xs italic px-3 py-1 rounded-full`),style:{color:c.textMuted,backgroundColor:c.surfaceAlt},children:h})});let _=u===`user`,v=_?a??(0,s.jsx)(jt,{}):o??(0,s.jsx)(Mt,{}),y=_?{backgroundColor:c.primary,color:c.bg}:{backgroundColor:c.surface,color:c.text,border:`1px solid ${m?c.danger:c.border}`};return m&&(y.borderColor=c.danger,y.borderWidth=`2px`),(0,s.jsxs)(`div`,{role:`listitem`,className:n.a(`flex gap-2 mb-4`,_?`flex-row-reverse`:`flex-row`),children:[(0,s.jsx)(`div`,{className:n.a(`shrink-0 w-8 h-8 rounded-full flex items-center justify-center overflow-hidden`),style:{color:_?c.primary:c.secondary},children:v}),(0,s.jsxs)(`div`,{className:n.a(`flex flex-col gap-1 max-w-[75%]`,_?`items-end`:`items-start`),children:[(0,s.jsxs)(`div`,{className:n.t(n.a(`px-4 py-2.5 rounded-2xl text-sm leading-relaxed break-words whitespace-pre-wrap`),p&&!l?`tkx-cursor`:``),style:y,children:[h,m&&(0,s.jsx)(`span`,{"aria-label":`Error`,style:{marginLeft:6,color:c.danger},children:`⚠`})]}),i&&g&&(0,s.jsx)(`span`,{className:n.a(`text-[10px]`),style:{color:c.textMuted},children:g})]})]})}function Ft({messages:e,onSend:i,isLoading:a=!1,placeholder:c=`Type a message…`,maxLength:l,showTimestamps:u=!1,avatarUser:d,avatarAssistant:f,height:p=480,inputPosition:m=`bottom`}){let h=t.f(),g=r.o(),[_,v]=(0,o.useState)(``),y=(0,o.useRef)(null),b=(0,o.useRef)(null);(0,o.useEffect)(()=>{At()},[]),(0,o.useEffect)(()=>{let e=y.current;e&&e.scrollTo({top:e.scrollHeight,behavior:g?`auto`:`smooth`})},[e,a,g]);let x=(0,o.useCallback)(()=>{let e=_.trim();!e||!i||(i(e),v(``),b.current&&(b.current.style.height=`auto`))},[_,i]),S=(0,o.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),x())},[x]),C=(0,o.useCallback)(e=>{v(l?e.target.value.slice(0,l):e.target.value);let t=b.current;t&&(t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,120)}px`)},[l]),w=_.trim().length>0&&!a,T=typeof p==`number`?`${p}px`:p,E=m===`floating`,D=(0,s.jsxs)(`div`,{className:n.a(`flex flex-col gap-1 p-3`),style:E?{position:`absolute`,bottom:12,left:12,right:12,borderRadius:16,backgroundColor:h.surface,border:`1px solid ${h.border}`,boxShadow:`0 4px 24px rgba(0,0,0,0.18)`}:{borderTop:`1px solid ${h.border}`,backgroundColor:h.surface},children:[(0,s.jsxs)(`div`,{className:n.a(`flex items-end gap-2`),children:[(0,s.jsx)(`textarea`,{ref:b,rows:1,value:_,onChange:C,onKeyDown:S,placeholder:n.m(c),"aria-label":`Message input`,"aria-multiline":`true`,disabled:a,className:n.a(`flex-1 resize-none text-sm leading-6 bg-transparent outline-none py-1`),style:{color:h.text,caretColor:h.primary,minHeight:32,maxHeight:120}}),(0,s.jsx)(`button`,{onClick:x,disabled:!w,"aria-label":`Send message`,className:n.a(`shrink-0 w-9 h-9 rounded-xl flex items-center justify-center`,!g&&`transition-opacity duration-150`,w?`cursor-pointer opacity-100`:`opacity-40 cursor-not-allowed`),style:{backgroundColor:h.primary,color:h.bg},children:(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M2 14L14 8 2 2v4.5l8 1.5-8 1.5V14z`,fill:`currentColor`})})})]}),l&&(0,s.jsxs)(`div`,{className:n.a(`text-right text-[10px]`),style:{color:h.textMuted},children:[_.length,`/`,l]})]});return(0,s.jsxs)(`div`,{className:n.a(`flex flex-col overflow-hidden rounded-2xl`),style:{height:T,backgroundColor:h.bg,border:`1px solid ${h.border}`,position:`relative`},children:[(0,s.jsx)(`div`,{ref:y,role:`log`,"aria-live":`polite`,"aria-label":`Chat messages`,className:n.a(`flex-1 overflow-y-auto p-4`),style:{paddingBottom:E?80:void 0},children:(0,s.jsxs)(`div`,{role:`list`,children:[e.map(e=>(0,s.jsx)(Pt,{message:e,showTimestamp:u,avatarUser:d,avatarAssistant:f},e.id)),a&&(0,s.jsxs)(`div`,{role:`listitem`,className:n.a(`flex gap-2 mb-4`),children:[(0,s.jsx)(`div`,{className:n.a(`w-8 h-8 shrink-0`)}),(0,s.jsx)(Nt,{})]})]})}),D]})}var It={sm:`text-[11px]`,md:`text-xs`,lg:`text-sm`},Lt={sm:`px-2 py-0.5`,md:`px-2.5 py-1`,lg:`px-3 py-1.5`},Rt={sm:`gap-1`,md:`gap-1.5`,lg:`gap-2`},zt={sm:12,md:14,lg:16};function Bt(e,n){let r=t.f(),i={default:r.textMuted,primary:r.primary,secondary:r.secondary,success:r.success,danger:r.danger,warning:r.warning,info:r.info}[e];return n===`solid`?{bg:i,color:r.bg,border:`transparent`}:n===`subtle`?{bg:`${i}22`,color:i,border:`transparent`}:{bg:`transparent`,color:i,border:i}}function Vt({variant:e=`subtle`,size:i=`md`,colorScheme:a=`default`,onRemove:o,leftIcon:c,isDisabled:l=!1,clickable:u=!1,children:d,className:f,style:p,onClick:m,...h}){t.f();let g=r.o(),_=Bt(a,e),v=typeof d==`string`?n.m(d):d,y=zt[i],b=n.a(`inline-flex items-center font-medium rounded-full select-none`,It[i],Lt[i],Rt[i],l?`opacity-50 cursor-not-allowed`:u?`cursor-pointer`:`cursor-default`,u&&!g&&`transition-opacity duration-150`);return(0,s.jsxs)(`span`,{role:u?`button`:void 0,tabIndex:u&&!l?0:void 0,"aria-disabled":l||void 0,className:n.t(b,f),style:{backgroundColor:_.bg,color:_.color,border:`1px solid ${_.border===`transparent`?`transparent`:_.border}`,...p},onClick:l?void 0:m,onKeyDown:u&&!l&&m?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),m(e))}:void 0,...h,children:[c&&(0,s.jsx)(`span`,{"aria-hidden":`true`,className:n.a(`shrink-0 flex items-center`),children:c}),(0,s.jsx)(`span`,{children:v}),o&&!l&&(0,s.jsx)(`button`,{type:`button`,"aria-label":`Remove ${typeof d==`string`?d:`tag`}`,onClick:e=>{e.stopPropagation(),o()},className:n.a(`shrink-0 flex items-center justify-center rounded-full cursor-pointer`),style:{width:y+4,height:y+4,color:_.color,backgroundColor:`transparent`,border:`none`,padding:0},tabIndex:0,children:(0,s.jsx)(`svg`,{width:y,height:y,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M2 2l8 8M10 2L2 10`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`})})})]})}function Ht({value:e,defaultValue:i=[],onChange:a,placeholder:c=`Add tag…`,maxTags:l,allowDuplicates:u=!1,validate:d,colorScheme:f=`primary`,size:p=`md`,label:m,hint:h,isDisabled:g=!1}){let _=t.f(),v=r.o(),[y,b]=(0,o.useState)(i),[x,S]=(0,o.useState)(``),[C,w]=(0,o.useState)(null),T=(0,o.useRef)(null),E=e!==void 0,D=E?e:y,O=(0,o.useCallback)(e=>{E||b(e),a?.(e)},[E,a]),k=(0,o.useCallback)(e=>{let t=e.trim();if(t){if(l!==void 0&&D.length>=l){w(`Maximum ${l} tags allowed`);return}if(!u&&D.includes(t)){w(`Duplicate tags are not allowed`);return}if(d){let e=d(t);if(e===!1){w(`Invalid tag`);return}if(typeof e==`string`){w(e);return}}w(null),O([...D,t]),S(``)}},[D,l,u,d,O]),A=(0,o.useCallback)(e=>{O(D.filter((t,n)=>n!==e)),w(null)},[D,O]),j=(0,o.useCallback)(e=>{e.key===`Enter`||e.key===`,`?(e.preventDefault(),k(x)):e.key===`Backspace`&&x===``&&D.length>0&&A(D.length-1)},[x,D,k,A]),M=(0,o.useCallback)(e=>{let t=e.target.value;t.endsWith(`,`)?k(t.slice(0,-1)):(S(t),C&&w(null))},[k,C]),N=p===`sm`?`6px 8px`:p===`lg`?`10px 12px`:`8px 10px`,P=p===`sm`?11:p===`lg`?14:12;return(0,s.jsxs)(`div`,{className:n.a(`flex flex-col gap-1.5`),children:[m&&(0,s.jsx)(`label`,{className:n.a(`text-sm font-medium`),style:{color:_.text},onClick:()=>T.current?.focus(),children:n.m(m)}),(0,s.jsxs)(`div`,{className:n.a(`flex flex-wrap items-center gap-1.5 rounded-lg cursor-text`,!v&&`transition-colors duration-150`),style:{padding:N,backgroundColor:_.surface,border:`1.5px solid ${C?_.danger:_.border}`,opacity:g?.55:1,minHeight:p===`sm`?36:p===`lg`?48:40},onClick:()=>!g&&T.current?.focus(),children:[D.map((e,t)=>(0,s.jsx)(Vt,{size:p,variant:`subtle`,colorScheme:f,onRemove:g?void 0:()=>A(t),isDisabled:g,children:e},`${e}-${t}`)),(!l||D.length<l)&&!g&&(0,s.jsx)(`input`,{ref:T,type:`text`,value:x,onChange:M,onKeyDown:j,placeholder:D.length===0?n.m(c):``,disabled:g,className:n.a(`flex-1 bg-transparent outline-none min-w-[80px]`),style:{fontSize:P,color:_.text,caretColor:_.primary},"aria-label":m??`Tag input`})]}),C&&(0,s.jsx)(`p`,{className:n.a(`text-xs`),style:{color:_.danger},role:`alert`,children:C}),h&&!C&&(0,s.jsx)(`p`,{className:n.a(`text-xs`),style:{color:_.textMuted},children:n.m(h)})]})}var Ut=!1;function Wt(){if(Ut||typeof document>`u`)return;Ut=!0;let e=document.createElement(`style`);e.textContent=`
28
28
  @keyframes tkx-pulse-dot { 0%,100% { box-shadow:0 0 0 0 currentColor; opacity:1; } 70% { box-shadow:0 0 0 8px transparent; opacity:0.7; } }
29
29
  @keyframes tkx-draw-line { from { transform:scaleY(0); transform-origin:top center; } to { transform:scaleY(1); } }
30
30
  @keyframes tkx-draw-line-h { from { transform:scaleX(0); transform-origin:left center; } to { transform:scaleX(1); } }
31
31
  .tkx-pulse-dot { animation: tkx-pulse-dot 1.5s ease-in-out infinite; }
32
32
  .tkx-draw-v { animation: tkx-draw-line 0.6s ease forwards; }
33
33
  .tkx-draw-h { animation: tkx-draw-line-h 0.6s ease forwards; }
34
- `,document.head.appendChild(t)}function jo(t="pending"){const n=O.useTheme();return{completed:n.success,active:n.primary,pending:n.border,error:n.danger}[t]}function Et({status:t="pending",icon:n,size:r=28}){const o=O.useTheme(),s=J.useReducedMotion(),a=jo(t),l=t==="active";return e.jsx("div",{className:x.cx(x.tkx("relative flex items-center justify-center rounded-full shrink-0 z-10"),l&&!s?"tkx-pulse-dot":""),style:{width:r,height:r,backgroundColor:t==="pending"?o.surface:a,border:`2px solid ${a}`,color:t==="pending"?a:o.bg},"aria-hidden":"true",children:n?e.jsx("span",{style:{fontSize:r*.45,lineHeight:1},children:n}):e.jsx("span",{style:{width:r*.35,height:r*.35,borderRadius:"50%",backgroundColor:t==="pending"?a:o.bg,display:"block"}})})}function xn({style:t,color:n,animate:r}){return O.useTheme(),e.jsx("div",{className:x.cx(x.tkx("w-0.5 flex-1 min-h-[24px]"),r?"tkx-draw-v":""),style:{borderLeft:`2px ${t} ${n}`,backgroundColor:"transparent",alignSelf:"stretch",borderColor:n,marginLeft:1},"aria-hidden":"true"})}function pn({style:t,color:n,animate:r}){return e.jsx("div",{className:x.cx(x.tkx("h-0.5 flex-1 min-w-[24px]"),r?"tkx-draw-h":""),style:{borderTop:`2px ${t} ${n}`,borderColor:n},"aria-hidden":"true"})}function Nt({item:t,compact:n}){const r=O.useTheme(),o=t.timestamp?A.sanitizeString(t.timestamp):null;return e.jsxs("div",{className:x.tkx("flex flex-col gap-0.5",n?"pb-3":"pb-5"),children:[e.jsxs("div",{className:x.tkx("flex items-center gap-2 flex-wrap"),children:[e.jsx("span",{className:x.tkx("text-sm font-semibold leading-snug"),style:{color:r.text},children:typeof t.title=="string"?A.sanitizeString(t.title):t.title}),t.badge&&e.jsx("span",{children:t.badge}),o&&e.jsx("span",{className:x.tkx("text-[11px] ml-auto"),style:{color:r.textMuted},children:o})]}),t.description&&!n&&e.jsx("div",{className:x.tkx("text-xs leading-relaxed mt-0.5"),style:{color:r.textMuted},children:typeof t.description=="string"?A.sanitizeString(t.description):t.description})]})}function So({items:t,variant:n="default",orientation:r="vertical",connectorStyle:o="solid"}){const s=O.useTheme(),a=J.useReducedMotion(),l=i.useRef(!1);i.useEffect(()=>{wo(),l.current=!0},[]);const d=!a,f=n==="compact",u=n==="alternating"&&r==="vertical";return r==="horizontal"?e.jsx("div",{role:"list","aria-label":"Timeline",className:x.tkx("flex items-start w-full overflow-x-auto"),children:t.map((h,p)=>{const m=h.status??"pending",b=m==="completed"?s.success:s.border,k=p===t.length-1;return e.jsx("div",{role:"listitem",className:x.tkx("flex items-start flex-1 min-w-0"),children:e.jsxs("div",{className:x.tkx("flex flex-col items-center flex-1 min-w-0"),children:[e.jsxs("div",{className:x.tkx("flex items-center w-full"),children:[p>0&&e.jsx(pn,{style:o,color:b,animate:d}),e.jsx(Et,{status:m,icon:h.icon,size:24}),!k&&e.jsx(pn,{style:o,color:b,animate:d})]}),e.jsxs("div",{className:x.tkx("mt-2 px-1 text-center min-w-0 w-full"),children:[e.jsx("div",{className:x.tkx("text-xs font-semibold truncate"),style:{color:s.text},children:typeof h.title=="string"?A.sanitizeString(h.title):h.title}),h.timestamp&&e.jsx("div",{className:x.tkx("text-[10px] mt-0.5"),style:{color:s.textMuted},children:A.sanitizeString(h.timestamp)})]})]})},h.id)})}):e.jsx("div",{role:"list","aria-label":"Timeline",className:x.tkx("flex flex-col"),children:t.map((h,p)=>{const m=h.status??"pending",b=p===t.length-1,k=m==="completed"?s.success:s.border,y=u&&p%2===0;return u?e.jsxs("div",{role:"listitem",className:x.tkx("flex items-stretch gap-0"),children:[e.jsx("div",{className:x.tkx("flex-1 flex flex-col items-end pr-4",y?"":"invisible"),children:y&&e.jsx(Nt,{item:h,compact:f})}),e.jsxs("div",{className:x.tkx("flex flex-col items-center"),children:[e.jsx(Et,{status:m,icon:h.icon,size:28}),!b&&e.jsx(xn,{style:o,color:k,animate:d})]}),e.jsx("div",{className:x.tkx("flex-1 flex flex-col items-start pl-4",y?"invisible":""),children:!y&&e.jsx(Nt,{item:h,compact:f})})]},h.id):e.jsxs("div",{role:"listitem",className:x.tkx("flex gap-3 items-stretch"),children:[e.jsxs("div",{className:x.tkx("flex flex-col items-center"),children:[e.jsx(Et,{status:m,icon:h.icon,size:f?22:28}),!b&&e.jsx(xn,{style:o,color:k,animate:d})]}),e.jsx("div",{className:x.tkx("flex-1 min-w-0 pt-0.5"),children:e.jsx(Nt,{item:h,compact:f})})]},h.id)})})}function hn(t,n,r,o){const s=window.innerWidth,a=window.innerHeight,l=6;let d=0,f=0,u="top left";switch(n){case"bottom-start":d=t.bottom+l,f=t.left,u="top left",d+o>a&&t.top-l-o>0&&(d=t.top-l-o,u="bottom left"),f+r>s&&(f=Math.max(0,s-r-8));break;case"bottom-end":d=t.bottom+l,f=t.right-r,u="top right",d+o>a&&t.top-l-o>0&&(d=t.top-l-o,u="bottom right"),f<0&&(f=8);break;case"top-start":d=t.top-l-o,f=t.left,u="bottom left",d<0&&(d=t.bottom+l,u="top left"),f+r>s&&(f=Math.max(0,s-r-8));break;case"top-end":d=t.top-l-o,f=t.right-r,u="bottom right",d<0&&(d=t.bottom+l,u="top right"),f<0&&(f=8);break;case"right-start":d=t.top,f=t.right+l,u="top left",f+r>s&&(f=t.left-l-r,u="top right"),d+o>a&&(d=Math.max(8,a-o-8));break;case"left-start":d=t.top,f=t.left-l-r,u="top right",f<0&&(f=t.right+l,u="top left"),d+o>a&&(d=Math.max(8,a-o-8));break}return{top:d+window.scrollY,left:f+window.scrollX,transformOrigin:u}}function Mo(t,n,r){const o=window.innerWidth,s=window.innerHeight,a=4;let l=t.right+a,d="top left";l+n>o&&(l=t.left-a-n,d="top right");let f=t.top;return f+r>s&&(f=Math.max(8,s-r-8)),{top:f+window.scrollY,left:l+window.scrollX,transformOrigin:d}}const To=`
34
+ `,document.head.appendChild(e)}function Gt(e=`pending`){let n=t.f();return{completed:n.success,active:n.primary,pending:n.border,error:n.danger}[e]}function Kt({status:e=`pending`,icon:i,size:a=28}){let o=t.f(),c=r.o(),l=Gt(e),u=e===`active`;return(0,s.jsx)(`div`,{className:n.t(n.a(`relative flex items-center justify-center rounded-full shrink-0 z-10`),u&&!c?`tkx-pulse-dot`:``),style:{width:a,height:a,backgroundColor:e===`pending`?o.surface:l,border:`2px solid ${l}`,color:e===`pending`?l:o.bg},"aria-hidden":`true`,children:i?(0,s.jsx)(`span`,{style:{fontSize:a*.45,lineHeight:1},children:i}):(0,s.jsx)(`span`,{style:{width:a*.35,height:a*.35,borderRadius:`50%`,backgroundColor:e===`pending`?l:o.bg,display:`block`}})})}function qt({style:e,color:r,animate:i}){return t.f(),(0,s.jsx)(`div`,{className:n.t(n.a(`w-0.5 flex-1 min-h-[24px]`),i?`tkx-draw-v`:``),style:{borderLeft:`2px ${e} ${r}`,backgroundColor:`transparent`,alignSelf:`stretch`,borderColor:r,marginLeft:1},"aria-hidden":`true`})}function Jt({style:e,color:t,animate:r}){return(0,s.jsx)(`div`,{className:n.t(n.a(`h-0.5 flex-1 min-w-[24px]`),r?`tkx-draw-h`:``),style:{borderTop:`2px ${e} ${t}`,borderColor:t},"aria-hidden":`true`})}function Yt({item:e,compact:r}){let i=t.f(),a=e.timestamp?n.m(e.timestamp):null;return(0,s.jsxs)(`div`,{className:n.a(`flex flex-col gap-0.5`,r?`pb-3`:`pb-5`),children:[(0,s.jsxs)(`div`,{className:n.a(`flex items-center gap-2 flex-wrap`),children:[(0,s.jsx)(`span`,{className:n.a(`text-sm font-semibold leading-snug`),style:{color:i.text},children:typeof e.title==`string`?n.m(e.title):e.title}),e.badge&&(0,s.jsx)(`span`,{children:e.badge}),a&&(0,s.jsx)(`span`,{className:n.a(`text-[11px] ml-auto`),style:{color:i.textMuted},children:a})]}),e.description&&!r&&(0,s.jsx)(`div`,{className:n.a(`text-xs leading-relaxed mt-0.5`),style:{color:i.textMuted},children:typeof e.description==`string`?n.m(e.description):e.description})]})}function Xt({items:e,variant:i=`default`,orientation:a=`vertical`,connectorStyle:c=`solid`}){let l=t.f(),u=r.o(),d=(0,o.useRef)(!1);(0,o.useEffect)(()=>{Wt(),d.current=!0},[]);let f=!u,p=i===`compact`,m=i===`alternating`&&a===`vertical`;return a===`horizontal`?(0,s.jsx)(`div`,{role:`list`,"aria-label":`Timeline`,className:n.a(`flex items-start w-full overflow-x-auto`),children:e.map((t,r)=>{let i=t.status??`pending`,a=i===`completed`?l.success:l.border,o=r===e.length-1;return(0,s.jsx)(`div`,{role:`listitem`,className:n.a(`flex items-start flex-1 min-w-0`),children:(0,s.jsxs)(`div`,{className:n.a(`flex flex-col items-center flex-1 min-w-0`),children:[(0,s.jsxs)(`div`,{className:n.a(`flex items-center w-full`),children:[r>0&&(0,s.jsx)(Jt,{style:c,color:a,animate:f}),(0,s.jsx)(Kt,{status:i,icon:t.icon,size:24}),!o&&(0,s.jsx)(Jt,{style:c,color:a,animate:f})]}),(0,s.jsxs)(`div`,{className:n.a(`mt-2 px-1 text-center min-w-0 w-full`),children:[(0,s.jsx)(`div`,{className:n.a(`text-xs font-semibold truncate`),style:{color:l.text},children:typeof t.title==`string`?n.m(t.title):t.title}),t.timestamp&&(0,s.jsx)(`div`,{className:n.a(`text-[10px] mt-0.5`),style:{color:l.textMuted},children:n.m(t.timestamp)})]})]})},t.id)})}):(0,s.jsx)(`div`,{role:`list`,"aria-label":`Timeline`,className:n.a(`flex flex-col`),children:e.map((t,r)=>{let i=t.status??`pending`,a=r===e.length-1,o=i===`completed`?l.success:l.border,u=m&&r%2==0;return m?(0,s.jsxs)(`div`,{role:`listitem`,className:n.a(`flex items-stretch gap-0`),children:[(0,s.jsx)(`div`,{className:n.a(`flex-1 flex flex-col items-end pr-4`,u?``:`invisible`),children:u&&(0,s.jsx)(Yt,{item:t,compact:p})}),(0,s.jsxs)(`div`,{className:n.a(`flex flex-col items-center`),children:[(0,s.jsx)(Kt,{status:i,icon:t.icon,size:28}),!a&&(0,s.jsx)(qt,{style:c,color:o,animate:f})]}),(0,s.jsx)(`div`,{className:n.a(`flex-1 flex flex-col items-start pl-4`,u?`invisible`:``),children:!u&&(0,s.jsx)(Yt,{item:t,compact:p})})]},t.id):(0,s.jsxs)(`div`,{role:`listitem`,className:n.a(`flex gap-3 items-stretch`),children:[(0,s.jsxs)(`div`,{className:n.a(`flex flex-col items-center`),children:[(0,s.jsx)(Kt,{status:i,icon:t.icon,size:p?22:28}),!a&&(0,s.jsx)(qt,{style:c,color:o,animate:f})]}),(0,s.jsx)(`div`,{className:n.a(`flex-1 min-w-0 pt-0.5`),children:(0,s.jsx)(Yt,{item:t,compact:p})})]},t.id)})})}function Zt(e,t,n,r){let i=window.innerWidth,a=window.innerHeight,o=0,s=0,c=`top left`;switch(t){case`bottom-start`:o=e.bottom+6,s=e.left,c=`top left`,o+r>a&&e.top-6-r>0&&(o=e.top-6-r,c=`bottom left`),s+n>i&&(s=Math.max(0,i-n-8));break;case`bottom-end`:o=e.bottom+6,s=e.right-n,c=`top right`,o+r>a&&e.top-6-r>0&&(o=e.top-6-r,c=`bottom right`),s<0&&(s=8);break;case`top-start`:o=e.top-6-r,s=e.left,c=`bottom left`,o<0&&(o=e.bottom+6,c=`top left`),s+n>i&&(s=Math.max(0,i-n-8));break;case`top-end`:o=e.top-6-r,s=e.right-n,c=`bottom right`,o<0&&(o=e.bottom+6,c=`top right`),s<0&&(s=8);break;case`right-start`:o=e.top,s=e.right+6,c=`top left`,s+n>i&&(s=e.left-6-n,c=`top right`),o+r>a&&(o=Math.max(8,a-r-8));break;case`left-start`:o=e.top,s=e.left-6-n,c=`top right`,s<0&&(s=e.right+6,c=`top left`),o+r>a&&(o=Math.max(8,a-r-8));break}return{top:o+window.scrollY,left:s+window.scrollX,transformOrigin:c}}function Qt(e,t,n){let r=window.innerWidth,i=window.innerHeight,a=e.right+4,o=`top left`;a+t>r&&(a=e.left-4-t,o=`top right`);let s=e.top;return s+n>i&&(s=Math.max(8,i-n-8)),{top:s+window.scrollY,left:a+window.scrollX,transformOrigin:o}}var $t=`
35
35
  @keyframes tkxMenuIn {
36
36
  from { opacity: 0; transform: scale(0.94); }
37
37
  to { opacity: 1; transform: scale(1); }
@@ -50,7 +50,7 @@
50
50
  animation: tkxMenuInReduced 100ms ease forwards;
51
51
  }
52
52
  }
53
- `;function Co(t,n){return{position:"absolute",top:n.top,left:n.left,zIndex:9999,minWidth:200,maxWidth:320,backgroundColor:t.surface,border:`1.5px solid ${t.border}`,borderRadius:10,boxShadow:"0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)",padding:"4px 0",transformOrigin:n.transformOrigin,overflow:"hidden"}}function Io({color:t}){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})}function $o({color:t}){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"5",fill:t}),e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:t,strokeWidth:"2"})]})}function zo({color:t}){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M9 18l6-6-6-6"})})}function Eo(t){const n=[];let r=0;for(const o of t)if(o.type!=="separator")if(o.type==="radio-group")for(let s=0;s<o.options.length;s++)n.push({kind:"radio",item:o,optionIdx:s,idx:r++});else o.type==="check"?n.push({kind:"check",item:o,idx:r++}):o.type==="submenu"?n.push({kind:"submenu",item:o,idx:r++}):n.push({kind:"action",item:o,idx:r++});return n}function pr({items:t,pos:n,panelId:r,onClose:o,onCloseAll:s,isSubmenu:a=!1}){const l=O.useTheme(),[d,f]=i.useState(-1),[u,c]=i.useState(null),[h,p]=i.useState(null),m=i.useRef(null),[b,k]=i.useState(""),y=i.useRef(null),g=Eo(t);i.useEffect(()=>{var I;(I=m.current)==null||I.focus()},[]),i.useEffect(()=>{var M;if(d<0)return;const I=(M=m.current)==null?void 0:M.querySelector(`[data-midx="${d}"]`);I==null||I.scrollIntoView({block:"nearest"})},[d]);const S=i.useCallback(I=>{var M,T,E,C,H,z;if(I.kind==="action"){if(I.item.disabled)return;(T=(M=I.item).onClick)==null||T.call(M),s()}else if(I.kind==="check"){if(I.item.disabled)return;(C=(E=I.item).onChange)==null||C.call(E,!I.item.checked)}else if(I.kind==="radio"){if(I.item.disabled)return;(z=(H=I.item).onChange)==null||z.call(H,I.item.options[I.optionIdx].value)}else if(I.kind==="submenu"){if(I.item.disabled)return;c(I.item.id)}},[s]),j=I=>{var M;switch(I.key){case"ArrowDown":I.preventDefault(),f(T=>{const E=T+1;return E<g.length?E:0});break;case"ArrowUp":I.preventDefault(),f(T=>{const E=T-1;return E>=0?E:g.length-1});break;case"Home":I.preventDefault(),f(0);break;case"End":I.preventDefault(),f(g.length-1);break;case"Enter":case" ":I.preventDefault(),d>=0&&g[d]&&S(g[d]);break;case"Escape":I.preventDefault(),a?o():s();break;case"Tab":I.preventDefault(),s();break;case"ArrowRight":I.preventDefault(),d>=0&&((M=g[d])==null?void 0:M.kind)==="submenu"&&c(g[d].item.id);break;case"ArrowLeft":I.preventDefault(),a&&o();break;default:I.key.length===1&&!I.ctrlKey&&!I.metaKey&&v(I.key)}};function v(I){y.current&&clearTimeout(y.current);const M=b+I.toLowerCase();k(M);const T=g.findIndex(E=>(E.kind==="radio"?E.item.options[E.optionIdx].label:E.item.label).toLowerCase().startsWith(M));T>=0&&f(T),y.current=setTimeout(()=>k(""),800)}function $(I,M){const T=M.getBoundingClientRect();c(I.id);const E=Math.min(I.items.length*38+12,360);p(Mo(T,220,E))}function w(){c(null),p(null)}const N=()=>{let I=-1;return t.map(M=>{if(M.type==="separator")return e.jsx("div",{role:"separator",style:{margin:(M.label,"4px 0"),display:"flex",alignItems:"center",gap:8},children:M.label?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1,height:1,backgroundColor:l.border,marginLeft:14}}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:l.textMuted,fontFamily:"inherit",whiteSpace:"nowrap"},children:A.sanitizeString(M.label)}),e.jsx("div",{style:{flex:1,height:1,backgroundColor:l.border,marginRight:14}})]}):e.jsx("div",{style:{flex:1,height:1,backgroundColor:l.border,margin:"0 10px"}})},M.id);if(M.type==="radio-group")return e.jsxs("div",{role:"group","aria-label":M.label,children:[M.label&&e.jsx("div",{style:{padding:"6px 14px 2px",fontSize:"11px",fontWeight:700,letterSpacing:"0.07em",textTransform:"uppercase",color:l.textMuted,fontFamily:"inherit"},"aria-hidden":"true",children:A.sanitizeString(M.label)}),M.options.map((B,V)=>{I++;const D=I,_=D===d,R=B.value===M.value,F=!!M.disabled,W=St(l,_,!1,F);return e.jsxs("div",{role:"menuitemradio","aria-checked":R,"aria-disabled":F||void 0,"data-midx":D,tabIndex:-1,style:W,onClick:()=>{var K;return!F&&((K=M.onChange)==null?void 0:K.call(M,B.value))},onMouseEnter:()=>!F&&f(D),children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:R?e.jsx($o,{color:l.primary}):e.jsx("span",{style:{width:14,height:14,borderRadius:"50%",border:`2px solid ${l.border}`,display:"inline-block"}})}),B.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:l.textMuted},children:B.icon}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(B.label)})]},B.value)})]},M.id);if(M.type==="check"){I++;const B=I,V=B===d,D=!!M.disabled,_=St(l,V,!1,D);return e.jsxs("div",{role:"menuitemcheckbox","aria-checked":M.checked,"aria-disabled":D||void 0,"data-midx":B,tabIndex:-1,style:_,onClick:()=>{var R;return!D&&((R=M.onChange)==null?void 0:R.call(M,!M.checked))},onMouseEnter:()=>!D&&f(B),children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:M.checked?e.jsx(Io,{color:l.primary}):e.jsx("span",{style:{width:14,height:14,display:"inline-block"}})}),M.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:l.textMuted},children:M.icon}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(M.label)})]},M.id)}if(M.type==="submenu"){I++;const B=I,V=B===d,D=!!M.disabled,_=u===M.id,R=St(l,V||_,!1,D);return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("div",{role:"menuitem","aria-haspopup":"menu","aria-expanded":_,"aria-disabled":D||void 0,"data-midx":B,tabIndex:-1,style:R,onMouseEnter:F=>{D||(f(B),$(M,F.currentTarget))},onMouseLeave:()=>{},onClick:()=>{D||c(_?null:M.id)},children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:M.icon?e.jsx("span",{style:{display:"flex",color:l.textMuted},children:M.icon}):e.jsx("span",{style:{width:14}})}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(M.label)}),e.jsx(zo,{color:l.textMuted})]}),_&&h&&Re.createPortal(e.jsx(pr,{items:M.items,pos:h,panelId:`${r}-sub-${M.id}`,onClose:w,onCloseAll:s,isSubmenu:!0}),document.body)]},M.id)}const T=M;I++;const E=I,C=E===d,H=!!T.disabled,z=!!T.danger,L=St(l,C,z,H);return e.jsxs("div",{role:"menuitem","aria-disabled":H||void 0,"data-midx":E,tabIndex:-1,style:L,onClick:()=>{var B;H||((B=T.onClick)==null||B.call(T),s())},onMouseEnter:()=>{H||(f(E),w())},children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:T.icon?e.jsx("span",{style:{display:"flex",color:z?l.danger:l.textMuted},children:T.icon}):e.jsx("span",{style:{width:14}})}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(T.label)}),T.description&&e.jsx("span",{style:{display:"block",fontSize:"12px",color:l.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(T.description)})]}),T.shortcut&&e.jsx("span",{style:{fontSize:"12px",color:l.textMuted,fontFamily:"inherit",flexShrink:0,marginLeft:16,opacity:.8},children:A.sanitizeString(T.shortcut)})]},T.id)})};return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:To}),e.jsx("div",{ref:m,id:r,role:"menu",tabIndex:-1,className:"tkx-menu-panel",onKeyDown:j,style:{...Co(l,n),maxHeight:400,overflowY:"auto"},children:N()})]})}function St(t,n,r,o){const s=r?t.danger:t.text;return{display:"flex",alignItems:"center",gap:8,padding:"7px 14px",fontSize:"14px",fontFamily:"inherit",cursor:o?"not-allowed":"pointer",userSelect:"none",color:o?t.textMuted:n&&r?t.danger:s,backgroundColor:n?r?`${t.danger}18`:`${t.primary}18`:"transparent",transition:"background-color 80ms",opacity:o?.5:1,outline:"none"}}function hr({trigger:t,items:n,placement:r="bottom-start",isDisabled:o=!1,onOpen:s,onClose:a,className:l,style:d}){const u=`tkx-menu-${i.useId().replace(/:/g,"")}`,[c,h]=i.useState(!1),[p,m]=i.useState(null),b=i.useRef(null),k=i.useCallback(()=>{if(o)return;const S=b.current;if(!S)return;const j=S.getBoundingClientRect(),v=Math.min(n.length*38+12,360);m(hn(j,r,220,v)),h(!0),s==null||s()},[o,n.length,s,r]),y=i.useCallback(()=>{var S,j,v;h(!1),a==null||a(),(v=(j=(S=b.current)==null?void 0:S.firstElementChild)==null?void 0:j.focus)==null||v.call(j)},[a]);i.useEffect(()=>{if(!c)return;const S=j=>{var w;const v=j.target;if((w=b.current)!=null&&w.contains(v))return;const $=document.querySelectorAll(".tkx-menu-panel");for(const N of $)if(N.contains(v))return;y()};return document.addEventListener("pointerdown",S),()=>document.removeEventListener("pointerdown",S)},[c,y]),i.useEffect(()=>{if(!c)return;const S=()=>{const j=b.current;if(!j)return;const v=j.getBoundingClientRect(),$=Math.min(n.length*38+12,360);m(hn(v,r,220,$))};return window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[c,n.length,r]);const g=S=>{(S.key==="Enter"||S.key===" "||S.key==="ArrowDown")&&(S.preventDefault(),c||k()),S.key==="Escape"&&c&&(S.preventDefault(),y())};return e.jsxs("span",{ref:b,className:l,style:{display:"inline-flex",...d},children:[e.jsx("span",{role:"button",tabIndex:o?-1:0,"aria-haspopup":"menu","aria-expanded":c,"aria-controls":c?u:void 0,"aria-disabled":o||void 0,onClick:()=>c?y():k(),onKeyDown:g,style:{display:"inline-flex",cursor:o?"not-allowed":"pointer",opacity:o?.55:1,outline:"none"},children:t}),c&&p&&Re.createPortal(e.jsx(pr,{items:n,pos:p,panelId:u,onClose:y,onCloseAll:y}),document.body)]})}hr.displayName="TkxMenu";const No={sm:120,md:180,lg:240,xl:320};function Mt(t){const n=new Date;if(t)try{const l=new Intl.DateTimeFormat("en-US",{timeZone:t,hour:"numeric",minute:"numeric",second:"numeric",hour12:!1,weekday:"long",month:"long",day:"2-digit",year:"numeric"}).formatToParts(n),d=y=>{var g;return((g=l.find(S=>S.type===y))==null?void 0:g.value)??"0"};let f=parseInt(d("hour"),10);f===24&&(f=0);const u=parseInt(d("minute"),10),c=parseInt(d("second"),10),h=d("weekday"),p=d("month"),m=d("day"),b=d("year"),k=`${h}, ${p} ${m}, ${b}`;return{hours:f,minutes:u,seconds:c,milliseconds:n.getMilliseconds(),dateString:k}}catch{}const r=n.getHours(),o=n.getMinutes(),s=n.getSeconds(),a=n.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"2-digit",year:"numeric"});return{hours:r,minutes:o,seconds:s,milliseconds:n.getMilliseconds(),dateString:a}}function Ro({time:t,size:n,analogStyle:r,showSeconds:o,reducedMotion:s,primary:a,danger:l,text:d,textMuted:f,border:u,surface:c,bg:h}){const p=n/2,m=n/2,b=n/2-4,{hours:k,minutes:y,seconds:g,milliseconds:S}=t,v=(g+(s?0:S)/1e3)/60*360,$=y/60*360+g/60*6,w=k%12/12*360+y/60*30,N=(z,L)=>{const B=(z-90)*Math.PI/180;return{x:p+Math.cos(B)*L,y:m+Math.sin(B)*L}},I=s?"none":"transform 0.15s cubic-bezier(0.4, 2.08, 0.55, 0.44)";if(r==="modern"){const z=(F,W)=>{const ne=-90+F*360,Z={x:p+Math.cos(-90*Math.PI/180)*W,y:m+Math.sin(-90*Math.PI/180)*W},ie={x:p+Math.cos(ne*Math.PI/180)*W,y:m+Math.sin(ne*Math.PI/180)*W},fe=F>.5?1:0;return`M ${Z.x} ${Z.y} A ${W} ${W} 0 ${fe} 1 ${ie.x} ${ie.y}`},L=k%12/12+y/60/12,B=y/60+g/3600,V=(g+(s?0:S/1e3))/60,D=b-2,_=b-10,R=b-18;return e.jsxs("svg",{width:n,height:n,viewBox:`0 0 ${n} ${n}`,"aria-hidden":"true",children:[e.jsx("circle",{cx:p,cy:m,r:D,fill:"none",stroke:u,strokeWidth:4}),e.jsx("circle",{cx:p,cy:m,r:_,fill:"none",stroke:u,strokeWidth:4}),o&&e.jsx("circle",{cx:p,cy:m,r:R,fill:"none",stroke:u,strokeWidth:3}),e.jsx("path",{d:z(L,D),fill:"none",stroke:a,strokeWidth:4,strokeLinecap:"round"}),e.jsx("path",{d:z(B,_),fill:"none",stroke:d,strokeWidth:4,strokeLinecap:"round"}),o&&e.jsx("path",{d:z(V,R),fill:"none",stroke:l,strokeWidth:3,strokeLinecap:"round"}),e.jsx("circle",{cx:p,cy:m,r:4,fill:a}),e.jsxs("text",{x:p,y:m+20,textAnchor:"middle",fontSize:n*.12,fill:f,fontFamily:"monospace",style:{fontVariantNumeric:"tabular-nums"},children:[String(k).padStart(2,"0"),":",String(y).padStart(2,"0")]})]})}const M=N(w,b*.5),T=N($,b*.75),E=N(v,b*.85),C=N(v+180,b*.2),H=[];if(r==="classic"){for(let L=0;L<60;L++){const B=L/60*360,V=L%5===0,D=(B-90)*Math.PI/180,_=V?b-10:b-6,R=p+Math.cos(D)*b,F=m+Math.sin(D)*b,W=p+Math.cos(D)*_,K=m+Math.sin(D)*_;H.push(e.jsx("line",{x1:R,y1:F,x2:W,y2:K,stroke:V?d:f,strokeWidth:V?2:1,strokeLinecap:"round"},L))}const z=[{n:12,angle:0},{n:3,angle:90},{n:6,angle:180},{n:9,angle:270}];for(const{n:L,angle:B}of z){const V=(B-90)*Math.PI/180,D=b-20;H.push(e.jsx("text",{x:p+Math.cos(V)*D,y:m+Math.sin(V)*D,textAnchor:"middle",dominantBaseline:"central",fontSize:n*.09,fill:d,fontFamily:"system-ui, sans-serif",fontWeight:"600",children:L},`n${L}`))}}else for(let z=0;z<12;z++){const B=(z/12*360-90)*Math.PI/180,V=b-8;H.push(e.jsx("circle",{cx:p+Math.cos(B)*V,cy:m+Math.sin(B)*V,r:z%3===0?3:2,fill:z%3===0?d:f},z))}return e.jsxs("svg",{width:n,height:n,viewBox:`0 0 ${n} ${n}`,"aria-hidden":"true",style:{display:"block"},children:[e.jsx("circle",{cx:p,cy:m,r:b,fill:c,stroke:u,strokeWidth:2}),H,e.jsx("line",{x1:p,y1:m,x2:M.x,y2:M.y,stroke:a,strokeWidth:r==="minimal"?3:4,strokeLinecap:"round",style:{transformOrigin:`${p}px ${m}px`,transition:I}}),e.jsx("line",{x1:p,y1:m,x2:T.x,y2:T.y,stroke:d,strokeWidth:r==="minimal"?2:3,strokeLinecap:"round",style:{transformOrigin:`${p}px ${m}px`,transition:I}}),o&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:C.x,y1:C.y,x2:E.x,y2:E.y,stroke:l,strokeWidth:1.5,strokeLinecap:"round",style:{transformOrigin:`${p}px ${m}px`,transition:"none"}}),e.jsx("circle",{cx:p,cy:m,r:3,fill:l})]}),e.jsx("circle",{cx:p,cy:m,r:r==="minimal"?3:5,fill:a})]})}function mn({time:t,format:n,showSeconds:r,showDate:o,label:s,size:a,primary:l,text:d,textMuted:f,colonVisible:u}){const{hours:c,minutes:h,seconds:p,dateString:m}=t;let b=c,k="";n==="12h"&&(k=c>=12?"PM":"AM",b=c%12||12);const y=a*.2,g={opacity:u?1:0,transition:"opacity 0.1s",display:"inline-block",minWidth:"0.5ch",textAlign:"center"};return e.jsxs("div",{style:{textAlign:"center",fontFamily:"'Courier New', Courier, monospace",fontVariantNumeric:"tabular-nums",lineHeight:1.1},children:[e.jsxs("div",{style:{fontSize:y,color:l,fontWeight:700,letterSpacing:"0.05em",display:"flex",alignItems:"center",justifyContent:"center",gap:0},children:[e.jsx("span",{children:String(b).padStart(2,"0")}),e.jsx("span",{style:g,children:":"}),e.jsx("span",{children:String(h).padStart(2,"0")}),r&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:g,children:":"}),e.jsx("span",{children:String(p).padStart(2,"0")})]}),n==="12h"&&e.jsx("span",{style:{fontSize:y*.45,color:f,marginLeft:"0.4ch",alignSelf:"flex-end",marginBottom:y*.05},children:k})]}),o&&e.jsx("div",{style:{fontSize:a*.072,color:f,marginTop:a*.025,letterSpacing:"0.03em"},children:m}),s&&e.jsx("div",{style:{fontSize:a*.065,color:f,marginTop:a*.015,textTransform:"uppercase",letterSpacing:"0.08em"},children:A.sanitizeString(s)})]})}function mr({variant:t="both",size:n="md",showSeconds:r=!0,showDate:o=!1,format:s="24h",timezone:a,timezone2:l,label:d,analogStyle:f="classic",className:u,style:c}){const h=O.useTheme(),p=J.useReducedMotion(),[m,b]=i.useState(()=>Mt(a)),[k,y]=i.useState(()=>l?Mt(l):null),[g,S]=i.useState(!0),[j,v]=i.useState(!1),$=i.useRef(null);i.useEffect(()=>{v(!0)},[]),i.useEffect(()=>{const T=()=>{b(Mt(a)),l&&y(Mt(l))};T();const E=setInterval(T,1e3);return()=>clearInterval(E)},[a,l]),i.useEffect(()=>($.current=setInterval(()=>{S(T=>!T)},500),()=>{$.current&&clearInterval($.current)}),[]);const w=No[n],N=t==="analog"||t==="both",I=t==="digital"||t==="both",M={display:"inline-flex",flexDirection:"column",alignItems:"center",gap:t==="both"?`${w*.06}px`:0,opacity:j?1:0,transition:p?"none":"opacity 0.4s ease",...c};return e.jsxs("div",{className:u,style:M,role:"timer","aria-live":"off",children:[N&&e.jsx(Ro,{time:m,size:w,analogStyle:f,showSeconds:r,reducedMotion:p,primary:h.primary,danger:h.danger,text:h.text,textMuted:h.textMuted,border:h.border,surface:h.surface,bg:h.bg}),I&&e.jsx(mn,{time:m,format:s,showSeconds:r,showDate:o,label:d,size:w,primary:h.primary,text:h.text,textMuted:h.textMuted,colonVisible:g}),k&&l&&e.jsx("div",{style:{marginTop:w*.04,padding:`${w*.03}px ${w*.06}px`,borderTop:`1px solid ${h.border}`,textAlign:"center"},children:e.jsx(mn,{time:k,format:s,showSeconds:!1,showDate:!1,label:l,size:w*.7,primary:h.secondary,text:h.text,textMuted:h.textMuted,colonVisible:g})})]})}mr.displayName="TkxClock";function Rt(t){if(!isFinite(t)||isNaN(t))return"0:00";const n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=Math.floor(t%60);return n>0?`${n}:${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`:`${r}:${String(o).padStart(2,"0")}`}function Xe({path:t,size:n=20,color:r="currentColor",title:o}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:r,"aria-hidden":o?void 0:"true",role:o?"img":void 0,"aria-label":o,style:{display:"block",flexShrink:0},children:e.jsx("path",{d:t})})}const De={play:"M8 5v14l11-7z",pause:"M6 19h4V5H6v14zm8-14v14h4V5h-4z",volumeUp:"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z",volumeMute:"M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z",volumeDown:"M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z",fullscreen:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",fullscreenExit:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z",pip:"M19 11h-8v6h8v-6zm4 8V4.98C23 3.88 22.1 3 21 3H3c-1.1 0-2 .88-2 1.98V19c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H3V4.97h18v14.05z",download:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z",closedCaption:"M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z",replay10:"M11.99 5V1l-5 5 5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z",forward10:"M18 13c0 3.31-2.69 6-6 6s-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8V1l-5 5 5 5V7c3.31 0 6 2.69 6 6z",errorOutline:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z",refresh:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"};function ct({onClick:t,title:n,children:r,active:o,primary:s}){const[a,l]=i.useState(!1);return e.jsx("button",{type:"button",onClick:t,title:n,"aria-label":n,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{background:"none",border:"none",padding:"6px",cursor:"pointer",color:o||a?s:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",flexShrink:0,transition:"color 0.15s ease"},children:r})}function gr({src:t,poster:n,title:r,width:o="100%",height:s,autoPlay:a=!1,loop:l=!1,muted:d=!1,controls:f=!0,showTitle:u=!0,allowFullscreen:c=!0,allowPiP:h=!0,allowDownload:p=!1,chapters:m=[],subtitles:b=[],startTime:k,onPlay:y,onPause:g,onEnded:S,onTimeUpdate:j,className:v,style:$}){const w=O.useTheme(),N=J.useReducedMotion(),I=i.useRef(null),M=i.useRef(null),T=i.useRef(null),E=i.useRef(null),[C,H]=i.useState(!1),[z,L]=i.useState(0),[B,V]=i.useState(0),[D,_]=i.useState(0),[R,F]=i.useState(1),[W,K]=i.useState(d),[ne,Z]=i.useState(!1),[ie,fe]=i.useState(!0),[pe,te]=i.useState(!1),[ce,Y]=i.useState(1),[se,ae]=i.useState(!1),[ge,he]=i.useState(-1),[ye,de]=i.useState(null),[xe,oe]=i.useState(0),[G,ue]=i.useState(null),[ke,ve]=i.useState(!1),[Me,Ie]=i.useState(!1),[We,Te]=i.useState(null),[ze,Ke]=i.useState(!1);i.useEffect(()=>{const U=I.current;if(!U)return;k!==void 0&&(U.currentTime=k);const be=()=>{L(U.currentTime),U.buffered.length>0&&_(U.buffered.end(U.buffered.length-1))},je=()=>V(U.duration),Ne=()=>H(!0),lt=()=>{H(!1),te(!0)},st=()=>{H(!1),te(!0),S==null||S()},pt=()=>ve(!0),ht=()=>ve(!1),mt=()=>Ie(!0),wt=()=>Ie(!1),jt=()=>{const et=U.error;Te(et?`Error ${et.code}: ${et.message||"Failed to load video"}`:"Failed to load video"),Ie(!1)};return U.addEventListener("timeupdate",be),U.addEventListener("durationchange",je),U.addEventListener("play",Ne),U.addEventListener("pause",lt),U.addEventListener("ended",st),U.addEventListener("enterpictureinpicture",pt),U.addEventListener("leavepictureinpicture",ht),U.addEventListener("waiting",mt),U.addEventListener("canplay",wt),U.addEventListener("error",jt),()=>{U.removeEventListener("timeupdate",be),U.removeEventListener("durationchange",je),U.removeEventListener("play",Ne),U.removeEventListener("pause",lt),U.removeEventListener("ended",st),U.removeEventListener("enterpictureinpicture",pt),U.removeEventListener("leavepictureinpicture",ht),U.removeEventListener("waiting",mt),U.removeEventListener("canplay",wt),U.removeEventListener("error",jt)}},[S,k]),i.useEffect(()=>{I.current&&(C?y==null||y():g==null||g())},[C,y,g]),i.useEffect(()=>{j==null||j(z,B)},[z,B,j]),i.useEffect(()=>{const U=I.current;if(!U)return;const be=U.textTracks;for(let je=0;je<be.length;je++)be[je].mode=je===ge?"showing":"disabled"},[ge]),i.useEffect(()=>{const U=()=>Z(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",U),()=>document.removeEventListener("fullscreenchange",U)},[]),i.useEffect(()=>{const U=M.current;if(!U)return;const be=je=>{const Ne=I.current;if(Ne&&je.target.tagName!=="INPUT")switch(je.key){case" ":case"k":je.preventDefault(),Fe();break;case"f":case"F":c&&Ge();break;case"m":case"M":Oe();break;case"ArrowRight":je.preventDefault(),Ne.currentTime=Math.min(Ne.currentTime+10,Ne.duration);break;case"ArrowLeft":je.preventDefault(),Ne.currentTime=Math.max(Ne.currentTime-10,0);break;case"ArrowUp":je.preventDefault(),F(Math.min(R+.1,1)),I.current&&(I.current.volume=Math.min(R+.1,1));break;case"ArrowDown":je.preventDefault(),F(Math.max(R-.1,0)),I.current&&(I.current.volume=Math.max(R-.1,0));break}};return U.addEventListener("keydown",be),()=>U.removeEventListener("keydown",be)},[R,c]);const Ze=i.useCallback(()=>{fe(!0),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{C&&fe(!1)},3e3)},[C]);i.useEffect(()=>(Ze(),()=>{E.current&&clearTimeout(E.current)}),[C,Ze]);const Fe=i.useCallback(()=>{const U=I.current;U&&(U.paused?(U.play().catch(()=>{}),ue("play"),te(!1)):(U.pause(),ue("pause")),setTimeout(()=>ue(null),600))},[]),Oe=i.useCallback(()=>{const U=I.current;if(!U)return;const be=!W;K(be),U.muted=be},[W]),Ge=i.useCallback(()=>{const U=M.current;U&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):U.requestFullscreen().catch(()=>{}))},[]),Ee=i.useCallback(async()=>{const U=I.current;if(U)try{document.pictureInPictureElement?await document.exitPictureInPicture():await U.requestPictureInPicture()}catch{}},[]),qe=i.useCallback(()=>{b.length!==0&&(he(U=>(U+1)%(b.length+1)-1),he(U=>{const be=U+1;return be>=b.length?-1:be}))},[b.length]),rt=i.useCallback(()=>{const U=I.current;U&&(U.currentTime=Math.min(U.currentTime+10,U.duration||0))},[]),Qe=i.useCallback(()=>{const U=I.current;U&&(U.currentTime=Math.max(U.currentTime-10,0))},[]),Le=i.useCallback(()=>{const U=I.current;U&&(Te(null),U.load())},[]),Pe=i.useCallback(()=>{c&&Ge()},[c,Ge]),Ae=i.useCallback(U=>{const be=I.current,je=T.current;if(!be||!je||!B)return;const Ne=je.getBoundingClientRect(),lt=Math.max(0,Math.min(1,(U.clientX-Ne.left)/Ne.width));be.currentTime=lt*B},[B]),Je=i.useCallback(U=>{const be=T.current;if(!be||!B)return;const je=be.getBoundingClientRect(),Ne=Math.max(0,Math.min(1,(U.clientX-je.left)/je.width));de(Ne*B),oe(U.clientX-je.left)},[B]),Ue=i.useCallback(U=>{const be=parseFloat(U.target.value);F(be),I.current&&(I.current.volume=be,I.current.muted=be===0,K(be===0))},[]),at=i.useCallback(U=>{Y(U),I.current&&(I.current.playbackRate=U),ae(!1)},[]),q=m.length>0?[...m].reverse().find(U=>z>=U.time):null,P=U=>[...m].reverse().find(be=>U>=be.time)??null,Q=Array.isArray(t)?t:[{src:t,type:"video/mp4"}],re=Array.isArray(t)?t[0].src:t,le=ie||pe||!C,Ce=N?"none":"opacity 0.25s ease",$e=W||R===0?De.volumeMute:R<.5?De.volumeDown:De.volumeUp,we=B>0?z/B*100:0,_e=B>0?D/B*100:0;return e.jsxs("div",{ref:M,className:v,tabIndex:0,onMouseMove:Ze,onMouseLeave:()=>{C&&fe(!1)},style:{position:"relative",width:o,height:s??"auto",background:"#000",borderRadius:"8px",overflow:"hidden",outline:"none",userSelect:"none",...$},children:[e.jsxs("video",{ref:I,style:{width:"100%",height:"100%",display:"block",objectFit:"contain"},poster:n,autoPlay:a,loop:l,muted:d,playsInline:!0,onClick:Fe,onDoubleClick:Pe,children:[Q.map((U,be)=>e.jsx("source",{src:U.src,type:U.type},be)),b.map((U,be)=>e.jsx("track",{kind:"subtitles",label:A.sanitizeString(U.label),srcLang:U.lang,src:U.src,default:U.default},be))]}),u&&r&&e.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,background:"linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%)",padding:"16px 16px 32px",opacity:le?1:0,transition:Ce,pointerEvents:"none"},children:[e.jsx("span",{style:{color:"#fff",fontSize:"0.95rem",fontWeight:600,textShadow:"0 1px 3px rgba(0,0,0,0.7)"},children:A.sanitizeString(r)}),q&&e.jsxs("span",{style:{color:"rgba(255,255,255,0.65)",fontSize:"0.8rem",marginLeft:8},children:["— ",A.sanitizeString(q.label)]})]}),G&&e.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",background:"rgba(0,0,0,0.45)",borderRadius:"50%",width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center",animation:N?"none":"tkxvp-flash 0.6s ease forwards",pointerEvents:"none"},children:e.jsx(Xe,{path:G==="play"?De.play:De.pause,size:32,color:"#fff"})}),Me&&!We&&e.jsx("div",{"aria-label":"Loading",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:10},children:e.jsx("div",{style:{width:48,height:48,border:"4px solid rgba(255,255,255,0.25)",borderTopColor:w.primary,borderRadius:"50%",animation:N?"none":"tkxvp-spin 0.8s linear infinite"}})}),We&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.8)",zIndex:20,gap:12},children:[e.jsx(Xe,{path:De.errorOutline,size:48,color:"#ef4444"}),e.jsx("span",{style:{color:"#fff",fontSize:"0.9rem",maxWidth:"80%",textAlign:"center"},children:We}),e.jsxs("button",{type:"button",onClick:Le,style:{display:"flex",alignItems:"center",gap:6,background:w.primary,color:"#fff",border:"none",borderRadius:6,padding:"8px 18px",fontSize:"0.85rem",fontWeight:600,cursor:"pointer",marginTop:4},children:[e.jsx(Xe,{path:De.refresh,size:18,color:"#fff"}),"Retry"]})]}),f&&e.jsxs("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 70%, transparent 100%)",padding:"32px 12px 8px",opacity:le?1:0,transition:Ce},onMouseEnter:()=>te(!0),onMouseLeave:()=>te(!1),children:[e.jsxs("div",{ref:T,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(B),"aria-valuenow":Math.floor(z),tabIndex:0,onClick:Ae,onMouseMove:Je,style:{position:"relative",height:4,borderRadius:2,background:"rgba(255,255,255,0.25)",cursor:"pointer",marginBottom:8,transition:"height 0.15s ease"},onMouseEnter:U=>{U.currentTarget.style.height="8px"},onMouseLeave:U=>{U.currentTarget.style.height="4px",de(null)},children:[e.jsx("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:`${_e}%`,background:"rgba(255,255,255,0.3)",borderRadius:2,pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:`${we}%`,background:w.primary,borderRadius:2,pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",top:"50%",left:`${we}%`,transform:"translate(-50%, -50%)",width:12,height:12,borderRadius:"50%",background:w.primary,pointerEvents:"none"}}),m.map((U,be)=>{const je=B>0?U.time/B*100:0;return e.jsx("div",{title:A.sanitizeString(U.label),style:{position:"absolute",top:"50%",left:`${je}%`,transform:"translate(-50%, -50%)",width:8,height:8,borderRadius:"50%",background:"#fff",border:`2px solid ${w.primary}`,zIndex:2,cursor:"pointer",pointerEvents:"auto"}},be)}),ye!==null&&e.jsxs("div",{style:{position:"absolute",bottom:12,left:xe,transform:"translateX(-50%)",background:"rgba(0,0,0,0.8)",color:"#fff",fontSize:"0.72rem",padding:"2px 6px",borderRadius:4,whiteSpace:"nowrap",pointerEvents:"none"},children:[Rt(ye),P(ye)&&e.jsx("span",{style:{display:"block",fontSize:"0.65rem",color:"rgba(255,255,255,0.7)"},children:A.sanitizeString(P(ye).label)})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(ct,{onClick:Fe,title:C?"Pause":"Play",primary:w.primary,children:e.jsx(Xe,{path:C?De.pause:De.play,size:22})}),e.jsx(ct,{onClick:Qe,title:"Skip back 10 seconds",primary:w.primary,children:e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(Xe,{path:De.replay10,size:22}),e.jsx("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),e.jsx(ct,{onClick:rt,title:"Skip forward 10 seconds",primary:w.primary,children:e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(Xe,{path:De.forward10,size:22}),e.jsx("span",{style:{position:"absolute",fontSize:"7px",fontWeight:700,color:"currentColor",marginTop:1},children:"10"})]})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",position:"relative"},onMouseEnter:()=>Ke(!0),onMouseLeave:()=>Ke(!1),children:[e.jsx(ct,{onClick:Oe,title:W?"Unmute":"Mute",primary:w.primary,children:e.jsx(Xe,{path:$e,size:20})}),e.jsx("div",{style:{overflow:"hidden",width:ze?64:0,opacity:ze?1:0,transition:N?"none":"width 0.2s ease, opacity 0.2s ease",display:"flex",alignItems:"center"},children:e.jsx("input",{type:"range",min:0,max:1,step:.05,value:W?0:R,onChange:Ue,"aria-label":"Volume",style:{width:64,accentColor:w.primary,cursor:"pointer",height:4}})})]}),e.jsxs("span",{style:{color:"#fff",fontSize:"0.78rem",fontFamily:"monospace",fontVariantNumeric:"tabular-nums",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:[Rt(z)," / ",Rt(B)]}),e.jsx("div",{style:{flex:1}}),b.length>0&&e.jsx(ct,{onClick:qe,title:"Subtitles",primary:w.primary,active:ge>=0,children:e.jsx(Xe,{path:De.closedCaption,size:20})}),e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[e.jsxs("button",{type:"button",onClick:()=>ae(U=>!U),title:"Playback speed",style:{background:"none",border:"none",cursor:"pointer",color:"#fff",fontSize:"0.75rem",fontWeight:600,padding:"6px 8px",letterSpacing:"0.02em",position:"relative"},children:[ce,"×"]}),ce!==1&&e.jsxs("span",{style:{position:"absolute",top:0,right:0,background:w.primary,color:"#fff",fontSize:"0.55rem",fontWeight:700,borderRadius:6,padding:"1px 4px",lineHeight:1.2,pointerEvents:"none"},children:[ce,"x"]}),se&&e.jsx("div",{style:{position:"absolute",bottom:"100%",right:0,background:"rgba(20,20,20,0.97)",border:`1px solid ${w.border}`,borderRadius:6,overflow:"hidden",zIndex:100,minWidth:80},children:[.5,.75,1,1.25,1.5,2].map(U=>e.jsxs("button",{type:"button",onClick:()=>at(U),style:{display:"block",width:"100%",padding:"6px 14px",background:U===ce?w.primary+"30":"none",border:"none",color:U===ce?w.primary:"#fff",fontSize:"0.8rem",cursor:"pointer",textAlign:"left"},children:[U,"×"]},U))})]}),h&&typeof document<"u"&&"pictureInPictureEnabled"in document&&e.jsx(ct,{onClick:Ee,title:"Picture-in-Picture",primary:w.primary,active:ke,children:e.jsx(Xe,{path:De.pip,size:20})}),p&&e.jsx("a",{href:re,download:!0,title:"Download",style:{color:"#fff",display:"flex",alignItems:"center",padding:"6px"},children:e.jsx(Xe,{path:De.download,size:20})}),c&&e.jsx(ct,{onClick:Ge,title:ne?"Exit fullscreen":"Fullscreen",primary:w.primary,children:e.jsx(Xe,{path:ne?De.fullscreenExit:De.fullscreen,size:20})})]})]}),e.jsx("style",{children:`
53
+ `;function en(e,t){return{position:`absolute`,top:t.top,left:t.left,zIndex:9999,minWidth:200,maxWidth:320,backgroundColor:e.surface,border:`1.5px solid ${e.border}`,borderRadius:10,boxShadow:`0 8px 32px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14)`,padding:`4px 0`,transformOrigin:t.transformOrigin,overflow:`hidden`}}function tn({color:e}){return(0,s.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:e,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M20 6L9 17l-5-5`})})}function nn({color:e}){return(0,s.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:`12`,cy:`12`,r:`5`,fill:e}),(0,s.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,fill:`none`,stroke:e,strokeWidth:`2`})]})}function rn({color:e}){return(0,s.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:e,strokeWidth:`2`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M9 18l6-6-6-6`})})}function an(e){let t=[],n=0;for(let r of e)if(r.type!==`separator`)if(r.type===`radio-group`)for(let e=0;e<r.options.length;e++)t.push({kind:`radio`,item:r,optionIdx:e,idx:n++});else r.type===`check`?t.push({kind:`check`,item:r,idx:n++}):r.type===`submenu`?t.push({kind:`submenu`,item:r,idx:n++}):t.push({kind:`action`,item:r,idx:n++});return t}function on({items:e,pos:r,panelId:i,onClose:a,onCloseAll:l,isSubmenu:u=!1}){let d=t.f(),[f,p]=(0,o.useState)(-1),[m,h]=(0,o.useState)(null),[g,_]=(0,o.useState)(null),v=(0,o.useRef)(null),[y,b]=(0,o.useState)(``),x=(0,o.useRef)(null),S=an(e);(0,o.useEffect)(()=>{v.current?.focus()},[]),(0,o.useEffect)(()=>{f<0||(v.current?.querySelector(`[data-midx="${f}"]`))?.scrollIntoView({block:`nearest`})},[f]);let C=(0,o.useCallback)(e=>{if(e.kind===`action`){if(e.item.disabled)return;e.item.onClick?.(),l()}else if(e.kind===`check`){if(e.item.disabled)return;e.item.onChange?.(!e.item.checked)}else if(e.kind===`radio`){if(e.item.disabled)return;e.item.onChange?.(e.item.options[e.optionIdx].value)}else if(e.kind===`submenu`){if(e.item.disabled)return;h(e.item.id)}},[l]),w=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),p(e=>{let t=e+1;return t<S.length?t:0});break;case`ArrowUp`:e.preventDefault(),p(e=>{let t=e-1;return t>=0?t:S.length-1});break;case`Home`:e.preventDefault(),p(0);break;case`End`:e.preventDefault(),p(S.length-1);break;case`Enter`:case` `:e.preventDefault(),f>=0&&S[f]&&C(S[f]);break;case`Escape`:e.preventDefault(),u?a():l();break;case`Tab`:e.preventDefault(),l();break;case`ArrowRight`:e.preventDefault(),f>=0&&S[f]?.kind===`submenu`&&h(S[f].item.id);break;case`ArrowLeft`:e.preventDefault(),u&&a();break;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&T(e.key)}};function T(e){x.current&&clearTimeout(x.current);let t=y+e.toLowerCase();b(t);let n=S.findIndex(e=>(e.kind===`radio`?e.item.options[e.optionIdx].label:e.item.label).toLowerCase().startsWith(t));n>=0&&p(n),x.current=setTimeout(()=>b(``),800)}function E(e,t){let n=t.getBoundingClientRect();h(e.id),_(Qt(n,220,Math.min(e.items.length*38+12,360)))}function D(){h(null),_(null)}let O=()=>{let t=-1;return e.map(e=>{if(e.type===`separator`)return(0,s.jsx)(`div`,{role:`separator`,style:{margin:(e.label,`4px 0`),display:`flex`,alignItems:`center`,gap:8},children:e.label?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{style:{flex:1,height:1,backgroundColor:d.border,marginLeft:14}}),(0,s.jsx)(`span`,{style:{fontSize:`11px`,fontWeight:600,letterSpacing:`0.06em`,textTransform:`uppercase`,color:d.textMuted,fontFamily:`inherit`,whiteSpace:`nowrap`},children:n.m(e.label)}),(0,s.jsx)(`div`,{style:{flex:1,height:1,backgroundColor:d.border,marginRight:14}})]}):(0,s.jsx)(`div`,{style:{flex:1,height:1,backgroundColor:d.border,margin:`0 10px`}})},e.id);if(e.type===`radio-group`)return(0,s.jsxs)(`div`,{role:`group`,"aria-label":e.label,children:[e.label&&(0,s.jsx)(`div`,{style:{padding:`6px 14px 2px`,fontSize:`11px`,fontWeight:700,letterSpacing:`0.07em`,textTransform:`uppercase`,color:d.textMuted,fontFamily:`inherit`},"aria-hidden":`true`,children:n.m(e.label)}),e.options.map((r,i)=>{t++;let a=t,o=a===f,c=r.value===e.value,l=!!e.disabled,u=sn(d,o,!1,l);return(0,s.jsxs)(`div`,{role:`menuitemradio`,"aria-checked":c,"aria-disabled":l||void 0,"data-midx":a,tabIndex:-1,style:u,onClick:()=>!l&&e.onChange?.(r.value),onMouseEnter:()=>!l&&p(a),children:[(0,s.jsx)(`span`,{style:{width:16,flexShrink:0,display:`flex`,alignItems:`center`},children:c?(0,s.jsx)(nn,{color:d.primary}):(0,s.jsx)(`span`,{style:{width:14,height:14,borderRadius:`50%`,border:`2px solid ${d.border}`,display:`inline-block`}})}),r.icon&&(0,s.jsx)(`span`,{style:{flexShrink:0,display:`flex`,color:d.textMuted},children:r.icon}),(0,s.jsx)(`span`,{style:{flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n.m(r.label)})]},r.value)})]},e.id);if(e.type===`check`){t++;let r=t,i=r===f,a=!!e.disabled,o=sn(d,i,!1,a);return(0,s.jsxs)(`div`,{role:`menuitemcheckbox`,"aria-checked":e.checked,"aria-disabled":a||void 0,"data-midx":r,tabIndex:-1,style:o,onClick:()=>!a&&e.onChange?.(!e.checked),onMouseEnter:()=>!a&&p(r),children:[(0,s.jsx)(`span`,{style:{width:16,flexShrink:0,display:`flex`,alignItems:`center`},children:e.checked?(0,s.jsx)(tn,{color:d.primary}):(0,s.jsx)(`span`,{style:{width:14,height:14,display:`inline-block`}})}),e.icon&&(0,s.jsx)(`span`,{style:{flexShrink:0,display:`flex`,color:d.textMuted},children:e.icon}),(0,s.jsx)(`span`,{style:{flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n.m(e.label)})]},e.id)}if(e.type===`submenu`){t++;let r=t,a=r===f,o=!!e.disabled,u=m===e.id,_=sn(d,a||u,!1,o);return(0,s.jsxs)(`div`,{style:{position:`relative`},children:[(0,s.jsxs)(`div`,{role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":u,"aria-disabled":o||void 0,"data-midx":r,tabIndex:-1,style:_,onMouseEnter:t=>{o||(p(r),E(e,t.currentTarget))},onMouseLeave:()=>{},onClick:()=>{o||h(u?null:e.id)},children:[(0,s.jsx)(`span`,{style:{width:16,flexShrink:0,display:`flex`,alignItems:`center`},children:e.icon?(0,s.jsx)(`span`,{style:{display:`flex`,color:d.textMuted},children:e.icon}):(0,s.jsx)(`span`,{style:{width:14}})}),(0,s.jsx)(`span`,{style:{flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n.m(e.label)}),(0,s.jsx)(rn,{color:d.textMuted})]}),u&&g&&(0,c.createPortal)((0,s.jsx)(on,{items:e.items,pos:g,panelId:`${i}-sub-${e.id}`,onClose:D,onCloseAll:l,isSubmenu:!0}),document.body)]},e.id)}let r=e;t++;let a=t,o=a===f,u=!!r.disabled,_=!!r.danger,v=sn(d,o,_,u);return(0,s.jsxs)(`div`,{role:`menuitem`,"aria-disabled":u||void 0,"data-midx":a,tabIndex:-1,style:v,onClick:()=>{u||(r.onClick?.(),l())},onMouseEnter:()=>{u||(p(a),D())},children:[(0,s.jsx)(`span`,{style:{width:16,flexShrink:0,display:`flex`,alignItems:`center`},children:r.icon?(0,s.jsx)(`span`,{style:{display:`flex`,color:_?d.danger:d.textMuted},children:r.icon}):(0,s.jsx)(`span`,{style:{width:14}})}),(0,s.jsxs)(`span`,{style:{flex:1,minWidth:0},children:[(0,s.jsx)(`span`,{style:{display:`block`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n.m(r.label)}),r.description&&(0,s.jsx)(`span`,{style:{display:`block`,fontSize:`12px`,color:d.textMuted,marginTop:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n.m(r.description)})]}),r.shortcut&&(0,s.jsx)(`span`,{style:{fontSize:`12px`,color:d.textMuted,fontFamily:`inherit`,flexShrink:0,marginLeft:16,opacity:.8},children:n.m(r.shortcut)})]},r.id)})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`style`,{children:$t}),(0,s.jsx)(`div`,{ref:v,id:i,role:`menu`,tabIndex:-1,className:`tkx-menu-panel`,onKeyDown:w,style:{...en(d,r),maxHeight:400,overflowY:`auto`},children:O()})]})}function sn(e,t,n,r){let i=n?e.danger:e.text;return{display:`flex`,alignItems:`center`,gap:8,padding:`7px 14px`,fontSize:`14px`,fontFamily:`inherit`,cursor:r?`not-allowed`:`pointer`,userSelect:`none`,color:r?e.textMuted:t&&n?e.danger:i,backgroundColor:t?n?`${e.danger}18`:`${e.primary}18`:`transparent`,transition:`background-color 80ms`,opacity:r?.5:1,outline:`none`}}function cn({trigger:e,items:t,placement:n=`bottom-start`,isDisabled:r=!1,onOpen:i,onClose:a,className:l,style:u}){let d=`tkx-menu-${(0,o.useId)().replace(/:/g,``)}`,[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)(null),g=(0,o.useRef)(null),_=(0,o.useCallback)(()=>{if(r)return;let e=g.current;e&&(h(Zt(e.getBoundingClientRect(),n,220,Math.min(t.length*38+12,360))),p(!0),i?.())},[r,t.length,i,n]),v=(0,o.useCallback)(()=>{p(!1),a?.(),(g.current?.firstElementChild)?.focus?.()},[a]);(0,o.useEffect)(()=>{if(!f)return;let e=e=>{let t=e.target;if(g.current?.contains(t))return;let n=document.querySelectorAll(`.tkx-menu-panel`);for(let e of n)if(e.contains(t))return;v()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[f,v]),(0,o.useEffect)(()=>{if(!f)return;let e=()=>{let e=g.current;e&&h(Zt(e.getBoundingClientRect(),n,220,Math.min(t.length*38+12,360)))};return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[f,t.length,n]);let y=e=>{(e.key===`Enter`||e.key===` `||e.key===`ArrowDown`)&&(e.preventDefault(),f||_()),e.key===`Escape`&&f&&(e.preventDefault(),v())};return(0,s.jsxs)(`span`,{ref:g,className:l,style:{display:`inline-flex`,...u},children:[(0,s.jsx)(`span`,{role:`button`,tabIndex:r?-1:0,"aria-haspopup":`menu`,"aria-expanded":f,"aria-controls":f?d:void 0,"aria-disabled":r||void 0,onClick:()=>f?v():_(),onKeyDown:y,style:{display:`inline-flex`,cursor:r?`not-allowed`:`pointer`,opacity:r?.55:1,outline:`none`},children:e}),f&&m&&(0,c.createPortal)((0,s.jsx)(on,{items:t,pos:m,panelId:d,onClose:v,onCloseAll:v}),document.body)]})}cn.displayName=`TkxMenu`;var ln={sm:120,md:180,lg:240,xl:320};function un(e){let t=new Date;if(e)try{let n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour:`numeric`,minute:`numeric`,second:`numeric`,hour12:!1,weekday:`long`,month:`long`,day:`2-digit`,year:`numeric`}).formatToParts(t),r=e=>n.find(t=>t.type===e)?.value??`0`,i=parseInt(r(`hour`),10);i===24&&(i=0);let a=parseInt(r(`minute`),10),o=parseInt(r(`second`),10),s=`${r(`weekday`)}, ${r(`month`)} ${r(`day`)}, ${r(`year`)}`;return{hours:i,minutes:a,seconds:o,milliseconds:t.getMilliseconds(),dateString:s}}catch{}let n=t.getHours(),r=t.getMinutes(),i=t.getSeconds(),a=t.toLocaleDateString(`en-US`,{weekday:`long`,month:`long`,day:`2-digit`,year:`numeric`});return{hours:n,minutes:r,seconds:i,milliseconds:t.getMilliseconds(),dateString:a}}function dn({time:e,size:t,analogStyle:n,showSeconds:r,reducedMotion:i,primary:a,danger:o,text:c,textMuted:l,border:u,surface:d,bg:f}){let p=t/2,m=t/2,h=t/2-4,{hours:g,minutes:_,seconds:v,milliseconds:y}=e,b=(v+(i?0:y)/1e3)/60*360,x=_/60*360+v/60*6,S=g%12/12*360+_/60*30,C=(e,t)=>{let n=(e-90)*Math.PI/180;return{x:p+Math.cos(n)*t,y:m+Math.sin(n)*t}},w=i?`none`:`transform 0.15s cubic-bezier(0.4, 2.08, 0.55, 0.44)`;if(n===`modern`){let e=(e,t)=>{let n=-90+e*360,r={x:p+Math.cos(-90*Math.PI/180)*t,y:m+Math.sin(-90*Math.PI/180)*t},i={x:p+Math.cos(n*Math.PI/180)*t,y:m+Math.sin(n*Math.PI/180)*t},a=+(e>.5);return`M ${r.x} ${r.y} A ${t} ${t} 0 ${a} 1 ${i.x} ${i.y}`},n=g%12/12+_/60/12,d=_/60+v/3600,f=(v+(i?0:y/1e3))/60,b=h-2,x=h-10,S=h-18;return(0,s.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:p,cy:m,r:b,fill:`none`,stroke:u,strokeWidth:4}),(0,s.jsx)(`circle`,{cx:p,cy:m,r:x,fill:`none`,stroke:u,strokeWidth:4}),r&&(0,s.jsx)(`circle`,{cx:p,cy:m,r:S,fill:`none`,stroke:u,strokeWidth:3}),(0,s.jsx)(`path`,{d:e(n,b),fill:`none`,stroke:a,strokeWidth:4,strokeLinecap:`round`}),(0,s.jsx)(`path`,{d:e(d,x),fill:`none`,stroke:c,strokeWidth:4,strokeLinecap:`round`}),r&&(0,s.jsx)(`path`,{d:e(f,S),fill:`none`,stroke:o,strokeWidth:3,strokeLinecap:`round`}),(0,s.jsx)(`circle`,{cx:p,cy:m,r:4,fill:a}),(0,s.jsxs)(`text`,{x:p,y:m+20,textAnchor:`middle`,fontSize:t*.12,fill:l,fontFamily:`monospace`,style:{fontVariantNumeric:`tabular-nums`},children:[String(g).padStart(2,`0`),`:`,String(_).padStart(2,`0`)]})]})}let T=C(S,h*.5),E=C(x,h*.75),D=C(b,h*.85),O=C(b+180,h*.2),k=[];if(n===`classic`){for(let e=0;e<60;e++){let t=e/60*360,n=e%5==0,r=(t-90)*Math.PI/180,i=n?h-10:h-6,a=p+Math.cos(r)*h,o=m+Math.sin(r)*h,u=p+Math.cos(r)*i,d=m+Math.sin(r)*i;k.push((0,s.jsx)(`line`,{x1:a,y1:o,x2:u,y2:d,stroke:n?c:l,strokeWidth:n?2:1,strokeLinecap:`round`},e))}for(let{n:e,angle:n}of[{n:12,angle:0},{n:3,angle:90},{n:6,angle:180},{n:9,angle:270}]){let r=(n-90)*Math.PI/180,i=h-20;k.push((0,s.jsx)(`text`,{x:p+Math.cos(r)*i,y:m+Math.sin(r)*i,textAnchor:`middle`,dominantBaseline:`central`,fontSize:t*.09,fill:c,fontFamily:`system-ui, sans-serif`,fontWeight:`600`,children:e},`n${e}`))}}else for(let e=0;e<12;e++){let t=(e/12*360-90)*Math.PI/180,n=h-8;k.push((0,s.jsx)(`circle`,{cx:p+Math.cos(t)*n,cy:m+Math.sin(t)*n,r:e%3==0?3:2,fill:e%3==0?c:l},e))}return(0,s.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":`true`,style:{display:`block`},children:[(0,s.jsx)(`circle`,{cx:p,cy:m,r:h,fill:d,stroke:u,strokeWidth:2}),k,(0,s.jsx)(`line`,{x1:p,y1:m,x2:T.x,y2:T.y,stroke:a,strokeWidth:n===`minimal`?3:4,strokeLinecap:`round`,style:{transformOrigin:`${p}px ${m}px`,transition:w}}),(0,s.jsx)(`line`,{x1:p,y1:m,x2:E.x,y2:E.y,stroke:c,strokeWidth:n===`minimal`?2:3,strokeLinecap:`round`,style:{transformOrigin:`${p}px ${m}px`,transition:w}}),r&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`line`,{x1:O.x,y1:O.y,x2:D.x,y2:D.y,stroke:o,strokeWidth:1.5,strokeLinecap:`round`,style:{transformOrigin:`${p}px ${m}px`,transition:`none`}}),(0,s.jsx)(`circle`,{cx:p,cy:m,r:3,fill:o})]}),(0,s.jsx)(`circle`,{cx:p,cy:m,r:n===`minimal`?3:5,fill:a})]})}function fn({time:e,format:t,showSeconds:r,showDate:i,label:a,size:o,primary:c,text:l,textMuted:u,colonVisible:d}){let{hours:f,minutes:p,seconds:m,dateString:h}=e,g=f,_=``;t===`12h`&&(_=f>=12?`PM`:`AM`,g=f%12||12);let v=o*.2,y={opacity:+!!d,transition:`opacity 0.1s`,display:`inline-block`,minWidth:`0.5ch`,textAlign:`center`};return(0,s.jsxs)(`div`,{style:{textAlign:`center`,fontFamily:`'Courier New', Courier, monospace`,fontVariantNumeric:`tabular-nums`,lineHeight:1.1},children:[(0,s.jsxs)(`div`,{style:{fontSize:v,color:c,fontWeight:700,letterSpacing:`0.05em`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:0},children:[(0,s.jsx)(`span`,{children:String(g).padStart(2,`0`)}),(0,s.jsx)(`span`,{style:y,children:`:`}),(0,s.jsx)(`span`,{children:String(p).padStart(2,`0`)}),r&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`span`,{style:y,children:`:`}),(0,s.jsx)(`span`,{children:String(m).padStart(2,`0`)})]}),t===`12h`&&(0,s.jsx)(`span`,{style:{fontSize:v*.45,color:u,marginLeft:`0.4ch`,alignSelf:`flex-end`,marginBottom:v*.05},children:_})]}),i&&(0,s.jsx)(`div`,{style:{fontSize:o*.072,color:u,marginTop:o*.025,letterSpacing:`0.03em`},children:h}),a&&(0,s.jsx)(`div`,{style:{fontSize:o*.065,color:u,marginTop:o*.015,textTransform:`uppercase`,letterSpacing:`0.08em`},children:n.m(a)})]})}function pn({variant:e=`both`,size:n=`md`,showSeconds:i=!0,showDate:a=!1,format:c=`24h`,timezone:l,timezone2:u,label:d,analogStyle:f=`classic`,className:p,style:m}){let h=t.f(),g=r.o(),[_,v]=(0,o.useState)(()=>un(l)),[y,b]=(0,o.useState)(()=>u?un(u):null),[x,S]=(0,o.useState)(!0),[C,w]=(0,o.useState)(!1),T=(0,o.useRef)(null);(0,o.useEffect)(()=>{w(!0)},[]),(0,o.useEffect)(()=>{let e=()=>{v(un(l)),u&&b(un(u))};e();let t=setInterval(e,1e3);return()=>clearInterval(t)},[l,u]),(0,o.useEffect)(()=>(T.current=setInterval(()=>{S(e=>!e)},500),()=>{T.current&&clearInterval(T.current)}),[]);let E=ln[n],D=e===`analog`||e===`both`,O=e===`digital`||e===`both`;return(0,s.jsxs)(`div`,{className:p,style:{display:`inline-flex`,flexDirection:`column`,alignItems:`center`,gap:e===`both`?`${E*.06}px`:0,opacity:+!!C,transition:g?`none`:`opacity 0.4s ease`,...m},role:`timer`,"aria-live":`off`,children:[D&&(0,s.jsx)(dn,{time:_,size:E,analogStyle:f,showSeconds:i,reducedMotion:g,primary:h.primary,danger:h.danger,text:h.text,textMuted:h.textMuted,border:h.border,surface:h.surface,bg:h.bg}),O&&(0,s.jsx)(fn,{time:_,format:c,showSeconds:i,showDate:a,label:d,size:E,primary:h.primary,text:h.text,textMuted:h.textMuted,colonVisible:x}),y&&u&&(0,s.jsx)(`div`,{style:{marginTop:E*.04,padding:`${E*.03}px ${E*.06}px`,borderTop:`1px solid ${h.border}`,textAlign:`center`},children:(0,s.jsx)(fn,{time:y,format:c,showSeconds:!1,showDate:!1,label:u,size:E*.7,primary:h.secondary,text:h.text,textMuted:h.textMuted,colonVisible:x})})]})}pn.displayName=`TkxClock`;function mn(e){if(!isFinite(e)||isNaN(e))return`0:00`;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?`${t}:${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`:`${n}:${String(r).padStart(2,`0`)}`}function hn({path:e,size:t=20,color:n=`currentColor`,title:r}){return(0,s.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:n,"aria-hidden":r?void 0:`true`,role:r?`img`:void 0,"aria-label":r,style:{display:`block`,flexShrink:0},children:(0,s.jsx)(`path`,{d:e})})}var gn={play:`M8 5v14l11-7z`,pause:`M6 19h4V5H6v14zm8-14v14h4V5h-4z`,volumeUp:`M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z`,volumeMute:`M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z`,volumeDown:`M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z`,fullscreen:`M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z`,fullscreenExit:`M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z`,pip:`M19 11h-8v6h8v-6zm4 8V4.98C23 3.88 22.1 3 21 3H3c-1.1 0-2 .88-2 1.98V19c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H3V4.97h18v14.05z`,download:`M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z`,closedCaption:`M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z`,settings:`M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z`,replay10:`M11.99 5V1l-5 5 5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z`,forward10:`M18 13c0 3.31-2.69 6-6 6s-6-2.69-6-6h-2c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8V1l-5 5 5 5V7c3.31 0 6 2.69 6 6z`,errorOutline:`M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z`,refresh:`M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z`};function _n({onClick:e,title:t,children:n,active:r,primary:i}){let[a,c]=(0,o.useState)(!1);return(0,s.jsx)(`button`,{type:`button`,onClick:e,title:t,"aria-label":t,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),style:{background:`none`,border:`none`,padding:`6px`,cursor:`pointer`,color:r||a?i:`#ffffff`,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:`4px`,flexShrink:0,transition:`color 0.15s ease`},children:n})}function vn({src:e,poster:i,title:a,width:c=`100%`,height:l,autoPlay:u=!1,loop:d=!1,muted:f=!1,controls:p=!0,showTitle:m=!0,allowFullscreen:h=!0,allowPiP:g=!0,allowDownload:_=!1,chapters:v=[],subtitles:y=[],startTime:b,onPlay:x,onPause:S,onEnded:C,onTimeUpdate:w,className:T,style:E}){let D=t.f(),O=r.o(),k=(0,o.useRef)(null),A=(0,o.useRef)(null),j=(0,o.useRef)(null),M=(0,o.useRef)(null),[N,P]=(0,o.useState)(!1),[F,I]=(0,o.useState)(0),[L,R]=(0,o.useState)(0),[z,B]=(0,o.useState)(0),[V,H]=(0,o.useState)(1),[U,W]=(0,o.useState)(f),[ee,te]=(0,o.useState)(!1),[G,K]=(0,o.useState)(!0),[ne,q]=(0,o.useState)(!1),[J,Y]=(0,o.useState)(1),[re,ie]=(0,o.useState)(!1),[ae,oe]=(0,o.useState)(-1),[X,Z]=(0,o.useState)(null),[se,ce]=(0,o.useState)(0),[le,ue]=(0,o.useState)(null),[de,fe]=(0,o.useState)(!1),[pe,Q]=(0,o.useState)(!1),[$,me]=(0,o.useState)(null),[he,ge]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=k.current;if(!e)return;b!==void 0&&(e.currentTime=b);let t=()=>{I(e.currentTime),e.buffered.length>0&&B(e.buffered.end(e.buffered.length-1))},n=()=>R(e.duration),r=()=>P(!0),i=()=>{P(!1),q(!0)},a=()=>{P(!1),q(!0),C?.()},o=()=>fe(!0),s=()=>fe(!1),c=()=>Q(!0),l=()=>Q(!1),u=()=>{let t=e.error;me(t?`Error ${t.code}: ${t.message||`Failed to load video`}`:`Failed to load video`),Q(!1)};return e.addEventListener(`timeupdate`,t),e.addEventListener(`durationchange`,n),e.addEventListener(`play`,r),e.addEventListener(`pause`,i),e.addEventListener(`ended`,a),e.addEventListener(`enterpictureinpicture`,o),e.addEventListener(`leavepictureinpicture`,s),e.addEventListener(`waiting`,c),e.addEventListener(`canplay`,l),e.addEventListener(`error`,u),()=>{e.removeEventListener(`timeupdate`,t),e.removeEventListener(`durationchange`,n),e.removeEventListener(`play`,r),e.removeEventListener(`pause`,i),e.removeEventListener(`ended`,a),e.removeEventListener(`enterpictureinpicture`,o),e.removeEventListener(`leavepictureinpicture`,s),e.removeEventListener(`waiting`,c),e.removeEventListener(`canplay`,l),e.removeEventListener(`error`,u)}},[C,b]),(0,o.useEffect)(()=>{k.current&&(N?x?.():S?.())},[N,x,S]),(0,o.useEffect)(()=>{w?.(F,L)},[F,L,w]),(0,o.useEffect)(()=>{let e=k.current;if(!e)return;let t=e.textTracks;for(let e=0;e<t.length;e++)t[e].mode=e===ae?`showing`:`disabled`},[ae]),(0,o.useEffect)(()=>{let e=()=>te(!!document.fullscreenElement);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]),(0,o.useEffect)(()=>{let e=A.current;if(!e)return;let t=e=>{let t=k.current;if(t&&e.target.tagName!==`INPUT`)switch(e.key){case` `:case`k`:e.preventDefault(),ve();break;case`f`:case`F`:h&&be();break;case`m`:case`M`:ye();break;case`ArrowRight`:e.preventDefault(),t.currentTime=Math.min(t.currentTime+10,t.duration);break;case`ArrowLeft`:e.preventDefault(),t.currentTime=Math.max(t.currentTime-10,0);break;case`ArrowUp`:e.preventDefault(),H(Math.min(V+.1,1)),k.current&&(k.current.volume=Math.min(V+.1,1));break;case`ArrowDown`:e.preventDefault(),H(Math.max(V-.1,0)),k.current&&(k.current.volume=Math.max(V-.1,0));break}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[V,h]);let _e=(0,o.useCallback)(()=>{K(!0),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{N&&K(!1)},3e3)},[N]);(0,o.useEffect)(()=>(_e(),()=>{M.current&&clearTimeout(M.current)}),[N,_e]);let ve=(0,o.useCallback)(()=>{let e=k.current;e&&(e.paused?(e.play().catch(()=>{}),ue(`play`),q(!1)):(e.pause(),ue(`pause`)),setTimeout(()=>ue(null),600))},[]),ye=(0,o.useCallback)(()=>{let e=k.current;if(!e)return;let t=!U;W(t),e.muted=t},[U]),be=(0,o.useCallback)(()=>{let e=A.current;e&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.requestFullscreen().catch(()=>{}))},[]),xe=(0,o.useCallback)(async()=>{let e=k.current;if(e)try{document.pictureInPictureElement?await document.exitPictureInPicture():await e.requestPictureInPicture()}catch{}},[]),Se=(0,o.useCallback)(()=>{y.length!==0&&(oe(e=>(e+1)%(y.length+1)-1),oe(e=>{let t=e+1;return t>=y.length?-1:t}))},[y.length]),Ce=(0,o.useCallback)(()=>{let e=k.current;e&&(e.currentTime=Math.min(e.currentTime+10,e.duration||0))},[]),we=(0,o.useCallback)(()=>{let e=k.current;e&&(e.currentTime=Math.max(e.currentTime-10,0))},[]),Te=(0,o.useCallback)(()=>{let e=k.current;e&&(me(null),e.load())},[]),Ee=(0,o.useCallback)(()=>{h&&be()},[h,be]),De=(0,o.useCallback)(e=>{let t=k.current,n=j.current;if(!t||!n||!L)return;let r=n.getBoundingClientRect();t.currentTime=Math.max(0,Math.min(1,(e.clientX-r.left)/r.width))*L},[L]),Oe=(0,o.useCallback)(e=>{let t=j.current;if(!t||!L)return;let n=t.getBoundingClientRect();Z(Math.max(0,Math.min(1,(e.clientX-n.left)/n.width))*L),ce(e.clientX-n.left)},[L]),ke=(0,o.useCallback)(e=>{let t=parseFloat(e.target.value);H(t),k.current&&(k.current.volume=t,k.current.muted=t===0,W(t===0))},[]),Ae=(0,o.useCallback)(e=>{Y(e),k.current&&(k.current.playbackRate=e),ie(!1)},[]),je=v.length>0?[...v].reverse().find(e=>F>=e.time):null,Me=e=>[...v].reverse().find(t=>e>=t.time)??null,Ne=Array.isArray(e)?e:[{src:e,type:`video/mp4`}],Pe=Array.isArray(e)?e[0].src:e,Fe=G||ne||!N,Ie=O?`none`:`opacity 0.25s ease`,Le=U||V===0?gn.volumeMute:V<.5?gn.volumeDown:gn.volumeUp,Re=L>0?F/L*100:0,ze=L>0?z/L*100:0;return(0,s.jsxs)(`div`,{ref:A,className:T,tabIndex:0,onMouseMove:_e,onMouseLeave:()=>{N&&K(!1)},style:{position:`relative`,width:c,height:l??`auto`,background:`#000`,borderRadius:`8px`,overflow:`hidden`,outline:`none`,userSelect:`none`,...E},children:[(0,s.jsxs)(`video`,{ref:k,style:{width:`100%`,height:`100%`,display:`block`,objectFit:`contain`},poster:i,autoPlay:u,loop:d,muted:f,playsInline:!0,onClick:ve,onDoubleClick:Ee,children:[Ne.map((e,t)=>(0,s.jsx)(`source`,{src:e.src,type:e.type},t)),y.map((e,t)=>(0,s.jsx)(`track`,{kind:`subtitles`,label:n.m(e.label),srcLang:e.lang,src:e.src,default:e.default},t))]}),m&&a&&(0,s.jsxs)(`div`,{style:{position:`absolute`,top:0,left:0,right:0,background:`linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%)`,padding:`16px 16px 32px`,opacity:+!!Fe,transition:Ie,pointerEvents:`none`},children:[(0,s.jsx)(`span`,{style:{color:`#fff`,fontSize:`0.95rem`,fontWeight:600,textShadow:`0 1px 3px rgba(0,0,0,0.7)`},children:n.m(a)}),je&&(0,s.jsxs)(`span`,{style:{color:`rgba(255,255,255,0.65)`,fontSize:`0.8rem`,marginLeft:8},children:[`— `,n.m(je.label)]})]}),le&&(0,s.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,background:`rgba(0,0,0,0.45)`,borderRadius:`50%`,width:64,height:64,display:`flex`,alignItems:`center`,justifyContent:`center`,animation:O?`none`:`tkxvp-flash 0.6s ease forwards`,pointerEvents:`none`},children:(0,s.jsx)(hn,{path:le===`play`?gn.play:gn.pause,size:32,color:`#fff`})}),pe&&!$&&(0,s.jsx)(`div`,{"aria-label":`Loading`,style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,pointerEvents:`none`,zIndex:10},children:(0,s.jsx)(`div`,{style:{width:48,height:48,border:`4px solid rgba(255,255,255,0.25)`,borderTopColor:D.primary,borderRadius:`50%`,animation:O?`none`:`tkxvp-spin 0.8s linear infinite`}})}),$&&(0,s.jsxs)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,background:`rgba(0,0,0,0.8)`,zIndex:20,gap:12},children:[(0,s.jsx)(hn,{path:gn.errorOutline,size:48,color:`#ef4444`}),(0,s.jsx)(`span`,{style:{color:`#fff`,fontSize:`0.9rem`,maxWidth:`80%`,textAlign:`center`},children:$}),(0,s.jsxs)(`button`,{type:`button`,onClick:Te,style:{display:`flex`,alignItems:`center`,gap:6,background:D.primary,color:`#fff`,border:`none`,borderRadius:6,padding:`8px 18px`,fontSize:`0.85rem`,fontWeight:600,cursor:`pointer`,marginTop:4},children:[(0,s.jsx)(hn,{path:gn.refresh,size:18,color:`#fff`}),`Retry`]})]}),p&&(0,s.jsxs)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,background:`linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 70%, transparent 100%)`,padding:`32px 12px 8px`,opacity:+!!Fe,transition:Ie},onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),children:[(0,s.jsxs)(`div`,{ref:j,role:`slider`,"aria-label":`Seek`,"aria-valuemin":0,"aria-valuemax":Math.floor(L),"aria-valuenow":Math.floor(F),tabIndex:0,onClick:De,onMouseMove:Oe,style:{position:`relative`,height:4,borderRadius:2,background:`rgba(255,255,255,0.25)`,cursor:`pointer`,marginBottom:8,transition:`height 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.height=`8px`},onMouseLeave:e=>{e.currentTarget.style.height=`4px`,Z(null)},children:[(0,s.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,bottom:0,width:`${ze}%`,background:`rgba(255,255,255,0.3)`,borderRadius:2,pointerEvents:`none`}}),(0,s.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,bottom:0,width:`${Re}%`,background:D.primary,borderRadius:2,pointerEvents:`none`}}),(0,s.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`${Re}%`,transform:`translate(-50%, -50%)`,width:12,height:12,borderRadius:`50%`,background:D.primary,pointerEvents:`none`}}),v.map((e,t)=>{let r=L>0?e.time/L*100:0;return(0,s.jsx)(`div`,{title:n.m(e.label),style:{position:`absolute`,top:`50%`,left:`${r}%`,transform:`translate(-50%, -50%)`,width:8,height:8,borderRadius:`50%`,background:`#fff`,border:`2px solid ${D.primary}`,zIndex:2,cursor:`pointer`,pointerEvents:`auto`}},t)}),X!==null&&(0,s.jsxs)(`div`,{style:{position:`absolute`,bottom:12,left:se,transform:`translateX(-50%)`,background:`rgba(0,0,0,0.8)`,color:`#fff`,fontSize:`0.72rem`,padding:`2px 6px`,borderRadius:4,whiteSpace:`nowrap`,pointerEvents:`none`},children:[mn(X),Me(X)&&(0,s.jsx)(`span`,{style:{display:`block`,fontSize:`0.65rem`,color:`rgba(255,255,255,0.7)`},children:n.m(Me(X).label)})]})]}),(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:2},children:[(0,s.jsx)(_n,{onClick:ve,title:N?`Pause`:`Play`,primary:D.primary,children:(0,s.jsx)(hn,{path:N?gn.pause:gn.play,size:22})}),(0,s.jsx)(_n,{onClick:we,title:`Skip back 10 seconds`,primary:D.primary,children:(0,s.jsxs)(`div`,{style:{position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[(0,s.jsx)(hn,{path:gn.replay10,size:22}),(0,s.jsx)(`span`,{style:{position:`absolute`,fontSize:`7px`,fontWeight:700,color:`currentColor`,marginTop:1},children:`10`})]})}),(0,s.jsx)(_n,{onClick:Ce,title:`Skip forward 10 seconds`,primary:D.primary,children:(0,s.jsxs)(`div`,{style:{position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[(0,s.jsx)(hn,{path:gn.forward10,size:22}),(0,s.jsx)(`span`,{style:{position:`absolute`,fontSize:`7px`,fontWeight:700,color:`currentColor`,marginTop:1},children:`10`})]})}),(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,position:`relative`},onMouseEnter:()=>ge(!0),onMouseLeave:()=>ge(!1),children:[(0,s.jsx)(_n,{onClick:ye,title:U?`Unmute`:`Mute`,primary:D.primary,children:(0,s.jsx)(hn,{path:Le,size:20})}),(0,s.jsx)(`div`,{style:{overflow:`hidden`,width:he?64:0,opacity:+!!he,transition:O?`none`:`width 0.2s ease, opacity 0.2s ease`,display:`flex`,alignItems:`center`},children:(0,s.jsx)(`input`,{type:`range`,min:0,max:1,step:.05,value:U?0:V,onChange:ke,"aria-label":`Volume`,style:{width:64,accentColor:D.primary,cursor:`pointer`,height:4}})})]}),(0,s.jsxs)(`span`,{style:{color:`#fff`,fontSize:`0.78rem`,fontFamily:`monospace`,fontVariantNumeric:`tabular-nums`,marginLeft:6,whiteSpace:`nowrap`,flexShrink:0},children:[mn(F),` / `,mn(L)]}),(0,s.jsx)(`div`,{style:{flex:1}}),y.length>0&&(0,s.jsx)(_n,{onClick:Se,title:`Subtitles`,primary:D.primary,active:ae>=0,children:(0,s.jsx)(hn,{path:gn.closedCaption,size:20})}),(0,s.jsxs)(`div`,{style:{position:`relative`,display:`flex`,alignItems:`center`},children:[(0,s.jsxs)(`button`,{type:`button`,onClick:()=>ie(e=>!e),title:`Playback speed`,style:{background:`none`,border:`none`,cursor:`pointer`,color:`#fff`,fontSize:`0.75rem`,fontWeight:600,padding:`6px 8px`,letterSpacing:`0.02em`,position:`relative`},children:[J,`×`]}),J!==1&&(0,s.jsxs)(`span`,{style:{position:`absolute`,top:0,right:0,background:D.primary,color:`#fff`,fontSize:`0.55rem`,fontWeight:700,borderRadius:6,padding:`1px 4px`,lineHeight:1.2,pointerEvents:`none`},children:[J,`x`]}),re&&(0,s.jsx)(`div`,{style:{position:`absolute`,bottom:`100%`,right:0,background:`rgba(20,20,20,0.97)`,border:`1px solid ${D.border}`,borderRadius:6,overflow:`hidden`,zIndex:100,minWidth:80},children:[.5,.75,1,1.25,1.5,2].map(e=>(0,s.jsxs)(`button`,{type:`button`,onClick:()=>Ae(e),style:{display:`block`,width:`100%`,padding:`6px 14px`,background:e===J?D.primary+`30`:`none`,border:`none`,color:e===J?D.primary:`#fff`,fontSize:`0.8rem`,cursor:`pointer`,textAlign:`left`},children:[e,`×`]},e))})]}),g&&typeof document<`u`&&`pictureInPictureEnabled`in document&&(0,s.jsx)(_n,{onClick:xe,title:`Picture-in-Picture`,primary:D.primary,active:de,children:(0,s.jsx)(hn,{path:gn.pip,size:20})}),_&&(0,s.jsx)(`a`,{href:Pe,download:!0,title:`Download`,style:{color:`#fff`,display:`flex`,alignItems:`center`,padding:`6px`},children:(0,s.jsx)(hn,{path:gn.download,size:20})}),h&&(0,s.jsx)(_n,{onClick:be,title:ee?`Exit fullscreen`:`Fullscreen`,primary:D.primary,children:(0,s.jsx)(hn,{path:ee?gn.fullscreenExit:gn.fullscreen,size:20})})]})]}),(0,s.jsx)(`style`,{children:`
54
54
  @keyframes tkxvp-flash {
55
55
  0% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
56
56
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.5); }
@@ -59,33 +59,33 @@
59
59
  0% { transform: rotate(0deg); }
60
60
  100% { transform: rotate(360deg); }
61
61
  }
62
- `})]})}gr.displayName="TkxVideoPlayer";const Lo={sm:{circle:24,fontSize:"0.75rem",titleSize:"0.8rem",descSize:"0.7rem",connectorWidth:2},md:{circle:32,fontSize:"0.875rem",titleSize:"0.9rem",descSize:"0.775rem",connectorWidth:2},lg:{circle:40,fontSize:"1rem",titleSize:"1rem",descSize:"0.85rem",connectorWidth:3}};function Ao({size:t}){const n=t*.55;return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"})})}function Do({size:t}){const n=t*.55;return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"})})}function Bo({status:t,index:n,showStepNumbers:r,icon:o,circleSize:s,fontSize:a,primary:l,danger:d,success:f,text:u,textMuted:c,border:h,surface:p,variant:m,reducedMotion:b,clickable:k}){const y=t==="completed",g=t==="active",S=t==="error",j=t==="pending";let v=p,$=h,w=c,N=2;y?(v=m==="filled"?f:p,$=f,w=m==="filled"?"#fff":f):g?(v=m==="outlined"?p:l,$=l,w=m==="outlined"?l:"#fff",N=2):S?(v=m==="filled"?d:p,$=d,w=m==="filled"?"#fff":d):j&&(v=p,$=h,w=c);const I=g&&!b?{boxShadow:`0 0 0 4px ${l}30`,animation:"tkxstepper-pulse 2s ease-in-out infinite"}:{},M=k?{cursor:"pointer",transition:"transform 0.15s ease, box-shadow 0.15s ease"}:{};let T;return o&&!y&&!S?T=e.jsx("span",{style:{fontSize:a,lineHeight:1},children:o}):y?T=e.jsx(Ao,{size:s}):S?T=e.jsx(Do,{size:s}):r?T=e.jsx("span",{style:{fontSize:a,fontWeight:600,lineHeight:1},children:n+1}):T=e.jsx("span",{style:{fontSize:s*.22,lineHeight:1,background:w,borderRadius:"50%",width:s*.22,height:s*.22,display:"block"}}),e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
62
+ `})]})}vn.displayName=`TkxVideoPlayer`;var yn={sm:{circle:24,fontSize:`0.75rem`,titleSize:`0.8rem`,descSize:`0.7rem`,connectorWidth:2},md:{circle:32,fontSize:`0.875rem`,titleSize:`0.9rem`,descSize:`0.775rem`,connectorWidth:2},lg:{circle:40,fontSize:`1rem`,titleSize:`1rem`,descSize:`0.85rem`,connectorWidth:3}};function bn({size:e}){let t=e*.55;return(0,s.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z`})})}function xn({size:e}){let t=e*.55;return(0,s.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z`})})}function Sn({status:e,index:t,showStepNumbers:n,icon:r,circleSize:i,fontSize:a,primary:o,danger:c,success:l,text:u,textMuted:d,border:f,surface:p,variant:m,reducedMotion:h,clickable:g}){let _=e===`completed`,v=e===`active`,y=e===`error`,b=e===`pending`,x=p,S=f,C=d,w=2;_?(x=m===`filled`?l:p,S=l,C=m===`filled`?`#fff`:l):v?(x=m===`outlined`?p:o,S=o,C=m===`outlined`?o:`#fff`,w=2):y?(x=m===`filled`?c:p,S=c,C=m===`filled`?`#fff`:c):b&&(x=p,S=f,C=d);let T=v&&!h?{boxShadow:`0 0 0 4px ${o}30`,animation:`tkxstepper-pulse 2s ease-in-out infinite`}:{},E=g?{cursor:`pointer`,transition:`transform 0.15s ease, box-shadow 0.15s ease`}:{},D;return D=r&&!_&&!y?(0,s.jsx)(`span`,{style:{fontSize:a,lineHeight:1},children:r}):_?(0,s.jsx)(bn,{size:i}):y?(0,s.jsx)(xn,{size:i}):n?(0,s.jsx)(`span`,{style:{fontSize:a,fontWeight:600,lineHeight:1},children:t+1}):(0,s.jsx)(`span`,{style:{fontSize:i*.22,lineHeight:1,background:C,borderRadius:`50%`,width:i*.22,height:i*.22,display:`block`}}),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`style`,{children:`
63
63
  @keyframes tkxstepper-pulse {
64
- 0%, 100% { box-shadow: 0 0 0 0 ${l}50; }
65
- 50% { box-shadow: 0 0 0 6px ${l}20; }
64
+ 0%, 100% { box-shadow: 0 0 0 0 ${o}50; }
65
+ 50% { box-shadow: 0 0 0 6px ${o}20; }
66
66
  }
67
- `}),e.jsx("div",{style:{width:s,height:s,minWidth:s,borderRadius:"50%",border:`${N}px solid ${$}`,backgroundColor:v,color:w,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:b?"none":"background-color 0.2s, border-color 0.2s",...I,...M},children:T})]})}function gn({completed:t,orientation:n,connectorStyle:r,connectorWidth:o,primary:s,border:a,reducedMotion:l}){const d=t?s:a;return n==="horizontal"?e.jsx("div",{"aria-hidden":"true",style:{flex:1,height:o,background:r==="solid"?d:"none",backgroundImage:r!=="solid"?`repeating-linear-gradient(90deg, ${d} 0, ${d} 6px, transparent 6px, transparent ${r==="dashed"?12:9}px)`:"none",borderRadius:1,transition:l?"none":"background 0.3s ease",alignSelf:"center",marginLeft:4,marginRight:4}}):e.jsx("div",{"aria-hidden":"true",style:{width:o,flex:1,minHeight:20,background:r==="solid"?d:"none",backgroundImage:r!=="solid"?`repeating-linear-gradient(180deg, ${d} 0, ${d} 6px, transparent 6px, transparent ${r==="dashed"?12:9}px)`:"none",borderRadius:1,transition:l?"none":"background 0.3s ease",alignSelf:"stretch",marginTop:4,marginBottom:4,marginLeft:"auto",marginRight:"auto"}})}function br({steps:t,activeStep:n=0,orientation:r="horizontal",variant:o="default",size:s="md",clickable:a=!1,onStepClick:l,showStepNumbers:d=!0,alternateLabel:f=!1,connector:u="solid",className:c,style:h}){const p=O.useTheme(),m=J.useReducedMotion(),b=Lo[s],k=(g,S)=>g.status?g.status:S<n?"completed":S===n?"active":"pending",y=r==="horizontal";return e.jsx("div",{className:c,role:"list","aria-label":"Steps",style:{display:"flex",flexDirection:y?"row":"column",alignItems:y?f?"flex-start":"center":"stretch",width:"100%",gap:0,...h},children:t.map((g,S)=>{const j=k(g,S),v=S===t.length-1,$=j==="completed"||S<n,w=S%2===0,N=()=>{a&&(l==null||l(S))},I=e.jsx(Bo,{status:j,index:S,showStepNumbers:d,icon:g.icon,circleSize:b.circle,fontSize:b.fontSize,primary:p.primary,danger:p.danger,success:p.success,text:p.text,textMuted:p.textMuted,border:p.border,surface:p.surface,variant:o,reducedMotion:m,clickable:a}),M=e.jsxs("div",{style:{textAlign:y&&!f?"center":"left",maxWidth:y?120:void 0},children:[e.jsxs("div",{style:{fontSize:b.titleSize,fontWeight:j==="active"?600:500,color:j==="pending"?p.textMuted:j==="error"?p.danger:p.text,lineHeight:1.3,transition:m?"none":"color 0.2s"},children:[A.sanitizeString(g.title),g.optional&&e.jsx("span",{style:{fontSize:b.descSize,color:p.textMuted,fontWeight:400,marginLeft:4},children:"(optional)"})]}),g.description&&e.jsx("div",{style:{fontSize:b.descSize,color:p.textMuted,marginTop:2,lineHeight:1.4},children:A.sanitizeString(g.description)}),g.error&&j==="error"&&e.jsx("div",{style:{fontSize:b.descSize,color:p.danger,marginTop:2},children:A.sanitizeString(g.error)})]});return y?e.jsxs("div",{role:"listitem",style:{display:"flex",flex:v?0:1,alignItems:"center",minWidth:0},children:[e.jsxs("div",{onClick:N,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,cursor:a?"pointer":"default",flexShrink:0},"aria-current":j==="active"?"step":void 0,children:[f&&!w&&e.jsx("div",{style:{minHeight:b.circle*1.5+6,display:"flex",alignItems:"flex-end",paddingBottom:6},children:M}),I,!f&&M,f&&w&&e.jsx("div",{style:{marginTop:6},children:M})]}),!v&&e.jsx(gn,{completed:$,orientation:"horizontal",connectorStyle:u,connectorWidth:b.connectorWidth,primary:p.primary,border:p.border,reducedMotion:m})]},g.id):e.jsxs("div",{role:"listitem",style:{display:"flex",flexDirection:"row",minHeight:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginRight:14,flexShrink:0},children:[e.jsx("div",{onClick:N,style:{cursor:a?"pointer":"default"},"aria-current":j==="active"?"step":void 0,children:I}),!v&&e.jsx(gn,{completed:$,orientation:"vertical",connectorStyle:u,connectorWidth:b.connectorWidth,primary:p.primary,border:p.border,reducedMotion:m})]}),e.jsx("div",{style:{paddingTop:(b.circle-parseFloat(b.titleSize)*16)/2,paddingBottom:v?0:16,flex:1,minWidth:0},children:M})]},g.id)})})}br.displayName="TkxStepper";function yr(t){let n=0,r=0,o=0;const s=t.replace("#","");s.length===3?(n=parseInt(s[0]+s[0],16),r=parseInt(s[1]+s[1],16),o=parseInt(s[2]+s[2],16)):s.length>=6&&(n=parseInt(s.slice(0,2),16),r=parseInt(s.slice(2,4),16),o=parseInt(s.slice(4,6),16)),n/=255,r/=255,o/=255;const a=Math.max(n,r,o),l=Math.min(n,r,o);let d=0,f=0;const u=(a+l)/2;if(a!==l){const c=a-l;switch(f=u>.5?c/(2-a-l):c/(a+l),a){case n:d=((r-o)/c+(r<o?6:0))/6;break;case r:d=((o-n)/c+2)/6;break;case o:d=((n-r)/c+4)/6;break}}return[Math.round(d*360),Math.round(f*100),Math.round(u*100)]}function Vt(t,n,r){n/=100,r/=100;const o=n*Math.min(r,1-r),s=a=>{const l=(a+t/30)%12,d=r-o*Math.max(Math.min(l-3,9-l,1),-1);return Math.round(255*d).toString(16).padStart(2,"0")};return`#${s(0)}${s(8)}${s(4)}`}function It(t){const n=t.replace("#",""),r=parseInt(n.slice(0,2),16),o=parseInt(n.slice(2,4),16),s=parseInt(n.slice(4,6),16);return[isNaN(r)?0:r,isNaN(o)?0:o,isNaN(s)?0:s]}function Lt(t,n,r){return`#${t.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function dt(t){return/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t)}function At(t,n,r){if(r==="hex")return n<1?`${t}${Math.round(n*255).toString(16).padStart(2,"0")}`:t;const[o,s,a]=It(t);if(r==="rgb")return n<1?`rgba(${o}, ${s}, ${a}, ${n.toFixed(2)})`:`rgb(${o}, ${s}, ${a})`;const[l,d,f]=yr(t);return r==="hsl"?n<1?`hsla(${l}, ${d}%, ${f}%, ${n.toFixed(2)})`:`hsl(${l}, ${d}%, ${f}%)`:t}const Wo=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#ffffff","#94a3b8","#475569","#0f172a"];function Fo({hue:t,sat:n,bright:r,onChange:o}){const s=i.useRef(null),a=i.useRef(!1),l=i.useCallback(u=>{const c=s.current;if(!c)return;const h=c.getBoundingClientRect(),p=Math.max(0,Math.min(1,(u.clientX-h.left)/h.width)),m=Math.max(0,Math.min(1,(u.clientY-h.top)/h.height));o(Math.round(p*100),Math.round((1-m)*100))},[o]);i.useEffect(()=>{const u=h=>{a.current&&l(h)},c=()=>{a.current=!1};return document.addEventListener("mousemove",u),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",c)}},[l]);const d=`${n}%`,f=`${100-r}%`;return e.jsxs("div",{ref:s,style:{position:"relative",width:"100%",height:"160px",borderRadius:"6px",cursor:"crosshair",background:`hsl(${t}, 100%, 50%)`,flexShrink:0},onMouseDown:u=>{a.current=!0,l(u)},children:[e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"6px",background:"linear-gradient(to right, #ffffff, transparent)"}}),e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"6px",background:"linear-gradient(to bottom, transparent, #000000)"}}),e.jsx("div",{style:{position:"absolute",left:d,top:f,transform:"translate(-50%, -50%)",width:"14px",height:"14px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.4)",pointerEvents:"none",backgroundColor:Vt(t,n,r/2+25)}})]})}function Po({hue:t,onChange:n}){const r=i.useRef(null),o=i.useRef(!1),s=i.useCallback(a=>{const l=r.current;if(!l)return;const d=l.getBoundingClientRect(),f=Math.max(0,Math.min(1,(a.clientX-d.left)/d.width));n(Math.round(f*360))},[n]);return i.useEffect(()=>{const a=d=>{o.current&&s(d)},l=()=>{o.current=!1};return document.addEventListener("mousemove",a),document.addEventListener("mouseup",l),()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l)}},[s]),e.jsx("div",{ref:r,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:"linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)"},onMouseDown:a=>{o.current=!0,s(a)},children:e.jsx("div",{style:{position:"absolute",left:`${t/360*100}%`,top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`hsl(${t}, 100%, 50%)`,pointerEvents:"none"}})})}function Ho({alpha:t,hex:n,onChange:r}){const o=i.useRef(null),s=i.useRef(!1),a=i.useCallback(u=>{const c=o.current;if(!c)return;const h=c.getBoundingClientRect(),p=Math.max(0,Math.min(1,(u.clientX-h.left)/h.width));r(Math.round(p*100)/100)},[r]);i.useEffect(()=>{const u=h=>{s.current&&a(h)},c=()=>{s.current=!1};return document.addEventListener("mousemove",u),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",c)}},[a]);const[l,d,f]=It(n);return e.jsxs("div",{style:{position:"relative"},children:[e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"6px",backgroundImage:"repeating-conic-gradient(#ccc 0% 25%, white 0% 50%)",backgroundSize:"8px 8px"}}),e.jsx("div",{ref:o,style:{position:"relative",height:"12px",borderRadius:"6px",cursor:"pointer",background:`linear-gradient(to right, rgba(${l},${d},${f},0), rgba(${l},${d},${f},1))`},onMouseDown:u=>{s.current=!0,a(u)},children:e.jsx("div",{style:{position:"absolute",left:`${t*100}%`,top:"50%",transform:"translate(-50%, -50%)",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid white",boxShadow:"0 0 0 1px rgba(0,0,0,0.3)",backgroundColor:`rgba(${l},${d},${f},${t})`,pointerEvents:"none"}})})]})}function Vo({value:t,defaultValue:n="#3b82f6",onChange:r,format:o="hex",showAlpha:s=!1,presets:a=Wo,disabled:l=!1,size:d="md",placeholder:f,label:u,style:c}){const h=O.useTheme(),p=i.useRef(null),m=i.useRef(null),[b,k]=i.useState(!1),y=t!==void 0,[g,S]=i.useState(y&&t||n),j=y?t||n:g,[v,$]=i.useState(1),[w,N]=i.useState(j),[I,M]=i.useState({top:0,left:0}),[T,E,C]=yr(dt(j)?j:n),H=i.useCallback((Y,se=v)=>{dt(Y)&&(N(Y),y||S(Y),r==null||r(At(Y,se,o),o))},[v,y,o,r]);i.useEffect(()=>{y&&t&&dt(t)&&N(t)},[y,t]);const z=()=>{if(l)return;const Y=p.current;if(!Y)return;const se=Y.getBoundingClientRect(),ge=window.innerHeight-se.bottom>320?se.bottom+6:se.top-326;M({top:ge+window.scrollY,left:se.left+window.scrollX}),k(!0)};i.useEffect(()=>{if(!b)return;const Y=se=>{m.current&&!m.current.contains(se.target)&&p.current&&!p.current.contains(se.target)&&k(!1)};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[b]),i.useEffect(()=>{if(!b)return;const Y=se=>{se.key==="Escape"&&k(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[b]);const L=(Y,se)=>{const ae=se/100,ge=Y/100,he=ae*(1-ge/2),ye=he===0||he===1?0:(ae-he)/Math.min(he,1-he),de=Vt(T,Math.round(ye*100),Math.round(he*100));H(de)},B=Y=>{const se=Vt(Y,E,C);H(se)},V=Y=>{$(Y),r==null||r(At(j,Y,o),o)},D=Y=>{const se=Y.target.value;N(se),dt(se)&&H(se)},_=(Y,se)=>{const ae=Math.max(0,Math.min(255,parseInt(se)||0)),[ge,he,ye]=It(j),de=Y==="r"?Lt(ae,he,ye):Y==="g"?Lt(ge,ae,ye):Lt(ge,he,ae);H(de)},F={sm:28,md:34,lg:40}[d],[W,K,ne]=It(dt(j)?j:n),Z={display:"inline-flex",alignItems:"center",gap:"8px",height:`${F}px`,padding:"4px 10px 4px 6px",borderRadius:"8px",border:`1px solid ${h.border}`,backgroundColor:h.surface,cursor:l?"not-allowed":"pointer",opacity:l?.5:1,color:h.text,fontSize:"13px",fontFamily:"inherit",transition:"border-color 0.15s",...c},ie={width:`${F-8}px`,height:`${F-8}px`,borderRadius:"4px",backgroundColor:`rgba(${W},${K},${ne},${v})`,border:`1px solid ${h.border}`,flexShrink:0},fe={position:"absolute",top:I.top,left:I.left,zIndex:9999,width:"260px",backgroundColor:h.surface,border:`1px solid ${h.border}`,borderRadius:"12px",padding:"16px",boxShadow:"0 8px 32px rgba(0,0,0,0.24)",display:"flex",flexDirection:"column",gap:"12px"},pe={width:"100%",padding:"6px 10px",borderRadius:"6px",border:`1px solid ${h.border}`,backgroundColor:h.bg,color:h.text,fontSize:"12px",fontFamily:"monospace",outline:"none"},te={flex:1,padding:"5px 6px",borderRadius:"6px",border:`1px solid ${h.border}`,backgroundColor:h.bg,color:h.text,fontSize:"11px",textAlign:"center",fontFamily:"monospace",outline:"none"},ce=Y=>({width:"20px",height:"20px",borderRadius:"50%",backgroundColor:Y,border:Y.toLowerCase()===j.toLowerCase()?`2px solid ${h.primary}`:`1px solid ${h.border}`,cursor:"pointer",flexShrink:0,transition:"transform 0.1s"});return e.jsxs(e.Fragment,{children:[u&&e.jsx("label",{style:{display:"block",fontSize:"13px",color:h.text,marginBottom:"6px",fontWeight:500},children:u}),e.jsxs("button",{ref:p,type:"button",style:Z,onClick:z,disabled:l,"aria-label":`Color picker, current color ${j}`,"aria-haspopup":"dialog","aria-expanded":b,children:[e.jsx("div",{style:ie}),e.jsx("span",{style:{fontFamily:"monospace",fontSize:"12px",color:h.textMuted},children:f??At(dt(j)?j:n,v,o)})]}),b&&Re.createPortal(e.jsxs("div",{ref:m,style:fe,role:"dialog","aria-label":"Color picker",children:[e.jsx(Fo,{hue:T,sat:E,bright:C,onChange:L}),e.jsx(Po,{hue:T,onChange:B}),s&&e.jsx(Ho,{alpha:v,hex:dt(j)?j:n,onChange:V}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"6px",flexShrink:0,backgroundColor:`rgba(${W},${K},${ne},${v})`,border:`1px solid ${h.border}`}}),e.jsx("input",{style:pe,value:w,onChange:D,maxLength:7,spellCheck:!1,"aria-label":"Hex color value"})]}),e.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[["r","g","b"].map(Y=>{const se=Y==="r"?W:Y==="g"?K:ne;return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[e.jsx("input",{style:te,type:"number",min:0,max:255,value:se,onChange:ae=>_(Y,ae.target.value),"aria-label":`${Y.toUpperCase()} channel`}),e.jsx("span",{style:{fontSize:"10px",color:h.textMuted,textTransform:"uppercase"},children:Y})]},Y)}),s&&e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"3px",alignItems:"center"},children:[e.jsx("input",{style:te,type:"number",min:0,max:100,value:Math.round(v*100),onChange:Y=>V(Math.max(0,Math.min(1,parseInt(Y.target.value)/100||0))),"aria-label":"Alpha channel"}),e.jsx("span",{style:{fontSize:"10px",color:h.textMuted},children:"A%"})]})]}),a.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"11px",color:h.textMuted,marginBottom:"6px",fontWeight:500},children:"Presets"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:a.map(Y=>e.jsx("button",{type:"button",style:ce(Y),onClick:()=>H(Y),"aria-label":`Select color ${Y}`,onMouseEnter:se=>{se.currentTarget.style.transform="scale(1.15)"},onMouseLeave:se=>{se.currentTarget.style.transform="scale(1)"}},Y))})]})]}),document.body)]})}const Oo={sm:{height:"32px",fontSize:"0.8125rem",px:"8px",btnW:"28px",iconSz:14},md:{height:"40px",fontSize:"0.875rem",px:"12px",btnW:"34px",iconSz:16},lg:{height:"48px",fontSize:"1rem",px:"14px",btnW:"40px",iconSz:18}};function bn(t,n,r){let o=t;return n!==void 0&&(o=Math.max(o,n)),r!==void 0&&(o=Math.min(o,r)),o}function Dt(t,n){if(n===void 0)return t;const r=Math.pow(10,n);return Math.round(t*r)/r}function _o(t,n,r,o,s){const a=o??"en-US";return n==="currency"?new Intl.NumberFormat(a,{style:"currency",currency:r??"USD",minimumFractionDigits:s??2,maximumFractionDigits:s??2}).format(t):n==="percent"?new Intl.NumberFormat(a,{style:"percent",minimumFractionDigits:s??0,maximumFractionDigits:s??0}).format(t/100):n==="decimal"||s!==void 0?new Intl.NumberFormat(a,{minimumFractionDigits:s??0,maximumFractionDigits:s??20}).format(t):String(t)}function yn({direction:t,isDisabled:n,btnW:r,height:o,primaryColor:s,borderColor:a,textMuted:l,iconSz:d,onStep:f}){const u=i.useRef(null),c=i.useRef(null),h=t==="inc"?1:-1,p=i.useCallback(()=>{f(h),u.current=setTimeout(()=>{c.current=setInterval(()=>f(h),60)},400)},[h,f]),m=i.useCallback(()=>{u.current&&(clearTimeout(u.current),u.current=null),c.current&&(clearInterval(c.current),c.current=null)},[]);i.useEffect(()=>()=>m(),[m]);const b=t==="inc";return e.jsx("button",{type:"button","aria-label":b?"Increment":"Decrement",disabled:n,onMouseDown:p,onMouseUp:m,onMouseLeave:m,onTouchStart:k=>{k.preventDefault(),p()},onTouchEnd:m,style:{width:r,height:o,minWidth:r,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",borderRight:b?void 0:`1px solid ${a}`,borderLeft:b?`1px solid ${a}`:void 0,cursor:n?"not-allowed":"pointer",color:n?l:s,transition:"color 120ms ease, background 120ms ease",outline:"none"},onFocus:k=>{n||(k.currentTarget.style.background=`${s}12`)},onBlur:k=>{k.currentTarget.style.background="transparent"},children:b?e.jsxs("svg",{width:d,height:d,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}):e.jsx("svg",{width:d,height:d,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})})}function kr({value:t,defaultValue:n=0,onChange:r,min:o,max:s,step:a=1,precision:l,prefix:d,suffix:f,format:u,currency:c,locale:h,clampOnBlur:p=!0,allowMouseWheel:m=!1,size:b="md",label:k,hint:y,isDisabled:g=!1,isReadOnly:S=!1,isInvalid:j=!1,errorMessage:v,id:$,className:w,style:N}){const I=O.useTheme(),M=i.useId(),T=$??M,E=`${T}-hint`,C=`${T}-error`,H=t!==void 0,[z,L]=i.useState(n),B=H?t:z,[V,D]=i.useState(!1),[_,R]=i.useState(""),F=Oo[b],W=j||!!v,K=W?I.danger:V?I.primary:I.border,ne=[y&&E,W&&C].filter(Boolean).join(" ")||void 0,Z=k?A.sanitizeString(k):void 0,ie=y?A.sanitizeString(y):void 0,fe=v?A.sanitizeString(v):void 0,pe=d?A.sanitizeString(d):void 0,te=f?A.sanitizeString(f):void 0,ce=i.useCallback(oe=>{const G=Dt(oe,l);H||L(G),r==null||r(G)},[H,r,l]),Y=i.useCallback(oe=>{if(g||S)return;const G=bn(Dt(B+oe*a,l),o,s);ce(G)},[g,S,B,a,l,o,s,ce]),se=()=>{D(!0),R(String(B))},ae=()=>{D(!1);const oe=parseFloat(_);if(isNaN(oe)){r==null||r(null),R(String(B));return}let G=Dt(oe,l);p&&(G=bn(G,o,s)),ce(G)},ge=oe=>{R(oe.target.value)},he=oe=>{oe.key==="ArrowUp"&&(oe.preventDefault(),Y(1)),oe.key==="ArrowDown"&&(oe.preventDefault(),Y(-1))},ye=oe=>{!m||!V||(oe.preventDefault(),Y(oe.deltaY<0?1:-1))},de=V?_:_o(B,u,c,h,l),xe=(pe||te)&&!V;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1 w-full"),w),style:N,children:[Z&&e.jsx("label",{htmlFor:T,className:x.tkx("text-sm font-medium font-sans"),style:{color:I.text},children:Z}),e.jsxs("div",{className:x.tkx("flex items-stretch overflow-hidden rounded-lg transition-colors duration-150"),style:{border:`1.5px solid ${K}`,backgroundColor:g?I.surfaceAlt:I.surface,opacity:g?.65:1,height:F.height},children:[e.jsx(yn,{direction:"dec",isDisabled:g||S,btnW:F.btnW,height:F.height,primaryColor:I.primary,borderColor:I.border,textMuted:I.textMuted,iconSz:F.iconSz,onStep:Y}),e.jsxs("div",{className:x.tkx("relative flex-1 flex items-center overflow-hidden"),children:[xe&&pe&&e.jsx("span",{style:{position:"absolute",left:F.px,fontSize:F.fontSize,color:I.textMuted,pointerEvents:"none",userSelect:"none"},children:pe}),e.jsx("input",{id:T,type:"text",inputMode:"decimal",value:V?_:de,readOnly:S,disabled:g,"aria-invalid":W,"aria-describedby":ne,"aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":B,style:{width:"100%",height:"100%",border:"none",background:"transparent",outline:"none",textAlign:"center",fontSize:F.fontSize,fontFamily:"inherit",color:I.text,paddingLeft:xe&&pe?`calc(${F.px} + 1.2em)`:F.px,paddingRight:xe&&te?`calc(${F.px} + 1.2em)`:F.px,cursor:g?"not-allowed":S?"default":"text"},onFocus:se,onBlur:ae,onChange:ge,onKeyDown:he,onWheel:ye}),xe&&te&&e.jsx("span",{style:{position:"absolute",right:F.px,fontSize:F.fontSize,color:I.textMuted,pointerEvents:"none",userSelect:"none"},children:te})]}),e.jsx(yn,{direction:"inc",isDisabled:g||S,btnW:F.btnW,height:F.height,primaryColor:I.primary,borderColor:I.border,textMuted:I.textMuted,iconSz:F.iconSz,onStep:Y})]}),ie&&!fe&&e.jsx("span",{id:E,className:x.tkx("text-xs"),style:{color:I.textMuted},children:ie}),fe&&e.jsxs("span",{id:C,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:I.danger},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),fe]})]})}kr.displayName="TkxNumberInput";const Yo={sm:{box:"36px",fontSize:"1rem",gap:"6px"},md:{box:"44px",fontSize:"1.25rem",gap:"8px"},lg:{box:"52px",fontSize:"1.5rem",gap:"10px"}},Ko={number:/^\d$/,alphanumeric:/^[a-zA-Z0-9]$/,alpha:/^[a-zA-Z]$/};function kn(t,n){return Ko[n].test(t)?t.toUpperCase():""}function vr({length:t=6,value:n,onChange:r,onComplete:o,type:s="number",mask:a=!1,autoFocus:l=!1,isDisabled:d=!1,isInvalid:f=!1,errorMessage:u,hint:c,size:h="md",separator:p,separatorPosition:m,className:b,style:k}){const y=O.useTheme(),g=i.useId(),S=`${g}-hint`,j=`${g}-error`,v=n!==void 0,$=W=>{const K=W.split("").slice(0,t);for(;K.length<t;)K.push("");return K},[w,N]=i.useState(()=>$(v?n:"")),I=v?$(n):w,M=i.useRef([]),T=Yo[h],E=f||!!u,C=I.every(W=>W!==""),H=c?A.sanitizeString(c):void 0,z=u?A.sanitizeString(u):void 0,L=W=>E?y.danger:C?y.success:y.border;i.useEffect(()=>{var W;l&&((W=M.current[0])==null||W.focus())},[]);const B=i.useCallback(W=>{v||N(W);const K=W.join("");r==null||r(K),W.every(ne=>ne!=="")&&(o==null||o(K))},[v,r,o]),V=W=>{var ne;const K=Math.max(0,Math.min(t-1,W));(ne=M.current[K])==null||ne.focus()},D=W=>K=>{if(!d){if(K.key==="Backspace"){if(K.preventDefault(),I[W]!==""){const ne=[...I];ne[W]="",B(ne)}else if(W>0){const ne=[...I];ne[W-1]="",B(ne),V(W-1)}return}if(K.key==="Delete"){K.preventDefault();const ne=[...I];ne[W]="",B(ne);return}if(K.key==="ArrowLeft"){K.preventDefault(),V(W-1);return}if(K.key==="ArrowRight"){K.preventDefault(),V(W+1);return}if(K.key==="Home"){K.preventDefault(),V(0);return}if(K.key==="End"){K.preventDefault(),V(t-1);return}}},_=W=>K=>{if(d)return;const Z=K.target.value.slice(-1);if(!Z)return;const ie=kn(Z,s);if(!ie)return;const fe=[...I];fe[W]=ie,B(fe),W<t-1&&V(W+1)},R=W=>K=>{if(K.preventDefault(),d)return;const Z=K.clipboardData.getData("text").split("").map(pe=>kn(pe,s)).filter(Boolean);if(!Z.length)return;const ie=[...I];let fe=W;for(const pe of Z){if(fe>=t)break;ie[fe]=pe,fe++}B(ie),V(Math.min(fe,t-1))},F=[H&&S,E&&j].filter(Boolean).join(" ")||void 0;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-2 w-fit"),b),style:k,children:[e.jsx("div",{role:"group","aria-label":"One-time password","aria-describedby":F,className:x.tkx("flex items-center"),style:{gap:T.gap},children:Array.from({length:t},(W,K)=>{const ne=L();return typeof document<"u"&&(document.activeElement,M.current[K]),e.jsxs("div",{className:x.tkx("flex items-center"),style:{gap:T.gap},children:[p&&m===K&&K!==0&&e.jsx("span",{"aria-hidden":"true",style:{color:y.textMuted,userSelect:"none",flexShrink:0},children:p}),e.jsx("input",{ref:Z=>{M.current[K]=Z},type:a?"password":"text",inputMode:s==="number"?"numeric":"text",maxLength:1,value:I[K],disabled:d,"aria-label":`Digit ${K+1} of ${t}`,autoComplete:"one-time-code",spellCheck:!1,onChange:_(K),onKeyDown:D(K),onPaste:R(K),onFocus:Z=>Z.target.select(),style:{width:T.box,height:T.box,textAlign:"center",fontSize:T.fontSize,fontFamily:"monospace",fontWeight:600,border:`1.5px solid ${ne}`,borderRadius:"8px",backgroundColor:d?y.surfaceAlt:y.surface,color:y.text,outline:"none",boxShadow:"none",cursor:d?"not-allowed":"text",transition:"border-color 150ms ease, box-shadow 150ms ease",opacity:d?.6:1},onFocusCapture:Z=>{d||(Z.currentTarget.style.borderColor=E?y.danger:y.primary,Z.currentTarget.style.boxShadow=`0 0 0 3px ${E?y.danger:y.primary}33`)},onBlurCapture:Z=>{Z.currentTarget.style.borderColor=L(),Z.currentTarget.style.boxShadow="none"}})]},K)})}),H&&!z&&e.jsx("span",{id:S,className:x.tkx("text-xs"),style:{color:y.textMuted},children:H}),z&&e.jsxs("span",{id:j,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:y.danger},children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),z]})]})}vr.displayName="TkxOTP";function Uo(t,n){i.useEffect(()=>{if(!n)return;const r=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,n])}function Xo(t){const n=i.useRef(null);return i.useEffect(()=>{if(!t||!n.current)return;const r=n.current,o=r.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),s=o[0],a=o[o.length-1],l=d=>{d.key==="Tab"&&(d.shiftKey?document.activeElement===s&&(d.preventDefault(),a==null||a.focus()):document.activeElement===a&&(d.preventDefault(),s==null||s.focus()))};return r.addEventListener("keydown",l),()=>r.removeEventListener("keydown",l)},[t]),n}function Zo(){const[t,n]=i.useState(!1),r=i.useCallback(()=>n(!0),[]),o=i.useCallback(()=>n(!1),[]),s=i.useCallback(()=>n(a=>!a),[]);return{isOpen:t,open:r,close:o,toggle:s}}function Bt(t,n){if(!t)return{matched:!0,ranges:[],score:0};const r=t.toLowerCase(),o=n.toLowerCase(),s=o.indexOf(r);if(s!==-1)return{matched:!0,ranges:[[s,s+r.length-1]],score:s===0?100:80};const a=[];let l=0,d=-1,f=-1;for(let u=0;u<o.length&&l<r.length;u++)o[u]===r[l]&&((f===-1||u!==f+1)&&(d!==-1&&a.push([d,f]),d=u),f=u,l++);return d!==-1&&f!==-1&&a.push([d,f]),l<r.length?{matched:!1,ranges:[],score:0}:{matched:!0,ranges:a,score:40}}function Go(t,n){if(!t.trim())return n.filter(o=>!o.disabled).map(o=>({item:o,score:0,labelRanges:[]}));const r=[];for(const o of n){if(o.disabled)continue;const s=Bt(t,o.label),a=o.description?Bt(t,o.description):{matched:!1,score:0},l=(o.keywords??[]).some(d=>Bt(t,d).matched);s.matched?r.push({item:o,score:s.score+20,labelRanges:s.ranges}):a.matched?r.push({item:o,score:a.score,labelRanges:[]}):l&&r.push({item:o,score:20,labelRanges:[]})}return r.sort((o,s)=>s.score-o.score)}function qo({text:t,ranges:n,color:r}){if(!n.length)return e.jsx(e.Fragment,{children:t});const o=[];let s=0;for(const[a,l]of n)s<a&&o.push(e.jsx("span",{children:t.slice(s,a)},`t-${s}`)),o.push(e.jsx("span",{style:{color:r,fontWeight:700},children:t.slice(a,l+1)},`h-${a}`)),s=l+1;return s<t.length&&o.push(e.jsx("span",{children:t.slice(s)},"t-end")),e.jsx(e.Fragment,{children:o})}function Qo({surface:t,border:n}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:8,overflow:"hidden"},children:[e.jsx("div",{style:{width:24,height:24,borderRadius:6,background:`linear-gradient(90deg, ${n} 25%, ${t} 50%, ${n} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite",flexShrink:0}}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:5},children:[e.jsx("div",{style:{height:13,borderRadius:4,width:"60%",background:`linear-gradient(90deg, ${n} 25%, ${t} 50%, ${n} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out infinite"}}),e.jsx("div",{style:{height:10,borderRadius:4,width:"40%",background:`linear-gradient(90deg, ${n} 25%, ${t} 50%, ${n} 75%)`,backgroundSize:"200% 100%",animation:"tkx-shimmer 1.4s ease-in-out 0.2s infinite"}})]})]})}function wr({items:t,isOpen:n=!1,onClose:r,placeholder:o="Type a command or search…",emptyMessage:s,maxItems:a=8,onItemSelect:l,className:d,style:f}){const u=O.useTheme(),[c,h]=i.useState(""),[p,m]=i.useState(0),[b,k]=i.useState(!1),y=i.useRef(null),g=i.useRef(null),S=i.useId(),j=Xo(n),v=Go(c,t).slice(0,a),$=[];for(const C of v){const H=C.item.group,z=$.find(L=>L.group===H);z?z.items.push(C):$.push({group:H,items:[C]})}const w=$.flatMap(C=>C.items);Uo(()=>{r==null||r()},n),i.useEffect(()=>{n&&(h(""),m(0),setTimeout(()=>{var C;return(C=y.current)==null?void 0:C.focus()},30))},[n]),i.useEffect(()=>{p>=w.length&&m(Math.max(0,w.length-1))},[w.length,p]);const N=i.useCallback(C=>{const H=g.current;if(!H)return;const z=H.querySelectorAll("[data-command-item]")[C];z==null||z.scrollIntoView({block:"nearest"})},[]),I=C=>{if(C.key==="ArrowDown"){C.preventDefault();const H=Math.min(w.length-1,p+1);m(H),N(H)}else if(C.key==="ArrowUp"){C.preventDefault();const H=Math.max(0,p-1);m(H),N(H)}else if(C.key==="Enter"){C.preventDefault();const H=w[p];H&&M(H.item)}},M=C=>{var H;C.disabled||((H=C.onSelect)==null||H.call(C),l==null||l(C),r==null||r())};if(!n||typeof document>"u")return null;const T=A.sanitizeString(o),E=s?A.sanitizeString(s):`No results for "${A.sanitizeString(c)}"`;if(typeof document<"u"&&!document.getElementById("tkx-shimmer-style")){const C=document.createElement("style");C.id="tkx-shimmer-style",C.textContent="@keyframes tkx-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }",document.head.appendChild(C)}return Re.createPortal(e.jsxs("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:1e4,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"15vh",paddingLeft:16,paddingRight:16},children:[e.jsx("div",{"aria-hidden":"true",onClick:r,style:{position:"absolute",inset:0,backgroundColor:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)",animation:"tkx-fade-in 120ms ease"}}),e.jsxs("div",{ref:j,role:"dialog","aria-modal":"true","aria-label":"Command palette",id:S,className:x.cx(d),style:{position:"relative",zIndex:1,width:"100%",maxWidth:560,backgroundColor:u.surface,border:`1px solid ${u.border}`,borderRadius:16,boxShadow:`0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px ${u.border}`,overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"70vh",...f},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px",borderBottom:`1px solid ${u.border}`},children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:u.textMuted,strokeWidth:2,"aria-hidden":"true",style:{flexShrink:0},children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:y,type:"text",role:"combobox","aria-expanded":!0,"aria-autocomplete":"list","aria-controls":`${S}-list`,"aria-activedescendant":w[p]?`${S}-item-${w[p].item.id}`:void 0,value:c,onChange:C=>{h(C.target.value),m(0)},onKeyDown:I,placeholder:T,style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:16,fontFamily:"inherit",color:u.text}}),c&&e.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>{var C;h(""),m(0),(C=y.current)==null||C.focus()},style:{border:"none",background:"transparent",cursor:"pointer",color:u.textMuted,display:"flex",alignItems:"center",padding:0},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("div",{id:`${S}-list`,ref:g,role:"listbox","aria-label":"Command results",style:{overflowY:"auto",flex:1,padding:"6px 8px"},children:b?Array.from({length:4},(C,H)=>e.jsx(Qo,{surface:u.surface,border:u.border},H)):w.length===0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:"32px 16px",color:u.textMuted},children:[e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]}),e.jsx("span",{style:{fontSize:"0.875rem"},children:E})]}):$.map(({group:C,items:H},z)=>{const L=$.slice(0,z).reduce((B,V)=>B+V.items.length,0);return e.jsxs("div",{children:[C&&e.jsx("div",{role:"presentation",style:{fontSize:"0.6875rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:u.textMuted,padding:"10px 12px 4px"},children:A.sanitizeString(C)}),H.map((B,V)=>{const D=L+V,_=D===p,R=B.item;return e.jsxs("div",{id:`${S}-item-${R.id}`,role:"option","aria-selected":_,"aria-disabled":R.disabled,"data-command-item":!0,onClick:()=>M(R),onMouseEnter:()=>m(D),style:{display:"flex",alignItems:"center",gap:10,padding:"9px 12px",borderRadius:8,cursor:R.disabled?"not-allowed":"pointer",opacity:R.disabled?.45:1,backgroundColor:_?`${u.primary}18`:"transparent",borderLeft:_?`2px solid ${u.primary}`:"2px solid transparent",transition:"background 80ms ease",userSelect:"none"},children:[R.icon&&e.jsx("span",{style:{width:20,height:20,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",color:_?u.primary:u.textMuted},children:R.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:"0.875rem",fontWeight:500,color:u.text,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.jsx(qo,{text:R.label,ranges:B.labelRanges,color:u.primary})}),R.description&&e.jsx("div",{style:{fontSize:"0.75rem",color:u.textMuted,marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:A.sanitizeString(R.description)})]}),R.shortcut&&e.jsx("span",{style:{flexShrink:0,fontSize:"0.6875rem",fontWeight:500,color:u.textMuted,backgroundColor:u.surfaceAlt,border:`1px solid ${u.border}`,borderRadius:6,padding:"2px 6px",fontFamily:"monospace",letterSpacing:"0.04em"},children:A.sanitizeString(R.shortcut)})]},R.id)})]},C??"__default__")})}),w.length>0&&e.jsxs("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",gap:12,padding:"8px 16px",borderTop:`1px solid ${u.border}`,fontSize:"0.6875rem",color:u.textMuted},children:[e.jsxs("span",{children:[e.jsx("kbd",{style:{fontFamily:"monospace"},children:"↑↓"})," navigate"]}),e.jsxs("span",{children:[e.jsx("kbd",{style:{fontFamily:"monospace"},children:"↵"})," select"]}),e.jsxs("span",{children:[e.jsx("kbd",{style:{fontFamily:"monospace"},children:"Esc"})," close"]})]})]})]}),document.body)}wr.displayName="TkxCommand";function Tt({direction:t,onClick:n,isDisabled:r,primaryColor:o,position:s,orientation:a}){const l=a==="vertical",d=t==="prev",f=s==="inside"?{position:"absolute",zIndex:3,...l?{[d?"top":"bottom"]:10,left:"50%",transform:"translateX(-50%)"}:{[d?"left":"right"]:10,top:"50%",transform:"translateY(-50%)"}}:{flexShrink:0,position:"relative"};return e.jsx("button",{type:"button","aria-label":d?"Previous slide":"Next slide",disabled:r,onClick:n,style:{...f,width:36,height:36,borderRadius:"50%",border:"none",backgroundColor:"rgba(0,0,0,0.45)",backdropFilter:"blur(4px)",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",cursor:r?"not-allowed":"pointer",opacity:r?.35:1,transition:"background 150ms ease, opacity 150ms ease",outline:"none"},onFocus:u=>{u.currentTarget.style.boxShadow=`0 0 0 3px ${o}55`},onBlur:u=>{u.currentTarget.style.boxShadow="none"},onMouseEnter:u=>{r||(u.currentTarget.style.backgroundColor="rgba(0,0,0,0.65)")},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="rgba(0,0,0,0.45)"},children:l?d?e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("polyline",{points:"18 15 12 9 6 15"})}):e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}):d?e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("polyline",{points:"15 18 9 12 15 6"})}):e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})})}function jr({slides:t,autoPlay:n=!1,autoPlayInterval:r=4e3,pauseOnHover:o=!0,loop:s=!0,showArrows:a=!0,showDots:l=!0,showThumbnails:d=!1,orientation:f="horizontal",slidesToShow:u=1,gap:c=0,transitionDuration:h=400,swipeable:p=!0,initialIndex:m=0,onChange:b,arrowPosition:k="inside",height:y=320,className:g,style:S}){const j=O.useTheme(),v=J.useReducedMotion(),$=i.useId(),w=t.length,[N,I]=i.useState(m),[M,T]=i.useState(s?m+1:m),[E,C]=i.useState(!1),[H,z]=i.useState(!1),L=i.useRef(null),B=i.useRef(null),V=i.useRef(null),D=i.useRef(0),_=i.useRef(!1),R=f==="vertical",F=v?0:h,W=s&&w>1?[t[w-1],...t,t[0]]:t,K=W.length,ne=100/u,Z=(G,ue=0)=>{const ke=ue!==0?` - ${ue}px`:"";return R?`translateY(calc(-${G*ne}%${ke}))`:`translateX(calc(-${G*ne}%${ke}))`},ie=i.useCallback((G,ue=!1)=>{const ke=s?(G%w+w)%w:Math.max(0,Math.min(w-1,G)),ve=s?ke+1:ke;ue&&L.current?(L.current.style.transition="none",T(ve),I(ke),L.current.offsetHeight,L.current.style.transition=""):(C(!0),T(ve),I(ke)),b==null||b(ke)},[w,s,b]),fe=i.useCallback(()=>ie(N-1),[N,ie]),pe=i.useCallback(()=>ie(N+1),[N,ie]),te=i.useCallback(()=>{C(!1),!(!s||w<=1)&&(M===0?ie(w-1,!0):M===K-1&&ie(0,!0))},[s,w,M,K,ie]);i.useEffect(()=>{if(!(!n||H||w<=1))return B.current=setInterval(pe,r),()=>{B.current&&clearInterval(B.current)}},[n,H,r,pe,w]),i.useEffect(()=>{const G=ue=>{const ke=document.activeElement,ve=document.getElementById($);ve!=null&&ve.contains(ke)&&(ue.key===(R?"ArrowUp":"ArrowLeft")&&(ue.preventDefault(),fe()),ue.key===(R?"ArrowDown":"ArrowRight")&&(ue.preventDefault(),pe()))};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[$,R,fe,pe]);const ce=G=>"touches"in G?R?G.touches[0].clientY:G.touches[0].clientX:R?G.clientY:G.clientX,Y=G=>{p&&(V.current=ce(G),D.current=0,_.current=!0)},se=G=>{if(!_.current||V.current===null)return;const ue=ce(G)-V.current;D.current=ue,L.current&&(L.current.style.transition="none",L.current.style.transform=Z(M,-ue))},ae=()=>{if(!_.current)return;_.current=!1;const G=D.current,ue=50;L.current&&(L.current.style.transition="",L.current.style.transform=""),G<-ue?pe():G>ue?fe():L.current&&(L.current.style.transform=Z(M)),V.current=null,D.current=0},ge=typeof y=="number"?`${y}px`:y,he={display:"flex",flexDirection:R?"column":"row",width:R?"100%":`${K/u*100}%`,height:R?`${K/u*100}%`:"100%",transform:Z(M),transition:E||!v?`transform ${F}ms cubic-bezier(0.4, 0, 0.2, 1)`:"none",willChange:"transform",gap:c>0?c:void 0},ye={flexShrink:0,width:R?"100%":`${ne/(K/u)}%`,height:R?`${ne/(K/u)}%`:"100%",overflow:"hidden",position:"relative"},de=s||N>0,xe=s||N<w-1,oe=k==="outside";return e.jsxs("div",{id:$,className:x.cx(x.tkx("flex flex-col gap-2"),g),style:S,"aria-roledescription":"carousel","aria-label":"Content carousel",children:[e.jsxs("div",{className:x.tkx("flex items-center gap-2"),style:{gap:oe&&a?8:0},children:[a&&oe&&e.jsx(Tt,{direction:"prev",onClick:fe,isDisabled:!de,primaryColor:j.primary,position:"outside",orientation:f}),e.jsxs("div",{style:{position:"relative",flex:1,overflow:"hidden",height:ge,borderRadius:12,cursor:p?_.current?"grabbing":"grab":"default",userSelect:"none"},onMouseEnter:()=>o&&z(!0),onMouseLeave:()=>{z(!1),ae()},onTouchStart:Y,onTouchMove:se,onTouchEnd:ae,onMouseDown:Y,onMouseMove:se,onMouseUp:ae,"aria-live":"polite","aria-atomic":"false",children:[a&&!oe&&e.jsxs(e.Fragment,{children:[e.jsx(Tt,{direction:"prev",onClick:fe,isDisabled:!de,primaryColor:j.primary,position:"inside",orientation:f}),e.jsx(Tt,{direction:"next",onClick:pe,isDisabled:!xe,primaryColor:j.primary,position:"inside",orientation:f})]}),e.jsx("div",{ref:L,style:he,onTransitionEnd:te,children:W.map((G,ue)=>e.jsx("div",{style:ye,role:"group","aria-roledescription":"slide","aria-label":`Slide ${(ue-(s?1:0)+w)%w+1} of ${w}`,"aria-hidden":(ue-(s?1:0)+w)%w!==N,children:G.content},`${G.id}-${ue}`))}),l&&!d&&e.jsx("div",{"aria-label":"Slide indicators",style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",display:"flex",gap:6,zIndex:2},children:t.map((G,ue)=>e.jsx("button",{type:"button","aria-label":`Go to slide ${ue+1}`,"aria-current":ue===N?"true":void 0,onClick:()=>ie(ue),style:{width:ue===N?20:8,height:8,borderRadius:9999,border:"none",backgroundColor:ue===N?j.primary:"rgba(255,255,255,0.5)",cursor:"pointer",padding:0,transition:"width 250ms ease, background 250ms ease",outline:"none"},onFocus:ke=>{ke.currentTarget.style.boxShadow=`0 0 0 3px ${j.primary}66`},onBlur:ke=>{ke.currentTarget.style.boxShadow="none"}},G.id))})]}),a&&oe&&e.jsx(Tt,{direction:"next",onClick:pe,isDisabled:!xe,primaryColor:j.primary,position:"outside",orientation:f})]}),d&&e.jsx("div",{role:"tablist","aria-label":"Slide thumbnails",style:{display:"flex",gap:6,overflowX:"auto",paddingBottom:4,scrollbarWidth:"thin"},children:t.map((G,ue)=>e.jsxs("button",{type:"button",role:"tab","aria-selected":ue===N,"aria-label":`Thumbnail for slide ${ue+1}`,onClick:()=>ie(ue),style:{flexShrink:0,width:60,height:42,border:`2px solid ${ue===N?j.primary:j.border}`,borderRadius:6,overflow:"hidden",cursor:"pointer",padding:0,background:j.surfaceAlt,transition:"border-color 150ms ease",outline:"none",position:"relative"},onFocus:ke=>{ke.currentTarget.style.boxShadow=`0 0 0 3px ${j.primary}55`},onBlur:ke=>{ke.currentTarget.style.boxShadow="none"},children:[G.thumbnail?e.jsx("img",{src:G.thumbnail,alt:"","aria-hidden":"true",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):e.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.625rem",color:j.textMuted,fontWeight:600},children:ue+1}),ue===N&&e.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:`${j.primary}22`}})]},G.id))})]})}jr.displayName="TkxCarousel";function Jo({color:t}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M6 3l5 5-5 5",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ei({onClick:t,bgColor:n,hoverColor:r,textColor:o}){const s=a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())};return e.jsx("button",{type:"button",onClick:t,onKeyDown:s,"aria-label":"Show hidden breadcrumb items",className:x.tkx("inline-flex items-center justify-center rounded px-1.5 py-0.5","text-sm font-medium cursor-pointer border-none outline-none","focus-visible:ring-2 focus-visible:ring-offset-1"),style:{backgroundColor:n,color:o,transition:"background-color 150ms ease"},onMouseEnter:a=>{a.currentTarget.style.backgroundColor=r},onMouseLeave:a=>{a.currentTarget.style.backgroundColor=n},children:"…"})}function ti({items:t,separator:n,maxItems:r,onNavigate:o,className:s,style:a}){const l=O.useTheme(),d=J.useReducedMotion(),f=r!==void 0&&r>1&&t.length>r,c=i.useCallback(()=>{if(!f||!r)return t.map((N,I)=>({item:N,originalIndex:I}));const j=Math.ceil((r-1)/2),v=r-1-j,$=t.slice(0,j).map((N,I)=>({item:N,originalIndex:I})),w=t.slice(t.length-v).map((N,I)=>({item:N,originalIndex:t.length-v+I}));return $.concat(w)},[t,r,f])(),h=f&&r?Math.ceil((r-1)/2):-1,p=(j,v)=>{o==null||o(j,v)},m=(j,v,$)=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),p(v,$))},b=d?{}:{transition:"color 150ms ease, background-color 150ms ease"},k=j=>e.jsx("li",{role:"presentation","aria-hidden":"true",className:x.tkx("flex items-center mx-1.5"),children:n??e.jsx(Jo,{color:l.textMuted})},j),y=(j,v,$)=>{const w=A.sanitizeString(j.label);if($)return e.jsx("li",{children:e.jsxs("span",{"aria-current":"page",className:x.tkx("inline-flex items-center gap-1.5 text-sm font-medium"),style:{color:l.text},children:[j.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:j.icon}),w]})},`item-${v}`);const N=!!j.href,I={color:l.textMuted,textDecoration:"none",...b},M={onMouseEnter:E=>{E.currentTarget.style.color=l.primary},onMouseLeave:E=>{E.currentTarget.style.color=l.textMuted}},T=e.jsxs(e.Fragment,{children:[j.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:j.icon}),w]});return N?e.jsx("li",{children:e.jsx("a",{href:j.href,onClick:E=>{o&&(E.preventDefault(),p(j,v))},className:x.tkx("inline-flex items-center gap-1.5 text-sm rounded","outline-none focus-visible:ring-2 focus-visible:ring-offset-1"),style:{...I,focusRingColor:l.primary},...M,children:T})},`item-${v}`):e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>p(j,v),onKeyDown:E=>m(E,j,v),className:x.tkx("inline-flex items-center gap-1.5 text-sm rounded","border-none bg-transparent cursor-pointer p-0","outline-none focus-visible:ring-2 focus-visible:ring-offset-1"),style:I,...M,children:T})},`item-${v}`)},g=[];let S=!1;for(let j=0;j<c.length;j++){const{item:v,originalIndex:$}=c[j],w=$===t.length-1;f&&!S&&j===h&&(g.length>0&&g.push(k("sep-ellipsis-before")),g.push(e.jsx("li",{role:"presentation",children:e.jsx(ei,{onClick:()=>{},bgColor:l.surfaceAlt,hoverColor:l.surface,textColor:l.textMuted})},"ellipsis")),S=!0),g.length>0&&g[g.length-1]!==null&&g.push(k(`sep-${$}`)),g.push(y(v,$,w))}return e.jsx("nav",{"aria-label":"Breadcrumb",className:x.tkx("font-sans",s??""),style:{...a},children:e.jsx("ol",{role:"list",className:x.tkx("flex items-center flex-wrap list-none m-0 p-0"),children:g})})}const He=8,it=8;function ni(t,n,r){const o=n.getBoundingClientRect(),s=window.scrollX,a=window.scrollY,l=window.innerWidth,d=window.innerHeight;let f=0,u=0,c=r;const h={top:t.top-o.height-it-He>0,bottom:t.bottom+o.height+it+He<d,left:t.left-o.width-it-He>0,right:t.right+o.width+it+He<l};if(!h[r]){const m={top:"bottom",bottom:"top",left:"right",right:"left"};h[m[r]]&&(c=m[r])}switch(c){case"top":f=t.top+a-o.height-it-He,u=t.left+s+t.width/2-o.width/2;break;case"bottom":f=t.bottom+a+it+He,u=t.left+s+t.width/2-o.width/2;break;case"left":f=t.top+a+t.height/2-o.height/2,u=t.left+s-o.width-it-He;break;case"right":f=t.top+a+t.height/2-o.height/2,u=t.right+s+it+He;break}u=Math.max(8,Math.min(u,l+s-o.width-8)),f=Math.max(8,Math.min(f,d+a-o.height-8));const p={position:"absolute",width:0,height:0,borderStyle:"solid",borderWidth:He};switch(c){case"top":Object.assign(p,{bottom:-He*2,left:"50%",transform:"translateX(-50%)",borderColor:"var(--tkx-popover-bg) transparent transparent transparent"});break;case"bottom":Object.assign(p,{top:-He*2,left:"50%",transform:"translateX(-50%)",borderColor:"transparent transparent var(--tkx-popover-bg) transparent"});break;case"left":Object.assign(p,{right:-He*2,top:"50%",transform:"translateY(-50%)",borderColor:"transparent transparent transparent var(--tkx-popover-bg)"});break;case"right":Object.assign(p,{left:-He*2,top:"50%",transform:"translateY(-50%)",borderColor:"transparent var(--tkx-popover-bg) transparent transparent"});break}return{top:f,left:u,arrowStyle:p,resolvedPlacement:c}}function ri({trigger:t,content:n,placement:r="bottom",isOpen:o,onOpenChange:s,closeOnClickOutside:a=!0,className:l,style:d}){const f=O.useTheme(),u=J.useReducedMotion(),c=i.useId(),h=o!==void 0,[p,m]=i.useState(!1),b=h?o:p,k=i.useRef(null),y=i.useRef(null);i.useRef(null);const[g,S]=i.useState(null),j=i.useCallback(I=>{h||m(I),s==null||s(I)},[h,s]),v=i.useCallback(()=>j(!1),[j]),$=i.useCallback(()=>j(!b),[j,b]);J.useEscapeKey(v,b),i.useEffect(()=>{if(!b||!a)return;const I=M=>{var E,C;const T=M.target;(E=k.current)!=null&&E.contains(T)||(C=y.current)!=null&&C.contains(T)||v()};return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[b,a,v]),i.useEffect(()=>{if(!b||!k.current)return;const I=()=>{if(!k.current||!y.current)return;const M=k.current.getBoundingClientRect();S(ni(M,y.current,r))};return requestAnimationFrame(I),window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[b,r]);const w=u?{opacity:1}:{animation:"tkxPopoverFadeIn 150ms ease forwards",opacity:0},N=b&&typeof document<"u"?Re.createPortal(e.jsxs("div",{ref:y,id:c,role:"dialog","aria-modal":"false",className:x.tkx("absolute z-[9100] rounded-lg font-sans",l??""),style:{"--tkx-popover-bg":f.surface,top:(g==null?void 0:g.top)??-9999,left:(g==null?void 0:g.left)??-9999,backgroundColor:f.surface,border:`1px solid ${f.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)",minWidth:200,maxWidth:420,padding:"12px 16px",color:f.text,...w,...d},children:[g&&e.jsx("span",{style:g.arrowStyle,"aria-hidden":"true"}),n]}),document.body):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:k,className:x.tkx("inline-flex"),onClick:$,onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),$())},"aria-expanded":b,"aria-haspopup":"dialog","aria-controls":b?c:void 0,children:t}),N,b&&!u&&e.jsx("style",{children:`
67
+ `}),(0,s.jsx)(`div`,{style:{width:i,height:i,minWidth:i,borderRadius:`50%`,border:`${w}px solid ${S}`,backgroundColor:x,color:C,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,transition:h?`none`:`background-color 0.2s, border-color 0.2s`,...T,...E},children:D})]})}function Cn({completed:e,orientation:t,connectorStyle:n,connectorWidth:r,primary:i,border:a,reducedMotion:o}){let c=e?i:a;return t===`horizontal`?(0,s.jsx)(`div`,{"aria-hidden":`true`,style:{flex:1,height:r,background:n===`solid`?c:`none`,backgroundImage:n===`solid`?`none`:`repeating-linear-gradient(90deg, ${c} 0, ${c} 6px, transparent 6px, transparent ${n===`dashed`?12:9}px)`,borderRadius:1,transition:o?`none`:`background 0.3s ease`,alignSelf:`center`,marginLeft:4,marginRight:4}}):(0,s.jsx)(`div`,{"aria-hidden":`true`,style:{width:r,flex:1,minHeight:20,background:n===`solid`?c:`none`,backgroundImage:n===`solid`?`none`:`repeating-linear-gradient(180deg, ${c} 0, ${c} 6px, transparent 6px, transparent ${n===`dashed`?12:9}px)`,borderRadius:1,transition:o?`none`:`background 0.3s ease`,alignSelf:`stretch`,marginTop:4,marginBottom:4,marginLeft:`auto`,marginRight:`auto`}})}function wn({steps:e,activeStep:i=0,orientation:a=`horizontal`,variant:o=`default`,size:c=`md`,clickable:l=!1,onStepClick:u,showStepNumbers:d=!0,alternateLabel:f=!1,connector:p=`solid`,className:m,style:h}){let g=t.f(),_=r.o(),v=yn[c],y=(e,t)=>e.status?e.status:t<i?`completed`:t===i?`active`:`pending`,b=a===`horizontal`;return(0,s.jsx)(`div`,{className:m,role:`list`,"aria-label":`Steps`,style:{display:`flex`,flexDirection:b?`row`:`column`,alignItems:b?f?`flex-start`:`center`:`stretch`,width:`100%`,gap:0,...h},children:e.map((t,r)=>{let a=y(t,r),c=r===e.length-1,m=a===`completed`||r<i,h=r%2==0,x=()=>{l&&u?.(r)},S=(0,s.jsx)(Sn,{status:a,index:r,showStepNumbers:d,icon:t.icon,circleSize:v.circle,fontSize:v.fontSize,primary:g.primary,danger:g.danger,success:g.success,text:g.text,textMuted:g.textMuted,border:g.border,surface:g.surface,variant:o,reducedMotion:_,clickable:l}),C=(0,s.jsxs)(`div`,{style:{textAlign:b&&!f?`center`:`left`,maxWidth:b?120:void 0},children:[(0,s.jsxs)(`div`,{style:{fontSize:v.titleSize,fontWeight:a===`active`?600:500,color:a===`pending`?g.textMuted:a===`error`?g.danger:g.text,lineHeight:1.3,transition:_?`none`:`color 0.2s`},children:[n.m(t.title),t.optional&&(0,s.jsx)(`span`,{style:{fontSize:v.descSize,color:g.textMuted,fontWeight:400,marginLeft:4},children:`(optional)`})]}),t.description&&(0,s.jsx)(`div`,{style:{fontSize:v.descSize,color:g.textMuted,marginTop:2,lineHeight:1.4},children:n.m(t.description)}),t.error&&a===`error`&&(0,s.jsx)(`div`,{style:{fontSize:v.descSize,color:g.danger,marginTop:2},children:n.m(t.error)})]});return b?(0,s.jsxs)(`div`,{role:`listitem`,style:{display:`flex`,flex:+!c,alignItems:`center`,minWidth:0},children:[(0,s.jsxs)(`div`,{onClick:x,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:6,cursor:l?`pointer`:`default`,flexShrink:0},"aria-current":a===`active`?`step`:void 0,children:[f&&!h&&(0,s.jsx)(`div`,{style:{minHeight:v.circle*1.5+6,display:`flex`,alignItems:`flex-end`,paddingBottom:6},children:C}),S,!f&&C,f&&h&&(0,s.jsx)(`div`,{style:{marginTop:6},children:C})]}),!c&&(0,s.jsx)(Cn,{completed:m,orientation:`horizontal`,connectorStyle:p,connectorWidth:v.connectorWidth,primary:g.primary,border:g.border,reducedMotion:_})]},t.id):(0,s.jsxs)(`div`,{role:`listitem`,style:{display:`flex`,flexDirection:`row`,minHeight:0},children:[(0,s.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,marginRight:14,flexShrink:0},children:[(0,s.jsx)(`div`,{onClick:x,style:{cursor:l?`pointer`:`default`},"aria-current":a===`active`?`step`:void 0,children:S}),!c&&(0,s.jsx)(Cn,{completed:m,orientation:`vertical`,connectorStyle:p,connectorWidth:v.connectorWidth,primary:g.primary,border:g.border,reducedMotion:_})]}),(0,s.jsx)(`div`,{style:{paddingTop:(v.circle-parseFloat(v.titleSize)*16)/2,paddingBottom:c?0:16,flex:1,minWidth:0},children:C})]},t.id)})})}wn.displayName=`TkxStepper`;function Tn(e){let t=0,n=0,r=0,i=e.replace(`#`,``);i.length===3?(t=parseInt(i[0]+i[0],16),n=parseInt(i[1]+i[1],16),r=parseInt(i[2]+i[2],16)):i.length>=6&&(t=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),r=parseInt(i.slice(4,6),16)),t/=255,n/=255,r/=255;let a=Math.max(t,n,r),o=Math.min(t,n,r),s=0,c=0,l=(a+o)/2;if(a!==o){let e=a-o;switch(c=l>.5?e/(2-a-o):e/(a+o),a){case t:s=((n-r)/e+(n<r?6:0))/6;break;case n:s=((r-t)/e+2)/6;break;case r:s=((t-n)/e+4)/6;break}}return[Math.round(s*360),Math.round(c*100),Math.round(l*100)]}function En(e,t,n){t/=100,n/=100;let r=t*Math.min(n,1-n),i=t=>{let i=(t+e/30)%12,a=n-r*Math.max(Math.min(i-3,9-i,1),-1);return Math.round(255*a).toString(16).padStart(2,`0`)};return`#${i(0)}${i(8)}${i(4)}`}function Dn(e){let t=e.replace(`#`,``),n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);return[isNaN(n)?0:n,isNaN(r)?0:r,isNaN(i)?0:i]}function On(e,t,n){return`#${e.toString(16).padStart(2,`0`)}${t.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}`}function kn(e){return/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e)}function An(e,t,n){if(n===`hex`)return t<1?`${e}${Math.round(t*255).toString(16).padStart(2,`0`)}`:e;let[r,i,a]=Dn(e);if(n===`rgb`)return t<1?`rgba(${r}, ${i}, ${a}, ${t.toFixed(2)})`:`rgb(${r}, ${i}, ${a})`;let[o,s,c]=Tn(e);return n===`hsl`?t<1?`hsla(${o}, ${s}%, ${c}%, ${t.toFixed(2)})`:`hsl(${o}, ${s}%, ${c}%)`:e}var jn=[`#ef4444`,`#f97316`,`#eab308`,`#22c55e`,`#06b6d4`,`#3b82f6`,`#8b5cf6`,`#ec4899`,`#ffffff`,`#94a3b8`,`#475569`,`#0f172a`];function Mn({hue:e,sat:t,bright:n,onChange:r}){let i=(0,o.useRef)(null),a=(0,o.useRef)(!1),c=(0,o.useCallback)(e=>{let t=i.current;if(!t)return;let n=t.getBoundingClientRect(),a=Math.max(0,Math.min(1,(e.clientX-n.left)/n.width)),o=Math.max(0,Math.min(1,(e.clientY-n.top)/n.height));r(Math.round(a*100),Math.round((1-o)*100))},[r]);(0,o.useEffect)(()=>{let e=e=>{a.current&&c(e)},t=()=>{a.current=!1};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[c]);let l=`${t}%`,u=`${100-n}%`;return(0,s.jsxs)(`div`,{ref:i,style:{position:`relative`,width:`100%`,height:`160px`,borderRadius:`6px`,cursor:`crosshair`,background:`hsl(${e}, 100%, 50%)`,flexShrink:0},onMouseDown:e=>{a.current=!0,c(e)},children:[(0,s.jsx)(`div`,{style:{position:`absolute`,inset:0,borderRadius:`6px`,background:`linear-gradient(to right, #ffffff, transparent)`}}),(0,s.jsx)(`div`,{style:{position:`absolute`,inset:0,borderRadius:`6px`,background:`linear-gradient(to bottom, transparent, #000000)`}}),(0,s.jsx)(`div`,{style:{position:`absolute`,left:l,top:u,transform:`translate(-50%, -50%)`,width:`14px`,height:`14px`,borderRadius:`50%`,border:`2px solid white`,boxShadow:`0 0 0 1px rgba(0,0,0,0.4)`,pointerEvents:`none`,backgroundColor:En(e,t,n/2+25)}})]})}function Nn({hue:e,onChange:t}){let n=(0,o.useRef)(null),r=(0,o.useRef)(!1),i=(0,o.useCallback)(e=>{let r=n.current;if(!r)return;let i=r.getBoundingClientRect(),a=Math.max(0,Math.min(1,(e.clientX-i.left)/i.width));t(Math.round(a*360))},[t]);return(0,o.useEffect)(()=>{let e=e=>{r.current&&i(e)},t=()=>{r.current=!1};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[i]),(0,s.jsx)(`div`,{ref:n,style:{position:`relative`,height:`12px`,borderRadius:`6px`,cursor:`pointer`,background:`linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)`},onMouseDown:e=>{r.current=!0,i(e)},children:(0,s.jsx)(`div`,{style:{position:`absolute`,left:`${e/360*100}%`,top:`50%`,transform:`translate(-50%, -50%)`,width:`16px`,height:`16px`,borderRadius:`50%`,border:`2px solid white`,boxShadow:`0 0 0 1px rgba(0,0,0,0.3)`,backgroundColor:`hsl(${e}, 100%, 50%)`,pointerEvents:`none`}})})}function Pn({alpha:e,hex:t,onChange:n}){let r=(0,o.useRef)(null),i=(0,o.useRef)(!1),a=(0,o.useCallback)(e=>{let t=r.current;if(!t)return;let i=t.getBoundingClientRect(),a=Math.max(0,Math.min(1,(e.clientX-i.left)/i.width));n(Math.round(a*100)/100)},[n]);(0,o.useEffect)(()=>{let e=e=>{i.current&&a(e)},t=()=>{i.current=!1};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[a]);let[c,l,u]=Dn(t);return(0,s.jsxs)(`div`,{style:{position:`relative`},children:[(0,s.jsx)(`div`,{style:{position:`absolute`,inset:0,borderRadius:`6px`,backgroundImage:`repeating-conic-gradient(#ccc 0% 25%, white 0% 50%)`,backgroundSize:`8px 8px`}}),(0,s.jsx)(`div`,{ref:r,style:{position:`relative`,height:`12px`,borderRadius:`6px`,cursor:`pointer`,background:`linear-gradient(to right, rgba(${c},${l},${u},0), rgba(${c},${l},${u},1))`},onMouseDown:e=>{i.current=!0,a(e)},children:(0,s.jsx)(`div`,{style:{position:`absolute`,left:`${e*100}%`,top:`50%`,transform:`translate(-50%, -50%)`,width:`16px`,height:`16px`,borderRadius:`50%`,border:`2px solid white`,boxShadow:`0 0 0 1px rgba(0,0,0,0.3)`,backgroundColor:`rgba(${c},${l},${u},${e})`,pointerEvents:`none`}})})]})}function Fn({value:e,defaultValue:n=`#3b82f6`,onChange:r,format:i=`hex`,showAlpha:a=!1,presets:l=jn,disabled:u=!1,size:d=`md`,placeholder:f,label:p,style:m}){let h=t.f(),g=(0,o.useRef)(null),_=(0,o.useRef)(null),[v,y]=(0,o.useState)(!1),b=e!==void 0,[x,S]=(0,o.useState)(b&&e||n),C=b?e||n:x,[w,T]=(0,o.useState)(1),[E,D]=(0,o.useState)(C),[O,k]=(0,o.useState)({top:0,left:0}),[A,j,M]=Tn(kn(C)?C:n);Math.round(M+j/100*Math.min(M/100,1-M/100)*100);let N=(0,o.useCallback)((e,t=w)=>{kn(e)&&(D(e),b||S(e),r?.(An(e,t,i),i))},[w,b,i,r]);(0,o.useEffect)(()=>{b&&e&&kn(e)&&D(e)},[b,e]);let P=()=>{if(u)return;let e=g.current;if(!e)return;let t=e.getBoundingClientRect();k({top:(window.innerHeight-t.bottom>320?t.bottom+6:t.top-326)+window.scrollY,left:t.left+window.scrollX}),y(!0)};(0,o.useEffect)(()=>{if(!v)return;let e=e=>{_.current&&!_.current.contains(e.target)&&g.current&&!g.current.contains(e.target)&&y(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[v]),(0,o.useEffect)(()=>{if(!v)return;let e=e=>{e.key===`Escape`&&y(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[v]);let F=(e,t)=>{let n=t/100,r=n*(1-e/100/2),i=r===0||r===1?0:(n-r)/Math.min(r,1-r);N(En(A,Math.round(i*100),Math.round(r*100)))},I=e=>{N(En(e,j,M))},L=e=>{T(e),r?.(An(C,e,i),i)},R=e=>{let t=e.target.value;D(t),kn(t)&&N(t)},z=(e,t)=>{let n=Math.max(0,Math.min(255,parseInt(t)||0)),[r,i,a]=Dn(C);N(e===`r`?On(n,i,a):e===`g`?On(r,n,a):On(r,i,n))},B={sm:28,md:34,lg:40}[d],[V,H,U]=Dn(kn(C)?C:n),W={display:`inline-flex`,alignItems:`center`,gap:`8px`,height:`${B}px`,padding:`4px 10px 4px 6px`,borderRadius:`8px`,border:`1px solid ${h.border}`,backgroundColor:h.surface,cursor:u?`not-allowed`:`pointer`,opacity:u?.5:1,color:h.text,fontSize:`13px`,fontFamily:`inherit`,transition:`border-color 0.15s`,...m},ee={width:`${B-8}px`,height:`${B-8}px`,borderRadius:`4px`,backgroundColor:`rgba(${V},${H},${U},${w})`,border:`1px solid ${h.border}`,flexShrink:0},te={position:`absolute`,top:O.top,left:O.left,zIndex:9999,width:`260px`,backgroundColor:h.surface,border:`1px solid ${h.border}`,borderRadius:`12px`,padding:`16px`,boxShadow:`0 8px 32px rgba(0,0,0,0.24)`,display:`flex`,flexDirection:`column`,gap:`12px`},G={width:`100%`,padding:`6px 10px`,borderRadius:`6px`,border:`1px solid ${h.border}`,backgroundColor:h.bg,color:h.text,fontSize:`12px`,fontFamily:`monospace`,outline:`none`},K={flex:1,padding:`5px 6px`,borderRadius:`6px`,border:`1px solid ${h.border}`,backgroundColor:h.bg,color:h.text,fontSize:`11px`,textAlign:`center`,fontFamily:`monospace`,outline:`none`},ne=e=>({width:`20px`,height:`20px`,borderRadius:`50%`,backgroundColor:e,border:e.toLowerCase()===C.toLowerCase()?`2px solid ${h.primary}`:`1px solid ${h.border}`,cursor:`pointer`,flexShrink:0,transition:`transform 0.1s`});return(0,s.jsxs)(s.Fragment,{children:[p&&(0,s.jsx)(`label`,{style:{display:`block`,fontSize:`13px`,color:h.text,marginBottom:`6px`,fontWeight:500},children:p}),(0,s.jsxs)(`button`,{ref:g,type:`button`,style:W,onClick:P,disabled:u,"aria-label":`Color picker, current color ${C}`,"aria-haspopup":`dialog`,"aria-expanded":v,children:[(0,s.jsx)(`div`,{style:ee}),(0,s.jsx)(`span`,{style:{fontFamily:`monospace`,fontSize:`12px`,color:h.textMuted},children:f??An(kn(C)?C:n,w,i)})]}),v&&(0,c.createPortal)((0,s.jsxs)(`div`,{ref:_,style:te,role:`dialog`,"aria-label":`Color picker`,children:[(0,s.jsx)(Mn,{hue:A,sat:j,bright:M,onChange:F}),(0,s.jsx)(Nn,{hue:A,onChange:I}),a&&(0,s.jsx)(Pn,{alpha:w,hex:kn(C)?C:n,onChange:L}),(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,s.jsx)(`div`,{style:{width:`28px`,height:`28px`,borderRadius:`6px`,flexShrink:0,backgroundColor:`rgba(${V},${H},${U},${w})`,border:`1px solid ${h.border}`}}),(0,s.jsx)(`input`,{style:G,value:E,onChange:R,maxLength:7,spellCheck:!1,"aria-label":`Hex color value`})]}),(0,s.jsxs)(`div`,{style:{display:`flex`,gap:`6px`,alignItems:`center`},children:[[`r`,`g`,`b`].map(e=>(0,s.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:`3px`,alignItems:`center`},children:[(0,s.jsx)(`input`,{style:K,type:`number`,min:0,max:255,value:e===`r`?V:e===`g`?H:U,onChange:t=>z(e,t.target.value),"aria-label":`${e.toUpperCase()} channel`}),(0,s.jsx)(`span`,{style:{fontSize:`10px`,color:h.textMuted,textTransform:`uppercase`},children:e})]},e)),a&&(0,s.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:`3px`,alignItems:`center`},children:[(0,s.jsx)(`input`,{style:K,type:`number`,min:0,max:100,value:Math.round(w*100),onChange:e=>L(Math.max(0,Math.min(1,parseInt(e.target.value)/100||0))),"aria-label":`Alpha channel`}),(0,s.jsx)(`span`,{style:{fontSize:`10px`,color:h.textMuted},children:`A%`})]})]}),l.length>0&&(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`div`,{style:{fontSize:`11px`,color:h.textMuted,marginBottom:`6px`,fontWeight:500},children:`Presets`}),(0,s.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:`6px`},children:l.map(e=>(0,s.jsx)(`button`,{type:`button`,style:ne(e),onClick:()=>N(e),"aria-label":`Select color ${e}`,onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.15)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`}},e))})]})]}),document.body)]})}var In={sm:{height:`32px`,fontSize:`0.8125rem`,px:`8px`,btnW:`28px`,iconSz:14},md:{height:`40px`,fontSize:`0.875rem`,px:`12px`,btnW:`34px`,iconSz:16},lg:{height:`48px`,fontSize:`1rem`,px:`14px`,btnW:`40px`,iconSz:18}};function Ln(e,t,n){let r=e;return t!==void 0&&(r=Math.max(r,t)),n!==void 0&&(r=Math.min(r,n)),r}function Rn(e,t){if(t===void 0)return e;let n=10**t;return Math.round(e*n)/n}function zn(e,t,n,r,i){let a=r??`en-US`;return t===`currency`?new Intl.NumberFormat(a,{style:`currency`,currency:n??`USD`,minimumFractionDigits:i??2,maximumFractionDigits:i??2}).format(e):t===`percent`?new Intl.NumberFormat(a,{style:`percent`,minimumFractionDigits:i??0,maximumFractionDigits:i??0}).format(e/100):t===`decimal`||i!==void 0?new Intl.NumberFormat(a,{minimumFractionDigits:i??0,maximumFractionDigits:i??20}).format(e):String(e)}function Bn({direction:e,isDisabled:t,btnW:n,height:r,primaryColor:i,borderColor:a,textMuted:c,iconSz:l,onStep:u}){let d=(0,o.useRef)(null),f=(0,o.useRef)(null),p=e===`inc`?1:-1,m=(0,o.useCallback)(()=>{u(p),d.current=setTimeout(()=>{f.current=setInterval(()=>u(p),60)},400)},[p,u]),h=(0,o.useCallback)(()=>{d.current&&=(clearTimeout(d.current),null),f.current&&=(clearInterval(f.current),null)},[]);(0,o.useEffect)(()=>()=>h(),[h]);let g=e===`inc`;return(0,s.jsx)(`button`,{type:`button`,"aria-label":g?`Increment`:`Decrement`,disabled:t,onMouseDown:m,onMouseUp:h,onMouseLeave:h,onTouchStart:e=>{e.preventDefault(),m()},onTouchEnd:h,style:{width:n,height:r,minWidth:n,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`transparent`,border:`none`,borderRight:g?void 0:`1px solid ${a}`,borderLeft:g?`1px solid ${a}`:void 0,cursor:t?`not-allowed`:`pointer`,color:t?c:i,transition:`color 120ms ease, background 120ms ease`,outline:`none`},onFocus:e=>{t||(e.currentTarget.style.background=`${i}12`)},onBlur:e=>{e.currentTarget.style.background=`transparent`},children:g?(0,s.jsxs)(`svg`,{width:l,height:l,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.5,"aria-hidden":`true`,children:[(0,s.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,s.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}):(0,s.jsx)(`svg`,{width:l,height:l,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.5,"aria-hidden":`true`,children:(0,s.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})})})}function Vn({value:e,defaultValue:r=0,onChange:i,min:a,max:c,step:l=1,precision:u,prefix:d,suffix:f,format:p,currency:m,locale:h,clampOnBlur:g=!0,allowMouseWheel:_=!1,size:v=`md`,label:y,hint:b,isDisabled:x=!1,isReadOnly:S=!1,isInvalid:C=!1,errorMessage:w,id:T,className:E,style:D}){let O=t.f(),k=(0,o.useId)(),A=T??k,j=`${A}-hint`,M=`${A}-error`,N=e!==void 0,[P,F]=(0,o.useState)(r),I=N?e:P,[L,R]=(0,o.useState)(!1),[z,B]=(0,o.useState)(``),V=In[v],H=C||!!w,U=H?O.danger:L?O.primary:O.border,W=[b&&j,H&&M].filter(Boolean).join(` `)||void 0,ee=y?n.m(y):void 0,te=b?n.m(b):void 0,G=w?n.m(w):void 0,K=d?n.m(d):void 0,ne=f?n.m(f):void 0,q=(0,o.useCallback)(e=>{let t=Rn(e,u);N||F(t),i?.(t)},[N,i,u]),J=(0,o.useCallback)(e=>{x||S||q(Ln(Rn(I+e*l,u),a,c))},[x,S,I,l,u,a,c,q]),Y=()=>{R(!0),B(String(I))},re=()=>{R(!1);let e=parseFloat(z);if(isNaN(e)){i?.(null),B(String(I));return}let t=Rn(e,u);g&&(t=Ln(t,a,c)),q(t)},ie=e=>{B(e.target.value)},ae=e=>{e.key===`ArrowUp`&&(e.preventDefault(),J(1)),e.key===`ArrowDown`&&(e.preventDefault(),J(-1))},oe=e=>{!_||!L||(e.preventDefault(),J(e.deltaY<0?1:-1))},X=L?z:zn(I,p,m,h,u),Z=(K||ne)&&!L;return(0,s.jsxs)(`div`,{className:n.t(n.a(`flex flex-col gap-1 w-full`),E),style:D,children:[ee&&(0,s.jsx)(`label`,{htmlFor:A,className:n.a(`text-sm font-medium font-sans`),style:{color:O.text},children:ee}),(0,s.jsxs)(`div`,{className:n.a(`flex items-stretch overflow-hidden rounded-lg transition-colors duration-150`),style:{border:`1.5px solid ${U}`,backgroundColor:x?O.surfaceAlt:O.surface,opacity:x?.65:1,height:V.height},children:[(0,s.jsx)(Bn,{direction:`dec`,isDisabled:x||S,btnW:V.btnW,height:V.height,primaryColor:O.primary,borderColor:O.border,textMuted:O.textMuted,iconSz:V.iconSz,onStep:J}),(0,s.jsxs)(`div`,{className:n.a(`relative flex-1 flex items-center overflow-hidden`),children:[Z&&K&&(0,s.jsx)(`span`,{style:{position:`absolute`,left:V.px,fontSize:V.fontSize,color:O.textMuted,pointerEvents:`none`,userSelect:`none`},children:K}),(0,s.jsx)(`input`,{id:A,type:`text`,inputMode:`decimal`,value:L?z:X,readOnly:S,disabled:x,"aria-invalid":H,"aria-describedby":W,"aria-valuemin":a,"aria-valuemax":c,"aria-valuenow":I,style:{width:`100%`,height:`100%`,border:`none`,background:`transparent`,outline:`none`,textAlign:`center`,fontSize:V.fontSize,fontFamily:`inherit`,color:O.text,paddingLeft:Z&&K?`calc(${V.px} + 1.2em)`:V.px,paddingRight:Z&&ne?`calc(${V.px} + 1.2em)`:V.px,cursor:x?`not-allowed`:S?`default`:`text`},onFocus:Y,onBlur:re,onChange:ie,onKeyDown:ae,onWheel:oe}),Z&&ne&&(0,s.jsx)(`span`,{style:{position:`absolute`,right:V.px,fontSize:V.fontSize,color:O.textMuted,pointerEvents:`none`,userSelect:`none`},children:ne})]}),(0,s.jsx)(Bn,{direction:`inc`,isDisabled:x||S,btnW:V.btnW,height:V.height,primaryColor:O.primary,borderColor:O.border,textMuted:O.textMuted,iconSz:V.iconSz,onStep:J})]}),te&&!G&&(0,s.jsx)(`span`,{id:j,className:n.a(`text-xs`),style:{color:O.textMuted},children:te}),G&&(0,s.jsxs)(`span`,{id:M,role:`alert`,className:n.a(`text-xs flex items-center gap-1`),style:{color:O.danger},children:[(0,s.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z`})}),G]})]})}Vn.displayName=`TkxNumberInput`;var Hn={sm:{box:`36px`,fontSize:`1rem`,gap:`6px`},md:{box:`44px`,fontSize:`1.25rem`,gap:`8px`},lg:{box:`52px`,fontSize:`1.5rem`,gap:`10px`}},Un={number:/^\d$/,alphanumeric:/^[a-zA-Z0-9]$/,alpha:/^[a-zA-Z]$/};function Wn(e,t){return Un[t].test(e)?e.toUpperCase():``}function Gn({length:e=6,value:r,onChange:i,onComplete:a,type:c=`number`,mask:l=!1,autoFocus:u=!1,isDisabled:d=!1,isInvalid:f=!1,errorMessage:p,hint:m,size:h=`md`,separator:g,separatorPosition:_,className:v,style:y}){let b=t.f(),x=(0,o.useId)(),S=`${x}-hint`,C=`${x}-error`,w=r!==void 0,T=t=>{let n=t.split(``).slice(0,e);for(;n.length<e;)n.push(``);return n},[E,D]=(0,o.useState)(()=>T(w?r:``)),O=w?T(r):E,k=(0,o.useRef)([]),A=Hn[h],j=f||!!p,M=O.every(e=>e!==``),N=m?n.m(m):void 0,P=p?n.m(p):void 0,F=e=>j?b.danger:M?b.success:b.border;(0,o.useEffect)(()=>{u&&k.current[0]?.focus()},[]);let I=(0,o.useCallback)(e=>{w||D(e);let t=e.join(``);i?.(t),e.every(e=>e!==``)&&a?.(t)},[w,i,a]),L=t=>{let n=Math.max(0,Math.min(e-1,t));k.current[n]?.focus()},R=t=>n=>{if(!d){if(n.key===`Backspace`){if(n.preventDefault(),O[t]!==``){let e=[...O];e[t]=``,I(e)}else if(t>0){let e=[...O];e[t-1]=``,I(e),L(t-1)}return}if(n.key===`Delete`){n.preventDefault();let e=[...O];e[t]=``,I(e);return}if(n.key===`ArrowLeft`){n.preventDefault(),L(t-1);return}if(n.key===`ArrowRight`){n.preventDefault(),L(t+1);return}if(n.key===`Home`){n.preventDefault(),L(0);return}if(n.key===`End`){n.preventDefault(),L(e-1);return}}},z=t=>n=>{if(d)return;let r=n.target.value.slice(-1);if(!r)return;let i=Wn(r,c);if(!i)return;let a=[...O];a[t]=i,I(a),t<e-1&&L(t+1)},B=t=>n=>{if(n.preventDefault(),d)return;let r=n.clipboardData.getData(`text`).split(``).map(e=>Wn(e,c)).filter(Boolean);if(!r.length)return;let i=[...O],a=t;for(let t of r){if(a>=e)break;i[a]=t,a++}I(i),L(Math.min(a,e-1))},V=[N&&S,j&&C].filter(Boolean).join(` `)||void 0;return(0,s.jsxs)(`div`,{className:n.t(n.a(`flex flex-col gap-2 w-fit`),v),style:y,children:[(0,s.jsx)(`div`,{role:`group`,"aria-label":`One-time password`,"aria-describedby":V,className:n.a(`flex items-center`),style:{gap:A.gap},children:Array.from({length:e},(t,r)=>{let i=F(r);return typeof document<`u`&&(document.activeElement,k.current[r]),(0,s.jsxs)(`div`,{className:n.a(`flex items-center`),style:{gap:A.gap},children:[g&&_===r&&r!==0&&(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{color:b.textMuted,userSelect:`none`,flexShrink:0},children:g}),(0,s.jsx)(`input`,{ref:e=>{k.current[r]=e},type:l?`password`:`text`,inputMode:c===`number`?`numeric`:`text`,maxLength:1,value:O[r],disabled:d,"aria-label":`Digit ${r+1} of ${e}`,autoComplete:`one-time-code`,spellCheck:!1,onChange:z(r),onKeyDown:R(r),onPaste:B(r),onFocus:e=>e.target.select(),style:{width:A.box,height:A.box,textAlign:`center`,fontSize:A.fontSize,fontFamily:`monospace`,fontWeight:600,border:`1.5px solid ${i}`,borderRadius:`8px`,backgroundColor:d?b.surfaceAlt:b.surface,color:b.text,outline:`none`,boxShadow:`none`,cursor:d?`not-allowed`:`text`,transition:`border-color 150ms ease, box-shadow 150ms ease`,opacity:d?.6:1},onFocusCapture:e=>{d||(e.currentTarget.style.borderColor=j?b.danger:b.primary,e.currentTarget.style.boxShadow=`0 0 0 3px ${j?b.danger:b.primary}33`)},onBlurCapture:e=>{e.currentTarget.style.borderColor=F(r),e.currentTarget.style.boxShadow=`none`}})]},r)})}),N&&!P&&(0,s.jsx)(`span`,{id:S,className:n.a(`text-xs`),style:{color:b.textMuted},children:N}),P&&(0,s.jsxs)(`span`,{id:C,role:`alert`,className:n.a(`text-xs flex items-center gap-1`),style:{color:b.danger},children:[(0,s.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z`})}),P]})]})}Gn.displayName=`TkxOTP`;function Kn(e,t){(0,o.useEffect)(()=>{if(!t)return;let n=t=>{t.key===`Escape`&&e()};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t])}function qn(e){let t=(0,o.useRef)(null);return(0,o.useEffect)(()=>{if(!e||!t.current)return;let n=t.current,r=n.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`),i=r[0],a=r[r.length-1],o=e=>{e.key===`Tab`&&(e.shiftKey?document.activeElement===i&&(e.preventDefault(),a?.focus()):document.activeElement===a&&(e.preventDefault(),i?.focus()))};return n.addEventListener(`keydown`,o),()=>n.removeEventListener(`keydown`,o)},[e]),t}function Jn(){let[e,t]=(0,o.useState)(!1);return{isOpen:e,open:(0,o.useCallback)(()=>t(!0),[]),close:(0,o.useCallback)(()=>t(!1),[]),toggle:(0,o.useCallback)(()=>t(e=>!e),[])}}function Yn(e,t){if(!e)return{matched:!0,ranges:[],score:0};let n=e.toLowerCase(),r=t.toLowerCase(),i=r.indexOf(n);if(i!==-1)return{matched:!0,ranges:[[i,i+n.length-1]],score:i===0?100:80};let a=[],o=0,s=-1,c=-1;for(let e=0;e<r.length&&o<n.length;e++)r[e]===n[o]&&((c===-1||e!==c+1)&&(s!==-1&&a.push([s,c]),s=e),c=e,o++);return s!==-1&&c!==-1&&a.push([s,c]),o<n.length?{matched:!1,ranges:[],score:0}:{matched:!0,ranges:a,score:40}}function Xn(e,t){if(!e.trim())return t.filter(e=>!e.disabled).map(e=>({item:e,score:0,labelRanges:[]}));let n=[];for(let r of t){if(r.disabled)continue;let t=Yn(e,r.label),i=r.description?Yn(e,r.description):{matched:!1,score:0},a=(r.keywords??[]).some(t=>Yn(e,t).matched);t.matched?n.push({item:r,score:t.score+20,labelRanges:t.ranges}):i.matched?n.push({item:r,score:i.score,labelRanges:[]}):a&&n.push({item:r,score:20,labelRanges:[]})}return n.sort((e,t)=>t.score-e.score)}function Zn({text:e,ranges:t,color:n}){if(!t.length)return(0,s.jsx)(s.Fragment,{children:e});let r=[],i=0;for(let[a,o]of t)i<a&&r.push((0,s.jsx)(`span`,{children:e.slice(i,a)},`t-${i}`)),r.push((0,s.jsx)(`span`,{style:{color:n,fontWeight:700},children:e.slice(a,o+1)},`h-${a}`)),i=o+1;return i<e.length&&r.push((0,s.jsx)(`span`,{children:e.slice(i)},`t-end`)),(0,s.jsx)(s.Fragment,{children:r})}function Qn({surface:e,border:t}){return(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 12px`,borderRadius:8,overflow:`hidden`},children:[(0,s.jsx)(`div`,{style:{width:24,height:24,borderRadius:6,background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:`200% 100%`,animation:`tkx-shimmer 1.4s ease-in-out infinite`,flexShrink:0}}),(0,s.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:5},children:[(0,s.jsx)(`div`,{style:{height:13,borderRadius:4,width:`60%`,background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:`200% 100%`,animation:`tkx-shimmer 1.4s ease-in-out infinite`}}),(0,s.jsx)(`div`,{style:{height:10,borderRadius:4,width:`40%`,background:`linear-gradient(90deg, ${t} 25%, ${e} 50%, ${t} 75%)`,backgroundSize:`200% 100%`,animation:`tkx-shimmer 1.4s ease-in-out 0.2s infinite`}})]})]})}function $n({items:e,isOpen:r=!1,onClose:i,placeholder:a=`Type a command or search…`,emptyMessage:l,maxItems:u=8,onItemSelect:d,className:f,style:p}){let m=t.f(),[h,g]=(0,o.useState)(``),[_,v]=(0,o.useState)(0),[y,b]=(0,o.useState)(!1),x=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useId)(),w=qn(r),T=Xn(h,e).slice(0,u),E=[];for(let e of T){let t=e.item.group,n=E.find(e=>e.group===t);n?n.items.push(e):E.push({group:t,items:[e]})}let D=E.flatMap(e=>e.items);Kn(()=>{i?.()},r),(0,o.useEffect)(()=>{r&&(g(``),v(0),setTimeout(()=>x.current?.focus(),30))},[r]),(0,o.useEffect)(()=>{_>=D.length&&v(Math.max(0,D.length-1))},[D.length,_]);let O=(0,o.useCallback)(e=>{let t=S.current;t&&t.querySelectorAll(`[data-command-item]`)[e]?.scrollIntoView({block:`nearest`})},[]),k=e=>{if(e.key===`ArrowDown`){e.preventDefault();let t=Math.min(D.length-1,_+1);v(t),O(t)}else if(e.key===`ArrowUp`){e.preventDefault();let t=Math.max(0,_-1);v(t),O(t)}else if(e.key===`Enter`){e.preventDefault();let t=D[_];t&&A(t.item)}},A=e=>{e.disabled||(e.onSelect?.(),d?.(e),i?.())};if(!r||typeof document>`u`)return null;let j=n.m(a),M=l?n.m(l):`No results for "${n.m(h)}"`;if(typeof document<`u`&&!document.getElementById(`tkx-shimmer-style`)){let e=document.createElement(`style`);e.id=`tkx-shimmer-style`,e.textContent=`@keyframes tkx-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }`,document.head.appendChild(e)}return(0,c.createPortal)((0,s.jsxs)(`div`,{role:`presentation`,style:{position:`fixed`,inset:0,zIndex:1e4,display:`flex`,alignItems:`flex-start`,justifyContent:`center`,paddingTop:`15vh`,paddingLeft:16,paddingRight:16},children:[(0,s.jsx)(`div`,{"aria-hidden":`true`,onClick:i,style:{position:`absolute`,inset:0,backgroundColor:`rgba(0,0,0,0.55)`,backdropFilter:`blur(4px)`,animation:`tkx-fade-in 120ms ease`}}),(0,s.jsxs)(`div`,{ref:w,role:`dialog`,"aria-modal":`true`,"aria-label":`Command palette`,id:C,className:n.t(f),style:{position:`relative`,zIndex:1,width:`100%`,maxWidth:560,backgroundColor:m.surface,border:`1px solid ${m.border}`,borderRadius:16,boxShadow:`0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px ${m.border}`,overflow:`hidden`,display:`flex`,flexDirection:`column`,maxHeight:`70vh`,...p},children:[(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`14px 16px`,borderBottom:`1px solid ${m.border}`},children:[(0,s.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:m.textMuted,strokeWidth:2,"aria-hidden":`true`,style:{flexShrink:0},children:[(0,s.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,s.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),(0,s.jsx)(`input`,{ref:x,type:`text`,role:`combobox`,"aria-expanded":!0,"aria-autocomplete":`list`,"aria-controls":`${C}-list`,"aria-activedescendant":D[_]?`${C}-item-${D[_].item.id}`:void 0,value:h,onChange:e=>{g(e.target.value),v(0)},onKeyDown:k,placeholder:j,style:{flex:1,border:`none`,background:`transparent`,outline:`none`,fontSize:16,fontFamily:`inherit`,color:m.text}}),h&&(0,s.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>{g(``),v(0),x.current?.focus()},style:{border:`none`,background:`transparent`,cursor:`pointer`,color:m.textMuted,display:`flex`,alignItems:`center`,padding:0},children:(0,s.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:[(0,s.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,s.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),(0,s.jsx)(`div`,{id:`${C}-list`,ref:S,role:`listbox`,"aria-label":`Command results`,style:{overflowY:`auto`,flex:1,padding:`6px 8px`},children:y?Array.from({length:4},(e,t)=>(0,s.jsx)(Qn,{surface:m.surface,border:m.border},t)):D.length===0?(0,s.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:8,padding:`32px 16px`,color:m.textMuted},children:[(0,s.jsxs)(`svg`,{width:`32`,height:`32`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,s.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`}),(0,s.jsx)(`line`,{x1:`8`,y1:`11`,x2:`14`,y2:`11`})]}),(0,s.jsx)(`span`,{style:{fontSize:`0.875rem`},children:M})]}):E.map(({group:e,items:t},r)=>{let i=E.slice(0,r).reduce((e,t)=>e+t.items.length,0);return(0,s.jsxs)(`div`,{children:[e&&(0,s.jsx)(`div`,{role:`presentation`,style:{fontSize:`0.6875rem`,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.08em`,color:m.textMuted,padding:`10px 12px 4px`},children:n.m(e)}),t.map((e,t)=>{let r=i+t,a=r===_,o=e.item;return(0,s.jsxs)(`div`,{id:`${C}-item-${o.id}`,role:`option`,"aria-selected":a,"aria-disabled":o.disabled,"data-command-item":!0,onClick:()=>A(o),onMouseEnter:()=>v(r),style:{display:`flex`,alignItems:`center`,gap:10,padding:`9px 12px`,borderRadius:8,cursor:o.disabled?`not-allowed`:`pointer`,opacity:o.disabled?.45:1,backgroundColor:a?`${m.primary}18`:`transparent`,borderLeft:a?`2px solid ${m.primary}`:`2px solid transparent`,transition:`background 80ms ease`,userSelect:`none`},children:[o.icon&&(0,s.jsx)(`span`,{style:{width:20,height:20,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,color:a?m.primary:m.textMuted},children:o.icon}),(0,s.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,s.jsx)(`div`,{style:{fontSize:`0.875rem`,fontWeight:500,color:m.text,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:(0,s.jsx)(Zn,{text:o.label,ranges:e.labelRanges,color:m.primary})}),o.description&&(0,s.jsx)(`div`,{style:{fontSize:`0.75rem`,color:m.textMuted,marginTop:1,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:n.m(o.description)})]}),o.shortcut&&(0,s.jsx)(`span`,{style:{flexShrink:0,fontSize:`0.6875rem`,fontWeight:500,color:m.textMuted,backgroundColor:m.surfaceAlt,border:`1px solid ${m.border}`,borderRadius:6,padding:`2px 6px`,fontFamily:`monospace`,letterSpacing:`0.04em`},children:n.m(o.shortcut)})]},o.id)})]},e??`__default__`)})}),D.length>0&&(0,s.jsxs)(`div`,{"aria-hidden":`true`,style:{display:`flex`,alignItems:`center`,gap:12,padding:`8px 16px`,borderTop:`1px solid ${m.border}`,fontSize:`0.6875rem`,color:m.textMuted},children:[(0,s.jsxs)(`span`,{children:[(0,s.jsx)(`kbd`,{style:{fontFamily:`monospace`},children:`↑↓`}),` navigate`]}),(0,s.jsxs)(`span`,{children:[(0,s.jsx)(`kbd`,{style:{fontFamily:`monospace`},children:`↵`}),` select`]}),(0,s.jsxs)(`span`,{children:[(0,s.jsx)(`kbd`,{style:{fontFamily:`monospace`},children:`Esc`}),` close`]})]})]})]}),document.body)}$n.displayName=`TkxCommand`;function er({direction:e,onClick:t,isDisabled:n,primaryColor:r,position:i,orientation:a}){let o=a===`vertical`,c=e===`prev`,l=i===`inside`?{position:`absolute`,zIndex:3,...o?{[c?`top`:`bottom`]:10,left:`50%`,transform:`translateX(-50%)`}:{[c?`left`:`right`]:10,top:`50%`,transform:`translateY(-50%)`}}:{flexShrink:0,position:`relative`};return(0,s.jsx)(`button`,{type:`button`,"aria-label":c?`Previous slide`:`Next slide`,disabled:n,onClick:t,style:{...l,width:36,height:36,borderRadius:`50%`,border:`none`,backgroundColor:`rgba(0,0,0,0.45)`,backdropFilter:`blur(4px)`,color:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:n?`not-allowed`:`pointer`,opacity:n?.35:1,transition:`background 150ms ease, opacity 150ms ease`,outline:`none`},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${r}55`},onBlur:e=>{e.currentTarget.style.boxShadow=`none`},onMouseEnter:e=>{n||(e.currentTarget.style.backgroundColor=`rgba(0,0,0,0.65)`)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`rgba(0,0,0,0.45)`},children:o?c?(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.5,"aria-hidden":`true`,children:(0,s.jsx)(`polyline`,{points:`18 15 12 9 6 15`})}):(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.5,"aria-hidden":`true`,children:(0,s.jsx)(`polyline`,{points:`6 9 12 15 18 9`})}):c?(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.5,"aria-hidden":`true`,children:(0,s.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}):(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.5,"aria-hidden":`true`,children:(0,s.jsx)(`polyline`,{points:`9 18 15 12 9 6`})})})}function tr({slides:e,autoPlay:i=!1,autoPlayInterval:a=4e3,pauseOnHover:c=!0,loop:l=!0,showArrows:u=!0,showDots:d=!0,showThumbnails:f=!1,orientation:p=`horizontal`,slidesToShow:m=1,gap:h=0,transitionDuration:g=400,swipeable:_=!0,initialIndex:v=0,onChange:y,arrowPosition:b=`inside`,height:x=320,className:S,style:C}){let w=t.f(),T=r.o(),E=(0,o.useId)(),D=e.length,[O,k]=(0,o.useState)(v),[A,j]=(0,o.useState)(l?v+1:v),[M,N]=(0,o.useState)(!1),[P,F]=(0,o.useState)(!1),I=(0,o.useRef)(null),L=(0,o.useRef)(null),R=(0,o.useRef)(null),z=(0,o.useRef)(0),B=(0,o.useRef)(!1),V=p===`vertical`,H=T?0:g,U=l&&D>1?[e[D-1],...e,e[0]]:e,W=U.length,ee=100/m,te=(e,t=0)=>{let n=t===0?``:` - ${t}px`;return V?`translateY(calc(-${e*ee}%${n}))`:`translateX(calc(-${e*ee}%${n}))`},G=(0,o.useCallback)((e,t=!1)=>{let n=l?(e%D+D)%D:Math.max(0,Math.min(D-1,e)),r=l?n+1:n;t&&I.current?(I.current.style.transition=`none`,j(r),k(n),I.current.offsetHeight,I.current.style.transition=``):(N(!0),j(r),k(n)),y?.(n)},[D,l,y]),K=(0,o.useCallback)(()=>G(O-1),[O,G]),ne=(0,o.useCallback)(()=>G(O+1),[O,G]),q=(0,o.useCallback)(()=>{N(!1),!(!l||D<=1)&&(A===0?G(D-1,!0):A===W-1&&G(0,!0))},[l,D,A,W,G]);(0,o.useEffect)(()=>{if(!(!i||P||D<=1))return L.current=setInterval(ne,a),()=>{L.current&&clearInterval(L.current)}},[i,P,a,ne,D]),(0,o.useEffect)(()=>{let e=e=>{let t=document.activeElement;document.getElementById(E)?.contains(t)&&(e.key===(V?`ArrowUp`:`ArrowLeft`)&&(e.preventDefault(),K()),e.key===(V?`ArrowDown`:`ArrowRight`)&&(e.preventDefault(),ne()))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[E,V,K,ne]);let J=e=>`touches`in e?V?e.touches[0].clientY:e.touches[0].clientX:V?e.clientY:e.clientX,Y=e=>{_&&(R.current=J(e),z.current=0,B.current=!0)},re=e=>{if(!B.current||R.current===null)return;let t=J(e)-R.current;z.current=t,I.current&&(I.current.style.transition=`none`,I.current.style.transform=te(A,-t))},ie=()=>{if(!B.current)return;B.current=!1;let e=z.current;I.current&&(I.current.style.transition=``,I.current.style.transform=``),e<-50?ne():e>50?K():I.current&&(I.current.style.transform=te(A)),R.current=null,z.current=0},ae=typeof x==`number`?`${x}px`:x,oe={display:`flex`,flexDirection:V?`column`:`row`,width:V?`100%`:`${W/m*100}%`,height:V?`${W/m*100}%`:`100%`,transform:te(A),transition:M||!T?`transform ${H}ms cubic-bezier(0.4, 0, 0.2, 1)`:`none`,willChange:`transform`,gap:h>0?h:void 0},X={flexShrink:0,width:V?`100%`:`${ee/(W/m)}%`,height:V?`${ee/(W/m)}%`:`100%`,overflow:`hidden`,position:`relative`},Z=l||O>0,se=l||O<D-1,ce=b===`outside`;return(0,s.jsxs)(`div`,{id:E,className:n.t(n.a(`flex flex-col gap-2`),S),style:C,"aria-roledescription":`carousel`,"aria-label":`Content carousel`,children:[(0,s.jsxs)(`div`,{className:n.a(`flex items-center gap-2`),style:{gap:ce&&u?8:0},children:[u&&ce&&(0,s.jsx)(er,{direction:`prev`,onClick:K,isDisabled:!Z,primaryColor:w.primary,position:`outside`,orientation:p}),(0,s.jsxs)(`div`,{style:{position:`relative`,flex:1,overflow:`hidden`,height:ae,borderRadius:12,cursor:_?B.current?`grabbing`:`grab`:`default`,userSelect:`none`},onMouseEnter:()=>c&&F(!0),onMouseLeave:()=>{F(!1),ie()},onTouchStart:Y,onTouchMove:re,onTouchEnd:ie,onMouseDown:Y,onMouseMove:re,onMouseUp:ie,"aria-live":`polite`,"aria-atomic":`false`,children:[u&&!ce&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(er,{direction:`prev`,onClick:K,isDisabled:!Z,primaryColor:w.primary,position:`inside`,orientation:p}),(0,s.jsx)(er,{direction:`next`,onClick:ne,isDisabled:!se,primaryColor:w.primary,position:`inside`,orientation:p})]}),(0,s.jsx)(`div`,{ref:I,style:oe,onTransitionEnd:q,children:U.map((e,t)=>(0,s.jsx)(`div`,{style:X,role:`group`,"aria-roledescription":`slide`,"aria-label":`Slide ${(t-+!!l+D)%D+1} of ${D}`,"aria-hidden":(t-+!!l+D)%D!==O,children:e.content},`${e.id}-${t}`))}),d&&!f&&(0,s.jsx)(`div`,{"aria-label":`Slide indicators`,style:{position:`absolute`,bottom:12,left:`50%`,transform:`translateX(-50%)`,display:`flex`,gap:6,zIndex:2},children:e.map((e,t)=>(0,s.jsx)(`button`,{type:`button`,"aria-label":`Go to slide ${t+1}`,"aria-current":t===O?`true`:void 0,onClick:()=>G(t),style:{width:t===O?20:8,height:8,borderRadius:9999,border:`none`,backgroundColor:t===O?w.primary:`rgba(255,255,255,0.5)`,cursor:`pointer`,padding:0,transition:`width 250ms ease, background 250ms ease`,outline:`none`},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${w.primary}66`},onBlur:e=>{e.currentTarget.style.boxShadow=`none`}},e.id))})]}),u&&ce&&(0,s.jsx)(er,{direction:`next`,onClick:ne,isDisabled:!se,primaryColor:w.primary,position:`outside`,orientation:p})]}),f&&(0,s.jsx)(`div`,{role:`tablist`,"aria-label":`Slide thumbnails`,style:{display:`flex`,gap:6,overflowX:`auto`,paddingBottom:4,scrollbarWidth:`thin`},children:e.map((e,t)=>(0,s.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t===O,"aria-label":`Thumbnail for slide ${t+1}`,onClick:()=>G(t),style:{flexShrink:0,width:60,height:42,border:`2px solid ${t===O?w.primary:w.border}`,borderRadius:6,overflow:`hidden`,cursor:`pointer`,padding:0,background:w.surfaceAlt,transition:`border-color 150ms ease`,outline:`none`,position:`relative`},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 3px ${w.primary}55`},onBlur:e=>{e.currentTarget.style.boxShadow=`none`},children:[e.thumbnail?(0,s.jsx)(`img`,{src:e.thumbnail,alt:``,"aria-hidden":`true`,style:{width:`100%`,height:`100%`,objectFit:`cover`,display:`block`}}):(0,s.jsx)(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`0.625rem`,color:w.textMuted,fontWeight:600},children:t+1}),t===O&&(0,s.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,inset:0,backgroundColor:`${w.primary}22`}})]},e.id))})]})}tr.displayName=`TkxCarousel`;function nr({color:e}){return(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,style:{flexShrink:0},children:(0,s.jsx)(`path`,{d:`M6 3l5 5-5 5`,stroke:e,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function rr({onClick:e,bgColor:t,hoverColor:r,textColor:i}){return(0,s.jsx)(`button`,{type:`button`,onClick:e,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e())},"aria-label":`Show hidden breadcrumb items`,className:n.a(`inline-flex items-center justify-center rounded px-1.5 py-0.5`,`text-sm font-medium cursor-pointer border-none outline-none`,`focus-visible:ring-2 focus-visible:ring-offset-1`),style:{backgroundColor:t,color:i,transition:`background-color 150ms ease`},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=r},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=t},children:`…`})}function ir({items:e,separator:i,maxItems:a,onNavigate:c,className:l,style:u}){let d=t.f(),f=r.o(),p=a!==void 0&&a>1&&e.length>a,m=(0,o.useCallback)(()=>{if(!p||!a)return e.map((e,t)=>({item:e,originalIndex:t}));let t=Math.ceil((a-1)/2),n=a-1-t,r=e.slice(0,t).map((e,t)=>({item:e,originalIndex:t})),i=e.slice(e.length-n).map((t,r)=>({item:t,originalIndex:e.length-n+r}));return r.concat(i)},[e,a,p])(),h=p&&a?Math.ceil((a-1)/2):-1,g=(e,t)=>{c?.(e,t)},_=(e,t,n)=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),g(t,n))},v=f?{}:{transition:`color 150ms ease, background-color 150ms ease`},y=e=>(0,s.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,className:n.a(`flex items-center mx-1.5`),children:i??(0,s.jsx)(nr,{color:d.textMuted})},e),b=(e,t,r)=>{let i=n.m(e.label);if(r)return(0,s.jsx)(`li`,{children:(0,s.jsxs)(`span`,{"aria-current":`page`,className:n.a(`inline-flex items-center gap-1.5 text-sm font-medium`),style:{color:d.text},children:[e.icon&&(0,s.jsx)(`span`,{"aria-hidden":`true`,className:n.a(`flex-shrink-0`),children:e.icon}),i]})},`item-${t}`);let a=!!e.href,o={color:d.textMuted,textDecoration:`none`,...v},l={onMouseEnter:e=>{e.currentTarget.style.color=d.primary},onMouseLeave:e=>{e.currentTarget.style.color=d.textMuted}},u=(0,s.jsxs)(s.Fragment,{children:[e.icon&&(0,s.jsx)(`span`,{"aria-hidden":`true`,className:n.a(`flex-shrink-0`),children:e.icon}),i]});return a?(0,s.jsx)(`li`,{children:(0,s.jsx)(`a`,{href:e.href,onClick:n=>{c&&(n.preventDefault(),g(e,t))},className:n.a(`inline-flex items-center gap-1.5 text-sm rounded`,`outline-none focus-visible:ring-2 focus-visible:ring-offset-1`),style:{...o,focusRingColor:d.primary},...l,children:u})},`item-${t}`):(0,s.jsx)(`li`,{children:(0,s.jsx)(`button`,{type:`button`,onClick:()=>g(e,t),onKeyDown:n=>_(n,e,t),className:n.a(`inline-flex items-center gap-1.5 text-sm rounded`,`border-none bg-transparent cursor-pointer p-0`,`outline-none focus-visible:ring-2 focus-visible:ring-offset-1`),style:o,...l,children:u})},`item-${t}`)},x=[],S=!1;for(let t=0;t<m.length;t++){let{item:n,originalIndex:r}=m[t],i=r===e.length-1;p&&!S&&t===h&&(x.length>0&&x.push(y(`sep-ellipsis-before`)),x.push((0,s.jsx)(`li`,{role:`presentation`,children:(0,s.jsx)(rr,{onClick:()=>{},bgColor:d.surfaceAlt,hoverColor:d.surface,textColor:d.textMuted})},`ellipsis`)),S=!0),x.length>0&&x[x.length-1]!==null&&x.push(y(`sep-${r}`)),x.push(b(n,r,i))}return(0,s.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:n.a(`font-sans`,l??``),style:{...u},children:(0,s.jsx)(`ol`,{role:`list`,className:n.a(`flex items-center flex-wrap list-none m-0 p-0`),children:x})})}var ar=8,or=8;function sr(e,t,n){let r=t.getBoundingClientRect(),i=window.scrollX,a=window.scrollY,o=window.innerWidth,s=window.innerHeight,c=0,l=0,u=n,d={top:e.top-r.height-or-ar>0,bottom:e.bottom+r.height+or+ar<s,left:e.left-r.width-or-ar>0,right:e.right+r.width+or+ar<o};if(!d[n]){let e={top:`bottom`,bottom:`top`,left:`right`,right:`left`};d[e[n]]&&(u=e[n])}switch(u){case`top`:c=e.top+a-r.height-or-ar,l=e.left+i+e.width/2-r.width/2;break;case`bottom`:c=e.bottom+a+or+ar,l=e.left+i+e.width/2-r.width/2;break;case`left`:c=e.top+a+e.height/2-r.height/2,l=e.left+i-r.width-or-ar;break;case`right`:c=e.top+a+e.height/2-r.height/2,l=e.right+i+or+ar;break}l=Math.max(8,Math.min(l,o+i-r.width-8)),c=Math.max(8,Math.min(c,s+a-r.height-8));let f={position:`absolute`,width:0,height:0,borderStyle:`solid`,borderWidth:ar};switch(u){case`top`:Object.assign(f,{bottom:-ar*2,left:`50%`,transform:`translateX(-50%)`,borderColor:`var(--tkx-popover-bg) transparent transparent transparent`});break;case`bottom`:Object.assign(f,{top:-ar*2,left:`50%`,transform:`translateX(-50%)`,borderColor:`transparent transparent var(--tkx-popover-bg) transparent`});break;case`left`:Object.assign(f,{right:-ar*2,top:`50%`,transform:`translateY(-50%)`,borderColor:`transparent transparent transparent var(--tkx-popover-bg)`});break;case`right`:Object.assign(f,{left:-ar*2,top:`50%`,transform:`translateY(-50%)`,borderColor:`transparent var(--tkx-popover-bg) transparent transparent`});break}return{top:c,left:l,arrowStyle:f,resolvedPlacement:u}}function cr({trigger:e,content:i,placement:a=`bottom`,isOpen:l,onOpenChange:u,closeOnClickOutside:d=!0,className:f,style:p}){let m=t.f(),h=r.o(),g=(0,o.useId)(),_=l!==void 0,[v,y]=(0,o.useState)(!1),b=_?l:v,x=(0,o.useRef)(null),S=(0,o.useRef)(null);(0,o.useRef)(null);let[C,w]=(0,o.useState)(null),T=(0,o.useCallback)(e=>{_||y(e),u?.(e)},[_,u]),E=(0,o.useCallback)(()=>T(!1),[T]),D=(0,o.useCallback)(()=>T(!b),[T,b]);r.r(E,b),(0,o.useEffect)(()=>{if(!b||!d)return;let e=e=>{let t=e.target;x.current?.contains(t)||S.current?.contains(t)||E()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[b,d,E]),(0,o.useEffect)(()=>{if(!b||!x.current)return;let e=()=>{!x.current||!S.current||w(sr(x.current.getBoundingClientRect(),S.current,a))};return requestAnimationFrame(e),window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[b,a]);let O=h?{opacity:1}:{animation:`tkxPopoverFadeIn 150ms ease forwards`,opacity:0},k=b&&typeof document<`u`?(0,c.createPortal)((0,s.jsxs)(`div`,{ref:S,id:g,role:`dialog`,"aria-modal":`false`,className:n.a(`absolute z-[9100] rounded-lg font-sans`,f??``),style:{"--tkx-popover-bg":m.surface,top:C?.top??-9999,left:C?.left??-9999,backgroundColor:m.surface,border:`1px solid ${m.border}`,boxShadow:`0 8px 24px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)`,minWidth:200,maxWidth:420,padding:`12px 16px`,color:m.text,...O,...p},children:[C&&(0,s.jsx)(`span`,{style:C.arrowStyle,"aria-hidden":`true`}),i]}),document.body):null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{ref:x,className:n.a(`inline-flex`),onClick:D,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),D())},"aria-expanded":b,"aria-haspopup":`dialog`,"aria-controls":b?g:void 0,children:e}),k,b&&!h&&(0,s.jsx)(`style`,{children:`
68
68
  @keyframes tkxPopoverFadeIn {
69
69
  from { opacity: 0; transform: translateY(4px); }
70
70
  to { opacity: 1; transform: translateY(0); }
71
71
  }
72
- `})]})}function si(t,n){if(!n)return!0;const r=n.toLowerCase(),o=t.label.toLowerCase();let s=0;for(let a=0;a<o.length&&s<r.length;a++)o[a]===r[s]&&s++;return s===r.length}function oi(t,n){const r=t.getBoundingClientRect(),o=4,s=window.innerHeight-r.bottom,a=r.top,l=s>=n+o||s>=a?"below":"above";return{top:l==="below"?r.bottom+window.scrollY+o:r.top+window.scrollY-n-o,left:r.left+window.scrollX,width:r.width,placement:l}}function vn({color:t}){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{animation:"spin 0.8s linear infinite",flexShrink:0},children:[e.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"2",opacity:"0.3"}),e.jsx("path",{d:"M14 8a6 6 0 00-6-6",stroke:t,strokeWidth:"2",strokeLinecap:"round"})]})}const wn=280;function ii({options:t,value:n,onChange:r,onInputChange:o,placeholder:s="",label:a,isLoading:l=!1,emptyMessage:d="No results found",filterFn:f,freeSolo:u=!1,className:c,style:h}){const p=O.useTheme(),m=J.useReducedMotion(),b=i.useId(),k=i.useId(),y=i.useRef(null),g=i.useRef(null),[S,j]=i.useState(""),[v,$]=i.useState(!1),[w,N]=i.useState(-1),[I,M]=i.useState(null);i.useEffect(()=>{if(n!==void 0){const R=t.find(F=>F.value===n);j(R?R.label:n)}},[n,t]);const T=f??si,E=i.useMemo(()=>v?t.filter(R=>T(R,S)):[],[t,S,v,T]),C=A.sanitizeString(a),H=A.sanitizeString(d);i.useEffect(()=>{if(!v||!g.current)return;const R=()=>{g.current&&M(oi(g.current,wn))};return R(),window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[v]),i.useEffect(()=>{if(!v)return;const R=F=>{var ne;const W=F.target;if((ne=g.current)!=null&&ne.contains(W))return;const K=document.getElementById(k);K!=null&&K.contains(W)||$(!1)};return document.addEventListener("pointerdown",R),()=>document.removeEventListener("pointerdown",R)},[v,k]),J.useEscapeKey(()=>$(!1),v);const z=i.useCallback(R=>{var F;R.disabled||(j(R.label),r==null||r(R.value),$(!1),N(-1),(F=y.current)==null||F.focus())},[r]),L=R=>{const F=R.target.value;j(F),o==null||o(F),v||$(!0),N(-1),u&&(r==null||r(F))},B=R=>{if(!v&&(R.key==="ArrowDown"||R.key==="ArrowUp")){$(!0);return}switch(R.key){case"ArrowDown":{R.preventDefault(),N(F=>{let W=F+1;for(;W<E.length&&E[W].disabled;)W++;return W<E.length?W:F});break}case"ArrowUp":{R.preventDefault(),N(F=>{let W=F-1;for(;W>=0&&E[W].disabled;)W--;return W>=0?W:F});break}case"Enter":{R.preventDefault(),w>=0&&w<E.length?z(E[w]):u&&S&&(r==null||r(S),$(!1));break}case"Escape":{$(!1),N(-1);break}}};i.useEffect(()=>{var F;if(w<0)return;const R=`${k}-opt-${w}`;(F=document.getElementById(R))==null||F.scrollIntoView({block:"nearest"})},[w,k]);const V=w>=0?`${k}-opt-${w}`:void 0,D=m?{}:{animation:"tkxAutoFadeIn 120ms ease forwards"},_=v&&typeof document<"u"&&I?Re.createPortal(e.jsx("ul",{id:k,role:"listbox","aria-label":C,className:x.tkx("absolute z-[9200] list-none m-0 p-1 rounded-lg overflow-y-auto font-sans"),style:{top:I.top,left:I.left,width:I.width,maxHeight:wn,backgroundColor:p.surface,border:`1px solid ${p.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.15)",...D},children:l?e.jsxs("li",{role:"option","aria-selected":!1,"aria-disabled":"true",className:x.tkx("flex items-center gap-2 px-3 py-2 text-sm"),style:{color:p.textMuted},children:[e.jsx(vn,{color:p.primary}),"Loading..."]}):E.length===0?e.jsx("li",{role:"option","aria-selected":!1,"aria-disabled":"true",className:x.tkx("px-3 py-2 text-sm text-center"),style:{color:p.textMuted},children:H}):E.map((R,F)=>{const W=F===w,K=A.sanitizeString(R.label),ne=R.description?A.sanitizeString(R.description):null;return e.jsxs("li",{id:`${k}-opt-${F}`,role:"option","aria-selected":R.value===n,"aria-disabled":R.disabled||void 0,className:x.tkx("flex items-center gap-2 px-3 py-2 text-sm rounded-md cursor-pointer",R.disabled?"opacity-50 cursor-not-allowed":""),style:{backgroundColor:W?p.surfaceAlt:"transparent",color:R.disabled?p.textMuted:p.text,transition:m?"none":"background-color 100ms ease"},onMouseEnter:()=>!R.disabled&&N(F),onMouseDown:Z=>{Z.preventDefault(),z(R)},children:[R.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:R.icon}),e.jsxs("span",{className:x.tkx("flex flex-col min-w-0"),children:[e.jsx("span",{className:x.tkx("truncate"),children:K}),ne&&e.jsx("span",{className:x.tkx("text-xs truncate"),style:{color:p.textMuted},children:ne})]}),R.value===n&&e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:x.tkx("ml-auto flex-shrink-0"),children:e.jsx("path",{d:"M3 8l3.5 3.5L13 5",stroke:p.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},R.value)})}),document.body):null;return e.jsxs("div",{ref:g,className:x.tkx("relative font-sans",c??""),style:h,children:[e.jsx("label",{htmlFor:b,className:x.tkx("block text-sm font-medium mb-1.5"),style:{color:p.text},children:C}),e.jsxs("div",{className:x.tkx("relative flex items-center"),style:{backgroundColor:p.surface,border:`1px solid ${v?p.primary:p.border}`,borderRadius:8,transition:m?"none":"border-color 150ms ease"},children:[e.jsx("input",{ref:y,id:b,type:"text",role:"combobox","aria-expanded":v,"aria-controls":k,"aria-activedescendant":V,"aria-autocomplete":"list","aria-label":C,value:S,placeholder:s,onChange:L,onFocus:()=>$(!0),onKeyDown:B,className:x.tkx("w-full bg-transparent border-none outline-none text-sm py-2.5 px-3","placeholder:opacity-50"),style:{color:p.text}}),l&&e.jsx("span",{className:x.tkx("pr-3"),children:e.jsx(vn,{color:p.primary})})]}),_,v&&!m&&e.jsx("style",{children:`
72
+ `})]})}function lr(e,t){if(!t)return!0;let n=t.toLowerCase(),r=e.label.toLowerCase(),i=0;for(let e=0;e<r.length&&i<n.length;e++)r[e]===n[i]&&i++;return i===n.length}function ur(e,t){let n=e.getBoundingClientRect(),r=window.innerHeight-n.bottom,i=n.top,a=r>=t+4||r>=i?`below`:`above`;return{top:a===`below`?n.bottom+window.scrollY+4:n.top+window.scrollY-t-4,left:n.left+window.scrollX,width:n.width,placement:a}}function dr({color:e}){return(0,s.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,style:{animation:`spin 0.8s linear infinite`,flexShrink:0},children:[(0,s.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`,stroke:e,strokeWidth:`2`,opacity:`0.3`}),(0,s.jsx)(`path`,{d:`M14 8a6 6 0 00-6-6`,stroke:e,strokeWidth:`2`,strokeLinecap:`round`})]})}var fr=280;function pr({options:e,value:i,onChange:a,onInputChange:l,placeholder:u=``,label:d,isLoading:f=!1,emptyMessage:p=`No results found`,filterFn:m,freeSolo:h=!1,className:g,style:_}){let v=t.f(),y=r.o(),b=(0,o.useId)(),x=(0,o.useId)(),S=(0,o.useRef)(null),C=(0,o.useRef)(null),[w,T]=(0,o.useState)(``),[E,D]=(0,o.useState)(!1),[O,k]=(0,o.useState)(-1),[A,j]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(i!==void 0){let t=e.find(e=>e.value===i);T(t?t.label:i)}},[i,e]);let M=m??lr,N=(0,o.useMemo)(()=>E?e.filter(e=>M(e,w)):[],[e,w,E,M]),P=n.m(d),F=n.m(p);(0,o.useEffect)(()=>{if(!E||!C.current)return;let e=()=>{C.current&&j(ur(C.current,fr))};return e(),window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[E]),(0,o.useEffect)(()=>{if(!E)return;let e=e=>{let t=e.target;C.current?.contains(t)||document.getElementById(x)?.contains(t)||D(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[E,x]),r.r(()=>D(!1),E);let I=(0,o.useCallback)(e=>{e.disabled||(T(e.label),a?.(e.value),D(!1),k(-1),S.current?.focus())},[a]),L=e=>{let t=e.target.value;T(t),l?.(t),E||D(!0),k(-1),h&&a?.(t)},R=e=>{if(!E&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){D(!0);return}switch(e.key){case`ArrowDown`:e.preventDefault(),k(e=>{let t=e+1;for(;t<N.length&&N[t].disabled;)t++;return t<N.length?t:e});break;case`ArrowUp`:e.preventDefault(),k(e=>{let t=e-1;for(;t>=0&&N[t].disabled;)t--;return t>=0?t:e});break;case`Enter`:e.preventDefault(),O>=0&&O<N.length?I(N[O]):h&&w&&(a?.(w),D(!1));break;case`Escape`:D(!1),k(-1);break}};(0,o.useEffect)(()=>{if(O<0)return;let e=`${x}-opt-${O}`;document.getElementById(e)?.scrollIntoView({block:`nearest`})},[O,x]);let z=O>=0?`${x}-opt-${O}`:void 0,B=y?{}:{animation:`tkxAutoFadeIn 120ms ease forwards`},V=E&&typeof document<`u`&&A?(0,c.createPortal)((0,s.jsx)(`ul`,{id:x,role:`listbox`,"aria-label":P,className:n.a(`absolute z-[9200] list-none m-0 p-1 rounded-lg overflow-y-auto font-sans`),style:{top:A.top,left:A.left,width:A.width,maxHeight:fr,backgroundColor:v.surface,border:`1px solid ${v.border}`,boxShadow:`0 8px 24px rgba(0,0,0,0.15)`,...B},children:f?(0,s.jsxs)(`li`,{role:`option`,"aria-selected":!1,"aria-disabled":`true`,className:n.a(`flex items-center gap-2 px-3 py-2 text-sm`),style:{color:v.textMuted},children:[(0,s.jsx)(dr,{color:v.primary}),`Loading...`]}):N.length===0?(0,s.jsx)(`li`,{role:`option`,"aria-selected":!1,"aria-disabled":`true`,className:n.a(`px-3 py-2 text-sm text-center`),style:{color:v.textMuted},children:F}):N.map((e,t)=>{let r=t===O,a=n.m(e.label),o=e.description?n.m(e.description):null;return(0,s.jsxs)(`li`,{id:`${x}-opt-${t}`,role:`option`,"aria-selected":e.value===i,"aria-disabled":e.disabled||void 0,className:n.a(`flex items-center gap-2 px-3 py-2 text-sm rounded-md cursor-pointer`,e.disabled?`opacity-50 cursor-not-allowed`:``),style:{backgroundColor:r?v.surfaceAlt:`transparent`,color:e.disabled?v.textMuted:v.text,transition:y?`none`:`background-color 100ms ease`},onMouseEnter:()=>!e.disabled&&k(t),onMouseDown:t=>{t.preventDefault(),I(e)},children:[e.icon&&(0,s.jsx)(`span`,{"aria-hidden":`true`,className:n.a(`flex-shrink-0`),children:e.icon}),(0,s.jsxs)(`span`,{className:n.a(`flex flex-col min-w-0`),children:[(0,s.jsx)(`span`,{className:n.a(`truncate`),children:a}),o&&(0,s.jsx)(`span`,{className:n.a(`text-xs truncate`),style:{color:v.textMuted},children:o})]}),e.value===i&&(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:n.a(`ml-auto flex-shrink-0`),children:(0,s.jsx)(`path`,{d:`M3 8l3.5 3.5L13 5`,stroke:v.primary,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})]},e.value)})}),document.body):null;return(0,s.jsxs)(`div`,{ref:C,className:n.a(`relative font-sans`,g??``),style:_,children:[(0,s.jsx)(`label`,{htmlFor:b,className:n.a(`block text-sm font-medium mb-1.5`),style:{color:v.text},children:P}),(0,s.jsxs)(`div`,{className:n.a(`relative flex items-center`),style:{backgroundColor:v.surface,border:`1px solid ${E?v.primary:v.border}`,borderRadius:8,transition:y?`none`:`border-color 150ms ease`},children:[(0,s.jsx)(`input`,{ref:S,id:b,type:`text`,role:`combobox`,"aria-expanded":E,"aria-controls":x,"aria-activedescendant":z,"aria-autocomplete":`list`,"aria-label":P,value:w,placeholder:u,onChange:L,onFocus:()=>D(!0),onKeyDown:R,className:n.a(`w-full bg-transparent border-none outline-none text-sm py-2.5 px-3`,`placeholder:opacity-50`),style:{color:v.text}}),f&&(0,s.jsx)(`span`,{className:n.a(`pr-3`),children:(0,s.jsx)(dr,{color:v.primary})})]}),V,E&&!y&&(0,s.jsx)(`style`,{children:`
73
73
  @keyframes tkxAutoFadeIn {
74
74
  from { opacity: 0; transform: translateY(4px); }
75
75
  to { opacity: 1; transform: translateY(0); }
76
76
  }
77
- `})]})}function ai(t,n){const r=[];function o(s,a){var l;for(const d of s)r.push({node:d,depth:a}),(l=d.children)!=null&&l.length&&n.has(d.id)&&o(d.children,a+1)}return o(t,0),r}function li({expanded:t,color:n,reducedMotion:r}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",style:{transform:t?"rotate(90deg)":"rotate(0deg)",transition:r?"none":"transform 150ms ease",flexShrink:0},children:e.jsx("path",{d:"M6 3l5 5-5 5",stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ci({checked:t,color:n,borderColor:r}){return e.jsx("span",{role:"presentation","aria-hidden":"true",className:x.tkx("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${t?n:r}`,backgroundColor:t?n:"transparent",transition:"all 100ms ease"},children:t&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:e.jsx("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}const jn=24;function di({data:t,selected:n,onSelect:r,expanded:o,onExpand:s,multiSelect:a=!1,showCheckboxes:l=!1,showLines:d=!1,className:f,style:u}){const c=O.useTheme(),h=J.useReducedMotion();i.useId();const[p,m]=i.useState([]),[b,k]=i.useState([]),y=new Set(n??p),g=new Set(o??b),S=i.useCallback(E=>{o===void 0&&k(E),s==null||s(E)},[o,s]),j=i.useCallback(E=>{n===void 0&&m(E),r==null||r(E)},[n,r]),v=i.useCallback(E=>{const C=Array.from(g);g.has(E)?S(C.filter(H=>H!==E)):S([...C,E])},[g,S]),$=i.useCallback(E=>{if(a){const C=Array.from(y);y.has(E)?j(C.filter(H=>H!==E)):j([...C,E])}else j(y.has(E)?[]:[E])},[a,y,j]),w=ai(t,g),N=i.useRef(0),I=i.useRef(new Map),M=E=>{var C;N.current=E,(C=I.current.get(E))==null||C.focus()},T=(E,C)=>{var B;const H=w[C];if(!H)return;const{node:z}=H,L=(((B=z.children)==null?void 0:B.length)??0)>0;switch(E.key){case"ArrowDown":{E.preventDefault(),C<w.length-1&&M(C+1);break}case"ArrowUp":{E.preventDefault(),C>0&&M(C-1);break}case"ArrowRight":{E.preventDefault(),L&&!g.has(z.id)?v(z.id):L&&g.has(z.id)&&C<w.length-1&&M(C+1);break}case"ArrowLeft":{if(E.preventDefault(),L&&g.has(z.id))v(z.id);else for(let V=C-1;V>=0;V--)if(w[V].depth<H.depth){M(V);break}break}case"Enter":case" ":{E.preventDefault(),z.disabled||$(z.id);break}case"Home":{E.preventDefault(),M(0);break}case"End":{E.preventDefault(),M(w.length-1);break}}};return e.jsx("ul",{role:"tree","aria-label":"Tree view","aria-multiselectable":a||void 0,className:x.tkx("list-none m-0 p-0 font-sans select-none",f??""),style:{color:c.text,...u},children:w.map(({node:E,depth:C},H)=>{var D;const z=(((D=E.children)==null?void 0:D.length)??0)>0,L=g.has(E.id),B=y.has(E.id),V=A.sanitizeString(E.label);return e.jsxs("li",{role:"treeitem","aria-selected":B,"aria-expanded":z?L:void 0,"aria-disabled":E.disabled||void 0,"aria-level":C+1,"aria-setsize":w.filter(_=>_.depth===C).length,tabIndex:H===0?0:-1,ref:_=>{_?I.current.set(H,_):I.current.delete(H)},onKeyDown:_=>T(_,H),onClick:()=>{E.disabled||(z&&v(E.id),$(E.id))},className:x.tkx("relative flex items-center gap-1.5 py-1 px-2 rounded-md cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-1",E.disabled?"opacity-50 cursor-not-allowed":""),style:{paddingLeft:C*jn+8,backgroundColor:B?`${c.primary}18`:"transparent",transition:h?"none":"background-color 100ms ease",minHeight:32},onMouseEnter:_=>{!B&&!E.disabled&&(_.currentTarget.style.backgroundColor=c.surfaceAlt)},onMouseLeave:_=>{_.currentTarget.style.backgroundColor=B?`${c.primary}18`:"transparent"},children:[d&&C>0&&e.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:(C-1)*jn+16,top:0,bottom:0,width:1,backgroundColor:c.border}}),z?e.jsx("span",{role:"presentation",onClick:_=>{_.stopPropagation(),v(E.id)},className:x.tkx("inline-flex items-center justify-center cursor-pointer"),style:{width:20,height:20},children:e.jsx(li,{expanded:L,color:c.textMuted,reducedMotion:h})}):e.jsx("span",{style:{width:20,height:20},"aria-hidden":"true"}),l&&e.jsx(ci,{checked:B,color:c.primary,borderColor:c.border}),E.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:E.icon}),e.jsx("span",{className:x.tkx("text-sm truncate"),style:{color:E.disabled?c.textMuted:c.text},children:V})]},E.id)})})}const ui={sm:{buttonPx:6,buttonPy:4,fontSize:12,iconSize:14,gap:2,separatorSize:16},md:{buttonPx:8,buttonPy:6,fontSize:13,iconSize:16,gap:4,separatorSize:20},lg:{buttonPx:12,buttonPy:8,fontSize:14,iconSize:18,gap:6,separatorSize:24}};function fi({items:t,orientation:n="horizontal",size:r="md",variant:o="default",ariaLabel:s="Toolbar",className:a,style:l}){const d=O.useTheme(),f=J.useReducedMotion(),u=ui[r],c=n==="horizontal",h=i.useRef(new Map),p=t.filter(g=>g.type!=="separator"&&!g.disabled).map(g=>g.id),m=i.useCallback(g=>{var S;(S=h.current.get(g))==null||S.focus()},[]),b=i.useCallback((g,S)=>{const j=p.indexOf(S);if(j<0)return;const v=c?"ArrowRight":"ArrowDown",$=c?"ArrowLeft":"ArrowUp";switch(g.key){case v:{g.preventDefault();const w=j+1<p.length?j+1:0;m(p[w]);break}case $:{g.preventDefault();const w=j-1>=0?j-1:p.length-1;m(p[w]);break}case"Home":{g.preventDefault(),m(p[0]);break}case"End":{g.preventDefault(),m(p[p.length-1]);break}}},[p,m,c]),k=()=>{switch(o){case"outlined":return{backgroundColor:"transparent",border:`1px solid ${d.border}`};case"filled":return{backgroundColor:d.surfaceAlt,border:"none"};default:return{backgroundColor:d.surface,border:`1px solid ${d.border}`}}},y=g=>{g.type;const S=g.active;return{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,padding:`${u.buttonPy}px ${u.buttonPx}px`,fontSize:u.fontSize,borderRadius:6,border:"none",cursor:g.disabled?"not-allowed":"pointer",backgroundColor:S?`${d.primary}20`:"transparent",color:S?d.primary:g.disabled?d.textMuted:d.text,opacity:g.disabled?.5:1,outline:"none",transition:f?"none":"all 100ms ease",whiteSpace:"nowrap",lineHeight:1}};return e.jsx("div",{role:"toolbar","aria-label":s,"aria-orientation":n,className:x.tkx("inline-flex items-center rounded-lg font-sans",c?"flex-row":"flex-col",a??""),style:{...k(),padding:u.gap,gap:u.gap,...l},children:t.map((g,S)=>{if(g.type==="separator")return e.jsx("div",{role:"separator","aria-orientation":c?"vertical":"horizontal",className:x.tkx("flex-shrink-0"),style:{...c?{width:1,height:u.separatorSize,marginLeft:2,marginRight:2}:{height:1,width:u.separatorSize,marginTop:2,marginBottom:2},backgroundColor:d.border}},g.id);const j=A.sanitizeString(g.label),v=!g.disabled,$=p[0]===g.id;return e.jsxs("button",{ref:w=>{w?h.current.set(g.id,w):h.current.delete(g.id)},type:"button",role:(g.type==="toggle",void 0),"aria-pressed":g.type==="toggle"?g.active:void 0,"aria-label":j,"aria-disabled":g.disabled||void 0,tabIndex:v&&$?0:-1,disabled:g.disabled,onClick:()=>{var w;g.disabled||(w=g.onClick)==null||w.call(g)},onKeyDown:w=>{var N;b(w,g.id),(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),g.disabled||(N=g.onClick)==null||N.call(g))},className:x.tkx("focus-visible:ring-2 focus-visible:ring-offset-1"),style:y(g),onMouseEnter:w=>{!g.disabled&&!g.active&&(w.currentTarget.style.backgroundColor=d.surfaceAlt)},onMouseLeave:w=>{g.disabled||(w.currentTarget.style.backgroundColor=g.active?`${d.primary}20`:"transparent")},children:[g.icon&&e.jsx("span",{"aria-hidden":"true",style:{width:u.iconSize,height:u.iconSize,display:"flex",alignItems:"center",justifyContent:"center"},children:g.icon}),!g.icon&&j]},g.id)})})}function xi({color:t}){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"6",cy:"6",r:"4.5",stroke:t,strokeWidth:"1.5"}),e.jsx("path",{d:"M9.5 9.5L13 13",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"})]})}function Sn({checked:t,primaryColor:n,borderColor:r}){return e.jsx("span",{"aria-hidden":"true",className:x.tkx("inline-flex items-center justify-center flex-shrink-0"),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${t?n:r}`,backgroundColor:t?n:"transparent",transition:"all 100ms ease"},children:t&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:e.jsx("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#fff",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}function pi({color:t}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M3 8h10M9 4l4 4-4 4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function hi({color:t}){return e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M13 8H3M7 4l-4 4 4 4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Mn({title:t,items:n,selected:r,onToggle:o,onToggleAll:s,search:a,onSearchChange:l,searchable:d,height:f,listId:u}){const c=O.useTheme(),h=J.useReducedMotion(),p=A.sanitizeString(t),m=i.useMemo(()=>{if(!a)return n;const g=a.toLowerCase();return n.filter(S=>S.label.toLowerCase().includes(g))},[n,a]),b=m.filter(g=>!g.disabled),k=b.length>0&&b.every(g=>r.has(g.value));b.some(g=>r.has(g.value));const y=(g,S)=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),o(S))};return e.jsxs("div",{className:x.tkx("flex flex-col rounded-lg overflow-hidden flex-1 min-w-0"),style:{border:`1px solid ${c.border}`,backgroundColor:c.surface},children:[e.jsxs("div",{className:x.tkx("flex items-center gap-2 px-3 py-2 border-b"),style:{borderColor:c.border,backgroundColor:c.surfaceAlt},children:[e.jsx("button",{type:"button","aria-label":k?`Deselect all ${p}`:`Select all ${p}`,onClick:s,className:x.tkx("border-none bg-transparent cursor-pointer p-0 outline-none focus-visible:ring-2"),children:e.jsx(Sn,{checked:k,primaryColor:c.primary,borderColor:c.border})}),e.jsx("span",{className:x.tkx("text-sm font-medium flex-1 truncate"),style:{color:c.text},children:p}),e.jsxs("span",{className:x.tkx("text-xs"),style:{color:c.textMuted},children:[r.size,"/",n.length]})]}),d&&e.jsxs("div",{className:x.tkx("flex items-center gap-1.5 px-3 py-1.5 border-b"),style:{borderColor:c.border},children:[e.jsx(xi,{color:c.textMuted}),e.jsx("input",{type:"text","aria-label":`Search ${p}`,value:a,onChange:g=>l(g.target.value),placeholder:"Search...",className:x.tkx("flex-1 bg-transparent border-none outline-none text-xs"),style:{color:c.text}})]}),e.jsx("ul",{id:u,role:"listbox","aria-label":p,"aria-multiselectable":"true",className:x.tkx("list-none m-0 p-1 overflow-y-auto"),style:{height:f,minHeight:100},children:m.length===0?e.jsx("li",{className:x.tkx("text-xs text-center py-4"),style:{color:c.textMuted},"aria-disabled":"true",children:"No items"}):m.map(g=>{const S=r.has(g.value),j=A.sanitizeString(g.label);return e.jsxs("li",{role:"option","aria-selected":S,"aria-disabled":g.disabled||void 0,tabIndex:0,onClick:()=>!g.disabled&&o(g.value),onKeyDown:v=>!g.disabled&&y(v,g.value),className:x.tkx("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm","outline-none focus-visible:ring-2 focus-visible:ring-offset-1",g.disabled?"opacity-50 cursor-not-allowed":""),style:{color:g.disabled?c.textMuted:c.text,backgroundColor:S?`${c.primary}10`:"transparent",transition:h?"none":"background-color 100ms ease"},onMouseEnter:v=>{!g.disabled&&!S&&(v.currentTarget.style.backgroundColor=c.surfaceAlt)},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=S?`${c.primary}10`:"transparent"},children:[e.jsx(Sn,{checked:S,primaryColor:c.primary,borderColor:c.border}),e.jsx("span",{className:x.tkx("truncate"),children:j})]},g.value)})})]})}function mi({sourceItems:t,targetItems:n,onTransfer:r,sourceTitle:o="Available",targetTitle:s="Selected",searchable:a=!1,height:l=300,className:d,style:f}){const u=O.useTheme(),c=J.useReducedMotion(),h=i.useId(),p=i.useId(),[m,b]=i.useState(new Set),[k,y]=i.useState(new Set),[g,S]=i.useState(""),[j,v]=i.useState(""),$=i.useCallback(C=>{b(H=>{const z=new Set(H);return z.has(C)?z.delete(C):z.add(C),z})},[]),w=i.useCallback(C=>{y(H=>{const z=new Set(H);return z.has(C)?z.delete(C):z.add(C),z})},[]),N=i.useCallback(()=>{const C=t.filter(z=>!z.disabled).map(z=>z.value),H=C.every(z=>m.has(z));b(H?new Set:new Set(C))},[t,m]),I=i.useCallback(()=>{const C=n.filter(z=>!z.disabled).map(z=>z.value),H=C.every(z=>k.has(z));y(H?new Set:new Set(C))},[n,k]),M=i.useCallback(()=>{if(m.size===0)return;const C=t.filter(L=>m.has(L.value)&&!L.disabled),H=t.filter(L=>!m.has(L.value)||L.disabled),z=[...n,...C];r(H,z),b(new Set)},[t,n,m,r]),T=i.useCallback(()=>{if(k.size===0)return;const C=n.filter(L=>k.has(L.value)&&!L.disabled),H=n.filter(L=>!k.has(L.value)||L.disabled),z=[...t,...C];r(z,H),y(new Set)},[t,n,k,r]),E=C=>({display:"inline-flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:8,border:`1px solid ${u.border}`,backgroundColor:C?u.surface:u.surfaceAlt,cursor:C?"not-allowed":"pointer",opacity:C?.5:1,transition:c?"none":"all 100ms ease",outline:"none"});return e.jsxs("div",{className:x.tkx("flex gap-3 font-sans","flex-col sm:flex-row",d??""),style:{color:u.text,...f},children:[e.jsx(Mn,{title:o,items:t,selected:m,onToggle:$,onToggleAll:N,search:g,onSearchChange:S,searchable:a,height:l,listId:h}),e.jsxs("div",{className:x.tkx("flex items-center justify-center gap-2","flex-row sm:flex-col"),style:{padding:"8px 0"},children:[e.jsx("button",{type:"button","aria-label":"Move selected items to target list",disabled:m.size===0,onClick:M,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),M())},className:x.tkx("focus-visible:ring-2 focus-visible:ring-offset-1"),style:E(m.size===0),onMouseEnter:C=>{m.size>0&&(C.currentTarget.style.backgroundColor=u.primary,C.currentTarget.style.borderColor=u.primary)},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=m.size===0?u.surface:u.surfaceAlt,C.currentTarget.style.borderColor=u.border},children:e.jsx(pi,{color:u.text})}),e.jsx("button",{type:"button","aria-label":"Move selected items to source list",disabled:k.size===0,onClick:T,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),T())},className:x.tkx("focus-visible:ring-2 focus-visible:ring-offset-1"),style:E(k.size===0),onMouseEnter:C=>{k.size>0&&(C.currentTarget.style.backgroundColor=u.primary,C.currentTarget.style.borderColor=u.primary)},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=k.size===0?u.surface:u.surfaceAlt,C.currentTarget.style.borderColor=u.border},children:e.jsx(hi,{color:u.text})})]}),e.jsx(Mn,{title:s,items:n,selected:k,onToggle:w,onToggleAll:I,search:j,onSearchChange:v,searchable:a,height:l,listId:p})]})}function gi({color:t,rotated:n,reducedMotion:r}){return e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{transform:n?"rotate(45deg)":"rotate(0deg)",transition:r?"none":"transform 200ms ease"},children:e.jsx("path",{d:"M12 5v14M5 12h14",stroke:t,strokeWidth:"2.5",strokeLinecap:"round"})})}const bi={"bottom-right":{bottom:24,right:24},"bottom-left":{bottom:24,left:24},"top-right":{top:24,right:24},"top-left":{top:24,left:24}};function yi(t,n,r){const o=(n+1)*r;switch(t){case"up":return{bottom:o,left:"50%",transform:"translateX(-50%)"};case"down":return{top:o,left:"50%",transform:"translateX(-50%)"};case"left":return{right:o,top:"50%",transform:"translateY(-50%)"};case"right":return{left:o,top:"50%",transform:"translateY(-50%)"}}}function ki(t){switch(t){case"up":case"down":return{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:10};case"left":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:10};case"right":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:10}}}const Tn=56,Cn=48,vi=64;function wi({actions:t,icon:n,direction:r="up",position:o="bottom-right",className:s,style:a}){const l=O.useTheme(),d=J.useReducedMotion(),f=i.useId(),[u,c]=i.useState(!1),[h,p]=i.useState(-1),m=i.useRef(null),b=i.useRef(new Map),k=i.useCallback(()=>{c(v=>!v),p(-1)},[]),y=i.useCallback(()=>{c(!1),p(-1)},[]);J.useEscapeKey(y,u),i.useEffect(()=>{if(!u)return;const v=$=>{var w;(w=m.current)!=null&&w.contains($.target)||y()};return document.addEventListener("pointerdown",v),()=>document.removeEventListener("pointerdown",v)},[u,y]),i.useEffect(()=>{var v;h>=0&&((v=b.current.get(h))==null||v.focus())},[h]);const g=v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),k()),u&&((v.key==="ArrowUp"||v.key==="ArrowLeft")&&(v.preventDefault(),p(0)),(v.key==="ArrowDown"||v.key==="ArrowRight")&&(v.preventDefault(),p(0)))},S=(v,$)=>{var w,N;switch(v.key){case"ArrowUp":case"ArrowLeft":{v.preventDefault(),p($>0?$-1:t.length-1);break}case"ArrowDown":case"ArrowRight":{v.preventDefault(),p($<t.length-1?$+1:0);break}case"Enter":case" ":{v.preventDefault(),(N=(w=t[$]).onClick)==null||N.call(w),y();break}case"Escape":{y();break}case"Home":{v.preventDefault(),p(0);break}case"End":{v.preventDefault(),p(t.length-1);break}}},j=v=>d?"0ms":`${v*40}ms`;return e.jsxs(e.Fragment,{children:[u&&typeof document<"u"&&Re.createPortal(e.jsx("div",{"aria-hidden":"true",onClick:y,style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.3)",zIndex:9e3,transition:d?"none":"opacity 200ms ease"}}),document.body),e.jsxs("div",{ref:m,className:x.tkx("fixed z-[9100] font-sans",s??""),style:{...bi[o],...a},children:[u&&t.map((v,$)=>{const w=A.sanitizeString(v.label),N=yi(r,$,vi),I=ki(r);return e.jsx("div",{className:x.tkx("absolute"),style:{...N,opacity:d?1:0,animation:d?"none":"tkxSpeedDialIn 180ms ease forwards",animationDelay:j($)},children:e.jsxs("div",{className:x.tkx("relative inline-flex"),children:[e.jsx("span",{className:x.tkx("absolute z-10 whitespace-nowrap text-xs py-1 px-2 rounded-md pointer-events-none"),style:{...I,backgroundColor:l.surfaceAlt,color:l.text,border:`1px solid ${l.border}`,boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},role:"tooltip",children:w}),e.jsx("button",{ref:M=>{M?b.current.set($,M):b.current.delete($)},type:"button","aria-label":w,tabIndex:u?0:-1,onClick:()=>{var M;(M=v.onClick)==null||M.call(v),y()},onKeyDown:M=>S(M,$),className:x.tkx("inline-flex items-center justify-center rounded-full border-none cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-2","shadow-lg"),style:{width:Cn,height:Cn,backgroundColor:l.surface,color:l.text,border:`1px solid ${l.border}`,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",transition:d?"none":"all 150ms ease"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=l.surfaceAlt,M.currentTarget.style.transform="scale(1.1)"},onMouseLeave:M=>{M.currentTarget.style.backgroundColor=l.surface,M.currentTarget.style.transform="scale(1)"},children:v.icon})]})},v.id)}),e.jsx("button",{type:"button","aria-label":u?"Close actions menu":"Open actions menu","aria-expanded":u,"aria-controls":f,"aria-haspopup":"true",onClick:k,onKeyDown:g,className:x.tkx("inline-flex items-center justify-center rounded-full border-none cursor-pointer","outline-none focus-visible:ring-2 focus-visible:ring-offset-2"),style:{width:Tn,height:Tn,backgroundColor:l.primary,color:l.bg,boxShadow:`0 6px 20px ${l.primary}40`,transition:d?"none":"all 200ms ease",position:"relative",zIndex:1},onMouseEnter:v=>{v.currentTarget.style.boxShadow=`0 8px 28px ${l.primary}60`,d||(v.currentTarget.style.transform="scale(1.05)")},onMouseLeave:v=>{v.currentTarget.style.boxShadow=`0 6px 20px ${l.primary}40`,v.currentTarget.style.transform="scale(1)"},children:n??e.jsx(gi,{color:l.bg,rotated:u,reducedMotion:d})}),e.jsx("div",{id:f,role:"menu","aria-label":"Speed dial actions",style:{display:"none"},children:t.map(v=>e.jsx("div",{role:"menuitem",children:A.sanitizeString(v.label)},v.id))})]}),u&&!d&&e.jsx("style",{children:`
77
+ `})]})}function mr(e,t){let n=[];function r(e,i){for(let a of e)n.push({node:a,depth:i}),a.children?.length&&t.has(a.id)&&r(a.children,i+1)}return r(e,0),n}function hr({expanded:e,color:t,reducedMotion:n}){return(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,style:{transform:e?`rotate(90deg)`:`rotate(0deg)`,transition:n?`none`:`transform 150ms ease`,flexShrink:0},children:(0,s.jsx)(`path`,{d:`M6 3l5 5-5 5`,stroke:t,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function gr({checked:e,color:t,borderColor:r}){return(0,s.jsx)(`span`,{role:`presentation`,"aria-hidden":`true`,className:n.a(`inline-flex items-center justify-center flex-shrink-0`),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${e?t:r}`,backgroundColor:e?t:`transparent`,transition:`all 100ms ease`},children:e&&(0,s.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,children:(0,s.jsx)(`path`,{d:`M2 5l2.5 2.5L8 3`,stroke:`#fff`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})})}var _r=24;function vr({data:e,selected:i,onSelect:a,expanded:c,onExpand:l,multiSelect:u=!1,showCheckboxes:d=!1,showLines:f=!1,className:p,style:m}){let h=t.f(),g=r.o();(0,o.useId)();let[_,v]=(0,o.useState)([]),[y,b]=(0,o.useState)([]),x=new Set(i??_),S=new Set(c??y),C=(0,o.useCallback)(e=>{c===void 0&&b(e),l?.(e)},[c,l]),w=(0,o.useCallback)(e=>{i===void 0&&v(e),a?.(e)},[i,a]),T=(0,o.useCallback)(e=>{let t=Array.from(S);S.has(e)?C(t.filter(t=>t!==e)):C([...t,e])},[S,C]),E=(0,o.useCallback)(e=>{if(u){let t=Array.from(x);x.has(e)?w(t.filter(t=>t!==e)):w([...t,e])}else w(x.has(e)?[]:[e])},[u,x,w]),D=mr(e,S),O=(0,o.useRef)(0),k=(0,o.useRef)(new Map),A=e=>{O.current=e,k.current.get(e)?.focus()},j=(e,t)=>{for(let n of t){if(n.id===e)return n;if(n.children){let t=j(e,n.children);if(t)return t}}},M=(e,t)=>{let n=D[t];if(!n)return;let{node:r}=n,i=(r.children?.length??0)>0;switch(e.key){case`ArrowDown`:e.preventDefault(),t<D.length-1&&A(t+1);break;case`ArrowUp`:e.preventDefault(),t>0&&A(t-1);break;case`ArrowRight`:e.preventDefault(),i&&!S.has(r.id)?T(r.id):i&&S.has(r.id)&&t<D.length-1&&A(t+1);break;case`ArrowLeft`:if(e.preventDefault(),i&&S.has(r.id))T(r.id);else for(let e=t-1;e>=0;e--)if(D[e].depth<n.depth){A(e);break}break;case`Enter`:case` `:e.preventDefault(),r.disabled||E(r.id);break;case`Home`:e.preventDefault(),A(0);break;case`End`:e.preventDefault(),A(D.length-1);break}};return(0,s.jsx)(`ul`,{role:`tree`,"aria-label":`Tree view`,"aria-multiselectable":u||void 0,className:n.a(`list-none m-0 p-0 font-sans select-none`,p??``),style:{color:h.text,...m},children:D.map(({node:e,depth:t},r)=>{let i=(e.children?.length??0)>0,a=S.has(e.id),o=x.has(e.id),c=n.m(e.label);return(0,s.jsxs)(`li`,{role:`treeitem`,"aria-selected":o,"aria-expanded":i?a:void 0,"aria-disabled":e.disabled||void 0,"aria-level":t+1,"aria-setsize":D.filter(e=>e.depth===t).length,tabIndex:r===0?0:-1,ref:e=>{e?k.current.set(r,e):k.current.delete(r)},onKeyDown:e=>M(e,r),onClick:()=>{e.disabled||(i&&T(e.id),E(e.id))},className:n.a(`relative flex items-center gap-1.5 py-1 px-2 rounded-md cursor-pointer`,`outline-none focus-visible:ring-2 focus-visible:ring-offset-1`,e.disabled?`opacity-50 cursor-not-allowed`:``),style:{paddingLeft:t*_r+8,backgroundColor:o?`${h.primary}18`:`transparent`,transition:g?`none`:`background-color 100ms ease`,minHeight:32},onMouseEnter:t=>{!o&&!e.disabled&&(t.currentTarget.style.backgroundColor=h.surfaceAlt)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=o?`${h.primary}18`:`transparent`},children:[f&&t>0&&(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{position:`absolute`,left:(t-1)*_r+16,top:0,bottom:0,width:1,backgroundColor:h.border}}),i?(0,s.jsx)(`span`,{role:`presentation`,onClick:t=>{t.stopPropagation(),T(e.id)},className:n.a(`inline-flex items-center justify-center cursor-pointer`),style:{width:20,height:20},children:(0,s.jsx)(hr,{expanded:a,color:h.textMuted,reducedMotion:g})}):(0,s.jsx)(`span`,{style:{width:20,height:20},"aria-hidden":`true`}),d&&(0,s.jsx)(gr,{checked:o,color:h.primary,borderColor:h.border}),e.icon&&(0,s.jsx)(`span`,{"aria-hidden":`true`,className:n.a(`flex-shrink-0`),children:e.icon}),(0,s.jsx)(`span`,{className:n.a(`text-sm truncate`),style:{color:e.disabled?h.textMuted:h.text},children:c})]},e.id)})})}var yr={sm:{buttonPx:6,buttonPy:4,fontSize:12,iconSize:14,gap:2,separatorSize:16},md:{buttonPx:8,buttonPy:6,fontSize:13,iconSize:16,gap:4,separatorSize:20},lg:{buttonPx:12,buttonPy:8,fontSize:14,iconSize:18,gap:6,separatorSize:24}};function br({items:e,orientation:i=`horizontal`,size:a=`md`,variant:c=`default`,ariaLabel:l=`Toolbar`,className:u,style:d}){let f=t.f(),p=r.o(),m=yr[a],h=i===`horizontal`,g=(0,o.useRef)(new Map),_=e.filter(e=>e.type!==`separator`&&!e.disabled).map(e=>e.id),v=(0,o.useCallback)(e=>{g.current.get(e)?.focus()},[]),y=(0,o.useCallback)((e,t)=>{let n=_.indexOf(t);if(n<0)return;let r=h?`ArrowRight`:`ArrowDown`,i=h?`ArrowLeft`:`ArrowUp`;switch(e.key){case r:e.preventDefault(),v(_[n+1<_.length?n+1:0]);break;case i:e.preventDefault(),v(_[n-1>=0?n-1:_.length-1]);break;case`Home`:e.preventDefault(),v(_[0]);break;case`End`:e.preventDefault(),v(_[_.length-1]);break}},[_,v,h]),b=()=>{switch(c){case`outlined`:return{backgroundColor:`transparent`,border:`1px solid ${f.border}`};case`filled`:return{backgroundColor:f.surfaceAlt,border:`none`};default:return{backgroundColor:f.surface,border:`1px solid ${f.border}`}}},x=e=>{e.type;let t=e.active;return{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,gap:4,padding:`${m.buttonPy}px ${m.buttonPx}px`,fontSize:m.fontSize,borderRadius:6,border:`none`,cursor:e.disabled?`not-allowed`:`pointer`,backgroundColor:t?`${f.primary}20`:`transparent`,color:t?f.primary:e.disabled?f.textMuted:f.text,opacity:e.disabled?.5:1,outline:`none`,transition:p?`none`:`all 100ms ease`,whiteSpace:`nowrap`,lineHeight:1}};return(0,s.jsx)(`div`,{role:`toolbar`,"aria-label":l,"aria-orientation":i,className:n.a(`inline-flex items-center rounded-lg font-sans`,h?`flex-row`:`flex-col`,u??``),style:{...b(),padding:m.gap,gap:m.gap,...d},children:e.map((e,t)=>{if(e.type===`separator`)return(0,s.jsx)(`div`,{role:`separator`,"aria-orientation":h?`vertical`:`horizontal`,className:n.a(`flex-shrink-0`),style:{...h?{width:1,height:m.separatorSize,marginLeft:2,marginRight:2}:{height:1,width:m.separatorSize,marginTop:2,marginBottom:2},backgroundColor:f.border}},e.id);let r=n.m(e.label),i=!e.disabled,a=_[0]===e.id;return(0,s.jsxs)(`button`,{ref:t=>{t?g.current.set(e.id,t):g.current.delete(e.id)},type:`button`,role:(e.type,void 0),"aria-pressed":e.type===`toggle`?e.active:void 0,"aria-label":r,"aria-disabled":e.disabled||void 0,tabIndex:i&&a?0:-1,disabled:e.disabled,onClick:()=>{e.disabled||e.onClick?.()},onKeyDown:t=>{y(t,e.id),(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e.disabled||e.onClick?.())},className:n.a(`focus-visible:ring-2 focus-visible:ring-offset-1`),style:x(e),onMouseEnter:t=>{!e.disabled&&!e.active&&(t.currentTarget.style.backgroundColor=f.surfaceAlt)},onMouseLeave:t=>{e.disabled||(t.currentTarget.style.backgroundColor=e.active?`${f.primary}20`:`transparent`)},children:[e.icon&&(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{width:m.iconSize,height:m.iconSize,display:`flex`,alignItems:`center`,justifyContent:`center`},children:e.icon}),!e.icon&&r]},e.id)})})}function xr({color:e}){return(0,s.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4.5`,stroke:e,strokeWidth:`1.5`}),(0,s.jsx)(`path`,{d:`M9.5 9.5L13 13`,stroke:e,strokeWidth:`1.5`,strokeLinecap:`round`})]})}function Sr({checked:e,primaryColor:t,borderColor:r}){return(0,s.jsx)(`span`,{"aria-hidden":`true`,className:n.a(`inline-flex items-center justify-center flex-shrink-0`),style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${e?t:r}`,backgroundColor:e?t:`transparent`,transition:`all 100ms ease`},children:e&&(0,s.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,children:(0,s.jsx)(`path`,{d:`M2 5l2.5 2.5L8 3`,stroke:`#fff`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})})}function Cr({color:e}){return(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M3 8h10M9 4l4 4-4 4`,stroke:e,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function wr({color:e}){return(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M13 8H3M7 4l-4 4 4 4`,stroke:e,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Tr({title:e,items:i,selected:a,onToggle:c,onToggleAll:l,search:u,onSearchChange:d,searchable:f,height:p,listId:m}){let h=t.f(),g=r.o(),_=n.m(e),v=(0,o.useMemo)(()=>{if(!u)return i;let e=u.toLowerCase();return i.filter(t=>t.label.toLowerCase().includes(e))},[i,u]),y=v.filter(e=>!e.disabled),b=y.length>0&&y.every(e=>a.has(e.value));y.some(e=>a.has(e.value));let x=(e,t)=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c(t))};return(0,s.jsxs)(`div`,{className:n.a(`flex flex-col rounded-lg overflow-hidden flex-1 min-w-0`),style:{border:`1px solid ${h.border}`,backgroundColor:h.surface},children:[(0,s.jsxs)(`div`,{className:n.a(`flex items-center gap-2 px-3 py-2 border-b`),style:{borderColor:h.border,backgroundColor:h.surfaceAlt},children:[(0,s.jsx)(`button`,{type:`button`,"aria-label":b?`Deselect all ${_}`:`Select all ${_}`,onClick:l,className:n.a(`border-none bg-transparent cursor-pointer p-0 outline-none focus-visible:ring-2`),children:(0,s.jsx)(Sr,{checked:b,primaryColor:h.primary,borderColor:h.border})}),(0,s.jsx)(`span`,{className:n.a(`text-sm font-medium flex-1 truncate`),style:{color:h.text},children:_}),(0,s.jsxs)(`span`,{className:n.a(`text-xs`),style:{color:h.textMuted},children:[a.size,`/`,i.length]})]}),f&&(0,s.jsxs)(`div`,{className:n.a(`flex items-center gap-1.5 px-3 py-1.5 border-b`),style:{borderColor:h.border},children:[(0,s.jsx)(xr,{color:h.textMuted}),(0,s.jsx)(`input`,{type:`text`,"aria-label":`Search ${_}`,value:u,onChange:e=>d(e.target.value),placeholder:`Search...`,className:n.a(`flex-1 bg-transparent border-none outline-none text-xs`),style:{color:h.text}})]}),(0,s.jsx)(`ul`,{id:m,role:`listbox`,"aria-label":_,"aria-multiselectable":`true`,className:n.a(`list-none m-0 p-1 overflow-y-auto`),style:{height:p,minHeight:100},children:v.length===0?(0,s.jsx)(`li`,{className:n.a(`text-xs text-center py-4`),style:{color:h.textMuted},"aria-disabled":`true`,children:`No items`}):v.map(e=>{let t=a.has(e.value),r=n.m(e.label);return(0,s.jsxs)(`li`,{role:`option`,"aria-selected":t,"aria-disabled":e.disabled||void 0,tabIndex:0,onClick:()=>!e.disabled&&c(e.value),onKeyDown:t=>!e.disabled&&x(t,e.value),className:n.a(`flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm`,`outline-none focus-visible:ring-2 focus-visible:ring-offset-1`,e.disabled?`opacity-50 cursor-not-allowed`:``),style:{color:e.disabled?h.textMuted:h.text,backgroundColor:t?`${h.primary}10`:`transparent`,transition:g?`none`:`background-color 100ms ease`},onMouseEnter:n=>{!e.disabled&&!t&&(n.currentTarget.style.backgroundColor=h.surfaceAlt)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=t?`${h.primary}10`:`transparent`},children:[(0,s.jsx)(Sr,{checked:t,primaryColor:h.primary,borderColor:h.border}),(0,s.jsx)(`span`,{className:n.a(`truncate`),children:r})]},e.value)})})]})}function Er({sourceItems:e,targetItems:i,onTransfer:a,sourceTitle:c=`Available`,targetTitle:l=`Selected`,searchable:u=!1,height:d=300,className:f,style:p}){let m=t.f(),h=r.o(),g=(0,o.useId)(),_=(0,o.useId)(),[v,y]=(0,o.useState)(new Set),[b,x]=(0,o.useState)(new Set),[S,C]=(0,o.useState)(``),[w,T]=(0,o.useState)(``),E=(0,o.useCallback)(e=>{y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),D=(0,o.useCallback)(e=>{x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),O=(0,o.useCallback)(()=>{let t=e.filter(e=>!e.disabled).map(e=>e.value);t.every(e=>v.has(e))?y(new Set):y(new Set(t))},[e,v]),k=(0,o.useCallback)(()=>{let e=i.filter(e=>!e.disabled).map(e=>e.value);e.every(e=>b.has(e))?x(new Set):x(new Set(e))},[i,b]),A=(0,o.useCallback)(()=>{if(v.size===0)return;let t=e.filter(e=>v.has(e.value)&&!e.disabled);a(e.filter(e=>!v.has(e.value)||e.disabled),[...i,...t]),y(new Set)},[e,i,v,a]),j=(0,o.useCallback)(()=>{if(b.size===0)return;let t=i.filter(e=>b.has(e.value)&&!e.disabled),n=i.filter(e=>!b.has(e.value)||e.disabled);a([...e,...t],n),x(new Set)},[e,i,b,a]),M=e=>({display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:36,height:36,borderRadius:8,border:`1px solid ${m.border}`,backgroundColor:e?m.surface:m.surfaceAlt,cursor:e?`not-allowed`:`pointer`,opacity:e?.5:1,transition:h?`none`:`all 100ms ease`,outline:`none`});return(0,s.jsxs)(`div`,{className:n.a(`flex gap-3 font-sans`,`flex-col sm:flex-row`,f??``),style:{color:m.text,...p},children:[(0,s.jsx)(Tr,{title:c,items:e,selected:v,onToggle:E,onToggleAll:O,search:S,onSearchChange:C,searchable:u,height:d,listId:g}),(0,s.jsxs)(`div`,{className:n.a(`flex items-center justify-center gap-2`,`flex-row sm:flex-col`),style:{padding:`8px 0`},children:[(0,s.jsx)(`button`,{type:`button`,"aria-label":`Move selected items to target list`,disabled:v.size===0,onClick:A,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),A())},className:n.a(`focus-visible:ring-2 focus-visible:ring-offset-1`),style:M(v.size===0),onMouseEnter:e=>{v.size>0&&(e.currentTarget.style.backgroundColor=m.primary,e.currentTarget.style.borderColor=m.primary)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=v.size===0?m.surface:m.surfaceAlt,e.currentTarget.style.borderColor=m.border},children:(0,s.jsx)(Cr,{color:m.text})}),(0,s.jsx)(`button`,{type:`button`,"aria-label":`Move selected items to source list`,disabled:b.size===0,onClick:j,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),j())},className:n.a(`focus-visible:ring-2 focus-visible:ring-offset-1`),style:M(b.size===0),onMouseEnter:e=>{b.size>0&&(e.currentTarget.style.backgroundColor=m.primary,e.currentTarget.style.borderColor=m.primary)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=b.size===0?m.surface:m.surfaceAlt,e.currentTarget.style.borderColor=m.border},children:(0,s.jsx)(wr,{color:m.text})})]}),(0,s.jsx)(Tr,{title:l,items:i,selected:b,onToggle:D,onToggleAll:k,search:w,onSearchChange:T,searchable:u,height:d,listId:_})]})}function Dr({color:e,rotated:t,reducedMotion:n}){return(0,s.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,style:{transform:t?`rotate(45deg)`:`rotate(0deg)`,transition:n?`none`:`transform 200ms ease`},children:(0,s.jsx)(`path`,{d:`M12 5v14M5 12h14`,stroke:e,strokeWidth:`2.5`,strokeLinecap:`round`})})}var Or={"bottom-right":{bottom:24,right:24},"bottom-left":{bottom:24,left:24},"top-right":{top:24,right:24},"top-left":{top:24,left:24}};function kr(e,t,n){let r=(t+1)*n;switch(e){case`up`:return{bottom:r,left:`50%`,transform:`translateX(-50%)`};case`down`:return{top:r,left:`50%`,transform:`translateX(-50%)`};case`left`:return{right:r,top:`50%`,transform:`translateY(-50%)`};case`right`:return{left:r,top:`50%`,transform:`translateY(-50%)`}}}function Ar(e){switch(e){case`up`:case`down`:return{right:`100%`,top:`50%`,transform:`translateY(-50%)`,marginRight:10};case`left`:return{bottom:`100%`,left:`50%`,transform:`translateX(-50%)`,marginBottom:10};case`right`:return{bottom:`100%`,left:`50%`,transform:`translateX(-50%)`,marginBottom:10}}}var jr=56,Mr=48,Nr=64;function Pr({actions:e,icon:i,direction:a=`up`,position:l=`bottom-right`,className:u,style:d}){let f=t.f(),p=r.o(),m=(0,o.useId)(),[h,g]=(0,o.useState)(!1),[_,v]=(0,o.useState)(-1),y=(0,o.useRef)(null),b=(0,o.useRef)(new Map),x=(0,o.useCallback)(()=>{g(e=>!e),v(-1)},[]),S=(0,o.useCallback)(()=>{g(!1),v(-1)},[]);r.r(S,h),(0,o.useEffect)(()=>{if(!h)return;let e=e=>{y.current?.contains(e.target)||S()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[h,S]),(0,o.useEffect)(()=>{_>=0&&b.current.get(_)?.focus()},[_]);let C=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),x()),h&&((e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),v(0)),(e.key===`ArrowDown`||e.key===`ArrowRight`)&&(e.preventDefault(),v(0)))},w=(t,n)=>{switch(t.key){case`ArrowUp`:case`ArrowLeft`:t.preventDefault(),v(n>0?n-1:e.length-1);break;case`ArrowDown`:case`ArrowRight`:t.preventDefault(),v(n<e.length-1?n+1:0);break;case`Enter`:case` `:t.preventDefault(),e[n].onClick?.(),S();break;case`Escape`:S();break;case`Home`:t.preventDefault(),v(0);break;case`End`:t.preventDefault(),v(e.length-1);break}},T=e=>p?`0ms`:`${e*40}ms`;return(0,s.jsxs)(s.Fragment,{children:[h&&typeof document<`u`&&(0,c.createPortal)((0,s.jsx)(`div`,{"aria-hidden":`true`,onClick:S,style:{position:`fixed`,inset:0,backgroundColor:`rgba(0,0,0,0.3)`,zIndex:9e3,transition:p?`none`:`opacity 200ms ease`}}),document.body),(0,s.jsxs)(`div`,{ref:y,className:n.a(`fixed z-[9100] font-sans`,u??``),style:{...Or[l],...d},children:[h&&e.map((e,t)=>{let r=n.m(e.label),i=kr(a,t,Nr),o=Ar(a);return(0,s.jsx)(`div`,{className:n.a(`absolute`),style:{...i,opacity:+!!p,animation:p?`none`:`tkxSpeedDialIn 180ms ease forwards`,animationDelay:T(t)},children:(0,s.jsxs)(`div`,{className:n.a(`relative inline-flex`),children:[(0,s.jsx)(`span`,{className:n.a(`absolute z-10 whitespace-nowrap text-xs py-1 px-2 rounded-md pointer-events-none`),style:{...o,backgroundColor:f.surfaceAlt,color:f.text,border:`1px solid ${f.border}`,boxShadow:`0 2px 8px rgba(0,0,0,0.15)`},role:`tooltip`,children:r}),(0,s.jsx)(`button`,{ref:e=>{e?b.current.set(t,e):b.current.delete(t)},type:`button`,"aria-label":r,tabIndex:h?0:-1,onClick:()=>{e.onClick?.(),S()},onKeyDown:e=>w(e,t),className:n.a(`inline-flex items-center justify-center rounded-full border-none cursor-pointer`,`outline-none focus-visible:ring-2 focus-visible:ring-offset-2`,`shadow-lg`),style:{width:Mr,height:Mr,backgroundColor:f.surface,color:f.text,border:`1px solid ${f.border}`,boxShadow:`0 4px 12px rgba(0,0,0,0.15)`,transition:p?`none`:`all 150ms ease`},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=f.surfaceAlt,e.currentTarget.style.transform=`scale(1.1)`},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=f.surface,e.currentTarget.style.transform=`scale(1)`},children:e.icon})]})},e.id)}),(0,s.jsx)(`button`,{type:`button`,"aria-label":h?`Close actions menu`:`Open actions menu`,"aria-expanded":h,"aria-controls":m,"aria-haspopup":`true`,onClick:x,onKeyDown:C,className:n.a(`inline-flex items-center justify-center rounded-full border-none cursor-pointer`,`outline-none focus-visible:ring-2 focus-visible:ring-offset-2`),style:{width:jr,height:jr,backgroundColor:f.primary,color:f.bg,boxShadow:`0 6px 20px ${f.primary}40`,transition:p?`none`:`all 200ms ease`,position:`relative`,zIndex:1},onMouseEnter:e=>{e.currentTarget.style.boxShadow=`0 8px 28px ${f.primary}60`,p||(e.currentTarget.style.transform=`scale(1.05)`)},onMouseLeave:e=>{e.currentTarget.style.boxShadow=`0 6px 20px ${f.primary}40`,e.currentTarget.style.transform=`scale(1)`},children:i??(0,s.jsx)(Dr,{color:f.bg,rotated:h,reducedMotion:p})}),(0,s.jsx)(`div`,{id:m,role:`menu`,"aria-label":`Speed dial actions`,style:{display:`none`},children:e.map(e=>(0,s.jsx)(`div`,{role:`menuitem`,children:n.m(e.label)},e.id))})]}),h&&!p&&(0,s.jsx)(`style`,{children:`
78
78
  @keyframes tkxSpeedDialIn {
79
79
  from { opacity: 0; transform: translateX(-50%) scale(0.5); }
80
80
  to { opacity: 1; transform: translateX(-50%) scale(1); }
81
81
  }
82
- `})]})}const In=768,ji=56;function Si({open:t}){return e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round","aria-hidden":"true",children:t?e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})})}function Mi(){const[t,n]=i.useState(()=>typeof window>"u"?!1:window.innerWidth<In);return i.useEffect(()=>{if(typeof window>"u")return;const r=()=>n(window.innerWidth<In);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),t}function Ti({title:t,logo:n,actions:r,navigation:o,position:s="sticky",variant:a="default",color:l="surface"}){const d=O.useTheme(),f=J.useReducedMotion(),u=Mi(),[c,h]=i.useState(!1),p=i.useRef(null),m=i.useId();J.useEscapeKey(()=>h(!1),c),i.useEffect(()=>{!u&&c&&h(!1)},[u,c]),i.useEffect(()=>{if(!c)return;const $=w=>{p.current&&!p.current.contains(w.target)&&h(!1)};return document.addEventListener("pointerdown",$),()=>document.removeEventListener("pointerdown",$)},[c]);const b=i.useCallback(()=>{h($=>!$)},[]),k=l==="primary"?d.primary:d.surface,y=l==="primary"?d.bg:d.text,g={default:{backgroundColor:k,borderBottom:`1px solid ${d.border}`},transparent:{backgroundColor:"transparent",borderBottom:"none"},elevated:{backgroundColor:k,boxShadow:`0 2px 8px ${d.bg}66`,borderBottom:"none"}},S={fixed:{position:"fixed",top:0,left:0,right:0,zIndex:1100},sticky:{position:"sticky",top:0,zIndex:1100},static:{position:"static"}},j=typeof t=="string"?A.sanitizeString(t):t,v=f?"none":"max-height 300ms cubic-bezier(0.4,0,0.2,1), opacity 300ms ease";return e.jsxs("header",{role:"banner",className:x.tkx("font-sans w-full"),style:{...S[s],...g[a],color:y,height:ji},children:[e.jsxs("div",{ref:p,className:x.tkx("flex items-center h-full px-4"),style:{maxWidth:1440,margin:"0 auto"},children:[n&&e.jsx("div",{className:x.tkx("flex items-center shrink-0 mr-3"),"aria-hidden":"true",children:n}),j&&e.jsx("div",{className:x.tkx("text-base font-semibold shrink-0 mr-4 leading-snug"),style:{color:y},children:j}),!u&&o&&e.jsx("nav",{id:m,"aria-label":"Main navigation",className:x.tkx("flex items-center flex-1 gap-1"),children:o}),u&&e.jsx("div",{className:x.tkx("flex-1")}),r&&e.jsx("div",{className:x.tkx("flex items-center gap-2 ml-auto shrink-0"),children:r}),u&&o&&e.jsx("button",{onClick:b,"aria-expanded":c,"aria-controls":m,"aria-label":c?"Close navigation menu":"Open navigation menu",className:x.tkx("bg-transparent border-none cursor-pointer p-2 ml-2 rounded flex items-center justify-center","focus-visible:focus-ring"),style:{color:y},children:e.jsx(Si,{open:c})})]}),u&&o&&e.jsx("nav",{id:m,"aria-label":"Main navigation",style:{maxHeight:c?400:0,opacity:c?1:0,overflow:"hidden",transition:v,backgroundColor:d.surface,borderBottom:c?`1px solid ${d.border}`:"none"},children:e.jsx("div",{className:x.tkx("flex flex-col gap-1 px-4 py-3"),role:"menu",children:o})})]})}const Ci=5,Ii=56;let $n=!1;function $i(){if($n||typeof document>"u")return;$n=!0;const t=document.createElement("style");t.id="tkx-bottom-nav-kf",t.textContent=`
82
+ `})]})}var Fr=768,Ir=56;function Lr({open:e}){return(0,s.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,"aria-hidden":`true`,children:e?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,s.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`line`,{x1:`3`,y1:`6`,x2:`21`,y2:`6`}),(0,s.jsx)(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),(0,s.jsx)(`line`,{x1:`3`,y1:`18`,x2:`21`,y2:`18`})]})})}function Rr(){let[e,t]=(0,o.useState)(()=>typeof window>`u`?!1:window.innerWidth<Fr);return(0,o.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>t(window.innerWidth<Fr);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function zr({title:e,logo:i,actions:a,navigation:c,position:l=`sticky`,variant:u=`default`,color:d=`surface`}){let f=t.f(),p=r.o(),m=Rr(),[h,g]=(0,o.useState)(!1),_=(0,o.useRef)(null),v=(0,o.useId)();r.r(()=>g(!1),h),(0,o.useEffect)(()=>{!m&&h&&g(!1)},[m,h]),(0,o.useEffect)(()=>{if(!h)return;let e=e=>{_.current&&!_.current.contains(e.target)&&g(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[h]);let y=(0,o.useCallback)(()=>{g(e=>!e)},[]),b=d===`primary`?f.primary:f.surface,x=d===`primary`?f.bg:f.text,S={default:{backgroundColor:b,borderBottom:`1px solid ${f.border}`},transparent:{backgroundColor:`transparent`,borderBottom:`none`},elevated:{backgroundColor:b,boxShadow:`0 2px 8px ${f.bg}66`,borderBottom:`none`}},C={fixed:{position:`fixed`,top:0,left:0,right:0,zIndex:1100},sticky:{position:`sticky`,top:0,zIndex:1100},static:{position:`static`}},w=typeof e==`string`?n.m(e):e,T=p?`none`:`max-height 300ms cubic-bezier(0.4,0,0.2,1), opacity 300ms ease`;return(0,s.jsxs)(`header`,{role:`banner`,className:n.a(`font-sans w-full`),style:{...C[l],...S[u],color:x,height:Ir},children:[(0,s.jsxs)(`div`,{ref:_,className:n.a(`flex items-center h-full px-4`),style:{maxWidth:1440,margin:`0 auto`},children:[i&&(0,s.jsx)(`div`,{className:n.a(`flex items-center shrink-0 mr-3`),"aria-hidden":`true`,children:i}),w&&(0,s.jsx)(`div`,{className:n.a(`text-base font-semibold shrink-0 mr-4 leading-snug`),style:{color:x},children:w}),!m&&c&&(0,s.jsx)(`nav`,{id:v,"aria-label":`Main navigation`,className:n.a(`flex items-center flex-1 gap-1`),children:c}),m&&(0,s.jsx)(`div`,{className:n.a(`flex-1`)}),a&&(0,s.jsx)(`div`,{className:n.a(`flex items-center gap-2 ml-auto shrink-0`),children:a}),m&&c&&(0,s.jsx)(`button`,{onClick:y,"aria-expanded":h,"aria-controls":v,"aria-label":h?`Close navigation menu`:`Open navigation menu`,className:n.a(`bg-transparent border-none cursor-pointer p-2 ml-2 rounded flex items-center justify-center`,`focus-visible:focus-ring`),style:{color:x},children:(0,s.jsx)(Lr,{open:h})})]}),m&&c&&(0,s.jsx)(`nav`,{id:v,"aria-label":`Main navigation`,style:{maxHeight:h?400:0,opacity:+!!h,overflow:`hidden`,transition:T,backgroundColor:f.surface,borderBottom:h?`1px solid ${f.border}`:`none`},children:(0,s.jsx)(`div`,{className:n.a(`flex flex-col gap-1 px-4 py-3`),role:`menu`,children:c})})]})}var Br=5,Vr=56,Hr=!1;function Ur(){if(Hr||typeof document>`u`)return;Hr=!0;let e=document.createElement(`style`);e.id=`tkx-bottom-nav-kf`,e.textContent=`
83
83
  @keyframes tkx-bottom-nav-pulse {
84
84
  0% { transform: scale(1); }
85
85
  50% { transform: scale(1.15); }
86
86
  100% { transform: scale(1); }
87
87
  }
88
- `,document.head.appendChild(t)}function zi({items:t,activeId:n,onChange:r,showLabels:o=!0}){const s=O.useTheme(),a=J.useReducedMotion(),l=i.useRef(null);i.useEffect(()=>{$i()},[]);const d=t.slice(0,Ci),f=i.useCallback(h=>{r==null||r(h)},[r]),u=i.useCallback(h=>{const p=l.current;if(!p)return;const m=Array.from(p.querySelectorAll('[role="tab"]')),b=m.findIndex(y=>y===document.activeElement);if(b===-1)return;let k=b;h.key==="ArrowRight"||h.key==="ArrowDown"?(h.preventDefault(),k=(b+1)%m.length):h.key==="ArrowLeft"||h.key==="ArrowUp"?(h.preventDefault(),k=(b-1+m.length)%m.length):h.key==="Home"?(h.preventDefault(),k=0):h.key==="End"&&(h.preventDefault(),k=m.length-1),k!==b&&(m[k].focus(),f(d[k].id))},[f,d]),c=a?"none":"color 200ms ease, transform 150ms ease";return e.jsx("nav",{ref:l,role:"navigation","aria-label":"Bottom navigation",className:x.tkx("fixed bottom-0 left-0 right-0 z-[1000] font-sans"),style:{height:Ii,backgroundColor:s.surface,borderTop:`1px solid ${s.border}`,boxShadow:`0 -2px 12px ${s.bg}44`},children:e.jsx("div",{role:"tablist","aria-label":"Navigation tabs",className:x.tkx("flex items-center justify-around h-full"),onKeyDown:u,children:d.map(h=>{const p=h.id===n,m=A.sanitizeString(h.label),b=p?s.primary:s.textMuted;return e.jsxs("button",{role:"tab","aria-selected":p,"aria-label":m,tabIndex:p?0:-1,onClick:()=>f(h.id),className:x.tkx("flex flex-col items-center justify-center gap-0.5","bg-transparent border-none cursor-pointer p-1","flex-1 h-full relative","focus-visible:focus-ring"),style:{color:b,transition:c,outline:"none"},children:[p&&e.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:0,left:"25%",right:"25%",height:3,borderRadius:"0 0 3px 3px",backgroundColor:s.primary,transition:a?"none":"width 200ms ease"}}),e.jsxs("div",{className:x.tkx("relative flex items-center justify-center"),style:{animation:p&&!a?"tkx-bottom-nav-pulse 300ms ease-out":"none"},children:[h.icon,h.badge!==void 0&&h.badge>0&&e.jsx("span",{"aria-label":`${h.badge} notifications`,className:x.tkx("absolute flex items-center justify-center","text-[10px] font-bold leading-none rounded-full"),style:{top:-4,right:-8,minWidth:16,height:16,padding:"0 4px",backgroundColor:s.danger,color:s.bg},children:h.badge>99?"99+":h.badge})]}),o&&e.jsx("span",{className:x.tkx("text-[10px] leading-tight mt-0.5"),style:{fontWeight:p?600:400,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m})]},h.id)})})})}const Ei=5e3;let zn=!1;function Ni(){if(zn||typeof document>"u")return;zn=!0;const t=document.createElement("style");t.id="tkx-snackbar-kf",t.textContent=`
88
+ `,document.head.appendChild(e)}function Wr({items:e,activeId:i,onChange:a,showLabels:c=!0}){let l=t.f(),u=r.o(),d=(0,o.useRef)(null);(0,o.useEffect)(()=>{Ur()},[]);let f=e.slice(0,Br),p=(0,o.useCallback)(e=>{a?.(e)},[a]),m=(0,o.useCallback)(e=>{let t=d.current;if(!t)return;let n=Array.from(t.querySelectorAll(`[role="tab"]`)),r=n.findIndex(e=>e===document.activeElement);if(r===-1)return;let i=r;e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),i=(r+1)%n.length):e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),i=(r-1+n.length)%n.length):e.key===`Home`?(e.preventDefault(),i=0):e.key===`End`&&(e.preventDefault(),i=n.length-1),i!==r&&(n[i].focus(),p(f[i].id))},[p,f]),h=u?`none`:`color 200ms ease, transform 150ms ease`;return(0,s.jsx)(`nav`,{ref:d,role:`navigation`,"aria-label":`Bottom navigation`,className:n.a(`fixed bottom-0 left-0 right-0 z-[1000] font-sans`),style:{height:Vr,backgroundColor:l.surface,borderTop:`1px solid ${l.border}`,boxShadow:`0 -2px 12px ${l.bg}44`},children:(0,s.jsx)(`div`,{role:`tablist`,"aria-label":`Navigation tabs`,className:n.a(`flex items-center justify-around h-full`),onKeyDown:m,children:f.map(e=>{let t=e.id===i,r=n.m(e.label),a=t?l.primary:l.textMuted;return(0,s.jsxs)(`button`,{role:`tab`,"aria-selected":t,"aria-label":r,tabIndex:t?0:-1,onClick:()=>p(e.id),className:n.a(`flex flex-col items-center justify-center gap-0.5`,`bg-transparent border-none cursor-pointer p-1`,`flex-1 h-full relative`,`focus-visible:focus-ring`),style:{color:a,transition:h,outline:`none`},children:[t&&(0,s.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,top:0,left:`25%`,right:`25%`,height:3,borderRadius:`0 0 3px 3px`,backgroundColor:l.primary,transition:u?`none`:`width 200ms ease`}}),(0,s.jsxs)(`div`,{className:n.a(`relative flex items-center justify-center`),style:{animation:t&&!u?`tkx-bottom-nav-pulse 300ms ease-out`:`none`},children:[e.icon,e.badge!==void 0&&e.badge>0&&(0,s.jsx)(`span`,{"aria-label":`${e.badge} notifications`,className:n.a(`absolute flex items-center justify-center`,`text-[10px] font-bold leading-none rounded-full`),style:{top:-4,right:-8,minWidth:16,height:16,padding:`0 4px`,backgroundColor:l.danger,color:l.bg},children:e.badge>99?`99+`:e.badge})]}),c&&(0,s.jsx)(`span`,{className:n.a(`text-[10px] leading-tight mt-0.5`),style:{fontWeight:t?600:400,maxWidth:`100%`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r})]},e.id)})})})}var Gr=5e3,Kr=!1;function qr(){if(Kr||typeof document>`u`)return;Kr=!0;let e=document.createElement(`style`);e.id=`tkx-snackbar-kf`,e.textContent=`
89
89
  @keyframes tkx-snackbar-slide-up {
90
90
  from { opacity: 0; transform: translateY(24px); }
91
91
  to { opacity: 1; transform: translateY(0); }
@@ -98,37 +98,37 @@
98
98
  from { opacity: 1; }
99
99
  to { opacity: 0; transform: translateY(8px); }
100
100
  }
101
- `,document.head.appendChild(t)}const Ri={success:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),error:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),warning:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),info:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})})},Li={"bottom-left":{bottom:24,left:24},"bottom-center":{bottom:24,left:"50%",transform:"translateX(-50%)"},"bottom-right":{bottom:24,right:24},"top-center":{top:24,left:"50%",transform:"translateX(-50%)"}};function Ai({message:t,isOpen:n,onClose:r,action:o,variant:s="default",position:a="bottom-center",autoHideDuration:l=Ei,icon:d}){const f=O.useTheme(),u=J.useReducedMotion(),c=i.useId(),h=i.useRef(null),[p,m]=i.useState(!1),[b,k]=i.useState(!1);i.useEffect(()=>{Ni()},[]),i.useEffect(()=>{if(n)k(!1),m(!0);else if(p)if(u)m(!1);else{k(!0);const M=setTimeout(()=>{m(!1),k(!1)},250);return()=>clearTimeout(M)}},[n,u,p]),i.useEffect(()=>{if(!(!n||l<=0||!r))return h.current=setTimeout(()=>{r()},l),()=>{h.current&&clearTimeout(h.current)}},[n,l,r]);const y=i.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),g=i.useCallback(()=>{n&&l>0&&r&&(h.current=setTimeout(()=>r(),l))},[n,l,r]),j={default:f.textMuted,success:f.success,error:f.danger,warning:f.warning,info:f.info}[s],v=A.sanitizeString(t);if(!p||typeof document>"u")return null;const w=a==="top-center"?"tkx-snackbar-slide-down":"tkx-snackbar-slide-up";let N={};u||(b?N={animation:"tkx-snackbar-fade-out 250ms ease forwards"}:N={animation:`${w} 250ms cubic-bezier(0.16,1,0.3,1) both`});const I=d??Ri[s]??null;return Re.createPortal(e.jsx("div",{role:s==="error"?"alert":"status","aria-live":s==="error"?"assertive":"polite","aria-atomic":"true","aria-labelledby":c,className:x.tkx("fixed z-[9500] font-sans"),style:{...Li[a],...N,pointerEvents:"auto"},onMouseEnter:y,onMouseLeave:g,children:e.jsxs("div",{className:x.tkx("flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg","min-w-[280px] max-w-[480px]"),style:{backgroundColor:f.surface,border:`1px solid ${j}44`,boxShadow:`0 8px 24px ${f.bg}aa`,color:f.text},children:[I&&e.jsx("span",{className:x.tkx("shrink-0 flex items-center"),style:{color:j},children:I}),e.jsx("span",{id:c,className:x.tkx("flex-1 text-sm leading-snug"),children:v}),o&&e.jsx("button",{onClick:()=>{o.onClick(),r==null||r()},className:x.tkx("bg-transparent border-none cursor-pointer p-0 ml-2","text-sm font-semibold shrink-0","focus-visible:focus-ring"),style:{color:f.primary},children:A.sanitizeString(o.label)}),r&&e.jsx("button",{"aria-label":"Dismiss snackbar",onClick:r,className:x.tkx("bg-transparent border-none cursor-pointer rounded p-[2px] ml-1","shrink-0 flex items-center justify-center","focus-visible:focus-ring"),style:{color:f.textMuted},children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),document.body)}function Di({direction:t}){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:x.tkx("shrink-0 ml-1"),children:t==="asc"?e.jsx("path",{d:"M7 14l5-5 5 5H7z"}):t==="desc"?e.jsx("path",{d:"M7 10l5 5 5-5H7z"}):e.jsx("path",{d:"M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z",opacity:"0.35"})})}function En({checked:t,indeterminate:n}){const r=O.useTheme();return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[e.jsx("rect",{x:"1",y:"1",width:"14",height:"14",rx:"2",fill:t||n?r.primary:"transparent",stroke:t||n?r.primary:r.border,strokeWidth:"1.5"}),n&&e.jsx("line",{x1:"4",y1:"8",x2:"12",y2:"8",stroke:r.bg,strokeWidth:"2"}),t&&!n&&e.jsx("path",{d:"M4.5 8L7 10.5L11.5 5.5",fill:"none",stroke:r.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Nn(t,n){return typeof n=="function"?n(t):String(t[n])}function bt(t,n){return t[n]}function Bi(t,n){return t==null&&n==null?0:t==null?1:n==null?-1:typeof t=="number"&&typeof n=="number"?t-n:String(t).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}function Rn(t){const n=String(t??"");return n.includes(",")||n.includes('"')||n.includes(`
102
- `)?`"${n.replace(/"/g,'""')}"`:n}function Wi({colCount:t}){const n=O.useTheme();return e.jsx("tbody",{children:Array.from({length:5},(r,o)=>e.jsx("tr",{children:Array.from({length:t},(s,a)=>e.jsx("td",{className:x.tkx("px-3 py-2"),style:{borderBottom:`1px solid ${n.border}`},children:e.jsx(xt,{height:16})},a))},o))})}function Fi({label:t,showExport:n,onExport:r,totalRows:o,selectedCount:s,theme:a}){return!n&&s===0?null:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderBottom:`1px solid ${a.border}`,backgroundColor:a.surface,gap:8},children:[e.jsx("span",{style:{fontSize:13,color:a.textMuted},children:s>0?`${s} of ${o} row${o!==1?"s":""} selected`:`${o} row${o!==1?"s":""}`}),n&&e.jsxs("button",{onClick:r,"aria-label":`Export ${t} as CSV`,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 12px",fontSize:13,fontWeight:500,borderRadius:6,border:`1px solid ${a.border}`,backgroundColor:"transparent",color:a.text,cursor:"pointer"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"7 10 12 15 17 10"}),e.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),"Export CSV"]})]})}function Pi({page:t,totalPages:n,pageSize:r,totalRows:o,onPageChange:s,theme:a}){const l=(t-1)*r+1,d=Math.min(t*r,o),f={display:"inline-flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:6,border:`1px solid ${a.border}`,backgroundColor:"transparent",color:a.text,cursor:"pointer",fontSize:13,fontWeight:500};return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderTop:`1px solid ${a.border}`,backgroundColor:a.surface,gap:8,flexWrap:"wrap"},role:"navigation","aria-label":"Pagination",children:[e.jsx("span",{style:{fontSize:13,color:a.textMuted},children:o===0?"0 rows":`${l}–${d} of ${o}`}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{onClick:()=>s(1),disabled:t===1,"aria-label":"First page",style:{...f,opacity:t===1?.4:1},children:"«"}),e.jsx("button",{onClick:()=>s(t-1),disabled:t===1,"aria-label":"Previous page",style:{...f,opacity:t===1?.4:1},children:"‹"}),Array.from({length:Math.min(5,n)},(u,c)=>{let h=c+1;if(n>5){const p=Math.floor(2.5);h=Math.max(1,Math.min(t-p,n-4))+c}return e.jsx("button",{onClick:()=>s(h),"aria-label":`Page ${h}`,"aria-current":h===t?"page":void 0,style:{...f,backgroundColor:h===t?a.primary:"transparent",color:h===t?a.bg:a.text,borderColor:h===t?a.primary:a.border},children:h},h)}),e.jsx("button",{onClick:()=>s(t+1),disabled:t===n,"aria-label":"Next page",style:{...f,opacity:t===n?.4:1},children:"›"}),e.jsx("button",{onClick:()=>s(n),disabled:t===n,"aria-label":"Last page",style:{...f,opacity:t===n?.4:1},children:"»"})]})]})}function Hi({columns:t,data:n,rowKey:r,selectable:o=!1,selectedRows:s=[],onSelectionChange:a,sortable:l=!1,onSort:d,loading:f=!1,emptyMessage:u="No data to display",stickyHeader:c=!1,striped:h=!1,bordered:p=!1,compact:m=!1,maxHeight:b,onRowClick:k,virtualScroll:y,rowHeight:g=40,showFilters:S=!1,filterValues:j,onFilterChange:v,pageSize:$=0,showExport:w=!1,exportFileName:N="export",onLoadMore:I,hasMore:M,loadingMore:T=!1,loadMoreThreshold:E=200}){const C=O.useTheme(),H=J.useReducedMotion(),z=i.useId(),[L,B]=i.useState(null),[V,D]=i.useState("asc"),_=i.useCallback(q=>{const P=L===q&&V==="asc"?"desc":"asc";B(q),D(P),d==null||d(q,P)},[L,V,d]),R=i.useMemo(()=>d||!L?n:[...n].sort((q,P)=>{const Q=bt(q,L),re=bt(P,L),le=Bi(Q,re);return V==="asc"?le:-le}),[n,L,V,d]),[F,W]=i.useState({}),K=j??F,ne=i.useCallback((q,P)=>{v?v(q,P):W(Q=>({...Q,[q]:P}))},[v]),Z=i.useMemo(()=>{const q=Object.entries(K).filter(([,P])=>P.trim()!=="");return q.length===0?R:R.filter(P=>q.every(([Q,re])=>{const le=bt(P,Q);return String(le??"").toLowerCase().includes(re.toLowerCase())}))},[R,K]),[ie,fe]=i.useState(1),pe=$>0,te=Z.length,ce=pe?Math.max(1,Math.ceil(te/$)):1;i.useEffect(()=>{fe(1)},[K,L,V]);const Y=i.useMemo(()=>pe?Z.slice((ie-1)*$,ie*$):Z,[Z,pe,ie,$]),se=10,ae=y!==void 0?y:!pe&&b!==void 0&&Y.length>=50,ge=i.useRef(null),[he,ye]=i.useState(0),[de,xe]=i.useState(0),oe=i.useCallback(()=>{ge.current&&ye(ge.current.scrollTop)},[]);i.useEffect(()=>{if(!ae||!ge.current)return;const q=ge.current;xe(q.clientHeight);const P=new ResizeObserver(()=>xe(q.clientHeight));return P.observe(q),()=>P.disconnect()},[ae]),Y.length*g;const G=ae?Math.max(0,Math.floor(he/g)-se):0,ue=ae?Math.min(Y.length,Math.ceil((he+de)/g)+se):Y.length,ke=ae?Y.slice(G,ue):Y,ve=G*g,Me=i.useRef(null),Ie=i.useRef(!1);i.useEffect(()=>{Ie.current=!1},[n.length]),i.useEffect(()=>{if(!I)return;const q=Me.current;if(!q)return;const P=new IntersectionObserver(Q=>{Q[0].isIntersecting&&!Ie.current&&M!==!1&&(Ie.current=!0,I())},{root:ge.current,rootMargin:`0px 0px ${E}px 0px`,threshold:0});return P.observe(q),()=>P.disconnect()},[I,M,E]);const We=i.useMemo(()=>new Set(s),[s]),Te=i.useMemo(()=>Z.map(q=>Nn(q,r)),[Z,r]),ze=Te.length>0&&Te.every(q=>We.has(q)),Ke=Te.some(q=>We.has(q)),Ze=i.useCallback(()=>{a==null||a(ze?[]:Te)},[ze,Te,a]),Fe=i.useCallback(q=>{const P=We.has(q)?s.filter(Q=>Q!==q):[...s,q];a==null||a(P)},[We,s,a]),[Oe,Ge]=i.useState({}),Ee=i.useRef(null),qe=i.useCallback((q,P)=>{P.preventDefault(),P.stopPropagation();const Q=P.target.closest("th");if(!Q)return;const re=Oe[q]||Q.getBoundingClientRect().width;Ee.current={key:q,startX:P.clientX,startWidth:re};const le=$e=>{if(!Ee.current)return;const we=Math.max(50,Ee.current.startWidth+$e.clientX-Ee.current.startX);Ge(_e=>({..._e,[Ee.current.key]:we}))},Ce=()=>{Ee.current=null,document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",Ce)};document.addEventListener("mousemove",le),document.addEventListener("mouseup",Ce)},[Oe]),rt=i.useCallback(()=>{const q=t.map($e=>Rn($e.header)).join(","),P=Z.map($e=>t.map(we=>{const _e=bt($e,we.key);return Rn(_e)}).join(",")),Q=[q,...P].join(`
103
- `),re=new Blob([Q],{type:"text/csv;charset=utf-8;"}),le=URL.createObjectURL(re),Ce=document.createElement("a");Ce.href=le,Ce.download=`${N}.csv`,Ce.click(),URL.revokeObjectURL(le)},[t,Z,N]),Qe=m?"4px":"8px",Le=m?"8px":"12px",Pe=q=>{const P=Oe[q.key]||q.width;return{width:P??void 0,minWidth:P??80,textAlign:q.align??"left",padding:`${Qe} ${Le}`}},Ae=p?`1px solid ${C.border}`:"none",Je=A.sanitizeString(u),Ue=t.length+(o?1:0),at=t.some(q=>q.filterable);return e.jsxs("div",{role:"grid","aria-label":"Data grid","aria-rowcount":te,id:z,className:x.tkx("font-sans rounded-lg overflow-hidden"),style:{border:`1px solid ${C.border}`,backgroundColor:C.bg},children:[e.jsx(Fi,{label:"data grid",showExport:w,onExport:rt,totalRows:te,selectedCount:s.length,theme:C}),e.jsxs("div",{ref:ge,onScroll:ae?oe:void 0,style:{maxHeight:b??"none",overflowX:"auto",overflowY:b?"auto":"visible"},children:[e.jsxs("table",{className:x.tkx("w-full"),style:{borderCollapse:"separate",borderSpacing:0,tableLayout:"auto"},children:[e.jsxs("thead",{children:[e.jsxs("tr",{role:"row",children:[o&&e.jsx("th",{scope:"col",role:"columnheader",style:{position:c?"sticky":"static",top:0,zIndex:2,backgroundColor:C.surface,borderBottom:`2px solid ${C.border}`,borderRight:Ae,padding:`${Qe} ${Le}`,width:40,textAlign:"center"},children:e.jsxs("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},children:[e.jsx("input",{type:"checkbox",checked:ze,ref:q=>{q&&(q.indeterminate=Ke&&!ze)},onChange:Ze,"aria-label":ze?"Deselect all rows":"Select all rows",style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),e.jsx(En,{checked:ze,indeterminate:Ke&&!ze})]})}),t.map(q=>{const P=(q.sortable??l)&&q.sortable!==!1,Q=L===q.key,re=A.sanitizeString(q.header);return e.jsx("th",{scope:"col",role:"columnheader","aria-sort":Q?V==="asc"?"ascending":"descending":P?"none":void 0,className:x.tkx("text-xs font-semibold uppercase tracking-wider"),style:{...Pe(q),position:c?"sticky":"static",top:0,zIndex:2,backgroundColor:C.surface,color:C.textMuted,borderBottom:`2px solid ${C.border}`,borderRight:Ae,cursor:P?"pointer":"default",userSelect:"none",whiteSpace:"nowrap",transition:H?"none":"background-color 150ms ease"},onClick:P?()=>_(q.key):void 0,onKeyDown:P?le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),_(q.key))}:void 0,tabIndex:P?0:void 0,children:e.jsxs("div",{className:x.tkx("flex items-center gap-1"),style:{position:"relative"},children:[q.renderHeader?q.renderHeader(q):re,P&&e.jsx(Di,{direction:Q?V:null}),q.resizable&&e.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize column ${re}`,className:x.tkx("cursor-col-resize shrink-0"),style:{position:"absolute",right:0,top:0,bottom:0,width:4,backgroundColor:"transparent"},onMouseDown:le=>qe(q.key,le)})]})},q.key)})]}),(S||at)&&e.jsxs("tr",{role:"row","aria-label":"Column filters",children:[o&&e.jsx("th",{scope:"col",style:{backgroundColor:C.surfaceAlt,borderBottom:`1px solid ${C.border}`,borderRight:Ae,padding:`4px ${Le}`,width:40}}),t.map(q=>e.jsx("th",{scope:"col",style:{backgroundColor:C.surfaceAlt,borderBottom:`1px solid ${C.border}`,borderRight:Ae,padding:`4px ${Le}`},children:(q.filterable||S)&&e.jsx("input",{type:"text",value:K[q.key]??"",onChange:P=>ne(q.key,P.target.value),placeholder:`Filter ${q.header}…`,"aria-label":`Filter by ${q.header}`,style:{width:"100%",padding:"3px 8px",fontSize:12,borderRadius:4,border:`1px solid ${C.border}`,backgroundColor:C.bg,color:C.text,outline:"none"}})},q.key))]})]}),f&&e.jsx(Wi,{colCount:Ue}),!f&&e.jsx("tbody",{children:Y.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:Ue,className:x.tkx("text-center py-10"),style:{color:C.textMuted},children:Je})}):e.jsxs(e.Fragment,{children:[ae&&ve>0&&e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:Ue,style:{height:ve,padding:0,border:"none"}})}),ke.map((q,P)=>{const Q=G+P,re=Nn(q,r),le=We.has(re),Ce=h&&Q%2===1;let $e="transparent";return le?$e=`${C.primary}22`:Ce&&($e=C.surfaceAlt),e.jsxs("tr",{role:"row","aria-rowindex":Q+1,"aria-selected":o?le:void 0,onClick:k?()=>k(q):void 0,onKeyDown:k?we=>{(we.key==="Enter"||we.key===" ")&&(we.preventDefault(),k(q))}:void 0,tabIndex:k?0:void 0,className:x.tkx(k?"cursor-pointer":""),style:{backgroundColor:$e,transition:H?"none":"background-color 120ms ease",...ae?{height:g,boxSizing:"border-box"}:{}},onMouseEnter:k?we=>{we.currentTarget.style.backgroundColor=le?`${C.primary}30`:C.surfaceAlt}:void 0,onMouseLeave:k?we=>{we.currentTarget.style.backgroundColor=$e}:void 0,children:[o&&e.jsx("td",{role:"gridcell",style:{borderBottom:`1px solid ${C.border}`,borderRight:Ae,padding:`${Qe} ${Le}`,textAlign:"center",width:40},children:e.jsxs("label",{style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",margin:"0 auto",width:16},onClick:we=>we.stopPropagation(),children:[e.jsx("input",{type:"checkbox",checked:le,onChange:()=>Fe(re),"aria-label":le?`Deselect row ${re}`:`Select row ${re}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),e.jsx(En,{checked:le})]})}),t.map(we=>{const _e=bt(q,we.key),U=we.renderCell?we.renderCell(_e,q):typeof _e=="string"?A.sanitizeString(_e):String(_e??"");return e.jsx("td",{role:"gridcell",className:x.tkx("text-sm"),style:{...Pe(we),borderBottom:`1px solid ${C.border}`,borderRight:Ae,color:C.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U},we.key)})]},re)}),ae&&ue<Y.length&&e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:Ue,style:{height:(Y.length-ue)*g,padding:0,border:"none"}})})]})})]}),(M||T)&&e.jsx("div",{ref:Me,style:{height:1,width:"100%"},children:T&&e.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:e.jsx("tbody",{children:Array.from({length:3},(q,P)=>e.jsx("tr",{children:t.map(Q=>e.jsx("td",{style:{padding:"10px 16px"},children:e.jsx(xt,{variant:"text",height:"16px"})},Q.key))},P))})})}),!M&&I&&e.jsx("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:C.textMuted},children:"✓ All rows loaded"})]}),pe&&!f&&e.jsx(Pi,{page:ie,totalPages:ce,pageSize:$,totalRows:te,onPageChange:fe,theme:C})]})}const Ct={md:768,lg:1024};function Vi(){const[t,n]=i.useState(()=>{if(typeof window>"u")return"lg";const r=window.innerWidth;return r>=Ct.lg?"lg":r>=Ct.md?"md":"sm"});return i.useEffect(()=>{if(typeof window>"u")return;const r=()=>{const o=window.innerWidth;o>=Ct.lg?n("lg"):o>=Ct.md?n("md"):n("sm")};return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),t}function Oi(t,n){return t===void 0?3:typeof t=="number"?Math.max(1,t):n==="lg"?t.lg??t.md??t.sm??3:n==="md"?t.md??t.sm??2:t.sm??1}let Ln=!1;function _i(){if(Ln||typeof document>"u")return;Ln=!0;const t=document.createElement("style");t.id="tkx-masonry-kf",t.textContent=`
101
+ `,document.head.appendChild(e)}var Jr={success:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z`})}),error:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z`})}),warning:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z`})}),info:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z`})})},Yr={"bottom-left":{bottom:24,left:24},"bottom-center":{bottom:24,left:`50%`,transform:`translateX(-50%)`},"bottom-right":{bottom:24,right:24},"top-center":{top:24,left:`50%`,transform:`translateX(-50%)`}};function Xr({message:e,isOpen:i,onClose:a,action:l,variant:u=`default`,position:d=`bottom-center`,autoHideDuration:f=Gr,icon:p}){let m=t.f(),h=r.o(),g=(0,o.useId)(),_=(0,o.useRef)(null),[v,y]=(0,o.useState)(!1),[b,x]=(0,o.useState)(!1);(0,o.useEffect)(()=>{qr()},[]),(0,o.useEffect)(()=>{if(i)x(!1),y(!0);else if(v)if(h)y(!1);else{x(!0);let e=setTimeout(()=>{y(!1),x(!1)},250);return()=>clearTimeout(e)}},[i,h,v]),(0,o.useEffect)(()=>{if(!(!i||f<=0||!a))return _.current=setTimeout(()=>{a()},f),()=>{_.current&&clearTimeout(_.current)}},[i,f,a]);let S=(0,o.useCallback)(()=>{_.current&&=(clearTimeout(_.current),null)},[]),C=(0,o.useCallback)(()=>{i&&f>0&&a&&(_.current=setTimeout(()=>a(),f))},[i,f,a]),w={default:m.textMuted,success:m.success,error:m.danger,warning:m.warning,info:m.info}[u],T=n.m(e);if(!v||typeof document>`u`)return null;let E=d===`top-center`?`tkx-snackbar-slide-down`:`tkx-snackbar-slide-up`,D={};h||(D=b?{animation:`tkx-snackbar-fade-out 250ms ease forwards`}:{animation:`${E} 250ms cubic-bezier(0.16,1,0.3,1) both`});let O=p??Jr[u]??null;return(0,c.createPortal)((0,s.jsx)(`div`,{role:u===`error`?`alert`:`status`,"aria-live":u===`error`?`assertive`:`polite`,"aria-atomic":`true`,"aria-labelledby":g,className:n.a(`fixed z-[9500] font-sans`),style:{...Yr[d],...D,pointerEvents:`auto`},onMouseEnter:S,onMouseLeave:C,children:(0,s.jsxs)(`div`,{className:n.a(`flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg`,`min-w-[280px] max-w-[480px]`),style:{backgroundColor:m.surface,border:`1px solid ${w}44`,boxShadow:`0 8px 24px ${m.bg}aa`,color:m.text},children:[O&&(0,s.jsx)(`span`,{className:n.a(`shrink-0 flex items-center`),style:{color:w},children:O}),(0,s.jsx)(`span`,{id:g,className:n.a(`flex-1 text-sm leading-snug`),children:T}),l&&(0,s.jsx)(`button`,{onClick:()=>{l.onClick(),a?.()},className:n.a(`bg-transparent border-none cursor-pointer p-0 ml-2`,`text-sm font-semibold shrink-0`,`focus-visible:focus-ring`),style:{color:m.primary},children:n.m(l.label)}),a&&(0,s.jsx)(`button`,{"aria-label":`Dismiss snackbar`,onClick:a,className:n.a(`bg-transparent border-none cursor-pointer rounded p-[2px] ml-1`,`shrink-0 flex items-center justify-center`,`focus-visible:focus-ring`),style:{color:m.textMuted},children:(0,s.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.5,"aria-hidden":`true`,children:[(0,s.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,s.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}),document.body)}function Zr({direction:e}){return(0,s.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,className:n.a(`shrink-0 ml-1`),children:e===`asc`?(0,s.jsx)(`path`,{d:`M7 14l5-5 5 5H7z`}):e===`desc`?(0,s.jsx)(`path`,{d:`M7 10l5 5 5-5H7z`}):(0,s.jsx)(`path`,{d:`M7 10l5 5 5-5H7zM7 14l5-5 5 5H7z`,opacity:`0.35`})})}function Qr({checked:e,indeterminate:n}){let r=t.f();return(0,s.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:[(0,s.jsx)(`rect`,{x:`1`,y:`1`,width:`14`,height:`14`,rx:`2`,fill:e||n?r.primary:`transparent`,stroke:e||n?r.primary:r.border,strokeWidth:`1.5`}),n&&(0,s.jsx)(`line`,{x1:`4`,y1:`8`,x2:`12`,y2:`8`,stroke:r.bg,strokeWidth:`2`}),e&&!n&&(0,s.jsx)(`path`,{d:`M4.5 8L7 10.5L11.5 5.5`,fill:`none`,stroke:r.bg,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function $r(e,t){return typeof t==`function`?t(e):String(e[t])}function ei(e,t){return e[t]}function ti(e,t){return e==null&&t==null?0:e==null?1:t==null?-1:typeof e==`number`&&typeof t==`number`?e-t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function ni(e){let t=String(e??``);return t.includes(`,`)||t.includes(`"`)||t.includes(`
102
+ `)?`"${t.replace(/"/g,`""`)}"`:t}function ri({colCount:e}){let r=t.f();return(0,s.jsx)(`tbody`,{children:Array.from({length:5},(t,i)=>(0,s.jsx)(`tr`,{children:Array.from({length:e},(e,t)=>(0,s.jsx)(`td`,{className:n.a(`px-3 py-2`),style:{borderBottom:`1px solid ${r.border}`},children:(0,s.jsx)(te,{height:16})},t))},i))})}function ii({label:e,showExport:t,onExport:n,totalRows:r,selectedCount:i,theme:a}){return!t&&i===0?null:(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`8px 12px`,borderBottom:`1px solid ${a.border}`,backgroundColor:a.surface,gap:8},children:[(0,s.jsx)(`span`,{style:{fontSize:13,color:a.textMuted},children:i>0?`${i} of ${r} row${r===1?``:`s`} selected`:`${r} row${r===1?``:`s`}`}),t&&(0,s.jsxs)(`button`,{onClick:n,"aria-label":`Export ${e} as CSV`,style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`5px 12px`,fontSize:13,fontWeight:500,borderRadius:6,border:`1px solid ${a.border}`,backgroundColor:`transparent`,color:a.text,cursor:`pointer`},children:[(0,s.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,s.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,s.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,s.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]}),`Export CSV`]})]})}function ai({page:e,totalPages:t,pageSize:n,totalRows:r,onPageChange:i,theme:a}){let o=(e-1)*n+1,c=Math.min(e*n,r),l={display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:32,height:32,borderRadius:6,border:`1px solid ${a.border}`,backgroundColor:`transparent`,color:a.text,cursor:`pointer`,fontSize:13,fontWeight:500};return(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`8px 12px`,borderTop:`1px solid ${a.border}`,backgroundColor:a.surface,gap:8,flexWrap:`wrap`},role:`navigation`,"aria-label":`Pagination`,children:[(0,s.jsx)(`span`,{style:{fontSize:13,color:a.textMuted},children:r===0?`0 rows`:`${o}–${c} of ${r}`}),(0,s.jsxs)(`div`,{style:{display:`flex`,gap:4},children:[(0,s.jsx)(`button`,{onClick:()=>i(1),disabled:e===1,"aria-label":`First page`,style:{...l,opacity:e===1?.4:1},children:`«`}),(0,s.jsx)(`button`,{onClick:()=>i(e-1),disabled:e===1,"aria-label":`Previous page`,style:{...l,opacity:e===1?.4:1},children:`‹`}),Array.from({length:Math.min(5,t)},(n,r)=>{let o=r+1;return t>5&&(o=Math.max(1,Math.min(e-2,t-4))+r),(0,s.jsx)(`button`,{onClick:()=>i(o),"aria-label":`Page ${o}`,"aria-current":o===e?`page`:void 0,style:{...l,backgroundColor:o===e?a.primary:`transparent`,color:o===e?a.bg:a.text,borderColor:o===e?a.primary:a.border},children:o},o)}),(0,s.jsx)(`button`,{onClick:()=>i(e+1),disabled:e===t,"aria-label":`Next page`,style:{...l,opacity:e===t?.4:1},children:`›`}),(0,s.jsx)(`button`,{onClick:()=>i(t),disabled:e===t,"aria-label":`Last page`,style:{...l,opacity:e===t?.4:1},children:`»`})]})]})}function oi({columns:e,data:i,rowKey:a,selectable:c=!1,selectedRows:l=[],onSelectionChange:u,sortable:d=!1,onSort:f,loading:p=!1,emptyMessage:m=`No data to display`,stickyHeader:h=!1,striped:g=!1,bordered:_=!1,compact:v=!1,maxHeight:y,onRowClick:b,virtualScroll:x,rowHeight:S=40,showFilters:C=!1,filterValues:w,onFilterChange:T,pageSize:E=0,showExport:D=!1,exportFileName:O=`export`,onLoadMore:k,hasMore:A,loadingMore:j=!1,loadMoreThreshold:M=200}){let N=t.f(),P=r.o(),F=(0,o.useId)(),[I,L]=(0,o.useState)(null),[R,z]=(0,o.useState)(`asc`),B=(0,o.useCallback)(e=>{let t=I===e&&R===`asc`?`desc`:`asc`;L(e),z(t),f?.(e,t)},[I,R,f]),V=(0,o.useMemo)(()=>f||!I?i:[...i].sort((e,t)=>{let n=ti(ei(e,I),ei(t,I));return R===`asc`?n:-n}),[i,I,R,f]),[H,U]=(0,o.useState)({}),W=w??H,ee=(0,o.useCallback)((e,t)=>{T?T(e,t):U(n=>({...n,[e]:t}))},[T]),G=(0,o.useMemo)(()=>{let e=Object.entries(W).filter(([,e])=>e.trim()!==``);return e.length===0?V:V.filter(t=>e.every(([e,n])=>{let r=ei(t,e);return String(r??``).toLowerCase().includes(n.toLowerCase())}))},[V,W]),[K,ne]=(0,o.useState)(1),q=E>0,J=G.length,Y=q?Math.max(1,Math.ceil(J/E)):1;(0,o.useEffect)(()=>{ne(1)},[W,I,R]);let re=(0,o.useMemo)(()=>q?G.slice((K-1)*E,K*E):G,[G,q,K,E]),ie=x===void 0?!q&&y!==void 0&&re.length>=50:x,ae=(0,o.useRef)(null),[oe,X]=(0,o.useState)(0),[Z,se]=(0,o.useState)(0),ce=(0,o.useCallback)(()=>{ae.current&&X(ae.current.scrollTop)},[]);(0,o.useEffect)(()=>{if(!ie||!ae.current)return;let e=ae.current;se(e.clientHeight);let t=new ResizeObserver(()=>se(e.clientHeight));return t.observe(e),()=>t.disconnect()},[ie]),re.length*S;let le=ie?Math.max(0,Math.floor(oe/S)-10):0,ue=ie?Math.min(re.length,Math.ceil((oe+Z)/S)+10):re.length,de=ie?re.slice(le,ue):re,fe=le*S,pe=(0,o.useRef)(null),Q=(0,o.useRef)(!1);(0,o.useEffect)(()=>{Q.current=!1},[i.length]),(0,o.useEffect)(()=>{if(!k)return;let e=pe.current;if(!e)return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&!Q.current&&A!==!1&&(Q.current=!0,k())},{root:ae.current,rootMargin:`0px 0px ${M}px 0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[k,A,M]);let $=(0,o.useMemo)(()=>new Set(l),[l]),me=(0,o.useMemo)(()=>G.map(e=>$r(e,a)),[G,a]),he=me.length>0&&me.every(e=>$.has(e)),ge=me.some(e=>$.has(e)),_e=(0,o.useCallback)(()=>{u?.(he?[]:me)},[he,me,u]),ve=(0,o.useCallback)(e=>{let t=$.has(e)?l.filter(t=>t!==e):[...l,e];u?.(t)},[$,l,u]),[ye,be]=(0,o.useState)({}),xe=(0,o.useRef)(null),Se=(0,o.useCallback)((e,t)=>{t.preventDefault(),t.stopPropagation();let n=t.target.closest(`th`);if(!n)return;let r=ye[e]||n.getBoundingClientRect().width;xe.current={key:e,startX:t.clientX,startWidth:r};let i=e=>{if(!xe.current)return;let t=Math.max(50,xe.current.startWidth+e.clientX-xe.current.startX);be(e=>({...e,[xe.current.key]:t}))},a=()=>{xe.current=null,document.removeEventListener(`mousemove`,i),document.removeEventListener(`mouseup`,a)};document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a)},[ye]),Ce=(0,o.useCallback)(()=>{let t=[e.map(e=>ni(e.header)).join(`,`),...G.map(t=>e.map(e=>ni(ei(t,e.key))).join(`,`))].join(`
103
+ `),n=new Blob([t],{type:`text/csv;charset=utf-8;`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${O}.csv`,i.click(),URL.revokeObjectURL(r)},[e,G,O]),we=v?`4px`:`8px`,Te=v?`8px`:`12px`,Ee=e=>{let t=ye[e.key]||e.width;return{width:t??void 0,minWidth:t??80,textAlign:e.align??`left`,padding:`${we} ${Te}`}},De=_?`1px solid ${N.border}`:`none`,Oe=n.m(m),ke=e.length+ +!!c,Ae=e.some(e=>e.filterable);return(0,s.jsxs)(`div`,{role:`grid`,"aria-label":`Data grid`,"aria-rowcount":J,id:F,className:n.a(`font-sans rounded-lg overflow-hidden`),style:{border:`1px solid ${N.border}`,backgroundColor:N.bg},children:[(0,s.jsx)(ii,{label:`data grid`,showExport:D,onExport:Ce,totalRows:J,selectedCount:l.length,theme:N}),(0,s.jsxs)(`div`,{ref:ae,onScroll:ie?ce:void 0,style:{maxHeight:y??`none`,overflowX:`auto`,overflowY:y?`auto`:`visible`},children:[(0,s.jsxs)(`table`,{className:n.a(`w-full`),style:{borderCollapse:`separate`,borderSpacing:0,tableLayout:`auto`},children:[(0,s.jsxs)(`thead`,{children:[(0,s.jsxs)(`tr`,{role:`row`,children:[c&&(0,s.jsx)(`th`,{scope:`col`,role:`columnheader`,style:{position:h?`sticky`:`static`,top:0,zIndex:2,backgroundColor:N.surface,borderBottom:`2px solid ${N.border}`,borderRight:De,padding:`${we} ${Te}`,width:40,textAlign:`center`},children:(0,s.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,margin:`0 auto`,width:16},children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:he,ref:e=>{e&&(e.indeterminate=ge&&!he)},onChange:_e,"aria-label":he?`Deselect all rows`:`Select all rows`,style:{position:`absolute`,opacity:0,width:16,height:16,cursor:`pointer`,margin:0}}),(0,s.jsx)(Qr,{checked:he,indeterminate:ge&&!he})]})}),e.map(e=>{let t=(e.sortable??d)&&e.sortable!==!1,r=I===e.key,i=n.m(e.header);return(0,s.jsx)(`th`,{scope:`col`,role:`columnheader`,"aria-sort":r?R===`asc`?`ascending`:`descending`:t?`none`:void 0,className:n.a(`text-xs font-semibold uppercase tracking-wider`),style:{...Ee(e),position:h?`sticky`:`static`,top:0,zIndex:2,backgroundColor:N.surface,color:N.textMuted,borderBottom:`2px solid ${N.border}`,borderRight:De,cursor:t?`pointer`:`default`,userSelect:`none`,whiteSpace:`nowrap`,transition:P?`none`:`background-color 150ms ease`},onClick:t?()=>B(e.key):void 0,onKeyDown:t?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),B(e.key))}:void 0,tabIndex:t?0:void 0,children:(0,s.jsxs)(`div`,{className:n.a(`flex items-center gap-1`),style:{position:`relative`},children:[e.renderHeader?e.renderHeader(e):i,t&&(0,s.jsx)(Zr,{direction:r?R:null}),e.resizable&&(0,s.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize column ${i}`,className:n.a(`cursor-col-resize shrink-0`),style:{position:`absolute`,right:0,top:0,bottom:0,width:4,backgroundColor:`transparent`},onMouseDown:t=>Se(e.key,t)})]})},e.key)})]}),(C||Ae)&&(0,s.jsxs)(`tr`,{role:`row`,"aria-label":`Column filters`,children:[c&&(0,s.jsx)(`th`,{scope:`col`,style:{backgroundColor:N.surfaceAlt,borderBottom:`1px solid ${N.border}`,borderRight:De,padding:`4px ${Te}`,width:40}}),e.map(e=>(0,s.jsx)(`th`,{scope:`col`,style:{backgroundColor:N.surfaceAlt,borderBottom:`1px solid ${N.border}`,borderRight:De,padding:`4px ${Te}`},children:(e.filterable||C)&&(0,s.jsx)(`input`,{type:`text`,value:W[e.key]??``,onChange:t=>ee(e.key,t.target.value),placeholder:`Filter ${e.header}…`,"aria-label":`Filter by ${e.header}`,style:{width:`100%`,padding:`3px 8px`,fontSize:12,borderRadius:4,border:`1px solid ${N.border}`,backgroundColor:N.bg,color:N.text,outline:`none`}})},e.key))]})]}),p&&(0,s.jsx)(ri,{colCount:ke}),!p&&(0,s.jsx)(`tbody`,{children:re.length===0?(0,s.jsx)(`tr`,{children:(0,s.jsx)(`td`,{colSpan:ke,className:n.a(`text-center py-10`),style:{color:N.textMuted},children:Oe})}):(0,s.jsxs)(s.Fragment,{children:[ie&&fe>0&&(0,s.jsx)(`tr`,{"aria-hidden":`true`,children:(0,s.jsx)(`td`,{colSpan:ke,style:{height:fe,padding:0,border:`none`}})}),de.map((t,r)=>{let i=le+r,o=$r(t,a),l=$.has(o),u=g&&i%2==1,d=`transparent`;return l?d=`${N.primary}22`:u&&(d=N.surfaceAlt),(0,s.jsxs)(`tr`,{role:`row`,"aria-rowindex":i+1,"aria-selected":c?l:void 0,onClick:b?()=>b(t):void 0,onKeyDown:b?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),b(t))}:void 0,tabIndex:b?0:void 0,className:n.a(b?`cursor-pointer`:``),style:{backgroundColor:d,transition:P?`none`:`background-color 120ms ease`,...ie?{height:S,boxSizing:`border-box`}:{}},onMouseEnter:b?e=>{e.currentTarget.style.backgroundColor=l?`${N.primary}30`:N.surfaceAlt}:void 0,onMouseLeave:b?e=>{e.currentTarget.style.backgroundColor=d}:void 0,children:[c&&(0,s.jsx)(`td`,{role:`gridcell`,style:{borderBottom:`1px solid ${N.border}`,borderRight:De,padding:`${we} ${Te}`,textAlign:`center`,width:40},children:(0,s.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,margin:`0 auto`,width:16},onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:l,onChange:()=>ve(o),"aria-label":l?`Deselect row ${o}`:`Select row ${o}`,style:{position:`absolute`,opacity:0,width:16,height:16,cursor:`pointer`,margin:0}}),(0,s.jsx)(Qr,{checked:l})]})}),e.map(e=>{let r=ei(t,e.key),i=e.renderCell?e.renderCell(r,t):typeof r==`string`?n.m(r):String(r??``);return(0,s.jsx)(`td`,{role:`gridcell`,className:n.a(`text-sm`),style:{...Ee(e),borderBottom:`1px solid ${N.border}`,borderRight:De,color:N.text,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:i},e.key)})]},o)}),ie&&ue<re.length&&(0,s.jsx)(`tr`,{"aria-hidden":`true`,children:(0,s.jsx)(`td`,{colSpan:ke,style:{height:(re.length-ue)*S,padding:0,border:`none`}})})]})})]}),(A||j)&&(0,s.jsx)(`div`,{ref:pe,style:{height:1,width:`100%`},children:j&&(0,s.jsx)(`table`,{style:{width:`100%`,borderCollapse:`collapse`},children:(0,s.jsx)(`tbody`,{children:Array.from({length:3},(t,n)=>(0,s.jsx)(`tr`,{children:e.map(e=>(0,s.jsx)(`td`,{style:{padding:`10px 16px`},children:(0,s.jsx)(te,{variant:`text`,height:`16px`})},e.key))},n))})})}),!A&&k&&(0,s.jsx)(`div`,{style:{padding:`16px`,textAlign:`center`,fontSize:13,color:N.textMuted},children:`✓ All rows loaded`})]}),q&&!p&&(0,s.jsx)(ai,{page:K,totalPages:Y,pageSize:E,totalRows:J,onPageChange:ne,theme:N})]})}var si={sm:0,md:768,lg:1024};function ci(){let[e,t]=(0,o.useState)(()=>{if(typeof window>`u`)return`lg`;let e=window.innerWidth;return e>=si.lg?`lg`:e>=si.md?`md`:`sm`});return(0,o.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{let e=window.innerWidth;e>=si.lg?t(`lg`):e>=si.md?t(`md`):t(`sm`)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function li(e,t){return e===void 0?3:typeof e==`number`?Math.max(1,e):t===`lg`?e.lg??e.md??e.sm??3:t===`md`?e.md??e.sm??2:e.sm??1}var ui=!1;function di(){if(ui||typeof document>`u`)return;ui=!0;let e=document.createElement(`style`);e.id=`tkx-masonry-kf`,e.textContent=`
104
104
  @keyframes tkx-masonry-fade-in {
105
105
  from { opacity: 0; transform: translateY(8px); }
106
106
  to { opacity: 1; transform: translateY(0); }
107
107
  }
108
- `,document.head.appendChild(t)}function Yi({columns:t,gap:n=16,children:r}){O.useTheme();const o=J.useReducedMotion(),s=Vi();i.useEffect(()=>{_i()},[]);const a=Oi(t,s),l=i.Children.toArray(r),d=i.useMemo(()=>{const u=Array.from({length:a},()=>[]);return l.forEach((c,h)=>{u[h%a].push(c)}),u},[l,a]),f=u=>o?{}:{animation:"tkx-masonry-fade-in 300ms cubic-bezier(0.16,1,0.3,1) both",animationDelay:`${Math.min(u*40,400)}ms`};return e.jsx("div",{role:"list","aria-label":"Masonry grid",className:x.tkx("flex w-full"),style:{gap:n,alignItems:"flex-start"},children:d.map((u,c)=>e.jsx("div",{className:x.tkx("flex flex-col"),style:{flex:1,gap:n,minWidth:0},children:u.map((h,p)=>{const m=p*a+c;return e.jsx("div",{role:"listitem",style:f(m),children:h},p)})},c))})}const Ki={info:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),warning:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),success:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z"})}),danger:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})})},Ui={1:{fontSize:"1.75rem",fontWeight:700,lineHeight:1.25,marginTop:24,marginBottom:12},2:{fontSize:"1.375rem",fontWeight:600,lineHeight:1.3,marginTop:20,marginBottom:10},3:{fontSize:"1.1rem",fontWeight:600,lineHeight:1.35,marginTop:16,marginBottom:8}};function Xi({block:t}){const n=O.useTheme(),r=t.level??1,o=`h${r}`,s=A.sanitizeString(t.content??"");return e.jsx(o,{className:x.tkx("m-0"),style:{...Ui[r],color:n.text},children:s})}function Zi({block:t}){const n=O.useTheme(),r=A.sanitizeString(t.content??"");return e.jsx("p",{className:x.tkx("m-0"),style:{fontSize:"0.938rem",lineHeight:1.7,color:n.text,marginBottom:12},children:r})}function Gi({block:t}){const n=O.useTheme(),r=A.sanitizeString(t.content??"");return e.jsx("blockquote",{className:x.tkx("m-0"),style:{borderLeft:`3px solid ${n.primary}`,paddingLeft:16,paddingTop:8,paddingBottom:8,marginTop:12,marginBottom:12,backgroundColor:`${n.surfaceAlt}`,borderRadius:"0 6px 6px 0",color:n.textMuted,fontStyle:"italic",fontSize:"0.938rem",lineHeight:1.6},children:r})}function qi({block:t}){const n=O.useTheme(),r=A.sanitizeString(t.content??""),o=t.language?A.sanitizeString(t.language):null;return e.jsxs("div",{className:x.tkx("rounded-lg overflow-hidden"),style:{marginTop:12,marginBottom:12,border:`1px solid ${n.border}`,backgroundColor:n.surfaceAlt},children:[o&&e.jsx("div",{className:x.tkx("px-3 py-1 text-[11px] font-semibold uppercase tracking-wider"),style:{color:n.textMuted,borderBottom:`1px solid ${n.border}`,backgroundColor:n.surface},children:o}),e.jsx("pre",{className:x.tkx("m-0 p-4 overflow-x-auto"),style:{fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace",fontSize:"0.85rem",lineHeight:1.6,color:n.text,tabSize:2},children:e.jsx("code",{"aria-label":o?`Code block in ${o}`:"Code block",children:r})})]})}function Qi({block:t}){const n=O.useTheme(),r=t.ordered?"ol":"ul",o=(t.items??[]).map(s=>A.sanitizeString(s));return e.jsx(r,{className:x.tkx("m-0"),style:{paddingLeft:24,marginTop:8,marginBottom:12,color:n.text,fontSize:"0.938rem",lineHeight:1.7,listStyleType:t.ordered?"decimal":"disc"},role:"list",children:o.map((s,a)=>e.jsx("li",{role:"listitem",style:{marginBottom:4},children:s},a))})}function Ji(){const t=O.useTheme();return e.jsx("hr",{"aria-hidden":"true",style:{border:"none",borderTop:`1px solid ${t.border}`,marginTop:20,marginBottom:20}})}function ea({block:t}){const n=O.useTheme(),r=A.sanitizeString(t.src??""),o=A.sanitizeString(t.alt??"Image");return e.jsxs("figure",{className:x.tkx("m-0"),style:{marginTop:12,marginBottom:12},children:[e.jsx("img",{src:r,alt:o,loading:"lazy",className:x.tkx("rounded-lg"),style:{maxWidth:"100%",height:"auto",display:"block",border:`1px solid ${n.border}`}}),t.alt&&e.jsx("figcaption",{className:x.tkx("text-xs mt-2 text-center"),style:{color:n.textMuted},children:o})]})}function ta({block:t}){const n=O.useTheme(),r=t.variant??"info",o=A.sanitizeString(t.content??""),a={info:n.info,warning:n.warning,success:n.success,danger:n.danger}[r],l=Ki[r],d={info:"note",warning:"alert",success:"status",danger:"alert"};return e.jsxs("div",{role:d[r],className:x.tkx("flex gap-3 px-4 py-3 rounded-lg"),style:{backgroundColor:`${a}12`,border:`1px solid ${a}33`,marginTop:12,marginBottom:12},children:[e.jsx("span",{className:x.tkx("shrink-0 mt-[2px]"),style:{color:a},children:l}),e.jsx("div",{className:x.tkx("flex-1"),style:{fontSize:"0.9rem",lineHeight:1.6,color:n.text},children:o})]})}const na={heading:Xi,paragraph:Zi,blockquote:Gi,code:qi,list:Qi,divider:Ji,image:ea,callout:ta};function ra({blocks:t,className:n,style:r}){const o=O.useTheme(),s=J.useReducedMotion(),a=i.useMemo(()=>t.map((l,d)=>{const f=na[l.type];return f?e.jsx("div",{style:s?void 0:{animation:"tkx-rich-text-fade-in 300ms ease both",animationDelay:`${Math.min(d*30,300)}ms`},children:e.jsx(f,{block:l,index:d})},d):null}),[t,s]);return i.useMemo(()=>{if(typeof document>"u"||document.getElementById("tkx-rich-text-kf"))return;const l=document.createElement("style");l.id="tkx-rich-text-kf",l.textContent=`
108
+ `,document.head.appendChild(e)}function fi({columns:e,gap:i=16,children:a}){t.f();let c=r.o(),l=ci();(0,o.useEffect)(()=>{di()},[]);let u=li(e,l),d=o.Children.toArray(a),f=(0,o.useMemo)(()=>{let e=Array.from({length:u},()=>[]);return d.forEach((t,n)=>{e[n%u].push(t)}),e},[d,u]),p=e=>c?{}:{animation:`tkx-masonry-fade-in 300ms cubic-bezier(0.16,1,0.3,1) both`,animationDelay:`${Math.min(e*40,400)}ms`};return(0,s.jsx)(`div`,{role:`list`,"aria-label":`Masonry grid`,className:n.a(`flex w-full`),style:{gap:i,alignItems:`flex-start`},children:f.map((e,t)=>(0,s.jsx)(`div`,{className:n.a(`flex flex-col`),style:{flex:1,gap:i,minWidth:0},children:e.map((e,n)=>(0,s.jsx)(`div`,{role:`listitem`,style:p(n*u+t),children:e},n))},t))})}var pi={info:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z`})}),warning:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z`})}),success:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm-2 14.5l-4-4 1.41-1.41L10 13.67l6.59-6.59L18 8.5l-8 8z`})}),danger:(0,s.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z`})})},mi={1:{fontSize:`1.75rem`,fontWeight:700,lineHeight:1.25,marginTop:24,marginBottom:12},2:{fontSize:`1.375rem`,fontWeight:600,lineHeight:1.3,marginTop:20,marginBottom:10},3:{fontSize:`1.1rem`,fontWeight:600,lineHeight:1.35,marginTop:16,marginBottom:8}};function hi({block:e}){let r=t.f(),i=e.level??1,a=`h${i}`,o=n.m(e.content??``);return(0,s.jsx)(a,{className:n.a(`m-0`),style:{...mi[i],color:r.text},children:o})}function gi({block:e}){let r=t.f(),i=n.m(e.content??``);return(0,s.jsx)(`p`,{className:n.a(`m-0`),style:{fontSize:`0.938rem`,lineHeight:1.7,color:r.text,marginBottom:12},children:i})}function _i({block:e}){let r=t.f(),i=n.m(e.content??``);return(0,s.jsx)(`blockquote`,{className:n.a(`m-0`),style:{borderLeft:`3px solid ${r.primary}`,paddingLeft:16,paddingTop:8,paddingBottom:8,marginTop:12,marginBottom:12,backgroundColor:`${r.surfaceAlt}`,borderRadius:`0 6px 6px 0`,color:r.textMuted,fontStyle:`italic`,fontSize:`0.938rem`,lineHeight:1.6},children:i})}function vi({block:e}){let r=t.f(),i=n.m(e.content??``),a=e.language?n.m(e.language):null;return(0,s.jsxs)(`div`,{className:n.a(`rounded-lg overflow-hidden`),style:{marginTop:12,marginBottom:12,border:`1px solid ${r.border}`,backgroundColor:r.surfaceAlt},children:[a&&(0,s.jsx)(`div`,{className:n.a(`px-3 py-1 text-[11px] font-semibold uppercase tracking-wider`),style:{color:r.textMuted,borderBottom:`1px solid ${r.border}`,backgroundColor:r.surface},children:a}),(0,s.jsx)(`pre`,{className:n.a(`m-0 p-4 overflow-x-auto`),style:{fontFamily:`'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace`,fontSize:`0.85rem`,lineHeight:1.6,color:r.text,tabSize:2},children:(0,s.jsx)(`code`,{"aria-label":a?`Code block in ${a}`:`Code block`,children:i})})]})}function yi({block:e}){let r=t.f(),i=e.ordered?`ol`:`ul`,a=(e.items??[]).map(e=>n.m(e));return(0,s.jsx)(i,{className:n.a(`m-0`),style:{paddingLeft:24,marginTop:8,marginBottom:12,color:r.text,fontSize:`0.938rem`,lineHeight:1.7,listStyleType:e.ordered?`decimal`:`disc`},role:`list`,children:a.map((e,t)=>(0,s.jsx)(`li`,{role:`listitem`,style:{marginBottom:4},children:e},t))})}function bi(){return(0,s.jsx)(`hr`,{"aria-hidden":`true`,style:{border:`none`,borderTop:`1px solid ${t.f().border}`,marginTop:20,marginBottom:20}})}function xi({block:e}){let r=t.f(),i=n.m(e.src??``),a=n.m(e.alt??`Image`);return(0,s.jsxs)(`figure`,{className:n.a(`m-0`),style:{marginTop:12,marginBottom:12},children:[(0,s.jsx)(`img`,{src:i,alt:a,loading:`lazy`,className:n.a(`rounded-lg`),style:{maxWidth:`100%`,height:`auto`,display:`block`,border:`1px solid ${r.border}`}}),e.alt&&(0,s.jsx)(`figcaption`,{className:n.a(`text-xs mt-2 text-center`),style:{color:r.textMuted},children:a})]})}function Si({block:e}){let r=t.f(),i=e.variant??`info`,a=n.m(e.content??``),o={info:r.info,warning:r.warning,success:r.success,danger:r.danger}[i],c=pi[i];return(0,s.jsxs)(`div`,{role:{info:`note`,warning:`alert`,success:`status`,danger:`alert`}[i],className:n.a(`flex gap-3 px-4 py-3 rounded-lg`),style:{backgroundColor:`${o}12`,border:`1px solid ${o}33`,marginTop:12,marginBottom:12},children:[(0,s.jsx)(`span`,{className:n.a(`shrink-0 mt-[2px]`),style:{color:o},children:c}),(0,s.jsx)(`div`,{className:n.a(`flex-1`),style:{fontSize:`0.9rem`,lineHeight:1.6,color:r.text},children:a})]})}var Ci={heading:hi,paragraph:gi,blockquote:_i,code:vi,list:yi,divider:bi,image:xi,callout:Si};function wi({blocks:e,className:i,style:a}){let c=t.f(),l=r.o(),u=(0,o.useMemo)(()=>e.map((e,t)=>{let n=Ci[e.type];return n?(0,s.jsx)(`div`,{style:l?void 0:{animation:`tkx-rich-text-fade-in 300ms ease both`,animationDelay:`${Math.min(t*30,300)}ms`},children:(0,s.jsx)(n,{block:e,index:t})},t):null}),[e,l]);return(0,o.useMemo)(()=>{if(typeof document>`u`||document.getElementById(`tkx-rich-text-kf`))return;let e=document.createElement(`style`);e.id=`tkx-rich-text-kf`,e.textContent=`
109
109
  @keyframes tkx-rich-text-fade-in {
110
110
  from { opacity: 0; }
111
111
  to { opacity: 1; }
112
112
  }
113
- `,document.head.appendChild(l)},[]),e.jsx("article",{"aria-label":"Rich text content",className:x.tkx("font-sans",n??""),style:{color:o.text,maxWidth:720,...r},children:a})}const Sr={sm:576,md:768,lg:992,xl:1200};function Mr(t){return typeof t=="number"?`${t}px`:t}const Tr=i.createContext({h:0,v:0}),Cr=i.forwardRef(({children:t,hasSider:n=!1,className:r,style:o,...s},a)=>{const l=O.useTheme(),d=x.tkx("flex min-h-0 w-full font-sans"),f=n?{flexDirection:"row"}:{flexDirection:"column"};return e.jsx("section",{ref:a,className:x.cx("tkx-layout",d,r),style:{minHeight:"100%",color:l.text,backgroundColor:l.bg,...f,...o},...s,children:t})});Cr.displayName="TkxLayout";const Ir=i.forwardRef(({children:t,height:n=64,fixed:r=!1,className:o,style:s,...a},l)=>{const d=O.useTheme(),f=Mr(n),u=x.tkx("flex items-center px-6 shrink-0 w-full"),c=r?{position:"fixed",top:0,left:0,right:0,zIndex:1e3}:{};return e.jsx("header",{ref:l,className:x.cx("tkx-layout-header",u,o),style:{height:f,minHeight:f,backgroundColor:d.surface,borderBottom:`1px solid ${d.border}`,...c,...s},...a,children:t})});Ir.displayName="TkxHeader";function sa({collapsed:t,onClick:n,color:r}){const o=J.useReducedMotion();return e.jsx("button",{type:"button","aria-label":t?"Expand sidebar":"Collapse sidebar",onClick:n,className:x.tkx("flex items-center justify-center w-full py-3 cursor-pointer","border-0 bg-transparent"),style:{color:r},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{transform:t?"rotate(0deg)":"rotate(180deg)",transition:o?"none":"transform 200ms ease"},"aria-hidden":"true",children:e.jsx("path",{d:"M6 3l5 5-5 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}const $r=i.forwardRef(({children:t,width:n=240,collapsedWidth:r=64,collapsed:o,onCollapse:s,collapsible:a=!1,breakpoint:l,trigger:d,className:f,style:u,...c},h)=>{const p=O.useTheme(),m=J.useReducedMotion(),[b,k]=i.useState(!1),y=o??b,g=i.useCallback(w=>{o===void 0&&k(w),s==null||s(w)},[o,s]);i.useEffect(()=>{if(!l)return;const w=Sr[l];if(!w)return;const N=window.matchMedia(`(max-width: ${w-1}px)`),I=M=>{g(M.matches)};return g(N.matches),N.addEventListener("change",I),()=>N.removeEventListener("change",I)},[l,g]);const S=Mr(n),j=y?`${r}px`:S,v=a&&d!==null,$=m?"none":"width 200ms ease, min-width 200ms ease, max-width 200ms ease";return e.jsxs("aside",{ref:h,className:x.cx("tkx-layout-sider",x.tkx("shrink-0 overflow-hidden flex flex-col"),f),style:{width:j,minWidth:j,maxWidth:j,backgroundColor:p.surface,borderRight:`1px solid ${p.border}`,transition:$,...u},...c,children:[e.jsx("div",{className:x.tkx("flex-1 overflow-y-auto overflow-x-hidden"),style:{width:j,transition:$},children:t}),v&&e.jsx("div",{className:x.tkx("shrink-0"),style:{borderTop:`1px solid ${p.border}`},children:d!==void 0?d:e.jsx(sa,{collapsed:y,onClick:()=>g(!y),color:p.textMuted})})]})});$r.displayName="TkxSider";const zr=i.forwardRef(({children:t,className:n,style:r,...o},s)=>{const a=O.useTheme();return e.jsx("main",{ref:s,className:x.cx("tkx-layout-content",x.tkx("flex-1 min-w-0 min-h-0"),n),style:{backgroundColor:a.bg,padding:"24px",...r},...o,children:t})});zr.displayName="TkxContent";const Er=i.forwardRef(({children:t,className:n,style:r,...o},s)=>{const a=O.useTheme();return e.jsx("footer",{ref:s,className:x.cx("tkx-layout-footer",x.tkx("flex items-center px-6 py-4 shrink-0"),n),style:{backgroundColor:a.surface,borderTop:`1px solid ${a.border}`,color:a.textMuted,...r},...o,children:t})});Er.displayName="TkxFooter";const oa={start:"flex-start",center:"center",end:"flex-end","space-between":"space-between","space-around":"space-around","space-evenly":"space-evenly"},ia={top:"flex-start",middle:"center",bottom:"flex-end",stretch:"stretch"},Nr=i.forwardRef(({children:t,gutter:n,justify:r="start",align:o="top",wrap:s=!0,className:a,style:l,...d},f)=>{const[u,c]=Array.isArray(n)?n:[n??0,0],h=u/2,p=c/2,m=u||c?{marginLeft:-h,marginRight:-h,marginTop:-p,marginBottom:-p}:{},b={h,v:p};return e.jsx(Tr.Provider,{value:b,children:e.jsx("div",{ref:f,className:x.cx("tkx-row",x.tkx("flex w-full"),a),style:{flexWrap:s?"wrap":"nowrap",justifyContent:oa[r]??"flex-start",alignItems:ia[o]??"flex-start",...m,...l},...d,children:t})})});Nr.displayName="TkxRow";let An=!1;function aa(){if(An||typeof document>"u")return;An=!0;const t=[];for(const[r,o]of Object.entries(Sr)){for(let s=1;s<=24;s++){const a=`${s/24*100}%`;t.push(`@media (min-width: ${o}px) { .tkx-col-${r}-${s} { flex: 0 0 ${a} !important; max-width: ${a} !important; } }`)}for(let s=0;s<=24;s++){const a=`${s/24*100}%`;t.push(`@media (min-width: ${o}px) { .tkx-col-${r}-offset-${s} { margin-left: ${a} !important; } }`)}}const n=document.createElement("style");n.id="tkx-col-responsive",n.textContent=t.join(`
114
- `),document.head.appendChild(n)}function la(t){if(t!==void 0)return typeof t=="number"?{span:t}:t}const Rr=i.forwardRef(({children:t,span:n,offset:r=0,push:o,pull:s,order:a,sm:l,md:d,lg:f,xl:u,className:c,style:h,...p},m)=>{i.useEffect(()=>{aa()},[]);const b=i.useContext(Tr),k=n!==void 0?`${n/24*100}%`:void 0,y=r?`${r/24*100}%`:void 0,g=[],S=[["sm",l],["md",d],["lg",f],["xl",u]];for(const[v,$]of S){const w=la($);w&&(g.push(`tkx-col-${v}-${w.span}`),w.offset!==void 0&&w.offset>0&&g.push(`tkx-col-${v}-offset-${w.offset}`))}const j={};return o!==void 0&&(j.left=`${o/24*100}%`,j.position="relative"),s!==void 0&&(j.right=`${s/24*100}%`,j.position="relative"),a!==void 0&&(j.order=a),e.jsx("div",{ref:m,className:x.cx("tkx-col",x.tkx("box-border min-h-[1px]"),...g,c),style:{flex:k?`0 0 ${k}`:"1",maxWidth:k??"100%",marginLeft:y,paddingLeft:b.h||void 0,paddingRight:b.h||void 0,paddingTop:b.v||void 0,paddingBottom:b.v||void 0,...j,...h},...p,children:t})});Rr.displayName="TkxCol";const ca={size:"md",variant:"default",animation:!0,bordered:!0},da={locale:"en-US",direction:"ltr",componentDefaults:ca,componentOverrides:{},prefixCls:"tkx",configured:!1,cls:t=>`tkx-${t}`,getSize:()=>"md",getAnimation:()=>!0,getBordered:()=>!0},Ot=i.createContext(da);function Lr({children:t,locale:n,direction:r,componentDefaults:o,componentOverrides:s,prefixCls:a}){const l=i.useContext(Ot),d=i.useMemo(()=>({size:(o==null?void 0:o.size)??l.componentDefaults.size,variant:(o==null?void 0:o.variant)??l.componentDefaults.variant,animation:(o==null?void 0:o.animation)??l.componentDefaults.animation,bordered:(o==null?void 0:o.bordered)??l.componentDefaults.bordered}),[o,l.componentDefaults]),f=i.useMemo(()=>{const g=l.componentOverrides,S=s??{};return{button:{...g.button,...S.button},input:{...g.input,...S.input},table:{...g.table,...S.table},modal:{...g.modal,...S.modal}}},[s,l.componentOverrides]),u=n??l.locale,c=r??l.direction,h=a??l.prefixCls,p=i.useCallback(g=>`${h}-${g}`,[h]),m=i.useCallback((g,S)=>{if(S!==void 0)return S;if(g){const j=f[g];if(j!=null&&j.size)return j.size}return d.size},[d.size,f]),b=i.useCallback(g=>g!==void 0?g:d.animation,[d.animation]),k=i.useCallback((g,S)=>{if(S!==void 0)return S;if(g){const j=f[g];if((j==null?void 0:j.bordered)!==void 0)return j.bordered}return d.bordered},[d.bordered,f]),y=i.useMemo(()=>({locale:u,direction:c,componentDefaults:d,componentOverrides:f,prefixCls:h,configured:!0,cls:p,getSize:m,getAnimation:b,getBordered:k}),[u,c,d,f,h,p,m,b,k]);return e.jsx(Ot.Provider,{value:y,children:e.jsx("div",{dir:c,lang:u,className:`${h}-config-root`,style:{direction:c},children:t})})}Lr.displayName="TkxConfigProvider";function vt(){return i.useContext(Ot)}function ua(t,n){const{prefixCls:r}=vt();return`${n??r}-${t}`}function fa(t,n){const{getSize:r}=vt();return r(t,n)}const xa={sm:32,md:40,lg:48},pa={sm:"0.75rem",md:"0.875rem",lg:"1rem"},ha={sm:8,md:12,lg:16},ma={sm:4,md:8,lg:12},ga={sm:4,md:6,lg:8},ba={sm:14,md:16,lg:20};function ya(){const{direction:t}=vt();if(t==="rtl")return{transform:"scaleX(-1)"}}function ka(t,n=0){const{direction:r}=vt(),o=typeof t=="number"?`${t}px`:t,s=typeof n=="number"?`${n}px`:n;return r==="rtl"?{marginRight:o,marginLeft:s}:{marginLeft:o,marginRight:s}}const Dn={"en-US":"English (US)","en-GB":"English (UK)","es-ES":"Spanish","fr-FR":"French","de-DE":"German","ja-JP":"Japanese","ko-KR":"Korean","zh-CN":"Chinese (Simplified)","zh-TW":"Chinese (Traditional)","pt-BR":"Portuguese (Brazil)","ar-SA":"Arabic","hi-IN":"Hindi","ru-RU":"Russian","it-IT":"Italian","nl-NL":"Dutch","sv-SE":"Swedish","pl-PL":"Polish","tr-TR":"Turkish","th-TH":"Thai","vi-VN":"Vietnamese"},Bn=new Set(["ar","ar-SA","ar-EG","ar-AE","he","he-IL","fa","fa-IR","ur","ur-PK","ps","ps-AF"]);function va(t){return Bn.has(t)||Bn.has(t.split("-")[0])}function wa(t){if(Dn[t])return Dn[t];if(typeof Intl<"u"&&Intl.DisplayNames)try{return new Intl.DisplayNames(["en"],{type:"language"}).of(t)??t}catch{return t}return t}function kt(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(kt).join(""):t&&typeof t=="object"&&"props"in t?kt(t.props.children):""}function Ut({text:t}){const n=O.useTheme(),[r,o]=i.useState(!1),s=i.useCallback(()=>{navigator.clipboard.writeText(t).then(()=>{o(!0),setTimeout(()=>o(!1),2e3)})},[t]);return i.createElement("button",{type:"button",onClick:s,"aria-label":r?"Copied":"Copy to clipboard",style:{display:"inline-flex",alignItems:"center",marginLeft:"4px",padding:"2px 6px",border:"none",background:"transparent",color:r?n.success:n.textMuted,cursor:"pointer",fontSize:"0.8em",borderRadius:"4px",transition:"color 0.2s"}},r?"Copied!":"⎘")}function Ar(t="default"){const n=O.useTheme();return{default:n.text,secondary:n.textMuted,success:n.success,warning:n.warning,danger:n.danger}[t]}const ja={1:{fontSize:"2.25rem",lineHeight:"1.2",fontWeight:700},2:{fontSize:"1.875rem",lineHeight:"1.25",fontWeight:700},3:{fontSize:"1.5rem",lineHeight:"1.3",fontWeight:600},4:{fontSize:"1.25rem",lineHeight:"1.35",fontWeight:600},5:{fontSize:"1rem",lineHeight:"1.4",fontWeight:600}};function Sa({level:t=1,children:n,copyable:r=!1,type:o="default",style:s}){const a=Ar(o);O.useTheme();const l=ja[t],d=`h${t}`,f=typeof n=="string"?A.sanitizeString(n):n,u=kt(n);return i.createElement(d,{style:{color:a,fontSize:l.fontSize,lineHeight:l.lineHeight,fontWeight:l.fontWeight,margin:"0 0 0.5em 0",fontFamily:"inherit",...s}},f,r&&i.createElement(Ut,{text:u}))}function Ma({children:t,type:n="default",strong:r=!1,italic:o=!1,underline:s=!1,delete:a=!1,code:l=!1,mark:d=!1,copyable:f=!1,style:u}){const c=Ar(n),h=O.useTheme(),p=kt(t),m=typeof t=="string"?A.sanitizeString(t):t,b=[];s&&b.push("underline"),a&&b.push("line-through");let k=m;l&&(k=i.createElement("code",{style:{padding:"0.15em 0.4em",fontSize:"0.875em",backgroundColor:h.surfaceAlt,border:`1px solid ${h.border}`,borderRadius:"4px",fontFamily:"monospace"}},k)),d&&(k=i.createElement("mark",{style:{backgroundColor:`${h.warning}33`,color:c,padding:"0 2px",borderRadius:"2px"}},k));const y=r?"strong":o?"em":"span";return i.createElement(y,{style:{color:c,fontStyle:o?"italic":"normal",textDecoration:b.length>0?b.join(" "):"none",...u}},k,f&&i.createElement(Ut,{text:p}))}function Ta({children:t,type:n="default",copyable:r=!1,ellipsis:o=!1,style:s}){const a=O.useTheme(),l=n==="secondary"?a.textMuted:a.text,d=kt(t),f=typeof t=="string"?A.sanitizeString(t):t,u={};if(o){const c=typeof o=="object"?o.rows??3:3;u.display="-webkit-box",u.WebkitLineClamp=c,u.WebkitBoxOrient="vertical",u.overflow="hidden"}return i.createElement("div",{style:{color:l,fontSize:"1rem",lineHeight:"1.6",margin:"0 0 1em 0",...u,...s}},f,r&&i.createElement(Ut,{text:d}))}const Ca={sm:{dimension:20,borderWidth:2,fontSize:"0.75rem"},md:{dimension:32,borderWidth:3,fontSize:"0.875rem"},lg:{dimension:48,borderWidth:4,fontSize:"1rem"}};let Wn=!1;function Ia(){if(Wn||typeof document>"u")return;Wn=!0;const t=document.createElement("style");t.id="tkx-spin-styles",t.textContent=`
113
+ `,document.head.appendChild(e)},[]),(0,s.jsx)(`article`,{"aria-label":`Rich text content`,className:n.a(`font-sans`,i??``),style:{color:c.text,maxWidth:720,...a},children:u})}var Ti={sm:576,md:768,lg:992,xl:1200};function Ei(e){return typeof e==`number`?`${e}px`:e}var Di=(0,o.createContext)({h:0,v:0}),Oi=(0,o.forwardRef)(({children:e,hasSider:r=!1,className:i,style:a,...o},c)=>{let l=t.f(),u=n.a(`flex min-h-0 w-full font-sans`),d=r?{flexDirection:`row`}:{flexDirection:`column`};return(0,s.jsx)(`section`,{ref:c,className:n.t(`tkx-layout`,u,i),style:{minHeight:`100%`,color:l.text,backgroundColor:l.bg,...d,...a},...o,children:e})});Oi.displayName=`TkxLayout`;var ki=(0,o.forwardRef)(({children:e,height:r=64,fixed:i=!1,className:a,style:o,...c},l)=>{let u=t.f(),d=Ei(r),f=n.a(`flex items-center px-6 shrink-0 w-full`),p=i?{position:`fixed`,top:0,left:0,right:0,zIndex:1e3}:{};return(0,s.jsx)(`header`,{ref:l,className:n.t(`tkx-layout-header`,f,a),style:{height:d,minHeight:d,backgroundColor:u.surface,borderBottom:`1px solid ${u.border}`,...p,...o},...c,children:e})});ki.displayName=`TkxHeader`;function Ai({collapsed:e,onClick:t,color:i}){let a=r.o();return(0,s.jsx)(`button`,{type:`button`,"aria-label":e?`Expand sidebar`:`Collapse sidebar`,onClick:t,className:n.a(`flex items-center justify-center w-full py-3 cursor-pointer`,`border-0 bg-transparent`),style:{color:i},children:(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,style:{transform:e?`rotate(0deg)`:`rotate(180deg)`,transition:a?`none`:`transform 200ms ease`},"aria-hidden":`true`,children:(0,s.jsx)(`path`,{d:`M6 3l5 5-5 5`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})})}var ji=(0,o.forwardRef)(({children:e,width:i=240,collapsedWidth:a=64,collapsed:c,onCollapse:l,collapsible:u=!1,breakpoint:d,trigger:f,className:p,style:m,...h},g)=>{let _=t.f(),v=r.o(),[y,b]=(0,o.useState)(!1),x=c??y,S=(0,o.useCallback)(e=>{c===void 0&&b(e),l?.(e)},[c,l]);(0,o.useEffect)(()=>{if(!d)return;let e=Ti[d];if(!e)return;let t=window.matchMedia(`(max-width: ${e-1}px)`),n=e=>{S(e.matches)};return S(t.matches),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[d,S]);let C=Ei(i),w=x?`${a}px`:C,T=u&&f!==null,E=v?`none`:`width 200ms ease, min-width 200ms ease, max-width 200ms ease`;return(0,s.jsxs)(`aside`,{ref:g,className:n.t(`tkx-layout-sider`,n.a(`shrink-0 overflow-hidden flex flex-col`),p),style:{width:w,minWidth:w,maxWidth:w,backgroundColor:_.surface,borderRight:`1px solid ${_.border}`,transition:E,...m},...h,children:[(0,s.jsx)(`div`,{className:n.a(`flex-1 overflow-y-auto overflow-x-hidden`),style:{width:w,transition:E},children:e}),T&&(0,s.jsx)(`div`,{className:n.a(`shrink-0`),style:{borderTop:`1px solid ${_.border}`},children:f===void 0?(0,s.jsx)(Ai,{collapsed:x,onClick:()=>S(!x),color:_.textMuted}):f})]})});ji.displayName=`TkxSider`;var Mi=(0,o.forwardRef)(({children:e,className:r,style:i,...a},o)=>{let c=t.f();return(0,s.jsx)(`main`,{ref:o,className:n.t(`tkx-layout-content`,n.a(`flex-1 min-w-0 min-h-0`),r),style:{backgroundColor:c.bg,padding:`24px`,...i},...a,children:e})});Mi.displayName=`TkxContent`;var Ni=(0,o.forwardRef)(({children:e,className:r,style:i,...a},o)=>{let c=t.f();return(0,s.jsx)(`footer`,{ref:o,className:n.t(`tkx-layout-footer`,n.a(`flex items-center px-6 py-4 shrink-0`),r),style:{backgroundColor:c.surface,borderTop:`1px solid ${c.border}`,color:c.textMuted,...i},...a,children:e})});Ni.displayName=`TkxFooter`;var Pi={start:`flex-start`,center:`center`,end:`flex-end`,"space-between":`space-between`,"space-around":`space-around`,"space-evenly":`space-evenly`},Fi={top:`flex-start`,middle:`center`,bottom:`flex-end`,stretch:`stretch`},Ii=(0,o.forwardRef)(({children:e,gutter:t,justify:r=`start`,align:i=`top`,wrap:a=!0,className:o,style:c,...l},u)=>{let[d,f]=Array.isArray(t)?t:[t??0,0],p=d/2,m=f/2,h=d||f?{marginLeft:-p,marginRight:-p,marginTop:-m,marginBottom:-m}:{},g={h:p,v:m};return(0,s.jsx)(Di.Provider,{value:g,children:(0,s.jsx)(`div`,{ref:u,className:n.t(`tkx-row`,n.a(`flex w-full`),o),style:{flexWrap:a?`wrap`:`nowrap`,justifyContent:Pi[r]??`flex-start`,alignItems:Fi[i]??`flex-start`,...h,...c},...l,children:e})})});Ii.displayName=`TkxRow`;var Li=!1;function Ri(){if(Li||typeof document>`u`)return;Li=!0;let e=[];for(let[t,n]of Object.entries(Ti)){for(let r=1;r<=24;r++){let i=`${r/24*100}%`;e.push(`@media (min-width: ${n}px) { .tkx-col-${t}-${r} { flex: 0 0 ${i} !important; max-width: ${i} !important; } }`)}for(let r=0;r<=24;r++){let i=`${r/24*100}%`;e.push(`@media (min-width: ${n}px) { .tkx-col-${t}-offset-${r} { margin-left: ${i} !important; } }`)}}let t=document.createElement(`style`);t.id=`tkx-col-responsive`,t.textContent=e.join(`
114
+ `),document.head.appendChild(t)}function zi(e){if(e!==void 0)return typeof e==`number`?{span:e}:e}var Bi=(0,o.forwardRef)(({children:e,span:t,offset:r=0,push:i,pull:a,order:c,sm:l,md:u,lg:d,xl:f,className:p,style:m,...h},g)=>{(0,o.useEffect)(()=>{Ri()},[]);let _=(0,o.useContext)(Di),v=t===void 0?void 0:`${t/24*100}%`,y=r?`${r/24*100}%`:void 0,b=[],x=[[`sm`,l],[`md`,u],[`lg`,d],[`xl`,f]];for(let[e,t]of x){let n=zi(t);n&&(b.push(`tkx-col-${e}-${n.span}`),n.offset!==void 0&&n.offset>0&&b.push(`tkx-col-${e}-offset-${n.offset}`))}let S={};return i!==void 0&&(S.left=`${i/24*100}%`,S.position=`relative`),a!==void 0&&(S.right=`${a/24*100}%`,S.position=`relative`),c!==void 0&&(S.order=c),(0,s.jsx)(`div`,{ref:g,className:n.t(`tkx-col`,n.a(`box-border min-h-[1px]`),...b,p),style:{flex:v?`0 0 ${v}`:`1`,maxWidth:v??`100%`,marginLeft:y,paddingLeft:_.h||void 0,paddingRight:_.h||void 0,paddingTop:_.v||void 0,paddingBottom:_.v||void 0,...S,...m},...h,children:e})});Bi.displayName=`TkxCol`;var Vi=(0,o.createContext)({locale:`en-US`,direction:`ltr`,componentDefaults:{size:`md`,variant:`default`,animation:!0,bordered:!0},componentOverrides:{},prefixCls:`tkx`,configured:!1,cls:e=>`tkx-${e}`,getSize:()=>`md`,getAnimation:()=>!0,getBordered:()=>!0});function Hi({children:e,locale:t,direction:n,componentDefaults:r,componentOverrides:i,prefixCls:a}){let c=(0,o.useContext)(Vi),l=(0,o.useMemo)(()=>({size:r?.size??c.componentDefaults.size,variant:r?.variant??c.componentDefaults.variant,animation:r?.animation??c.componentDefaults.animation,bordered:r?.bordered??c.componentDefaults.bordered}),[r,c.componentDefaults]),u=(0,o.useMemo)(()=>{let e=c.componentOverrides,t=i??{};return{button:{...e.button,...t.button},input:{...e.input,...t.input},table:{...e.table,...t.table},modal:{...e.modal,...t.modal}}},[i,c.componentOverrides]),d=t??c.locale,f=n??c.direction,p=a??c.prefixCls,m=(0,o.useCallback)(e=>`${p}-${e}`,[p]),h=(0,o.useCallback)((e,t)=>{if(t!==void 0)return t;if(e){let t=u[e];if(t?.size)return t.size}return l.size},[l.size,u]),g=(0,o.useCallback)(e=>e===void 0?l.animation:e,[l.animation]),_=(0,o.useCallback)((e,t)=>{if(t!==void 0)return t;if(e){let t=u[e];if(t?.bordered!==void 0)return t.bordered}return l.bordered},[l.bordered,u]),v=(0,o.useMemo)(()=>({locale:d,direction:f,componentDefaults:l,componentOverrides:u,prefixCls:p,configured:!0,cls:m,getSize:h,getAnimation:g,getBordered:_}),[d,f,l,u,p,m,h,g,_]);return(0,s.jsx)(Vi.Provider,{value:v,children:(0,s.jsx)(`div`,{dir:f,lang:d,className:`${p}-config-root`,style:{direction:f},children:e})})}Hi.displayName=`TkxConfigProvider`;function Ui(){return(0,o.useContext)(Vi)}function Wi(e,t){let{prefixCls:n}=Ui();return`${t??n}-${e}`}function Gi(e,t){let{getSize:n}=Ui();return n(e,t)}var Ki={sm:32,md:40,lg:48},qi={sm:`0.75rem`,md:`0.875rem`,lg:`1rem`},Ji={sm:8,md:12,lg:16},Yi={sm:4,md:8,lg:12},Xi={sm:4,md:6,lg:8},Zi={sm:14,md:16,lg:20};function Qi(){let{direction:e}=Ui();if(e===`rtl`)return{transform:`scaleX(-1)`}}function $i(e,t=0){let{direction:n}=Ui(),r=typeof e==`number`?`${e}px`:e,i=typeof t==`number`?`${t}px`:t;return n===`rtl`?{marginRight:r,marginLeft:i}:{marginLeft:r,marginRight:i}}var ea={"en-US":`English (US)`,"en-GB":`English (UK)`,"es-ES":`Spanish`,"fr-FR":`French`,"de-DE":`German`,"ja-JP":`Japanese`,"ko-KR":`Korean`,"zh-CN":`Chinese (Simplified)`,"zh-TW":`Chinese (Traditional)`,"pt-BR":`Portuguese (Brazil)`,"ar-SA":`Arabic`,"hi-IN":`Hindi`,"ru-RU":`Russian`,"it-IT":`Italian`,"nl-NL":`Dutch`,"sv-SE":`Swedish`,"pl-PL":`Polish`,"tr-TR":`Turkish`,"th-TH":`Thai`,"vi-VN":`Vietnamese`},ta=new Set([`ar`,`ar-SA`,`ar-EG`,`ar-AE`,`he`,`he-IL`,`fa`,`fa-IR`,`ur`,`ur-PK`,`ps`,`ps-AF`]);function na(e){return ta.has(e)||ta.has(e.split(`-`)[0])}function ra(e){if(ea[e])return ea[e];if(typeof Intl<`u`&&Intl.DisplayNames)try{return new Intl.DisplayNames([`en`],{type:`language`}).of(e)??e}catch{return e}return e}function ia(e){return typeof e==`string`?e:typeof e==`number`?String(e):Array.isArray(e)?e.map(ia).join(``):e&&typeof e==`object`&&`props`in e?ia(e.props.children):``}function aa({text:e}){let n=t.f(),[r,i]=(0,o.useState)(!1);return(0,o.createElement)(`button`,{type:`button`,onClick:(0,o.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{i(!0),setTimeout(()=>i(!1),2e3)})},[e]),"aria-label":r?`Copied`:`Copy to clipboard`,style:{display:`inline-flex`,alignItems:`center`,marginLeft:`4px`,padding:`2px 6px`,border:`none`,background:`transparent`,color:r?n.success:n.textMuted,cursor:`pointer`,fontSize:`0.8em`,borderRadius:`4px`,transition:`color 0.2s`}},r?`Copied!`:`⎘`)}function oa(e=`default`){let n=t.f();return{default:n.text,secondary:n.textMuted,success:n.success,warning:n.warning,danger:n.danger}[e]}var sa={1:{fontSize:`2.25rem`,lineHeight:`1.2`,fontWeight:700},2:{fontSize:`1.875rem`,lineHeight:`1.25`,fontWeight:700},3:{fontSize:`1.5rem`,lineHeight:`1.3`,fontWeight:600},4:{fontSize:`1.25rem`,lineHeight:`1.35`,fontWeight:600},5:{fontSize:`1rem`,lineHeight:`1.4`,fontWeight:600}};function ca({level:e=1,children:r,copyable:i=!1,type:a=`default`,style:s}){let c=oa(a);t.f();let l=sa[e],u=`h${e}`,d=typeof r==`string`?n.m(r):r,f=ia(r);return(0,o.createElement)(u,{style:{color:c,fontSize:l.fontSize,lineHeight:l.lineHeight,fontWeight:l.fontWeight,margin:`0 0 0.5em 0`,fontFamily:`inherit`,...s}},d,i&&(0,o.createElement)(aa,{text:f}))}function la({children:e,type:r=`default`,strong:i=!1,italic:a=!1,underline:s=!1,delete:c=!1,code:l=!1,mark:u=!1,copyable:d=!1,style:f}){let p=oa(r),m=t.f(),h=ia(e),g=typeof e==`string`?n.m(e):e,_=[];s&&_.push(`underline`),c&&_.push(`line-through`);let v=g;return l&&(v=(0,o.createElement)(`code`,{style:{padding:`0.15em 0.4em`,fontSize:`0.875em`,backgroundColor:m.surfaceAlt,border:`1px solid ${m.border}`,borderRadius:`4px`,fontFamily:`monospace`}},v)),u&&(v=(0,o.createElement)(`mark`,{style:{backgroundColor:`${m.warning}33`,color:p,padding:`0 2px`,borderRadius:`2px`}},v)),(0,o.createElement)(i?`strong`:a?`em`:`span`,{style:{color:p,fontStyle:a?`italic`:`normal`,textDecoration:_.length>0?_.join(` `):`none`,...f}},v,d&&(0,o.createElement)(aa,{text:h}))}function ua({children:e,type:r=`default`,copyable:i=!1,ellipsis:a=!1,style:s}){let c=t.f(),l=r===`secondary`?c.textMuted:c.text,u=ia(e),d=typeof e==`string`?n.m(e):e,f={};if(a){let e=typeof a==`object`?a.rows??3:3;f.display=`-webkit-box`,f.WebkitLineClamp=e,f.WebkitBoxOrient=`vertical`,f.overflow=`hidden`}return(0,o.createElement)(`div`,{style:{color:l,fontSize:`1rem`,lineHeight:`1.6`,margin:`0 0 1em 0`,...f,...s}},d,i&&(0,o.createElement)(aa,{text:u}))}var da={sm:{dimension:20,borderWidth:2,fontSize:`0.75rem`},md:{dimension:32,borderWidth:3,fontSize:`0.875rem`},lg:{dimension:48,borderWidth:4,fontSize:`1rem`}},fa=!1;function pa(){if(fa||typeof document>`u`)return;fa=!0;let e=document.createElement(`style`);e.id=`tkx-spin-styles`,e.textContent=`
115
115
  @keyframes tkx-spin-rotate {
116
116
  0% { transform: rotate(0deg); }
117
117
  100% { transform: rotate(360deg); }
118
118
  }
119
- `,document.head.appendChild(t)}function $a({size:t,color:n}){return i.createElement("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",role:"img","aria-label":"Loading"},i.createElement("circle",{cx:12,cy:12,r:10,stroke:`${n}33`,strokeWidth:2.5,fill:"none"}),i.createElement("path",{d:"M12 2a10 10 0 0 1 10 10",stroke:n,strokeWidth:2.5,strokeLinecap:"round",fill:"none"}))}function za({size:t,borderWidth:n,color:r,reducedMotion:o}){return o?i.createElement($a,{size:t,color:r}):(Ia(),i.createElement("div",{role:"img","aria-label":"Loading",style:{width:`${t}px`,height:`${t}px`,border:`${n}px solid ${r}33`,borderTopColor:r,borderRadius:"50%",animation:"tkx-spin-rotate 0.8s linear infinite",boxSizing:"border-box"}}))}function Ea({spinning:t=!0,size:n="md",tip:r,indicator:o,children:s,fullscreen:a=!1,delay:l=0,style:d}){const f=O.useTheme(),u=J.useReducedMotion(),[c,h]=i.useState(l===0&&t),p=i.useRef(null);if(i.useEffect(()=>(t&&l>0?p.current=setTimeout(()=>h(!0),l):h(t),()=>{p.current!==null&&clearTimeout(p.current)}),[t,l]),!c)return s?i.createElement("div",{style:d},s):null;const m=Ca[n],b=r?A.sanitizeString(r):void 0,k=i.createElement("div",{role:"status","aria-live":"polite","aria-label":b??"Loading",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},o??i.createElement(za,{size:m.dimension,borderWidth:m.borderWidth,color:f.primary,reducedMotion:u}),b&&i.createElement("span",{style:{color:f.primary,fontSize:m.fontSize,marginTop:"4px"}},b));return a?i.createElement("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${f.bg}cc`,zIndex:9999,...d}},k):s?i.createElement("div",{style:{position:"relative",...d}},i.createElement("div",{style:{filter:"blur(1px)",opacity:.5,pointerEvents:"none",userSelect:"none",transition:u?"none":"opacity 0.2s, filter 0.2s"}},s),i.createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${f.bg}66`,borderRadius:"4px"}},k)):i.createElement("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",...d}},k)}function Na({color:t,mutedColor:n}){return i.createElement("svg",{width:120,height:100,viewBox:"0 0 120 100",fill:"none","aria-hidden":"true"},i.createElement("path",{d:"M20 40 L60 20 L100 40 L60 60 Z",fill:`${n}18`,stroke:n,strokeWidth:1.5,strokeLinejoin:"round"}),i.createElement("path",{d:"M20 40 L20 65 L60 85 L60 60 Z",fill:`${n}10`,stroke:n,strokeWidth:1.5,strokeLinejoin:"round"}),i.createElement("path",{d:"M100 40 L100 65 L60 85 L60 60 Z",fill:`${n}0d`,stroke:n,strokeWidth:1.5,strokeLinejoin:"round"}),i.createElement("path",{d:"M20 40 L40 28 L60 40 L40 52 Z",fill:`${t}15`,stroke:t,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}),i.createElement("path",{d:"M60 40 L80 28 L100 40 L80 52 Z",fill:`${t}15`,stroke:t,strokeWidth:1,strokeLinejoin:"round",strokeDasharray:"3 2"}))}function Ra({mutedColor:t}){return i.createElement("svg",{width:64,height:64,viewBox:"0 0 64 64",fill:"none","aria-hidden":"true"},i.createElement("rect",{x:16,y:8,width:32,height:40,rx:3,fill:`${t}12`,stroke:t,strokeWidth:1.5}),i.createElement("line",{x1:24,y1:20,x2:40,y2:20,stroke:t,strokeWidth:1.5,strokeLinecap:"round"}),i.createElement("line",{x1:24,y1:28,x2:36,y2:28,stroke:t,strokeWidth:1.5,strokeLinecap:"round"}),i.createElement("line",{x1:24,y1:36,x2:32,y2:36,stroke:t,strokeWidth:1.5,strokeLinecap:"round"}),i.createElement("circle",{cx:32,cy:54,r:6,stroke:t,strokeWidth:1.2,fill:"none"}),i.createElement("line",{x1:28,y1:54,x2:36,y2:54,stroke:t,strokeWidth:1.2,strokeLinecap:"round"}))}function La({image:t="default",description:n="No data",children:r,style:o}){const s=O.useTheme(),a=typeof n=="string"?A.sanitizeString(n):n;let l;return t==="default"?l=i.createElement(Na,{color:s.primary,mutedColor:s.textMuted}):t==="simple"?l=i.createElement(Ra,{mutedColor:s.textMuted}):l=t,i.createElement("div",{role:"status",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px 16px",textAlign:"center",...o}},i.createElement("div",{style:{marginBottom:"12px",opacity:.85}},l),a&&i.createElement("div",{style:{color:s.textMuted,fontSize:"0.875rem",lineHeight:"1.5",maxWidth:"320px"}},a),r&&i.createElement("div",{style:{marginTop:"16px"}},r))}function Aa(t,n,r=","){if(typeof t=="string")return t;const o=n!==void 0?t.toFixed(n):String(t),[s,a]=o.split("."),l=s.replace(/\B(?=(\d{3})+(?!\d))/g,r);return a!==void 0?`${l}.${a}`:l}function Da(t,n){if(t<=0)return n.replace(/DD?/g,"0").replace(/HH?/g,"00").replace(/mm?/g,"00").replace(/ss?/g,"00");const r=Math.floor(t/1e3),o=Math.floor(r/86400),s=Math.floor(r%86400/3600),a=Math.floor(r%3600/60),l=r%60,d=f=>String(f).padStart(2,"0");return n.replace(/DD/g,d(o)).replace(/D/g,String(o)).replace(/HH/g,d(s)).replace(/H/g,String(s)).replace(/mm/g,d(a)).replace(/m/g,String(a)).replace(/ss/g,d(l)).replace(/s/g,String(l))}function Ba({direction:t,color:n}){const r=t==="up"?"M6 10 L10 4 L14 10":"M6 4 L10 10 L14 4";return i.createElement("svg",{width:16,height:14,viewBox:"0 0 20 14",fill:"none","aria-hidden":"true",style:{display:"inline-block",verticalAlign:"middle"}},i.createElement("path",{d:r,stroke:n,strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}))}let Fn=!1;function Wa(){if(Fn||typeof document>"u")return;Fn=!0;const t=document.createElement("style");t.id="tkx-statistic-skeleton",t.textContent="@keyframes tkx-stat-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}",document.head.appendChild(t)}function Fa({w:t,h:n,alt:r,bdr:o,rm:s}){return s||Wa(),i.createElement("div",{"aria-hidden":"true",style:{width:t,height:n,borderRadius:"4px",background:s?r:`linear-gradient(90deg, ${r} 25%, ${o} 50%, ${r} 75%)`,backgroundSize:"200% 100%",animation:s?"none":"tkx-stat-shimmer 1.5s ease-in-out infinite"}})}function Pa({title:t,value:n,prefix:r,suffix:o,precision:s,groupSeparator:a=",",valueStyle:l,loading:d=!1,trend:f,trendValue:u,style:c}){const h=O.useTheme(),p=J.useReducedMotion(),m=A.sanitizeString(t),b=u?A.sanitizeString(u):void 0,k=f==="up"?h.success:f==="down"?h.danger:void 0;return i.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...c}},i.createElement("div",{style:{color:h.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},m),d?i.createElement(Fa,{w:"120px",h:"32px",alt:h.surfaceAlt,bdr:h.border,rm:p}):i.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:h.text,fontVariantNumeric:"tabular-nums",...l}},r&&i.createElement("span",{style:{fontSize:"0.75em",fontWeight:400}},r),i.createElement("span",null,Aa(n,s,a)),o&&i.createElement("span",{style:{fontSize:"0.6em",fontWeight:400,color:h.textMuted}},o)),f&&i.createElement("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"0.8125rem",color:k,marginTop:"2px"}},i.createElement(Ba,{direction:f,color:k}),b&&i.createElement("span",null,b)))}function Ha({title:t,value:n,format:r="HH:mm:ss",onFinish:o,prefix:s,suffix:a,style:l}){const d=O.useTheme(),f=A.sanitizeString(t),u=i.useRef(o);u.current=o;const c=i.useRef(!1),[h,p]=i.useState(()=>Math.max(0,n-Date.now()));i.useEffect(()=>{c.current=!1;const b=()=>{var g;const y=Math.max(0,n-Date.now());p(y),y<=0&&!c.current&&(c.current=!0,(g=u.current)==null||g.call(u))};b();const k=setInterval(b,1e3);return()=>clearInterval(k)},[n]);const m=Da(h,r);return i.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...l}},i.createElement("div",{style:{color:d.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},f),i.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:"4px",fontSize:"1.75rem",fontWeight:700,lineHeight:"1.2",color:h<=0?d.danger:d.text,fontVariantNumeric:"tabular-nums"}},s&&i.createElement("span",{style:{fontSize:"0.75em",fontWeight:400}},s),i.createElement("span",null,m),a&&i.createElement("span",{style:{fontSize:"0.6em",fontWeight:400,color:d.textMuted}},a)))}const Va={sm:{height:28,fontSize:12,px:10},md:{height:36,fontSize:14,px:16},lg:{height:44,fontSize:16,px:20}};function Oa({options:t,value:n,onChange:r,size:o="md",block:s=!1}){const a=O.useTheme(),l=J.useReducedMotion(),d=i.useRef(null),[f,u]=i.useState(()=>Math.max(0,t.findIndex(k=>k.value===n))),[c,h]=i.useState({}),p=Va[o];i.useEffect(()=>{const k=t.findIndex(y=>y.value===n);k>=0&&u(k)},[n,t]),i.useEffect(()=>{const k=d.current;if(!k)return;const g=k.querySelectorAll("[data-seg-btn]")[f];g&&h({left:g.offsetLeft,width:g.offsetWidth,height:g.offsetHeight,transition:l?"none":"left 0.2s ease, width 0.2s ease"})},[f,t,l]);const m=i.useCallback(k=>{const y=t[k];!y||y.disabled||(u(k),r==null||r(y.value))},[t,r]),b=i.useCallback(k=>{var g,S,j;let y=f;if(k.key==="ArrowRight"||k.key==="ArrowDown")for(k.preventDefault(),y=(f+1)%t.length;(g=t[y])!=null&&g.disabled&&y!==f;)y=(y+1)%t.length;else if(k.key==="ArrowLeft"||k.key==="ArrowUp")for(k.preventDefault(),y=(f-1+t.length)%t.length;(S=t[y])!=null&&S.disabled&&y!==f;)y=(y-1+t.length)%t.length;if(y!==f){m(y);const v=d.current,$=v==null?void 0:v.querySelectorAll("[data-seg-btn]");(j=$==null?void 0:$[y])==null||j.focus()}},[f,t,m]);return e.jsxs("div",{ref:d,role:"radiogroup","aria-label":"Segmented control",className:x.tkx("relative inline-flex items-center rounded-lg p-1"),style:{backgroundColor:a.surfaceAlt,border:`1px solid ${a.border}`,width:s?"100%":void 0},onKeyDown:b,children:[e.jsx("div",{"aria-hidden":"true",className:x.tkx("absolute top-1 rounded-md"),style:{...c,backgroundColor:a.surface,boxShadow:`0 1px 3px ${a.border}`,zIndex:0}}),t.map((k,y)=>{const g=y===f,S=A.sanitizeString(k.label);return e.jsxs("button",{"data-seg-btn":!0,type:"button",role:"radio","aria-checked":g,"aria-disabled":k.disabled||void 0,disabled:k.disabled,tabIndex:g?0:-1,className:x.tkx("relative z-10 flex items-center justify-center gap-1 rounded-md border-0 cursor-pointer","font-sans whitespace-nowrap select-none"),style:{height:p.height,fontSize:p.fontSize,padding:`0 ${p.px}px`,flex:s?1:void 0,color:g?a.text:a.textMuted,backgroundColor:"transparent",opacity:k.disabled?.4:1,fontWeight:g?600:400,transition:l?"none":"color 0.15s ease"},onClick:()=>m(y),children:[k.icon&&e.jsx("span",{"aria-hidden":"true",children:k.icon}),S]},k.value)})]})}function _a({options:t,value:n="",onChange:r,trigger:o="@",placeholder:s,label:a}){const l=O.useTheme(),d=J.useReducedMotion(),f=i.useRef(null),u=i.useRef(null),[c,h]=i.useState(n),[p,m]=i.useState(!1),[b,k]=i.useState(""),[y,g]=i.useState(0),[S,j]=i.useState(-1);i.useEffect(()=>{n!==void 0&&h(n)},[n]);const v=t.filter(T=>T.label.toLowerCase().includes(b.toLowerCase())),$=i.useCallback(T=>{const E=T.target.value;h(E),r==null||r(E);const C=T.target.selectionStart??E.length,H=E.slice(0,C),z=H.lastIndexOf(o);if(z>=0){const L=H.slice(z+o.length);if(!/\s/.test(L)){k(L),j(z),m(!0),g(0);return}}m(!1)},[o,r]),w=i.useCallback(T=>{var z;const E=c.slice(0,S),C=c.slice(S+o.length+b.length),H=`${E}${o}${T.value} ${C}`;h(H),r==null||r(H),m(!1),(z=f.current)==null||z.focus()},[c,S,o,b,r]),N=i.useCallback(T=>{p&&(T.key==="ArrowDown"?(T.preventDefault(),g(E=>(E+1)%v.length)):T.key==="ArrowUp"?(T.preventDefault(),g(E=>(E-1+v.length)%v.length)):T.key==="Enter"&&v[y]?(T.preventDefault(),w(v[y])):T.key==="Escape"&&m(!1))},[p,v,y,w]);i.useEffect(()=>{if(!p||!u.current)return;const T=u.current.children[y];T==null||T.scrollIntoView({block:"nearest"})},[y,p]);const I=a?A.sanitizeString(a):void 0,M=s?A.sanitizeString(s):void 0;return e.jsxs("div",{className:x.tkx("relative font-sans"),style:{width:"100%"},children:[I&&e.jsx("label",{className:x.tkx("block text-sm font-medium mb-1"),style:{color:l.text},children:I}),e.jsx("textarea",{ref:f,role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-label":I??"Mentions input",value:c,placeholder:M,onChange:$,onKeyDown:N,onBlur:()=>setTimeout(()=>m(!1),200),className:x.tkx("w-full rounded-lg border px-3 py-2 text-sm resize-y"),style:{backgroundColor:l.surface,borderColor:l.border,color:l.text,minHeight:80,outline:"none"},rows:3}),p&&v.length>0&&e.jsx("ul",{ref:u,role:"listbox","aria-label":"Mention suggestions",className:x.tkx("absolute left-0 right-0 z-50 rounded-lg border overflow-auto"),style:{backgroundColor:l.surface,borderColor:l.border,maxHeight:200,top:"100%",marginTop:4,listStyle:"none",padding:0,boxShadow:`0 4px 12px ${l.bg}80`,animation:d?"none":"tkxFadeIn 0.15s ease"},children:v.map((T,E)=>e.jsxs("li",{role:"option","aria-selected":E===y,className:x.tkx("flex items-center gap-3 px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:E===y?l.surfaceAlt:"transparent",color:l.text},onMouseDown:C=>{C.preventDefault(),w(T)},onMouseEnter:()=>g(E),children:[T.avatar&&e.jsx("img",{src:A.sanitizeString(T.avatar),alt:"","aria-hidden":"true",width:24,height:24,className:x.tkx("rounded-full"),style:{objectFit:"cover"}}),e.jsx("span",{children:A.sanitizeString(T.label)}),e.jsxs("span",{style:{color:l.textMuted,marginLeft:"auto"},children:[o,A.sanitizeString(T.value)]})]},T.value))})]})}function Ya(t){let n=5381;for(let r=0;r<t.length;r++)n=(n<<5)+n+t.charCodeAt(r)|0;return Math.abs(n)}function Ka(t){let n=t;return()=>(n=n*1664525+1013904223|0,(n>>>0)/4294967295)}const Ua={L:.38,M:.42,Q:.48,H:.55};function Xa(t,n,r){const o=Ya(t),s=Ka(o),a=Ua[r]??.42,l=Array.from({length:n},()=>Array.from({length:n},()=>!1)),d=(f,u)=>{for(let c=0;c<7;c++)for(let h=0;h<7;h++){const p=c===0||c===6||h===0||h===6,m=c>=2&&c<=4&&h>=2&&h<=4;l[f+c][u+h]=p||m}};d(0,0),d(0,n-7),d(n-7,0);for(let f=7;f<n-7;f++)l[6][f]=f%2===0,l[f][6]=f%2===0;for(let f=0;f<n;f++)for(let u=0;u<n;u++)f<8&&u<8||f<8&&u>=n-8||f>=n-8&&u<8||(f===6||u===6)||(l[f][u]=s()<a);return l}function Za({value:t,size:n=160,color:r,bgColor:o,errorLevel:s="M",icon:a,bordered:l=!0}){const d=O.useTheme(),f=J.useReducedMotion(),u=i.useRef(null),c=A.sanitizeString(t),h=r??d.text,p=o??d.surface,m=25,b=i.useMemo(()=>Xa(c,m,s),[c,s]);return i.useEffect(()=>{const k=u.current;if(!k)return;const y=k.getContext("2d");if(!y)return;const g=window.devicePixelRatio||1;k.width=n*g,k.height=n*g,y.scale(g,g);const S=n/m;y.fillStyle=p,y.fillRect(0,0,n,n),y.fillStyle=h;for(let j=0;j<m;j++)for(let v=0;v<m;v++)b[j][v]&&y.fillRect(v*S,j*S,S,S);if(a){const j=n*.22,v=(n-j)/2;y.fillStyle=p,y.fillRect(v-2,v-2,j+4,j+4);const $=new Image;$.crossOrigin="anonymous",$.onload=()=>{y.drawImage($,v,v,j,j)},$.src=A.sanitizeString(a)}},[b,n,h,p,a]),e.jsx("div",{role:"img","aria-label":`QR code for: ${c}`,className:x.tkx("inline-block rounded-lg"),style:{padding:l?12:0,backgroundColor:l?p:"transparent",border:l?`1px solid ${d.border}`:"none",lineHeight:0,animation:f?"none":"tkxFadeIn 0.2s ease"},children:e.jsx("canvas",{ref:u,"aria-hidden":"true",style:{width:n,height:n,display:"block"}})})}const Ga={success:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M22 37l9 9 19-19",stroke:t,strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]}),error:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M26 26l20 20M46 26L26 46",stroke:t,strokeWidth:"4",strokeLinecap:"round"})]}),warning:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M36 6L4 64h64L36 6z",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M36 30v16",stroke:t,strokeWidth:"4",strokeLinecap:"round"}),e.jsx("circle",{cx:"36",cy:"54",r:"2.5",fill:t})]}),info:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M36 32v18",stroke:t,strokeWidth:"4",strokeLinecap:"round"}),e.jsx("circle",{cx:"36",cy:"22",r:"2.5",fill:t})]}),404:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:t,children:"404"})]}),403:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("path",{d:"M28 30h16v16H28z",stroke:t,strokeWidth:"3",fill:"none"}),e.jsx("path",{d:"M32 30v-4a4 4 0 018 0v4",stroke:t,strokeWidth:"3",fill:"none"})]}),500:t=>e.jsxs("svg",{width:"72",height:"72",viewBox:"0 0 72 72",fill:"none","aria-hidden":"true",children:[e.jsx("circle",{cx:"36",cy:"36",r:"34",stroke:t,strokeWidth:"3",fill:`${t}18`}),e.jsx("text",{x:"36",y:"44",textAnchor:"middle",fontSize:"22",fontWeight:"bold",fill:t,children:"500"})]})};function qa(t,n){switch(t){case"success":return n.success;case"error":case"500":return n.danger;case"warning":return n.warning;case"info":return n.info;case"404":case"403":return n.textMuted}}function Qa({status:t,title:n,subTitle:r,icon:o,extra:s}){const a=O.useTheme(),l=J.useReducedMotion(),d=qa(t,a),f=A.sanitizeString(n),u=r?A.sanitizeString(r):void 0;return e.jsxs("div",{role:"status","aria-live":"polite",className:x.tkx("flex flex-col items-center text-center px-6 py-12 font-sans"),style:{animation:l?"none":"tkxFadeIn 0.3s ease"},children:[e.jsx("div",{className:x.tkx("mb-6"),children:o??Ga[t](d)}),e.jsx("h2",{className:x.tkx("text-xl font-semibold m-0 mb-2"),style:{color:a.text},children:f}),u&&e.jsx("p",{className:x.tkx("text-sm m-0 mb-6 max-w-md leading-relaxed"),style:{color:a.textMuted},children:u}),s&&e.jsx("div",{className:x.tkx("flex items-center gap-3 mt-4"),children:s})]})}function Ja(t){const n=document.querySelector(t);return n?n.getBoundingClientRect():null}function el(t,n,r,o){switch(n){case"top":return{top:t.top-o-12+window.scrollY,left:t.left+t.width/2-r/2+window.scrollX};case"bottom":return{top:t.bottom+12+window.scrollY,left:t.left+t.width/2-r/2+window.scrollX};case"left":return{top:t.top+t.height/2-o/2+window.scrollY,left:t.left-r-12+window.scrollX};case"right":return{top:t.top+t.height/2-o/2+window.scrollY,left:t.right+12+window.scrollX};default:return{top:t.bottom+12+window.scrollY,left:t.left+window.scrollX}}}function tl({steps:t,isOpen:n=!1,onClose:r,current:o,onChange:s}){const a=O.useTheme(),l=J.useReducedMotion(),[d,f]=i.useState(0),u=o??d,c=i.useRef(null),[h,p]=i.useState({top:0,left:0}),[m,b]=i.useState(null),k=t[u],y=i.useCallback(()=>{if(!k)return;const M=Ja(k.target);if(b(M),M&&c.current){const T=c.current.offsetWidth,E=c.current.offsetHeight;p(el(M,k.placement??"bottom",T,E))}},[k]);i.useEffect(()=>{if(n)return y(),window.addEventListener("resize",y),window.addEventListener("scroll",y,!0),()=>{window.removeEventListener("resize",y),window.removeEventListener("scroll",y,!0)}},[n,u,y]),i.useEffect(()=>{var M;n&&((M=c.current)==null||M.focus())},[n,u]);const g=i.useCallback(M=>{f(M),s==null||s(M)},[s]),S=i.useCallback(()=>{u<t.length-1?g(u+1):r==null||r()},[u,t.length,g,r]),j=i.useCallback(()=>{u>0&&g(u-1)},[u,g]);if(!n||!k)return null;const v=6,$=A.sanitizeString(k.title),w=A.sanitizeString(k.description),I=e.jsxs("div",{"aria-hidden":"true",children:[e.jsx("div",{style:{position:"fixed",inset:0,zIndex:9998,backgroundColor:"rgba(0,0,0,0.55)",clipPath:m?`polygon(0% 0%, 0% 100%, ${m.left-v}px 100%, ${m.left-v}px ${m.top-v}px, ${m.right+v}px ${m.top-v}px, ${m.right+v}px ${m.bottom+v}px, ${m.left-v}px ${m.bottom+v}px, ${m.left-v}px 100%, 100% 100%, 100% 0%)`:void 0,transition:l?"none":"clip-path 0.25s ease"},onClick:r}),e.jsxs("div",{ref:c,role:"dialog","aria-modal":"true","aria-label":`Tour step ${u+1} of ${t.length}`,tabIndex:-1,style:{position:"absolute",zIndex:9999,top:h.top,left:h.left,width:300,backgroundColor:a.surface,border:`1px solid ${a.border}`,borderRadius:10,padding:20,boxShadow:`0 8px 24px ${a.bg}80`,animation:l?"none":"tkxFadeIn 0.2s ease",fontFamily:"inherit"},onKeyDown:M=>{M.key==="Escape"&&(r==null||r())},children:[e.jsx("h3",{className:x.tkx("m-0 mb-2 text-base font-semibold"),style:{color:a.text},children:$}),e.jsx("p",{className:x.tkx("m-0 mb-4 text-sm leading-relaxed"),style:{color:a.textMuted},children:w}),e.jsx("div",{className:x.tkx("flex items-center gap-1 mb-4"),"aria-label":"Tour progress",children:t.map((M,T)=>e.jsx("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",backgroundColor:T===u?a.primary:a.border,transition:l?"none":"background-color 0.2s"}},T))}),e.jsxs("div",{className:x.tkx("flex items-center justify-between gap-2"),children:[e.jsx("button",{type:"button","aria-label":"Skip tour",onClick:r,className:x.tkx("border-0 bg-transparent cursor-pointer text-sm px-2 py-1"),style:{color:a.textMuted},children:"Skip"}),e.jsxs("div",{className:x.tkx("flex gap-2"),children:[u>0&&e.jsx("button",{type:"button","aria-label":"Previous step",onClick:j,className:x.tkx("rounded-md border px-3 py-1 text-sm cursor-pointer bg-transparent"),style:{borderColor:a.border,color:a.text},children:"Prev"}),e.jsx("button",{type:"button","aria-label":u===t.length-1?"Finish tour":"Next step",onClick:S,className:x.tkx("rounded-md border-0 px-4 py-1 text-sm cursor-pointer font-medium"),style:{backgroundColor:a.primary,color:"#fff"},children:u===t.length-1?"Finish":"Next"})]})]})]})]});return Re.createPortal(I,document.body)}function nl(t,n,r,o,s){const a=document.createElement("canvas"),l=a.getContext("2d");if(!l)return"";const d=o*1.5,f=t.length*d,u=Math.max(...t.map(m=>m.length))*o*.6,c=r[0]+u,h=r[1]+f,p=2;return a.width=c*p,a.height=h*p,l.scale(p,p),l.translate(c/2,h/2),l.rotate(n*Math.PI/180),l.font=`${o}px sans-serif`,l.fillStyle=s,l.textAlign="center",l.textBaseline="middle",t.forEach((m,b)=>{const k=(b-(t.length-1)/2)*d;l.fillText(m,0,k)}),a.toDataURL()}function rl({text:t,children:n,rotate:r=-22,gap:o=[100,100],fontSize:s=14,color:a,zIndex:l=10}){const d=O.useTheme(),f=J.useReducedMotion(),u=i.useRef(null),[c,h]=i.useState(""),p=i.useMemo(()=>(Array.isArray(t)?t:[t]).map(k=>A.sanitizeString(k)),[t]),m=a??`${d.textMuted}22`,b=i.useCallback(()=>nl(p,r,o,s,m),[p,r,o,s,m]);return i.useEffect(()=>{const k=b();k&&h(`url(${k})`)},[b]),i.useEffect(()=>{var g;const k=(g=u.current)==null?void 0:g.querySelector("[data-watermark]");if(!k)return;const y=new MutationObserver(()=>{const S=b();S&&(k.style.backgroundImage=`url(${S})`)});return y.observe(k,{attributes:!0,attributeFilter:["style"]}),()=>y.disconnect()},[b]),e.jsxs("div",{ref:u,className:x.tkx("relative"),style:{overflow:"hidden"},children:[n,e.jsx("div",{"data-watermark":!0,"aria-hidden":"true",className:x.tkx("absolute inset-0 pointer-events-none"),style:{zIndex:l,backgroundImage:c,backgroundRepeat:"repeat",animation:f?"none":"tkxFadeIn 0.3s ease"}})]})}function Pn(t){if(t)try{return t()}catch{return window}return window}function sl(t){if(t instanceof Window)return{top:0,bottom:t.innerHeight};const n=t.getBoundingClientRect();return{top:n.top,bottom:n.bottom}}function ol({children:t,offsetTop:n,offsetBottom:r,onChange:o,target:s}){const a=O.useTheme(),l=J.useReducedMotion(),d=i.useRef(null),f=i.useRef(null),[u,c]=i.useState(!1),[h,p]=i.useState({width:0,height:0}),m=i.useRef(!1),b=i.useMemo(()=>A.sanitizeString("Sticky content"),[]),k=i.useCallback(()=>{const S=d.current;if(!S)return;const j=S.getBoundingClientRect(),v=sl(Pn(s));let $=!1;n!==void 0?$=j.top-v.top<=n:r!==void 0&&($=v.bottom-j.bottom<=r),$!==m.current&&(m.current=$,c($),p({width:j.width,height:j.height}),o==null||o($))},[n,r,o,s]);i.useEffect(()=>{const S=Pn(s);return k(),S.addEventListener("scroll",k,{passive:!0}),window.addEventListener("resize",k),()=>{S.removeEventListener("scroll",k),window.removeEventListener("resize",k)}},[k,s]);const y=u?{position:"fixed",zIndex:100,...n!==void 0?{top:n}:{},...r!==void 0?{bottom:r}:{},width:h.width||void 0,transition:l?"none":"box-shadow 0.2s ease",boxShadow:`0 2px 8px ${a.border}`}:{},g=u?{height:h.height,width:h.width}:{};return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:d,"aria-hidden":u,style:g}),e.jsx("div",{ref:f,role:"region","aria-label":b,className:x.tkx(u?"tkx-affixed":""),style:y,children:t})]})}function Dr(t){const n=[];for(const r of t)n.push(r),r.children&&n.push(...Dr(r.children));return n}function Hn(t){return t.startsWith("#")?t.slice(1):t}function Br({item:t,activeKey:n,depth:r,onClick:o,theme:s,reducedMotion:a}){const l=t.key===n,d=A.sanitizeString(t.title);return e.jsxs("li",{role:"none",style:{listStyle:"none"},children:[e.jsx("a",{role:"treeitem","aria-current":l?"location":void 0,href:t.href,onClick:f=>{f.preventDefault(),o(t.href)},className:x.tkx("block text-sm py-1 no-underline"),style:{paddingLeft:12+r*16,color:l?s.primary:s.textMuted,fontWeight:l?600:400,borderLeft:`2px solid ${l?s.primary:"transparent"}`,transition:a?"none":"color 0.15s ease, border-color 0.15s ease"},children:d}),t.children&&t.children.length>0&&e.jsx("ul",{role:"group",style:{margin:0,padding:0},children:t.children.map(f=>e.jsx(Br,{item:f,activeKey:n,depth:r+1,onClick:o,theme:s,reducedMotion:a},f.key))})]})}function il({items:t,offsetTop:n=0,getCurrentAnchor:r,onChange:o}){var p;const s=O.useTheme(),a=J.useReducedMotion(),[l,d]=i.useState(((p=t[0])==null?void 0:p.key)??""),f=i.useRef(!1),u=Dr(t),c=i.useCallback(()=>{var b;if(f.current)return;let m=((b=u[0])==null?void 0:b.key)??"";for(const k of u){const y=Hn(k.href),g=document.getElementById(y);g&&g.getBoundingClientRect().top<=n+10&&(m=k.key)}r&&(m=r(m)),m!==l&&(d(m),o==null||o(m))},[u,n,r,l,o]);i.useEffect(()=>(window.addEventListener("scroll",c,{passive:!0}),c(),()=>window.removeEventListener("scroll",c)),[c]);const h=i.useCallback(m=>{const b=Hn(m),k=document.getElementById(b);if(!k)return;f.current=!0;const y=k.getBoundingClientRect().top+window.scrollY-n;window.scrollTo({top:y,behavior:a?"auto":"smooth"});const g=u.find(S=>S.href===m);g&&(d(g.key),o==null||o(g.key)),setTimeout(()=>{f.current=!1},800)},[u,n,a,o]);return e.jsx("nav",{role:"tree","aria-label":"Anchor navigation",className:x.tkx("font-sans"),style:{borderLeft:`1px solid ${s.border}`,padding:"4px 0"},children:e.jsx("ul",{role:"group",style:{margin:0,padding:0},children:t.map(m=>e.jsx(Br,{item:m,activeKey:l,depth:0,onClick:h,theme:s,reducedMotion:a},m.key))})})}function al(t,n){var s;const r=[t];let o=t;for(const a of n){const l=o.find(d=>d.value===a);if((s=l==null?void 0:l.children)!=null&&s.length)r.push(l.children),o=l.children;else break}return r}function Wr(t,n){const r=[];let o=t;for(const s of n){const a=o.find(l=>l.value===s);if(a)r.push(a),o=a.children??[];else break}return r}function ll(t,n){return Wr(t,n).map(r=>A.sanitizeString(r.label)).join(" / ")}function cl({options:t,value:n=[],onChange:r,placeholder:o="Select...",label:s,multiple:a=!1}){const l=O.useTheme(),d=J.useReducedMotion(),f=i.useRef(null),u=i.useRef(null),[c,h]=i.useState(!1),[p,m]=i.useState(n),[b,k]=i.useState({top:0,left:0,width:0}),y=s?A.sanitizeString(s):void 0,g=A.sanitizeString(o),S=n.length>0?ll(t,n):"";i.useEffect(()=>{if(!c||!f.current)return;const N=f.current.getBoundingClientRect();k({top:N.bottom+4+window.scrollY,left:N.left+window.scrollX,width:Math.max(N.width,200)})},[c]),i.useEffect(()=>{if(!c)return;const N=I=>{var M,T;!((M=f.current)!=null&&M.contains(I.target))&&!((T=u.current)!=null&&T.contains(I.target))&&h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[c]);const j=i.useCallback((N,I)=>{var T;if(I.disabled)return;const M=[...p.slice(0,N),I.value];if(m(M),!((T=I.children)!=null&&T.length)){const E=Wr(t,M);r==null||r(M,E),a||h(!1)}},[p,t,r,a]),v=i.useCallback(N=>{var I;N.key==="Escape"?(h(!1),(I=f.current)==null||I.focus()):(N.key==="Enter"||N.key===" ")&&(c||(N.preventDefault(),h(!0)))},[c]),$=al(t,p),w=c?Re.createPortal(e.jsx("div",{ref:u,role:"tree","aria-label":y??"Cascader options",className:x.tkx("flex rounded-lg border overflow-hidden"),style:{position:"absolute",zIndex:9999,top:b.top,left:b.left,backgroundColor:l.surface,borderColor:l.border,boxShadow:`0 4px 16px ${l.bg}80`,animation:d?"none":"tkxFadeIn 0.15s ease"},children:$.map((N,I)=>e.jsx("ul",{role:"group",className:x.tkx("m-0 p-0 overflow-auto"),style:{listStyle:"none",minWidth:160,maxHeight:260,borderRight:I<$.length-1?`1px solid ${l.border}`:"none"},children:N.map(M=>{var C;const T=p[I]===M.value,E=A.sanitizeString(M.label);return e.jsxs("li",{role:"treeitem","aria-selected":T,"aria-disabled":M.disabled||void 0,"aria-expanded":(C=M.children)!=null&&C.length?T:void 0,className:x.tkx("flex items-center justify-between px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:T?l.surfaceAlt:"transparent",color:M.disabled?l.textMuted:l.text,opacity:M.disabled?.5:1,cursor:M.disabled?"not-allowed":"pointer"},onClick:()=>j(I,M),onMouseEnter:()=>{M.disabled||m(H=>[...H.slice(0,I),M.value])},children:[e.jsx("span",{children:E}),M.children&&M.children.length>0&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:l.textMuted,flexShrink:0},children:e.jsx("path",{d:"M10 6l6 6-6 6V6z"})})]},M.value)})},I))}),document.body):null;return e.jsxs("div",{className:x.tkx("relative font-sans"),onKeyDown:v,children:[y&&e.jsx("label",{className:x.tkx("block text-sm font-medium mb-1"),style:{color:l.text},children:y}),e.jsxs("button",{ref:f,type:"button",role:"combobox","aria-expanded":c,"aria-haspopup":"tree","aria-label":y??"Cascader",className:x.tkx("w-full flex items-center justify-between rounded-lg border px-3 py-2 text-sm cursor-pointer"),style:{backgroundColor:l.surface,borderColor:c?l.primary:l.border,color:S?l.text:l.textMuted,outline:"none",minHeight:38,textAlign:"left"},onClick:()=>h(N=>!N),children:[e.jsx("span",{className:x.tkx("truncate"),children:S||g}),e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:l.textMuted,transform:c?"rotate(180deg)":"rotate(0deg)",transition:d?"none":"transform 0.2s ease",flexShrink:0},children:e.jsx("path",{d:"M7 10l5 5 5-5H7z"})})]}),w]})}const dl={sm:"8px 12px",md:"12px 16px",lg:"16px 20px"};function ul({theme:t,reducedMotion:n}){return e.jsxs("div",{className:x.tkx("flex items-center gap-3 px-4 py-3"),"aria-hidden":"true",children:[e.jsx("div",{style:{width:40,height:40,borderRadius:"50%",backgroundColor:t.surfaceAlt,animation:n?"none":"tkxPulse 1.5s ease infinite"}}),e.jsxs("div",{className:x.tkx("flex-1"),children:[e.jsx("div",{style:{width:"60%",height:14,borderRadius:4,backgroundColor:t.surfaceAlt,marginBottom:8,animation:n?"none":"tkxPulse 1.5s ease infinite"}}),e.jsx("div",{style:{width:"40%",height:12,borderRadius:4,backgroundColor:t.surfaceAlt,animation:n?"none":"tkxPulse 1.5s ease infinite"}})]})]})}function fl({items:t,header:n,footer:r,bordered:o=!0,size:s="md",loading:a=!1,emptyText:l="No data",grid:d}){const f=O.useTheme(),u=J.useReducedMotion(),c=A.sanitizeString(l),h=dl[s],p=!!d,m=(d==null?void 0:d.column)??1,b=(d==null?void 0:d.gutter)??16;return e.jsxs("div",{role:"list","aria-label":"List","aria-busy":a,className:x.tkx("font-sans rounded-lg overflow-hidden"),style:{border:o?`1px solid ${f.border}`:"none",backgroundColor:f.surface},children:[n&&e.jsx("div",{className:x.tkx("font-semibold text-sm"),style:{padding:h,color:f.text,borderBottom:`1px solid ${f.border}`,backgroundColor:f.surfaceAlt},children:n}),a&&e.jsx("div",{children:Array.from({length:3}).map((k,y)=>e.jsx(ul,{theme:f,reducedMotion:u},y))}),!a&&t.length===0&&e.jsx("div",{role:"status",className:x.tkx("text-center py-12 text-sm"),style:{color:f.textMuted},children:c}),!a&&t.length>0&&e.jsx("div",{style:p?{display:"grid",gridTemplateColumns:`repeat(${m}, 1fr)`,gap:b,padding:b}:void 0,children:t.map((k,y)=>{const g=A.sanitizeString(k.title),S=k.description?A.sanitizeString(k.description):void 0;return e.jsxs("div",{role:"listitem",className:x.tkx("flex items-start gap-3"),style:{padding:h,borderBottom:!p&&y<t.length-1?`1px solid ${f.border}`:"none",...p?{border:`1px solid ${f.border}`,borderRadius:8,backgroundColor:f.surface}:{},animation:u?"none":`tkxFadeIn 0.2s ease ${y*.03}s both`},children:[k.avatar&&e.jsx("div",{"aria-hidden":"true",className:x.tkx("shrink-0"),children:k.avatar}),e.jsxs("div",{className:x.tkx("flex-1 min-w-0"),children:[e.jsx("div",{className:x.tkx("text-sm font-medium"),style:{color:f.text},children:g}),S&&e.jsx("div",{className:x.tkx("text-xs mt-1 leading-relaxed"),style:{color:f.textMuted},children:S})]}),k.extra&&e.jsx("div",{className:x.tkx("shrink-0 ml-auto"),style:{color:f.textMuted},children:k.extra}),k.actions&&e.jsx("div",{className:x.tkx("shrink-0 flex items-center gap-2"),children:k.actions})]},k.key)})}),r&&e.jsx("div",{className:x.tkx("text-sm"),style:{padding:h,color:f.textMuted,borderTop:`1px solid ${f.border}`,backgroundColor:f.surfaceAlt},children:r})]})}function xl({locale:t="en-US",direction:n,strings:r,children:o}){const s=i.useMemo(()=>{const a=nt.LOCALES[t]??nt.enUS,l=r?{...a,...r}:a,d=n??(nt.isRTL(t)?"rtl":"ltr");return{locale:t,direction:d,strings:l}},[t,n,r]);return e.jsx(nt.I18nContext.Provider,{value:s,children:e.jsx("div",{dir:s.direction,style:{direction:s.direction,display:"contents"},children:o})})}function pl({contentId:t="tkx-main-content",label:n="Skip to main content"}){return e.jsx("a",{href:`#${t}`,className:"tkx-skip-nav",children:n})}function hl({politeness:t="polite",children:n,atomic:r=!0}){return e.jsx("div",{role:"status","aria-live":t,"aria-atomic":r,className:"tkx-sr-only",children:n})}function ml({active:t,children:n,as:r="div"}){const o=J.useFocusTrap(t);return e.jsx(r,{ref:o,children:n})}function gl({as:t,children:n,...r}){const o=t??"span";return e.jsx(o,{className:"tkx-sr-only",...r,children:n})}function Vn(t,n,r,o){const s=t.getBoundingClientRect(),a=n?n.offsetHeight:320,l=n?n.offsetWidth:200,d=window.innerWidth,f=window.innerHeight,u=window.scrollX,c=window.scrollY;let h=0,p=0;switch(r){case"bottom-start":h=s.bottom+c+o,p=s.left+u;break;case"bottom-end":h=s.bottom+c+o,p=s.right+u-l;break;case"top-start":h=s.top+c-o-a,p=s.left+u;break;case"top-end":h=s.top+c-o-a,p=s.right+u-l;break;case"right":h=s.top+c,p=s.right+u+o;break;case"left":h=s.top+c,p=s.left+u-o-l;break;default:h=s.bottom+c+o,p=s.left+u}return r.startsWith("bottom")&&s.bottom+a>f&&(h=s.top+c-o-a),r.startsWith("top")&&s.top-a<0&&(h=s.bottom+c+o),p+l>d+u&&(p=d+u-l-8),p<u&&(p=u+8),{top:h,left:p,minWidth:s.width}}function On(t,n){if(!n)return t;const o=t.toLowerCase().indexOf(n.toLowerCase());return o===-1?t:e.jsxs(e.Fragment,{children:[t.slice(0,o),e.jsx("mark",{style:{background:"rgba(0,245,212,0.3)",color:"inherit",borderRadius:2},children:t.slice(o,o+n.length)}),t.slice(o+n.length)]})}function bl(t,n){const r=[];for(const o of t)for(const s of o.items)s.disabled||(!n||s.label.toLowerCase().includes(n.toLowerCase()))&&r.push(s);return r}function yl({groups:t,position:n,maxHeight:r,minWidth:o,selectedKeys:s,multiSelect:a,searchable:l,searchPlaceholder:d,onSelect:f,onClose:u,renderItem:c,menuRef:h,isPortal:p,menuId:m}){const b=O.useTheme(),[k,y]=i.useState(""),[g,S]=i.useState(0),[j,v]=i.useState(null),[$,w]=i.useState(0),N=i.useRef(null),I=i.useRef([]),M=i.useRef([]),T=k?t.map(L=>({...L,items:L.items.filter(B=>{var V,D;return B.label.toLowerCase().includes(k.toLowerCase())||((V=B.description)==null?void 0:V.toLowerCase().includes(k.toLowerCase()))||((D=B.children)==null?void 0:D.some(_=>_.label.toLowerCase().includes(k.toLowerCase())))})})).filter(L=>L.items.length>0):t,E=bl(T,k);i.useEffect(()=>{var L;l&&N.current?N.current.focus():(L=I.current[0])==null||L.focus(),S(0)},[l]),i.useEffect(()=>{var L;(!l||k!=="")&&((L=I.current[g])==null||L.focus())},[g,l,k]);const C=i.useCallback(L=>{var B,V,D;switch(L.key){case"ArrowDown":if(L.preventDefault(),j){const R=(((B=E.find(F=>F.key===j))==null?void 0:B.children)??[]).filter(F=>!F.disabled);w(F=>Math.min(F+1,R.length-1))}else S(_=>Math.min(_+1,E.length-1));break;case"ArrowUp":L.preventDefault(),j?w(_=>Math.max(_-1,0)):S(_=>Math.max(_-1,0));break;case"ArrowRight":{L.preventDefault();const _=E[g];(V=_==null?void 0:_.children)!=null&&V.length&&(v(_.key),w(0));break}case"ArrowLeft":L.preventDefault(),v(null);break;case"Enter":case" ":if(L.preventDefault(),j){const F=(((D=E.find(W=>W.key===j))==null?void 0:D.children)??[]).filter(W=>!W.disabled)[$];F&&f(F.key,F)}else{const _=E[g];_&&f(_.key,_)}break;case"Escape":L.preventDefault(),j?v(null):u();break;case"Tab":u();break}},[E,g,u,f,j,$]);i.useEffect(()=>{var L;j&&((L=M.current[$])==null||L.focus())},[$,j]);const H={position:p?"fixed":"absolute",top:p?n.top:void 0,left:p?n.left:void 0,minWidth:Math.max(o,n.minWidth),maxHeight:r,overflowY:"auto",background:b.surface,border:`1px solid ${b.border}`,borderRadius:8,boxShadow:"0 8px 32px rgba(0,0,0,0.4)",zIndex:9999,outline:"none",transformOrigin:"top left",animation:"tkx-dropdown-in 150ms ease forwards"};let z=0;return e.jsxs("div",{ref:h,id:m,role:"menu","aria-label":"Dropdown menu",tabIndex:-1,style:H,onKeyDown:C,children:[e.jsx("style",{children:`
119
+ `,document.head.appendChild(e)}function ma({size:e,color:t}){return(0,o.createElement)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,role:`img`,"aria-label":`Loading`},(0,o.createElement)(`circle`,{cx:12,cy:12,r:10,stroke:`${t}33`,strokeWidth:2.5,fill:`none`}),(0,o.createElement)(`path`,{d:`M12 2a10 10 0 0 1 10 10`,stroke:t,strokeWidth:2.5,strokeLinecap:`round`,fill:`none`}))}function ha({size:e,borderWidth:t,color:n,reducedMotion:r}){return r?(0,o.createElement)(ma,{size:e,color:n}):(pa(),(0,o.createElement)(`div`,{role:`img`,"aria-label":`Loading`,style:{width:`${e}px`,height:`${e}px`,border:`${t}px solid ${n}33`,borderTopColor:n,borderRadius:`50%`,animation:`tkx-spin-rotate 0.8s linear infinite`,boxSizing:`border-box`}}))}function ga({spinning:e=!0,size:i=`md`,tip:a,indicator:s,children:c,fullscreen:l=!1,delay:u=0,style:d}){let f=t.f(),p=r.o(),[m,h]=(0,o.useState)(u===0&&e),g=(0,o.useRef)(null);if((0,o.useEffect)(()=>(e&&u>0?g.current=setTimeout(()=>h(!0),u):h(e),()=>{g.current!==null&&clearTimeout(g.current)}),[e,u]),!m)return c?(0,o.createElement)(`div`,{style:d},c):null;let _=da[i],v=a?n.m(a):void 0,y=(0,o.createElement)(`div`,{role:`status`,"aria-live":`polite`,"aria-label":v??`Loading`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`8px`}},s??(0,o.createElement)(ha,{size:_.dimension,borderWidth:_.borderWidth,color:f.primary,reducedMotion:p}),v&&(0,o.createElement)(`span`,{style:{color:f.primary,fontSize:_.fontSize,marginTop:`4px`}},v));return l?(0,o.createElement)(`div`,{style:{position:`fixed`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`${f.bg}cc`,zIndex:9999,...d}},y):c?(0,o.createElement)(`div`,{style:{position:`relative`,...d}},(0,o.createElement)(`div`,{style:{filter:`blur(1px)`,opacity:.5,pointerEvents:`none`,userSelect:`none`,transition:p?`none`:`opacity 0.2s, filter 0.2s`}},c),(0,o.createElement)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`${f.bg}66`,borderRadius:`4px`}},y)):(0,o.createElement)(`div`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,...d}},y)}function _a({color:e,mutedColor:t}){return(0,o.createElement)(`svg`,{width:120,height:100,viewBox:`0 0 120 100`,fill:`none`,"aria-hidden":`true`},(0,o.createElement)(`path`,{d:`M20 40 L60 20 L100 40 L60 60 Z`,fill:`${t}18`,stroke:t,strokeWidth:1.5,strokeLinejoin:`round`}),(0,o.createElement)(`path`,{d:`M20 40 L20 65 L60 85 L60 60 Z`,fill:`${t}10`,stroke:t,strokeWidth:1.5,strokeLinejoin:`round`}),(0,o.createElement)(`path`,{d:`M100 40 L100 65 L60 85 L60 60 Z`,fill:`${t}0d`,stroke:t,strokeWidth:1.5,strokeLinejoin:`round`}),(0,o.createElement)(`path`,{d:`M20 40 L40 28 L60 40 L40 52 Z`,fill:`${e}15`,stroke:e,strokeWidth:1,strokeLinejoin:`round`,strokeDasharray:`3 2`}),(0,o.createElement)(`path`,{d:`M60 40 L80 28 L100 40 L80 52 Z`,fill:`${e}15`,stroke:e,strokeWidth:1,strokeLinejoin:`round`,strokeDasharray:`3 2`}))}function va({mutedColor:e}){return(0,o.createElement)(`svg`,{width:64,height:64,viewBox:`0 0 64 64`,fill:`none`,"aria-hidden":`true`},(0,o.createElement)(`rect`,{x:16,y:8,width:32,height:40,rx:3,fill:`${e}12`,stroke:e,strokeWidth:1.5}),(0,o.createElement)(`line`,{x1:24,y1:20,x2:40,y2:20,stroke:e,strokeWidth:1.5,strokeLinecap:`round`}),(0,o.createElement)(`line`,{x1:24,y1:28,x2:36,y2:28,stroke:e,strokeWidth:1.5,strokeLinecap:`round`}),(0,o.createElement)(`line`,{x1:24,y1:36,x2:32,y2:36,stroke:e,strokeWidth:1.5,strokeLinecap:`round`}),(0,o.createElement)(`circle`,{cx:32,cy:54,r:6,stroke:e,strokeWidth:1.2,fill:`none`}),(0,o.createElement)(`line`,{x1:28,y1:54,x2:36,y2:54,stroke:e,strokeWidth:1.2,strokeLinecap:`round`}))}function ya({image:e=`default`,description:r=`No data`,children:i,style:a}){let s=t.f(),c=typeof r==`string`?n.m(r):r,l;return l=e===`default`?(0,o.createElement)(_a,{color:s.primary,mutedColor:s.textMuted}):e===`simple`?(0,o.createElement)(va,{mutedColor:s.textMuted}):e,(0,o.createElement)(`div`,{role:`status`,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:`32px 16px`,textAlign:`center`,...a}},(0,o.createElement)(`div`,{style:{marginBottom:`12px`,opacity:.85}},l),c&&(0,o.createElement)(`div`,{style:{color:s.textMuted,fontSize:`0.875rem`,lineHeight:`1.5`,maxWidth:`320px`}},c),i&&(0,o.createElement)(`div`,{style:{marginTop:`16px`}},i))}function ba(e,t,n=`,`){if(typeof e==`string`)return e;let[r,i]=(t===void 0?String(e):e.toFixed(t)).split(`.`),a=r.replace(/\B(?=(\d{3})+(?!\d))/g,n);return i===void 0?a:`${a}.${i}`}function xa(e,t){if(e<=0)return t.replace(/DD?/g,`0`).replace(/HH?/g,`00`).replace(/mm?/g,`00`).replace(/ss?/g,`00`);let n=Math.floor(e/1e3),r=Math.floor(n/86400),i=Math.floor(n%86400/3600),a=Math.floor(n%3600/60),o=n%60,s=e=>String(e).padStart(2,`0`);return t.replace(/DD/g,s(r)).replace(/D/g,String(r)).replace(/HH/g,s(i)).replace(/H/g,String(i)).replace(/mm/g,s(a)).replace(/m/g,String(a)).replace(/ss/g,s(o)).replace(/s/g,String(o))}function Sa({direction:e,color:t}){return(0,o.createElement)(`svg`,{width:16,height:14,viewBox:`0 0 20 14`,fill:`none`,"aria-hidden":`true`,style:{display:`inline-block`,verticalAlign:`middle`}},(0,o.createElement)(`path`,{d:e===`up`?`M6 10 L10 4 L14 10`:`M6 4 L10 10 L14 4`,stroke:t,strokeWidth:2.5,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`}))}var Ca=!1;function wa(){if(Ca||typeof document>`u`)return;Ca=!0;let e=document.createElement(`style`);e.id=`tkx-statistic-skeleton`,e.textContent=`@keyframes tkx-stat-shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}`,document.head.appendChild(e)}function Ta({w:e,h:t,alt:n,bdr:r,rm:i}){return i||wa(),(0,o.createElement)(`div`,{"aria-hidden":`true`,style:{width:e,height:t,borderRadius:`4px`,background:i?n:`linear-gradient(90deg, ${n} 25%, ${r} 50%, ${n} 75%)`,backgroundSize:`200% 100%`,animation:i?`none`:`tkx-stat-shimmer 1.5s ease-in-out infinite`}})}function Ea({title:e,value:i,prefix:a,suffix:s,precision:c,groupSeparator:l=`,`,valueStyle:u,loading:d=!1,trend:f,trendValue:p,style:m}){let h=t.f(),g=r.o(),_=n.m(e),v=p?n.m(p):void 0,y=f===`up`?h.success:f===`down`?h.danger:void 0;return(0,o.createElement)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`4px`,...m}},(0,o.createElement)(`div`,{style:{color:h.textMuted,fontSize:`0.875rem`,lineHeight:`1.4`}},_),d?(0,o.createElement)(Ta,{w:`120px`,h:`32px`,alt:h.surfaceAlt,bdr:h.border,rm:g}):(0,o.createElement)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:`4px`,fontSize:`1.75rem`,fontWeight:700,lineHeight:`1.2`,color:h.text,fontVariantNumeric:`tabular-nums`,...u}},a&&(0,o.createElement)(`span`,{style:{fontSize:`0.75em`,fontWeight:400}},a),(0,o.createElement)(`span`,null,ba(i,c,l)),s&&(0,o.createElement)(`span`,{style:{fontSize:`0.6em`,fontWeight:400,color:h.textMuted}},s)),f&&(0,o.createElement)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`4px`,fontSize:`0.8125rem`,color:y,marginTop:`2px`}},(0,o.createElement)(Sa,{direction:f,color:y}),v&&(0,o.createElement)(`span`,null,v)))}function Da({title:e,value:r,format:i=`HH:mm:ss`,onFinish:a,prefix:s,suffix:c,style:l}){let u=t.f(),d=n.m(e),f=(0,o.useRef)(a);f.current=a;let p=(0,o.useRef)(!1),[m,h]=(0,o.useState)(()=>Math.max(0,r-Date.now()));(0,o.useEffect)(()=>{p.current=!1;let e=()=>{let e=Math.max(0,r-Date.now());h(e),e<=0&&!p.current&&(p.current=!0,f.current?.())};e();let t=setInterval(e,1e3);return()=>clearInterval(t)},[r]);let g=xa(m,i);return(0,o.createElement)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`4px`,...l}},(0,o.createElement)(`div`,{style:{color:u.textMuted,fontSize:`0.875rem`,lineHeight:`1.4`}},d),(0,o.createElement)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:`4px`,fontSize:`1.75rem`,fontWeight:700,lineHeight:`1.2`,color:m<=0?u.danger:u.text,fontVariantNumeric:`tabular-nums`}},s&&(0,o.createElement)(`span`,{style:{fontSize:`0.75em`,fontWeight:400}},s),(0,o.createElement)(`span`,null,g),c&&(0,o.createElement)(`span`,{style:{fontSize:`0.6em`,fontWeight:400,color:u.textMuted}},c)))}var Oa={sm:{height:28,fontSize:12,px:10},md:{height:36,fontSize:14,px:16},lg:{height:44,fontSize:16,px:20}};function ka({options:e,value:i,onChange:a,size:c=`md`,block:l=!1}){let u=t.f(),d=r.o(),f=(0,o.useRef)(null),[p,m]=(0,o.useState)(()=>Math.max(0,e.findIndex(e=>e.value===i))),[h,g]=(0,o.useState)({}),_=Oa[c];(0,o.useEffect)(()=>{let t=e.findIndex(e=>e.value===i);t>=0&&m(t)},[i,e]),(0,o.useEffect)(()=>{let e=f.current;if(!e)return;let t=e.querySelectorAll(`[data-seg-btn]`)[p];t&&g({left:t.offsetLeft,width:t.offsetWidth,height:t.offsetHeight,transition:d?`none`:`left 0.2s ease, width 0.2s ease`})},[p,e,d]);let v=(0,o.useCallback)(t=>{let n=e[t];!n||n.disabled||(m(t),a?.(n.value))},[e,a]),y=(0,o.useCallback)(t=>{let n=p;if(t.key===`ArrowRight`||t.key===`ArrowDown`)for(t.preventDefault(),n=(p+1)%e.length;e[n]?.disabled&&n!==p;)n=(n+1)%e.length;else if(t.key===`ArrowLeft`||t.key===`ArrowUp`)for(t.preventDefault(),n=(p-1+e.length)%e.length;e[n]?.disabled&&n!==p;)n=(n-1+e.length)%e.length;n!==p&&(v(n),(f.current?.querySelectorAll(`[data-seg-btn]`))?.[n]?.focus())},[p,e,v]);return(0,s.jsxs)(`div`,{ref:f,role:`radiogroup`,"aria-label":`Segmented control`,className:n.a(`relative inline-flex items-center rounded-lg p-1`),style:{backgroundColor:u.surfaceAlt,border:`1px solid ${u.border}`,width:l?`100%`:void 0},onKeyDown:y,children:[(0,s.jsx)(`div`,{"aria-hidden":`true`,className:n.a(`absolute top-1 rounded-md`),style:{...h,backgroundColor:u.surface,boxShadow:`0 1px 3px ${u.border}`,zIndex:0}}),e.map((e,t)=>{let r=t===p,i=n.m(e.label);return(0,s.jsxs)(`button`,{"data-seg-btn":!0,type:`button`,role:`radio`,"aria-checked":r,"aria-disabled":e.disabled||void 0,disabled:e.disabled,tabIndex:r?0:-1,className:n.a(`relative z-10 flex items-center justify-center gap-1 rounded-md border-0 cursor-pointer`,`font-sans whitespace-nowrap select-none`),style:{height:_.height,fontSize:_.fontSize,padding:`0 ${_.px}px`,flex:l?1:void 0,color:r?u.text:u.textMuted,backgroundColor:`transparent`,opacity:e.disabled?.4:1,fontWeight:r?600:400,transition:d?`none`:`color 0.15s ease`},onClick:()=>v(t),children:[e.icon&&(0,s.jsx)(`span`,{"aria-hidden":`true`,children:e.icon}),i]},e.value)})]})}function Aa({options:e,value:i=``,onChange:a,trigger:c=`@`,placeholder:l,label:u}){let d=t.f(),f=r.o(),p=(0,o.useRef)(null),m=(0,o.useRef)(null),[h,g]=(0,o.useState)(i),[_,v]=(0,o.useState)(!1),[y,b]=(0,o.useState)(``),[x,S]=(0,o.useState)(0),[C,w]=(0,o.useState)(-1);(0,o.useEffect)(()=>{i!==void 0&&g(i)},[i]);let T=e.filter(e=>e.label.toLowerCase().includes(y.toLowerCase())),E=(0,o.useCallback)(e=>{let t=e.target.value;g(t),a?.(t);let n=e.target.selectionStart??t.length,r=t.slice(0,n),i=r.lastIndexOf(c);if(i>=0){let e=r.slice(i+c.length);if(!/\s/.test(e)){b(e),w(i),v(!0),S(0);return}}v(!1)},[c,a]),D=(0,o.useCallback)(e=>{let t=h.slice(0,C),n=h.slice(C+c.length+y.length),r=`${t}${c}${e.value} ${n}`;g(r),a?.(r),v(!1),p.current?.focus()},[h,C,c,y,a]),O=(0,o.useCallback)(e=>{_&&(e.key===`ArrowDown`?(e.preventDefault(),S(e=>(e+1)%T.length)):e.key===`ArrowUp`?(e.preventDefault(),S(e=>(e-1+T.length)%T.length)):e.key===`Enter`&&T[x]?(e.preventDefault(),D(T[x])):e.key===`Escape`&&v(!1))},[_,T,x,D]);(0,o.useEffect)(()=>{!_||!m.current||m.current.children[x]?.scrollIntoView({block:`nearest`})},[x,_]);let k=u?n.m(u):void 0,A=l?n.m(l):void 0;return(0,s.jsxs)(`div`,{className:n.a(`relative font-sans`),style:{width:`100%`},children:[k&&(0,s.jsx)(`label`,{className:n.a(`block text-sm font-medium mb-1`),style:{color:d.text},children:k}),(0,s.jsx)(`textarea`,{ref:p,role:`combobox`,"aria-expanded":_,"aria-haspopup":`listbox`,"aria-autocomplete":`list`,"aria-label":k??`Mentions input`,value:h,placeholder:A,onChange:E,onKeyDown:O,onBlur:()=>setTimeout(()=>v(!1),200),className:n.a(`w-full rounded-lg border px-3 py-2 text-sm resize-y`),style:{backgroundColor:d.surface,borderColor:d.border,color:d.text,minHeight:80,outline:`none`},rows:3}),_&&T.length>0&&(0,s.jsx)(`ul`,{ref:m,role:`listbox`,"aria-label":`Mention suggestions`,className:n.a(`absolute left-0 right-0 z-50 rounded-lg border overflow-auto`),style:{backgroundColor:d.surface,borderColor:d.border,maxHeight:200,top:`100%`,marginTop:4,listStyle:`none`,padding:0,boxShadow:`0 4px 12px ${d.bg}80`,animation:f?`none`:`tkxFadeIn 0.15s ease`},children:T.map((e,t)=>(0,s.jsxs)(`li`,{role:`option`,"aria-selected":t===x,className:n.a(`flex items-center gap-3 px-3 py-2 cursor-pointer text-sm`),style:{backgroundColor:t===x?d.surfaceAlt:`transparent`,color:d.text},onMouseDown:t=>{t.preventDefault(),D(e)},onMouseEnter:()=>S(t),children:[e.avatar&&(0,s.jsx)(`img`,{src:n.m(e.avatar),alt:``,"aria-hidden":`true`,width:24,height:24,className:n.a(`rounded-full`),style:{objectFit:`cover`}}),(0,s.jsx)(`span`,{children:n.m(e.label)}),(0,s.jsxs)(`span`,{style:{color:d.textMuted,marginLeft:`auto`},children:[c,n.m(e.value)]})]},e.value))})]})}function ja(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return Math.abs(t)}function Ma(e){let t=e;return()=>(t=t*1664525+1013904223|0,(t>>>0)/4294967295)}var Na={L:.38,M:.42,Q:.48,H:.55};function Pa(e,t,n){let r=Ma(ja(e)),i=Na[n]??.42,a=Array.from({length:t},()=>Array.from({length:t},()=>!1)),o=(e,t)=>{for(let n=0;n<7;n++)for(let r=0;r<7;r++){let i=n===0||n===6||r===0||r===6,o=n>=2&&n<=4&&r>=2&&r<=4;a[e+n][t+r]=i||o}};o(0,0),o(0,t-7),o(t-7,0);for(let e=7;e<t-7;e++)a[6][e]=e%2==0,a[e][6]=e%2==0;for(let e=0;e<t;e++)for(let n=0;n<t;n++)e<8&&n<8||e<8&&n>=t-8||e>=t-8&&n<8||e===6||n===6||(a[e][n]=r()<i);return a}function Fa({value:e,size:i=160,color:a,bgColor:c,errorLevel:l=`M`,icon:u,bordered:d=!0}){let f=t.f(),p=r.o(),m=(0,o.useRef)(null),h=n.m(e),g=a??f.text,_=c??f.surface,v=(0,o.useMemo)(()=>Pa(h,25,l),[h,l]);return(0,o.useEffect)(()=>{let e=m.current;if(!e)return;let t=e.getContext(`2d`);if(!t)return;let r=window.devicePixelRatio||1;e.width=i*r,e.height=i*r,t.scale(r,r);let a=i/25;t.fillStyle=_,t.fillRect(0,0,i,i),t.fillStyle=g;for(let e=0;e<25;e++)for(let n=0;n<25;n++)v[e][n]&&t.fillRect(n*a,e*a,a,a);if(u){let e=i*.22,r=(i-e)/2;t.fillStyle=_,t.fillRect(r-2,r-2,e+4,e+4);let a=new Image;a.crossOrigin=`anonymous`,a.onload=()=>{t.drawImage(a,r,r,e,e)},a.src=n.m(u)}},[v,i,g,_,u]),(0,s.jsx)(`div`,{role:`img`,"aria-label":`QR code for: ${h}`,className:n.a(`inline-block rounded-lg`),style:{padding:d?12:0,backgroundColor:d?_:`transparent`,border:d?`1px solid ${f.border}`:`none`,lineHeight:0,animation:p?`none`:`tkxFadeIn 0.2s ease`},children:(0,s.jsx)(`canvas`,{ref:m,"aria-hidden":`true`,style:{width:i,height:i,display:`block`}})})}var Ia={success:e=>(0,s.jsxs)(`svg`,{width:`72`,height:`72`,viewBox:`0 0 72 72`,fill:`none`,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:`36`,cy:`36`,r:`34`,stroke:e,strokeWidth:`3`,fill:`${e}18`}),(0,s.jsx)(`path`,{d:`M22 37l9 9 19-19`,stroke:e,strokeWidth:`4`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),error:e=>(0,s.jsxs)(`svg`,{width:`72`,height:`72`,viewBox:`0 0 72 72`,fill:`none`,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:`36`,cy:`36`,r:`34`,stroke:e,strokeWidth:`3`,fill:`${e}18`}),(0,s.jsx)(`path`,{d:`M26 26l20 20M46 26L26 46`,stroke:e,strokeWidth:`4`,strokeLinecap:`round`})]}),warning:e=>(0,s.jsxs)(`svg`,{width:`72`,height:`72`,viewBox:`0 0 72 72`,fill:`none`,"aria-hidden":`true`,children:[(0,s.jsx)(`path`,{d:`M36 6L4 64h64L36 6z`,stroke:e,strokeWidth:`3`,fill:`${e}18`}),(0,s.jsx)(`path`,{d:`M36 30v16`,stroke:e,strokeWidth:`4`,strokeLinecap:`round`}),(0,s.jsx)(`circle`,{cx:`36`,cy:`54`,r:`2.5`,fill:e})]}),info:e=>(0,s.jsxs)(`svg`,{width:`72`,height:`72`,viewBox:`0 0 72 72`,fill:`none`,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:`36`,cy:`36`,r:`34`,stroke:e,strokeWidth:`3`,fill:`${e}18`}),(0,s.jsx)(`path`,{d:`M36 32v18`,stroke:e,strokeWidth:`4`,strokeLinecap:`round`}),(0,s.jsx)(`circle`,{cx:`36`,cy:`22`,r:`2.5`,fill:e})]}),404:e=>(0,s.jsxs)(`svg`,{width:`72`,height:`72`,viewBox:`0 0 72 72`,fill:`none`,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:`36`,cy:`36`,r:`34`,stroke:e,strokeWidth:`3`,fill:`${e}18`}),(0,s.jsx)(`text`,{x:`36`,y:`44`,textAnchor:`middle`,fontSize:`22`,fontWeight:`bold`,fill:e,children:`404`})]}),403:e=>(0,s.jsxs)(`svg`,{width:`72`,height:`72`,viewBox:`0 0 72 72`,fill:`none`,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:`36`,cy:`36`,r:`34`,stroke:e,strokeWidth:`3`,fill:`${e}18`}),(0,s.jsx)(`path`,{d:`M28 30h16v16H28z`,stroke:e,strokeWidth:`3`,fill:`none`}),(0,s.jsx)(`path`,{d:`M32 30v-4a4 4 0 018 0v4`,stroke:e,strokeWidth:`3`,fill:`none`})]}),500:e=>(0,s.jsxs)(`svg`,{width:`72`,height:`72`,viewBox:`0 0 72 72`,fill:`none`,"aria-hidden":`true`,children:[(0,s.jsx)(`circle`,{cx:`36`,cy:`36`,r:`34`,stroke:e,strokeWidth:`3`,fill:`${e}18`}),(0,s.jsx)(`text`,{x:`36`,y:`44`,textAnchor:`middle`,fontSize:`22`,fontWeight:`bold`,fill:e,children:`500`})]})};function La(e,t){switch(e){case`success`:return t.success;case`error`:case`500`:return t.danger;case`warning`:return t.warning;case`info`:return t.info;case`404`:case`403`:return t.textMuted}}function Ra({status:e,title:i,subTitle:a,icon:o,extra:c}){let l=t.f(),u=r.o(),d=La(e,l),f=n.m(i),p=a?n.m(a):void 0;return(0,s.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:n.a(`flex flex-col items-center text-center px-6 py-12 font-sans`),style:{animation:u?`none`:`tkxFadeIn 0.3s ease`},children:[(0,s.jsx)(`div`,{className:n.a(`mb-6`),children:o??Ia[e](d)}),(0,s.jsx)(`h2`,{className:n.a(`text-xl font-semibold m-0 mb-2`),style:{color:l.text},children:f}),p&&(0,s.jsx)(`p`,{className:n.a(`text-sm m-0 mb-6 max-w-md leading-relaxed`),style:{color:l.textMuted},children:p}),c&&(0,s.jsx)(`div`,{className:n.a(`flex items-center gap-3 mt-4`),children:c})]})}function za(e){let t=document.querySelector(e);return t?t.getBoundingClientRect():null}function Ba(e,t,n,r){switch(t){case`top`:return{top:e.top-r-12+window.scrollY,left:e.left+e.width/2-n/2+window.scrollX};case`bottom`:return{top:e.bottom+12+window.scrollY,left:e.left+e.width/2-n/2+window.scrollX};case`left`:return{top:e.top+e.height/2-r/2+window.scrollY,left:e.left-n-12+window.scrollX};case`right`:return{top:e.top+e.height/2-r/2+window.scrollY,left:e.right+12+window.scrollX};default:return{top:e.bottom+12+window.scrollY,left:e.left+window.scrollX}}}function Va({steps:e,isOpen:i=!1,onClose:a,current:l,onChange:u}){let d=t.f(),f=r.o(),[p,m]=(0,o.useState)(0),h=l??p,g=(0,o.useRef)(null),[_,v]=(0,o.useState)({top:0,left:0}),[y,b]=(0,o.useState)(null),x=e[h],S=(0,o.useCallback)(()=>{if(!x)return;let e=za(x.target);if(b(e),e&&g.current){let t=g.current.offsetWidth,n=g.current.offsetHeight;v(Ba(e,x.placement??`bottom`,t,n))}},[x]);(0,o.useEffect)(()=>{if(i)return S(),window.addEventListener(`resize`,S),window.addEventListener(`scroll`,S,!0),()=>{window.removeEventListener(`resize`,S),window.removeEventListener(`scroll`,S,!0)}},[i,h,S]),(0,o.useEffect)(()=>{i&&g.current?.focus()},[i,h]);let C=(0,o.useCallback)(e=>{m(e),u?.(e)},[u]),w=(0,o.useCallback)(()=>{h<e.length-1?C(h+1):a?.()},[h,e.length,C,a]),T=(0,o.useCallback)(()=>{h>0&&C(h-1)},[h,C]);if(!i||!x)return null;let E=n.m(x.title),D=n.m(x.description);return(0,c.createPortal)((0,s.jsxs)(`div`,{"aria-hidden":`true`,children:[(0,s.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:9998,backgroundColor:`rgba(0,0,0,0.55)`,clipPath:y?`polygon(0% 0%, 0% 100%, ${y.left-6}px 100%, ${y.left-6}px ${y.top-6}px, ${y.right+6}px ${y.top-6}px, ${y.right+6}px ${y.bottom+6}px, ${y.left-6}px ${y.bottom+6}px, ${y.left-6}px 100%, 100% 100%, 100% 0%)`:void 0,transition:f?`none`:`clip-path 0.25s ease`},onClick:a}),(0,s.jsxs)(`div`,{ref:g,role:`dialog`,"aria-modal":`true`,"aria-label":`Tour step ${h+1} of ${e.length}`,tabIndex:-1,style:{position:`absolute`,zIndex:9999,top:_.top,left:_.left,width:300,backgroundColor:d.surface,border:`1px solid ${d.border}`,borderRadius:10,padding:20,boxShadow:`0 8px 24px ${d.bg}80`,animation:f?`none`:`tkxFadeIn 0.2s ease`,fontFamily:`inherit`},onKeyDown:e=>{e.key===`Escape`&&a?.()},children:[(0,s.jsx)(`h3`,{className:n.a(`m-0 mb-2 text-base font-semibold`),style:{color:d.text},children:E}),(0,s.jsx)(`p`,{className:n.a(`m-0 mb-4 text-sm leading-relaxed`),style:{color:d.textMuted},children:D}),(0,s.jsx)(`div`,{className:n.a(`flex items-center gap-1 mb-4`),"aria-label":`Tour progress`,children:e.map((e,t)=>(0,s.jsx)(`span`,{"aria-hidden":`true`,style:{width:8,height:8,borderRadius:`50%`,backgroundColor:t===h?d.primary:d.border,transition:f?`none`:`background-color 0.2s`}},t))}),(0,s.jsxs)(`div`,{className:n.a(`flex items-center justify-between gap-2`),children:[(0,s.jsx)(`button`,{type:`button`,"aria-label":`Skip tour`,onClick:a,className:n.a(`border-0 bg-transparent cursor-pointer text-sm px-2 py-1`),style:{color:d.textMuted},children:`Skip`}),(0,s.jsxs)(`div`,{className:n.a(`flex gap-2`),children:[h>0&&(0,s.jsx)(`button`,{type:`button`,"aria-label":`Previous step`,onClick:T,className:n.a(`rounded-md border px-3 py-1 text-sm cursor-pointer bg-transparent`),style:{borderColor:d.border,color:d.text},children:`Prev`}),(0,s.jsx)(`button`,{type:`button`,"aria-label":h===e.length-1?`Finish tour`:`Next step`,onClick:w,className:n.a(`rounded-md border-0 px-4 py-1 text-sm cursor-pointer font-medium`),style:{backgroundColor:d.primary,color:`#fff`},children:h===e.length-1?`Finish`:`Next`})]})]})]})]}),document.body)}function Ha(e,t,n,r,i){let a=document.createElement(`canvas`),o=a.getContext(`2d`);if(!o)return``;let s=r*1.5,c=e.length*s,l=Math.max(...e.map(e=>e.length))*r*.6,u=n[0]+l,d=n[1]+c;return a.width=u*2,a.height=d*2,o.scale(2,2),o.translate(u/2,d/2),o.rotate(t*Math.PI/180),o.font=`${r}px sans-serif`,o.fillStyle=i,o.textAlign=`center`,o.textBaseline=`middle`,e.forEach((t,n)=>{let r=(n-(e.length-1)/2)*s;o.fillText(t,0,r)}),a.toDataURL()}function Ua({text:e,children:i,rotate:a=-22,gap:c=[100,100],fontSize:l=14,color:u,zIndex:d=10}){let f=t.f(),p=r.o(),m=(0,o.useRef)(null),[h,g]=(0,o.useState)(``),_=(0,o.useMemo)(()=>(Array.isArray(e)?e:[e]).map(e=>n.m(e)),[e]),v=u??`${f.textMuted}22`,y=(0,o.useCallback)(()=>Ha(_,a,c,l,v),[_,a,c,l,v]);return(0,o.useEffect)(()=>{let e=y();e&&g(`url(${e})`)},[y]),(0,o.useEffect)(()=>{let e=m.current?.querySelector(`[data-watermark]`);if(!e)return;let t=new MutationObserver(()=>{let t=y();t&&(e.style.backgroundImage=`url(${t})`)});return t.observe(e,{attributes:!0,attributeFilter:[`style`]}),()=>t.disconnect()},[y]),(0,s.jsxs)(`div`,{ref:m,className:n.a(`relative`),style:{overflow:`hidden`},children:[i,(0,s.jsx)(`div`,{"data-watermark":!0,"aria-hidden":`true`,className:n.a(`absolute inset-0 pointer-events-none`),style:{zIndex:d,backgroundImage:h,backgroundRepeat:`repeat`,animation:p?`none`:`tkxFadeIn 0.3s ease`}})]})}function Wa(e){if(e)try{return e()}catch{return window}return window}function Ga(e){if(e instanceof Window)return{top:0,bottom:e.innerHeight};let t=e.getBoundingClientRect();return{top:t.top,bottom:t.bottom}}function Ka({children:e,offsetTop:i,offsetBottom:a,onChange:c,target:l}){let u=t.f(),d=r.o(),f=(0,o.useRef)(null),p=(0,o.useRef)(null),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)({width:0,height:0}),v=(0,o.useRef)(!1),y=(0,o.useMemo)(()=>n.m(`Sticky content`),[]),b=(0,o.useCallback)(()=>{let e=f.current;if(!e)return;let t=e.getBoundingClientRect(),n=Ga(Wa(l)),r=!1;i===void 0?a!==void 0&&(r=n.bottom-t.bottom<=a):r=t.top-n.top<=i,r!==v.current&&(v.current=r,h(r),_({width:t.width,height:t.height}),c?.(r))},[i,a,c,l]);(0,o.useEffect)(()=>{let e=Wa(l);return b(),e.addEventListener(`scroll`,b,{passive:!0}),window.addEventListener(`resize`,b),()=>{e.removeEventListener(`scroll`,b),window.removeEventListener(`resize`,b)}},[b,l]);let x=m?{position:`fixed`,zIndex:100,...i===void 0?{}:{top:i},...a===void 0?{}:{bottom:a},width:g.width||void 0,transition:d?`none`:`box-shadow 0.2s ease`,boxShadow:`0 2px 8px ${u.border}`}:{};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{ref:f,"aria-hidden":m,style:m?{height:g.height,width:g.width}:{}}),(0,s.jsx)(`div`,{ref:p,role:`region`,"aria-label":y,className:n.a(m?`tkx-affixed`:``),style:x,children:e})]})}function qa(e){let t=[];for(let n of e)t.push(n),n.children&&t.push(...qa(n.children));return t}function Ja(e){return e.startsWith(`#`)?e.slice(1):e}function Ya({item:e,activeKey:t,depth:r,onClick:i,theme:a,reducedMotion:o}){let c=e.key===t,l=n.m(e.title);return(0,s.jsxs)(`li`,{role:`none`,style:{listStyle:`none`},children:[(0,s.jsx)(`a`,{role:`treeitem`,"aria-current":c?`location`:void 0,href:e.href,onClick:t=>{t.preventDefault(),i(e.href)},className:n.a(`block text-sm py-1 no-underline`),style:{paddingLeft:12+r*16,color:c?a.primary:a.textMuted,fontWeight:c?600:400,borderLeft:`2px solid ${c?a.primary:`transparent`}`,transition:o?`none`:`color 0.15s ease, border-color 0.15s ease`},children:l}),e.children&&e.children.length>0&&(0,s.jsx)(`ul`,{role:`group`,style:{margin:0,padding:0},children:e.children.map(e=>(0,s.jsx)(Ya,{item:e,activeKey:t,depth:r+1,onClick:i,theme:a,reducedMotion:o},e.key))})]})}function Xa({items:e,offsetTop:i=0,getCurrentAnchor:a,onChange:c}){let l=t.f(),u=r.o(),[d,f]=(0,o.useState)(e[0]?.key??``),p=(0,o.useRef)(!1),m=qa(e),h=(0,o.useCallback)(()=>{if(p.current)return;let e=m[0]?.key??``;for(let t of m){let n=Ja(t.href),r=document.getElementById(n);r&&r.getBoundingClientRect().top<=i+10&&(e=t.key)}a&&(e=a(e)),e!==d&&(f(e),c?.(e))},[m,i,a,d,c]);(0,o.useEffect)(()=>(window.addEventListener(`scroll`,h,{passive:!0}),h(),()=>window.removeEventListener(`scroll`,h)),[h]);let g=(0,o.useCallback)(e=>{let t=Ja(e),n=document.getElementById(t);if(!n)return;p.current=!0;let r=n.getBoundingClientRect().top+window.scrollY-i;window.scrollTo({top:r,behavior:u?`auto`:`smooth`});let a=m.find(t=>t.href===e);a&&(f(a.key),c?.(a.key)),setTimeout(()=>{p.current=!1},800)},[m,i,u,c]);return(0,s.jsx)(`nav`,{role:`tree`,"aria-label":`Anchor navigation`,className:n.a(`font-sans`),style:{borderLeft:`1px solid ${l.border}`,padding:`4px 0`},children:(0,s.jsx)(`ul`,{role:`group`,style:{margin:0,padding:0},children:e.map(e=>(0,s.jsx)(Ya,{item:e,activeKey:d,depth:0,onClick:g,theme:l,reducedMotion:u},e.key))})})}function Za(e,t){let n=[e],r=e;for(let e of t){let t=r.find(t=>t.value===e);if(t?.children?.length)n.push(t.children),r=t.children;else break}return n}function Qa(e,t){let n=[],r=e;for(let e of t){let t=r.find(t=>t.value===e);if(t)n.push(t),r=t.children??[];else break}return n}function $a(e,t){return Qa(e,t).map(e=>n.m(e.label)).join(` / `)}function eo({options:e,value:i=[],onChange:a,placeholder:l=`Select...`,label:u,multiple:d=!1}){let f=t.f(),p=r.o(),m=(0,o.useRef)(null),h=(0,o.useRef)(null),[g,_]=(0,o.useState)(!1),[v,y]=(0,o.useState)(i),[b,x]=(0,o.useState)({top:0,left:0,width:0}),S=u?n.m(u):void 0,C=n.m(l),w=i.length>0?$a(e,i):``;(0,o.useEffect)(()=>{if(!g||!m.current)return;let e=m.current.getBoundingClientRect();x({top:e.bottom+4+window.scrollY,left:e.left+window.scrollX,width:Math.max(e.width,200)})},[g]),(0,o.useEffect)(()=>{if(!g)return;let e=e=>{!m.current?.contains(e.target)&&!h.current?.contains(e.target)&&_(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[g]);let T=(0,o.useCallback)((t,n)=>{if(n.disabled)return;let r=[...v.slice(0,t),n.value];if(y(r),!n.children?.length){let t=Qa(e,r);a?.(r,t),d||_(!1)}},[v,e,a,d]),E=(0,o.useCallback)(e=>{e.key===`Escape`?(_(!1),m.current?.focus()):(e.key===`Enter`||e.key===` `)&&(g||(e.preventDefault(),_(!0)))},[g]),D=Za(e,v),O=g?(0,c.createPortal)((0,s.jsx)(`div`,{ref:h,role:`tree`,"aria-label":S??`Cascader options`,className:n.a(`flex rounded-lg border overflow-hidden`),style:{position:`absolute`,zIndex:9999,top:b.top,left:b.left,backgroundColor:f.surface,borderColor:f.border,boxShadow:`0 4px 16px ${f.bg}80`,animation:p?`none`:`tkxFadeIn 0.15s ease`},children:D.map((e,t)=>(0,s.jsx)(`ul`,{role:`group`,className:n.a(`m-0 p-0 overflow-auto`),style:{listStyle:`none`,minWidth:160,maxHeight:260,borderRight:t<D.length-1?`1px solid ${f.border}`:`none`},children:e.map(e=>{let r=v[t]===e.value,i=n.m(e.label);return(0,s.jsxs)(`li`,{role:`treeitem`,"aria-selected":r,"aria-disabled":e.disabled||void 0,"aria-expanded":e.children?.length?r:void 0,className:n.a(`flex items-center justify-between px-3 py-2 cursor-pointer text-sm`),style:{backgroundColor:r?f.surfaceAlt:`transparent`,color:e.disabled?f.textMuted:f.text,opacity:e.disabled?.5:1,cursor:e.disabled?`not-allowed`:`pointer`},onClick:()=>T(t,e),onMouseEnter:()=>{e.disabled||y(n=>[...n.slice(0,t),e.value])},children:[(0,s.jsx)(`span`,{children:i}),e.children&&e.children.length>0&&(0,s.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,style:{color:f.textMuted,flexShrink:0},children:(0,s.jsx)(`path`,{d:`M10 6l6 6-6 6V6z`})})]},e.value)})},t))}),document.body):null;return(0,s.jsxs)(`div`,{className:n.a(`relative font-sans`),onKeyDown:E,children:[S&&(0,s.jsx)(`label`,{className:n.a(`block text-sm font-medium mb-1`),style:{color:f.text},children:S}),(0,s.jsxs)(`button`,{ref:m,type:`button`,role:`combobox`,"aria-expanded":g,"aria-haspopup":`tree`,"aria-label":S??`Cascader`,className:n.a(`w-full flex items-center justify-between rounded-lg border px-3 py-2 text-sm cursor-pointer`),style:{backgroundColor:f.surface,borderColor:g?f.primary:f.border,color:w?f.text:f.textMuted,outline:`none`,minHeight:38,textAlign:`left`},onClick:()=>_(e=>!e),children:[(0,s.jsx)(`span`,{className:n.a(`truncate`),children:w||C}),(0,s.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,style:{color:f.textMuted,transform:g?`rotate(180deg)`:`rotate(0deg)`,transition:p?`none`:`transform 0.2s ease`,flexShrink:0},children:(0,s.jsx)(`path`,{d:`M7 10l5 5 5-5H7z`})})]}),O]})}var to={sm:`8px 12px`,md:`12px 16px`,lg:`16px 20px`};function no({theme:e,reducedMotion:t}){return(0,s.jsxs)(`div`,{className:n.a(`flex items-center gap-3 px-4 py-3`),"aria-hidden":`true`,children:[(0,s.jsx)(`div`,{style:{width:40,height:40,borderRadius:`50%`,backgroundColor:e.surfaceAlt,animation:t?`none`:`tkxPulse 1.5s ease infinite`}}),(0,s.jsxs)(`div`,{className:n.a(`flex-1`),children:[(0,s.jsx)(`div`,{style:{width:`60%`,height:14,borderRadius:4,backgroundColor:e.surfaceAlt,marginBottom:8,animation:t?`none`:`tkxPulse 1.5s ease infinite`}}),(0,s.jsx)(`div`,{style:{width:`40%`,height:12,borderRadius:4,backgroundColor:e.surfaceAlt,animation:t?`none`:`tkxPulse 1.5s ease infinite`}})]})]})}function ro({items:e,header:i,footer:a,bordered:o=!0,size:c=`md`,loading:l=!1,emptyText:u=`No data`,grid:d}){let f=t.f(),p=r.o(),m=n.m(u),h=to[c],g=!!d,_=d?.column??1,v=d?.gutter??16;return(0,s.jsxs)(`div`,{role:`list`,"aria-label":`List`,"aria-busy":l,className:n.a(`font-sans rounded-lg overflow-hidden`),style:{border:o?`1px solid ${f.border}`:`none`,backgroundColor:f.surface},children:[i&&(0,s.jsx)(`div`,{className:n.a(`font-semibold text-sm`),style:{padding:h,color:f.text,borderBottom:`1px solid ${f.border}`,backgroundColor:f.surfaceAlt},children:i}),l&&(0,s.jsx)(`div`,{children:Array.from({length:3}).map((e,t)=>(0,s.jsx)(no,{theme:f,reducedMotion:p},t))}),!l&&e.length===0&&(0,s.jsx)(`div`,{role:`status`,className:n.a(`text-center py-12 text-sm`),style:{color:f.textMuted},children:m}),!l&&e.length>0&&(0,s.jsx)(`div`,{style:g?{display:`grid`,gridTemplateColumns:`repeat(${_}, 1fr)`,gap:v,padding:v}:void 0,children:e.map((t,r)=>{let i=n.m(t.title),a=t.description?n.m(t.description):void 0;return(0,s.jsxs)(`div`,{role:`listitem`,className:n.a(`flex items-start gap-3`),style:{padding:h,borderBottom:!g&&r<e.length-1?`1px solid ${f.border}`:`none`,...g?{border:`1px solid ${f.border}`,borderRadius:8,backgroundColor:f.surface}:{},animation:p?`none`:`tkxFadeIn 0.2s ease ${r*.03}s both`},children:[t.avatar&&(0,s.jsx)(`div`,{"aria-hidden":`true`,className:n.a(`shrink-0`),children:t.avatar}),(0,s.jsxs)(`div`,{className:n.a(`flex-1 min-w-0`),children:[(0,s.jsx)(`div`,{className:n.a(`text-sm font-medium`),style:{color:f.text},children:i}),a&&(0,s.jsx)(`div`,{className:n.a(`text-xs mt-1 leading-relaxed`),style:{color:f.textMuted},children:a})]}),t.extra&&(0,s.jsx)(`div`,{className:n.a(`shrink-0 ml-auto`),style:{color:f.textMuted},children:t.extra}),t.actions&&(0,s.jsx)(`div`,{className:n.a(`shrink-0 flex items-center gap-2`),children:t.actions})]},t.key)})}),a&&(0,s.jsx)(`div`,{className:n.a(`text-sm`),style:{padding:h,color:f.textMuted,borderTop:`1px solid ${f.border}`,backgroundColor:f.surfaceAlt},children:a})]})}function io({locale:e=`en-US`,direction:t,strings:n,children:r}){let i=(0,o.useMemo)(()=>{let r=a.LOCALES[e]??a.enUS,i=n?{...r,...n}:r;return{locale:e,direction:t??(a.isRTL(e)?`rtl`:`ltr`),strings:i}},[e,t,n]);return(0,s.jsx)(a.I18nContext.Provider,{value:i,children:(0,s.jsx)(`div`,{dir:i.direction,style:{direction:i.direction,display:`contents`},children:r})})}function ao({contentId:e=`tkx-main-content`,label:t=`Skip to main content`}){return(0,s.jsx)(`a`,{href:`#${e}`,className:`tkx-skip-nav`,children:t})}function oo({politeness:e=`polite`,children:t,atomic:n=!0}){return(0,s.jsx)(`div`,{role:`status`,"aria-live":e,"aria-atomic":n,className:`tkx-sr-only`,children:t})}function so({active:e,children:t,as:n=`div`}){return(0,s.jsx)(n,{ref:r.i(e),children:t})}function co({as:e,children:t,...n}){return(0,s.jsx)(e??`span`,{className:`tkx-sr-only`,...n,children:t})}function lo(e,t,n,r){let i=e.getBoundingClientRect(),a=t?t.offsetHeight:320,o=t?t.offsetWidth:200,s=window.innerWidth,c=window.innerHeight,l=window.scrollX,u=window.scrollY,d=0,f=0;switch(n){case`bottom-start`:d=i.bottom+u+r,f=i.left+l;break;case`bottom-end`:d=i.bottom+u+r,f=i.right+l-o;break;case`top-start`:d=i.top+u-r-a,f=i.left+l;break;case`top-end`:d=i.top+u-r-a,f=i.right+l-o;break;case`right`:d=i.top+u,f=i.right+l+r;break;case`left`:d=i.top+u,f=i.left+l-r-o;break;default:d=i.bottom+u+r,f=i.left+l}return n.startsWith(`bottom`)&&i.bottom+a>c&&(d=i.top+u-r-a),n.startsWith(`top`)&&i.top-a<0&&(d=i.bottom+u+r),f+o>s+l&&(f=s+l-o-8),f<l&&(f=l+8),{top:d,left:f,minWidth:i.width}}function uo(e,t){if(!t)return e;let n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?e:(0,s.jsxs)(s.Fragment,{children:[e.slice(0,n),(0,s.jsx)(`mark`,{style:{background:`rgba(0,245,212,0.3)`,color:`inherit`,borderRadius:2},children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function fo(e,t){let n=[];for(let r of e)for(let e of r.items)e.disabled||(!t||e.label.toLowerCase().includes(t.toLowerCase()))&&n.push(e);return n}function po({groups:e,position:r,maxHeight:i,minWidth:a,selectedKeys:c,multiSelect:l,searchable:u,searchPlaceholder:d,onSelect:f,onClose:p,renderItem:m,menuRef:h,isPortal:g,menuId:_}){let v=t.f(),[y,b]=(0,o.useState)(``),[x,S]=(0,o.useState)(0),[C,w]=(0,o.useState)(null),[T,E]=(0,o.useState)(0),D=(0,o.useRef)(null),O=(0,o.useRef)([]),k=(0,o.useRef)([]),A=y?e.map(e=>({...e,items:e.items.filter(e=>e.label.toLowerCase().includes(y.toLowerCase())||e.description?.toLowerCase().includes(y.toLowerCase())||e.children?.some(e=>e.label.toLowerCase().includes(y.toLowerCase())))})).filter(e=>e.items.length>0):e,j=fo(A,y);(0,o.useEffect)(()=>{u&&D.current?D.current.focus():O.current[0]?.focus(),S(0)},[u]),(0,o.useEffect)(()=>{(!u||y!==``)&&O.current[x]?.focus()},[x,u,y]);let M=(0,o.useCallback)(e=>{switch(e.key){case`ArrowDown`:if(e.preventDefault(),C){let e=(j.find(e=>e.key===C)?.children??[]).filter(e=>!e.disabled);E(t=>Math.min(t+1,e.length-1))}else S(e=>Math.min(e+1,j.length-1));break;case`ArrowUp`:e.preventDefault(),C?E(e=>Math.max(e-1,0)):S(e=>Math.max(e-1,0));break;case`ArrowRight`:{e.preventDefault();let t=j[x];t?.children?.length&&(w(t.key),E(0));break}case`ArrowLeft`:e.preventDefault(),w(null);break;case`Enter`:case` `:if(e.preventDefault(),C){let e=(j.find(e=>e.key===C)?.children??[]).filter(e=>!e.disabled)[T];e&&f(e.key,e)}else{let e=j[x];e&&f(e.key,e)}break;case`Escape`:e.preventDefault(),C?w(null):p();break;case`Tab`:p();break;default:break}},[j,x,p,f,C,T]);(0,o.useEffect)(()=>{C&&k.current[T]?.focus()},[T,C]);let N={position:g?`fixed`:`absolute`,top:g?r.top:void 0,left:g?r.left:void 0,minWidth:Math.max(a,r.minWidth),maxHeight:i,overflowY:`auto`,background:v.surface,border:`1px solid ${v.border}`,borderRadius:8,boxShadow:`0 8px 32px rgba(0,0,0,0.4)`,zIndex:9999,outline:`none`,transformOrigin:`top left`,animation:`tkx-dropdown-in 150ms ease forwards`},P=0;return(0,s.jsxs)(`div`,{ref:h,id:_,role:`menu`,"aria-label":`Dropdown menu`,tabIndex:-1,style:N,onKeyDown:M,children:[(0,s.jsx)(`style`,{children:`
120
120
  @keyframes tkx-dropdown-in {
121
121
  from { opacity: 0; transform: scale(0.95); }
122
122
  to { opacity: 1; transform: scale(1); }
123
123
  }
124
- `}),l&&e.jsx("div",{style:{padding:"8px 8px 4px"},children:e.jsx("input",{ref:N,type:"text",value:k,onChange:L=>{y(L.target.value),S(0)},placeholder:d,"aria-label":"Search items",style:{width:"100%",boxSizing:"border-box",padding:"6px 10px",background:b.surfaceAlt,border:`1px solid ${b.border}`,borderRadius:6,color:b.text,fontSize:13,outline:"none"}})}),T.length===0&&e.jsx("div",{style:{padding:"12px 16px",color:b.textMuted,fontSize:13,textAlign:"center"},children:"No results found"}),T.map((L,B)=>e.jsxs("div",{role:"group","aria-label":L.label,children:[L.label&&e.jsx("div",{style:{padding:"8px 12px 4px",fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:b.textMuted},children:A.sanitizeString(L.label)}),L.items.map(V=>{var ne;const D=z;V.disabled||z++;const _=s.includes(V.key),R=D===g&&!V.disabled,F=!!((ne=V.children)!=null&&ne.length),W=j===V.key,K=c?c(V,_):e.jsx(_n,{item:V,isSelected:_,isFocused:R,multiSelect:a,query:k,theme:b,hasSubmenu:F});return e.jsxs("div",{children:[V.divider&&e.jsx("div",{role:"separator",style:{height:1,background:b.border,margin:"4px 0"}}),e.jsxs("div",{ref:Z=>{I.current[D]=Z},role:"menuitem","aria-disabled":V.disabled,"aria-checked":a?_:void 0,"aria-selected":a?void 0:_,"aria-haspopup":F?"menu":void 0,"aria-expanded":F?W:void 0,tabIndex:V.disabled?-1:0,style:{position:"relative",cursor:V.disabled?"not-allowed":"pointer",opacity:V.disabled?.5:1},onClick:()=>{V.disabled||(F?(v(W?null:V.key),w(0)):f(V.key,V))},onMouseEnter:()=>{V.disabled||(S(D),F?(v(V.key),w(0)):v(null))},onFocus:()=>{V.disabled||S(D)},children:[K,F&&W&&e.jsx("div",{role:"menu",style:{position:"absolute",top:0,left:"100%",minWidth:180,background:b.surface,border:`1px solid ${b.border}`,borderRadius:8,boxShadow:"0 8px 32px rgba(0,0,0,0.4)",zIndex:1e4,animation:"tkx-dropdown-in 120ms ease forwards"},children:V.children.map((Z,ie)=>{const fe=s.includes(Z.key),pe=ie===$;return e.jsx("div",{ref:te=>{M.current[ie]=te},role:"menuitem","aria-disabled":Z.disabled,"aria-selected":fe,tabIndex:Z.disabled?-1:0,style:{cursor:Z.disabled?"not-allowed":"pointer",opacity:Z.disabled?.5:1},onClick:te=>{te.stopPropagation(),Z.disabled||f(Z.key,Z)},onMouseEnter:()=>w(ie),children:e.jsx(_n,{item:Z,isSelected:fe,isFocused:pe,multiSelect:a,query:k,theme:b,hasSubmenu:!1})},Z.key)})})]})]},V.key)})]},B))]})}function _n({item:t,isSelected:n,isFocused:r,multiSelect:o,query:s,theme:a,hasSubmenu:l}){const d=r?t.danger?`${a.danger}20`:`${a.primary}18`:"transparent";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:d,transition:"background 80ms",color:t.danger?a.danger:a.text,fontSize:14,userSelect:"none"},children:[o&&e.jsx("div",{style:{width:16,height:16,border:`2px solid ${n?a.primary:a.border}`,borderRadius:4,background:n?a.primary:"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 120ms"},children:n&&e.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:e.jsx("path",{d:"M1 4l3 3L9 1",stroke:a.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}),t.icon&&e.jsx("span",{style:{display:"flex",alignItems:"center",flexShrink:0,color:t.danger?a.danger:a.textMuted},children:t.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:n&&!o?600:400},children:On(t.label,s)}),t.description&&e.jsx("div",{style:{fontSize:12,color:a.textMuted,marginTop:1},children:On(t.description,s)})]}),t.badge!==void 0&&e.jsx("span",{style:{background:a.primary,color:a.bg,fontSize:11,fontWeight:700,borderRadius:10,padding:"1px 7px",flexShrink:0},children:t.badge}),t.shortcut&&!l&&e.jsx("span",{style:{fontSize:12,color:a.textMuted,flexShrink:0},children:t.shortcut}),l&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:"M4 2l4 4-4 4",stroke:a.textMuted,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),!o&&n&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:"M2 7l4 4L12 3",stroke:a.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function kl({trigger:t,items:n,groups:r,placement:o="bottom-start",onSelect:s,selectedKeys:a,multiSelect:l=!1,searchable:d=!1,searchPlaceholder:f="Search…",closeOnSelect:u,disabled:c=!1,maxHeight:h=320,minWidth:p=200,open:m,onOpenChange:b,portal:k=!0,offset:y=6,renderItem:g}){const[S,j]=i.useState(!1),[v,$]=i.useState([]),[w,N]=i.useState({top:0,left:0,minWidth:p}),I=i.useRef(null),M=i.useRef(null),T=i.useId(),E=m!==void 0?m:S,C=a!==void 0?a:v,H=u!==void 0?u:!l,z=r??(n?[{items:n}]:[{items:[]}]),L=i.useCallback(R=>{m===void 0&&j(R),b==null||b(R)},[m,b]),B=i.useCallback((R,F)=>{l&&a===void 0&&$(W=>W.includes(R)?W.filter(K=>K!==R):[...W,R]),s==null||s(R,F),H&&L(!1)},[l,a,s,H,L]),V=i.useCallback(()=>L(!1),[L]);i.useEffect(()=>{if(E&&I.current){const R=Vn(I.current,M.current,o,y);N(R)}},[E,o,y]),i.useEffect(()=>{if(E&&I.current&&M.current){const R=Vn(I.current,M.current,o,y);N(R)}},[E,o,y]),i.useEffect(()=>{if(!E)return;const R=F=>{const W=F.target;I.current&&!I.current.contains(W)&&M.current&&!M.current.contains(W)&&L(!1)};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[E,L]);const D=()=>{c||L(!E)},_=E?e.jsx(yl,{groups:z,position:w,maxHeight:h,minWidth:p,selectedKeys:C,multiSelect:l,searchable:d,searchPlaceholder:f,onSelect:B,onClose:V,renderItem:g,menuRef:M,isPortal:k,menuId:T}):null;return e.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[e.jsx("div",{ref:I,onClick:D,"aria-haspopup":"menu","aria-expanded":E,"aria-controls":E?T:void 0,"aria-disabled":c,style:{cursor:c?"not-allowed":"pointer",opacity:c?.5:1,display:"inline-block"},children:t}),k&&typeof document<"u"?Re.createPortal(_,document.body):_]})}const vl={sm:4,md:8,lg:12};function wl(t,n){return t>=80?"#10b981":t>=55?n:t>=30?"#f59e0b":"#ef4444"}function jl({value:t,label:n,showLabel:r=!0,size:o="md",animate:s=!0,className:a,style:l}){const d=O.useTheme(),f=i.useRef(null),u=Math.max(0,Math.min(100,t)),c=wl(u,d.primary),h=vl[o];i.useEffect(()=>{if(!s||!f.current)return;const m=f.current;m.style.width="0%";const b=requestAnimationFrame(()=>{m.style.transition="width 0.9s cubic-bezier(0.4, 0, 0.2, 1)",m.style.width=`${u}%`});return()=>cancelAnimationFrame(b)},[u,s]);const p=typeof u=="number"?`${u.toFixed(0)}% AI confidence${n?` for ${n}`:""}`:n;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1"),a),style:l,role:"meter","aria-valuenow":u,"aria-valuemin":0,"aria-valuemax":100,"aria-label":p,children:[(n||r)&&e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:4},children:[n&&e.jsx("span",{style:{fontSize:12,fontWeight:600,color:d.textMuted},children:n}),r&&e.jsxs("span",{style:{fontSize:12,fontWeight:700,color:c,marginLeft:"auto"},children:[u.toFixed(0),"%"]})]}),e.jsxs("div",{style:{height:h,borderRadius:h,background:`${d.border}`,overflow:"hidden",position:"relative"},children:[e.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.12) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"tkx-ai-shimmer 2s linear infinite",pointerEvents:"none",zIndex:1}}),e.jsx("div",{ref:f,style:{height:"100%",width:s?"0%":`${u}%`,background:`linear-gradient(90deg, ${c}cc, ${c})`,borderRadius:h,boxShadow:`0 0 8px ${c}66`,transition:s?void 0:"width 0.3s ease"}})]}),e.jsxs("div",{style:{fontSize:10,color:d.textMuted,marginTop:2,display:"flex",gap:4,alignItems:"center"},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:c,display:"inline-block",flexShrink:0}}),u>=80?"High confidence":u>=55?"Moderate confidence":u>=30?"Low confidence":"Very low — review manually"]}),e.jsx("style",{children:`
124
+ `}),u&&(0,s.jsx)(`div`,{style:{padding:`8px 8px 4px`},children:(0,s.jsx)(`input`,{ref:D,type:`text`,value:y,onChange:e=>{b(e.target.value),S(0)},placeholder:d,"aria-label":`Search items`,style:{width:`100%`,boxSizing:`border-box`,padding:`6px 10px`,background:v.surfaceAlt,border:`1px solid ${v.border}`,borderRadius:6,color:v.text,fontSize:13,outline:`none`}})}),A.length===0&&(0,s.jsx)(`div`,{style:{padding:`12px 16px`,color:v.textMuted,fontSize:13,textAlign:`center`},children:`No results found`}),A.map((e,t)=>(0,s.jsxs)(`div`,{role:`group`,"aria-label":e.label,children:[e.label&&(0,s.jsx)(`div`,{style:{padding:`8px 12px 4px`,fontSize:11,fontWeight:600,letterSpacing:`0.06em`,textTransform:`uppercase`,color:v.textMuted},children:n.m(e.label)}),e.items.map(e=>{let t=P;e.disabled||P++;let n=c.includes(e.key),r=t===x&&!e.disabled,i=!!e.children?.length,a=C===e.key,o=m?m(e,n):(0,s.jsx)(mo,{item:e,isSelected:n,isFocused:r,multiSelect:l,query:y,theme:v,hasSubmenu:i});return(0,s.jsxs)(`div`,{children:[e.divider&&(0,s.jsx)(`div`,{role:`separator`,style:{height:1,background:v.border,margin:`4px 0`}}),(0,s.jsxs)(`div`,{ref:e=>{O.current[t]=e},role:`menuitem`,"aria-disabled":e.disabled,"aria-checked":l?n:void 0,"aria-selected":l?void 0:n,"aria-haspopup":i?`menu`:void 0,"aria-expanded":i?a:void 0,tabIndex:e.disabled?-1:0,style:{position:`relative`,cursor:e.disabled?`not-allowed`:`pointer`,opacity:e.disabled?.5:1},onClick:()=>{e.disabled||(i?(w(a?null:e.key),E(0)):f(e.key,e))},onMouseEnter:()=>{e.disabled||(S(t),i?(w(e.key),E(0)):w(null))},onFocus:()=>{e.disabled||S(t)},children:[o,i&&a&&(0,s.jsx)(`div`,{role:`menu`,style:{position:`absolute`,top:0,left:`100%`,minWidth:180,background:v.surface,border:`1px solid ${v.border}`,borderRadius:8,boxShadow:`0 8px 32px rgba(0,0,0,0.4)`,zIndex:1e4,animation:`tkx-dropdown-in 120ms ease forwards`},children:e.children.map((e,t)=>{let n=c.includes(e.key),r=t===T;return(0,s.jsx)(`div`,{ref:e=>{k.current[t]=e},role:`menuitem`,"aria-disabled":e.disabled,"aria-selected":n,tabIndex:e.disabled?-1:0,style:{cursor:e.disabled?`not-allowed`:`pointer`,opacity:e.disabled?.5:1},onClick:t=>{t.stopPropagation(),e.disabled||f(e.key,e)},onMouseEnter:()=>E(t),children:(0,s.jsx)(mo,{item:e,isSelected:n,isFocused:r,multiSelect:l,query:y,theme:v,hasSubmenu:!1})},e.key)})})]})]},e.key)})]},t))]})}function mo({item:e,isSelected:t,isFocused:n,multiSelect:r,query:i,theme:a,hasSubmenu:o}){return(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,background:n?e.danger?`${a.danger}20`:`${a.primary}18`:`transparent`,transition:`background 80ms`,color:e.danger?a.danger:a.text,fontSize:14,userSelect:`none`},children:[r&&(0,s.jsx)(`div`,{style:{width:16,height:16,border:`2px solid ${t?a.primary:a.border}`,borderRadius:4,background:t?a.primary:`transparent`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,transition:`all 120ms`},children:t&&(0,s.jsx)(`svg`,{width:`10`,height:`8`,viewBox:`0 0 10 8`,fill:`none`,children:(0,s.jsx)(`path`,{d:`M1 4l3 3L9 1`,stroke:a.bg,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),e.icon&&(0,s.jsx)(`span`,{style:{display:`flex`,alignItems:`center`,flexShrink:0,color:e.danger?a.danger:a.textMuted},children:e.icon}),(0,s.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,s.jsx)(`div`,{style:{fontWeight:t&&!r?600:400},children:uo(e.label,i)}),e.description&&(0,s.jsx)(`div`,{style:{fontSize:12,color:a.textMuted,marginTop:1},children:uo(e.description,i)})]}),e.badge!==void 0&&(0,s.jsx)(`span`,{style:{background:a.primary,color:a.bg,fontSize:11,fontWeight:700,borderRadius:10,padding:`1px 7px`,flexShrink:0},children:e.badge}),e.shortcut&&!o&&(0,s.jsx)(`span`,{style:{fontSize:12,color:a.textMuted,flexShrink:0},children:e.shortcut}),o&&(0,s.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,style:{flexShrink:0},children:(0,s.jsx)(`path`,{d:`M4 2l4 4-4 4`,stroke:a.textMuted,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}),!r&&t&&(0,s.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,style:{flexShrink:0},children:(0,s.jsx)(`path`,{d:`M2 7l4 4L12 3`,stroke:a.primary,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})]})}function ho({trigger:e,items:t,groups:n,placement:r=`bottom-start`,onSelect:i,selectedKeys:a,multiSelect:l=!1,searchable:u=!1,searchPlaceholder:d=`Search…`,closeOnSelect:f,disabled:p=!1,maxHeight:m=320,minWidth:h=200,open:g,onOpenChange:_,portal:v=!0,offset:y=6,renderItem:b}){let[x,S]=(0,o.useState)(!1),[C,w]=(0,o.useState)([]),[T,E]=(0,o.useState)({top:0,left:0,minWidth:h}),D=(0,o.useRef)(null),O=(0,o.useRef)(null),k=(0,o.useId)(),A=g===void 0?x:g,j=a===void 0?C:a,M=f===void 0?!l:f,N=n??(t?[{items:t}]:[{items:[]}]),P=(0,o.useCallback)(e=>{g===void 0&&S(e),_?.(e)},[g,_]),F=(0,o.useCallback)((e,t)=>{l&&a===void 0&&w(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),i?.(e,t),M&&P(!1)},[l,a,i,M,P]),I=(0,o.useCallback)(()=>P(!1),[P]);(0,o.useEffect)(()=>{A&&D.current&&E(lo(D.current,O.current,r,y))},[A,r,y]),(0,o.useEffect)(()=>{A&&D.current&&O.current&&E(lo(D.current,O.current,r,y))},[A,r,y]),(0,o.useEffect)(()=>{if(!A)return;let e=e=>{let t=e.target;D.current&&!D.current.contains(t)&&O.current&&!O.current.contains(t)&&P(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[A,P]);let L=()=>{p||P(!A)},R=A?(0,s.jsx)(po,{groups:N,position:T,maxHeight:m,minWidth:h,selectedKeys:j,multiSelect:l,searchable:u,searchPlaceholder:d,onSelect:F,onClose:I,renderItem:b,menuRef:O,isPortal:v,menuId:k}):null;return(0,s.jsxs)(`div`,{style:{display:`inline-block`,position:`relative`},children:[(0,s.jsx)(`div`,{ref:D,onClick:L,"aria-haspopup":`menu`,"aria-expanded":A,"aria-controls":A?k:void 0,"aria-disabled":p,style:{cursor:p?`not-allowed`:`pointer`,opacity:p?.5:1,display:`inline-block`},children:e}),v&&typeof document<`u`?(0,c.createPortal)(R,document.body):R]})}var go={sm:4,md:8,lg:12};function _o(e,t){return e>=80?`#10b981`:e>=55?t:e>=30?`#f59e0b`:`#ef4444`}function vo({value:e,label:r,showLabel:i=!0,size:a=`md`,animate:c=!0,className:l,style:u}){let d=t.f(),f=(0,o.useRef)(null),p=Math.max(0,Math.min(100,e)),m=_o(p,d.primary),h=go[a];(0,o.useEffect)(()=>{if(!c||!f.current)return;let e=f.current;e.style.width=`0%`;let t=requestAnimationFrame(()=>{e.style.transition=`width 0.9s cubic-bezier(0.4, 0, 0.2, 1)`,e.style.width=`${p}%`});return()=>cancelAnimationFrame(t)},[p,c]);let g=typeof p==`number`?`${p.toFixed(0)}% AI confidence${r?` for ${r}`:``}`:r;return(0,s.jsxs)(`div`,{className:n.t(n.a(`flex flex-col gap-1`),l),style:u,role:`meter`,"aria-valuenow":p,"aria-valuemin":0,"aria-valuemax":100,"aria-label":g,children:[(r||i)&&(0,s.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:4},children:[r&&(0,s.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:d.textMuted},children:r}),i&&(0,s.jsxs)(`span`,{style:{fontSize:12,fontWeight:700,color:m,marginLeft:`auto`},children:[p.toFixed(0),`%`]})]}),(0,s.jsxs)(`div`,{style:{height:h,borderRadius:h,background:`${d.border}`,overflow:`hidden`,position:`relative`},children:[(0,s.jsx)(`div`,{style:{position:`absolute`,inset:0,background:`linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.12) 50%, transparent 100%)`,backgroundSize:`200% 100%`,animation:`tkx-ai-shimmer 2s linear infinite`,pointerEvents:`none`,zIndex:1}}),(0,s.jsx)(`div`,{ref:f,style:{height:`100%`,width:c?`0%`:`${p}%`,background:`linear-gradient(90deg, ${m}cc, ${m})`,borderRadius:h,boxShadow:`0 0 8px ${m}66`,transition:c?void 0:`width 0.3s ease`}})]}),(0,s.jsxs)(`div`,{style:{fontSize:10,color:d.textMuted,marginTop:2,display:`flex`,gap:4,alignItems:`center`},children:[(0,s.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:m,display:`inline-block`,flexShrink:0}}),p>=80?`High confidence`:p>=55?`Moderate confidence`:p>=30?`Low confidence`:`Very low — review manually`]}),(0,s.jsx)(`style`,{children:`
125
125
  @keyframes tkx-ai-shimmer {
126
126
  0% { background-position: -200% 0; }
127
127
  100% { background-position: 200% 0; }
128
128
  }
129
- `})]})}function Sl(t,n){return t>=80?"#10b981":t>=55?n:t>=30?"#f59e0b":"#ef4444"}function Ml({src:t,name:n,size:r=32}){const o=O.useTheme(),s=n?n.split(" ").map(a=>a[0]).join("").slice(0,2).toUpperCase():"?";return t?e.jsx("img",{src:t,alt:n??"avatar",width:r,height:r,style:{borderRadius:"50%",objectFit:"cover",flexShrink:0}}):e.jsx("div",{style:{width:r,height:r,borderRadius:"50%",flexShrink:0,background:`${o.primary}22`,border:`1px solid ${o.primary}44`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:r*.35,fontWeight:700,color:o.primary},children:s})}function Tl({role:t,content:n,avatar:r,name:o,timestamp:s,streaming:a=!1,confidence:l,copyable:d=!1,className:f,style:u}){const c=O.useTheme(),h=t==="user",p=t==="system",m=typeof n=="string"?A.sanitizeString(n):"",[b,k]=i.useState(a?"":m),[y,g]=i.useState(!1),S=i.useRef(0);i.useEffect(()=>{if(!a||typeof n!="string")return;S.current=0,k("");const $=setInterval(()=>{S.current++,k(m.slice(0,S.current)),S.current>=m.length&&clearInterval($)},18);return()=>clearInterval($)},[m,a,n]);const j=()=>{var $;($=navigator.clipboard)==null||$.writeText(m),g(!0),setTimeout(()=>g(!1),2e3)};if(p)return e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"8px 0"},children:e.jsx("div",{style:{padding:"6px 16px",borderRadius:999,fontSize:12,background:`${c.border}`,color:c.textMuted,fontStyle:"italic"},children:typeof n=="string"?A.sanitizeString(n):n})});const v={maxWidth:"75%",padding:"12px 16px",borderRadius:h?"18px 18px 4px 18px":"18px 18px 18px 4px",background:h?`linear-gradient(135deg, ${c.primary}, ${c.primary}cc)`:`${c.surface}`,border:h?"none":`1px solid ${c.border}`,color:h?"#fff":c.text,fontSize:14,lineHeight:1.65,boxShadow:h?`0 4px 16px -4px ${c.primary}55`:"0 2px 8px -2px rgba(0,0,0,0.2)",position:"relative",wordBreak:"break-word"};return e.jsxs("div",{className:x.cx(x.tkx("flex gap-2"),f),style:{flexDirection:h?"row-reverse":"row",alignItems:"flex-end",...u},children:[e.jsx(Ml,{src:r,name:o??(h?"You":"AI")}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,alignItems:h?"flex-end":"flex-start"},children:[(o||s)&&e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",paddingInline:4},children:[o&&e.jsx("span",{style:{fontSize:11,fontWeight:700,color:c.textMuted},children:o}),s&&e.jsx("span",{style:{fontSize:10,color:c.textMuted},children:s})]}),e.jsxs("div",{style:v,children:[typeof n=="string"?e.jsxs(e.Fragment,{children:[a?b:A.sanitizeString(n),a&&b.length<m.length&&e.jsx("span",{style:{display:"inline-block",width:2,height:14,background:h?"#fff":c.primary,marginLeft:2,animation:"tkx-blink 1s step-end infinite",verticalAlign:"text-bottom"}})]}):n,d&&!h&&e.jsx("button",{onClick:j,title:"Copy message",style:{position:"absolute",top:8,right:8,background:"none",border:"none",cursor:"pointer",fontSize:13,color:y?"#10b981":c.textMuted,padding:"2px 4px",borderRadius:4,transition:"color 0.2s"},children:y?"✓":"⎘"})]}),!h&&l!==void 0&&e.jsx("div",{style:{paddingInline:4,width:"100%",maxWidth:240},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("div",{style:{flex:1,height:3,borderRadius:3,background:c.border,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${l}%`,background:Sl(l,c.primary),borderRadius:3,transition:"width 0.8s ease"}})}),e.jsxs("span",{style:{fontSize:10,color:c.textMuted,whiteSpace:"nowrap"},children:[l,"% confident"]})]})})]}),e.jsx("style",{children:`
129
+ `})]})}function yo(e,t){return e>=80?`#10b981`:e>=55?t:e>=30?`#f59e0b`:`#ef4444`}function bo({src:e,name:n,size:r=32}){let i=t.f(),a=n?n.split(` `).map(e=>e[0]).join(``).slice(0,2).toUpperCase():`?`;return e?(0,s.jsx)(`img`,{src:e,alt:n??`avatar`,width:r,height:r,style:{borderRadius:`50%`,objectFit:`cover`,flexShrink:0}}):(0,s.jsx)(`div`,{style:{width:r,height:r,borderRadius:`50%`,flexShrink:0,background:`${i.primary}22`,border:`1px solid ${i.primary}44`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:r*.35,fontWeight:700,color:i.primary},children:a})}function xo({role:e,content:r,avatar:i,name:a,timestamp:c,streaming:l=!1,confidence:u,copyable:d=!1,className:f,style:p}){let m=t.f(),h=e===`user`,g=e===`system`,_=typeof r==`string`?n.m(r):``,[v,y]=(0,o.useState)(l?``:_),[b,x]=(0,o.useState)(!1),S=(0,o.useRef)(0);(0,o.useEffect)(()=>{if(!l||typeof r!=`string`)return;S.current=0,y(``);let e=setInterval(()=>{S.current++,y(_.slice(0,S.current)),S.current>=_.length&&clearInterval(e)},18);return()=>clearInterval(e)},[_,l,r]);let C=()=>{navigator.clipboard?.writeText(_),x(!0),setTimeout(()=>x(!1),2e3)};if(g)return(0,s.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,padding:`8px 0`},children:(0,s.jsx)(`div`,{style:{padding:`6px 16px`,borderRadius:999,fontSize:12,background:`${m.border}`,color:m.textMuted,fontStyle:`italic`},children:typeof r==`string`?n.m(r):r})});let w={maxWidth:`75%`,padding:`12px 16px`,borderRadius:h?`18px 18px 4px 18px`:`18px 18px 18px 4px`,background:h?`linear-gradient(135deg, ${m.primary}, ${m.primary}cc)`:`${m.surface}`,border:h?`none`:`1px solid ${m.border}`,color:h?`#fff`:m.text,fontSize:14,lineHeight:1.65,boxShadow:h?`0 4px 16px -4px ${m.primary}55`:`0 2px 8px -2px rgba(0,0,0,0.2)`,position:`relative`,wordBreak:`break-word`};return(0,s.jsxs)(`div`,{className:n.t(n.a(`flex gap-2`),f),style:{flexDirection:h?`row-reverse`:`row`,alignItems:`flex-end`,...p},children:[(0,s.jsx)(bo,{src:i,name:a??(h?`You`:`AI`)}),(0,s.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4,alignItems:h?`flex-end`:`flex-start`},children:[(a||c)&&(0,s.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`,paddingInline:4},children:[a&&(0,s.jsx)(`span`,{style:{fontSize:11,fontWeight:700,color:m.textMuted},children:a}),c&&(0,s.jsx)(`span`,{style:{fontSize:10,color:m.textMuted},children:c})]}),(0,s.jsxs)(`div`,{style:w,children:[typeof r==`string`?(0,s.jsxs)(s.Fragment,{children:[l?v:n.m(r),l&&v.length<_.length&&(0,s.jsx)(`span`,{style:{display:`inline-block`,width:2,height:14,background:h?`#fff`:m.primary,marginLeft:2,animation:`tkx-blink 1s step-end infinite`,verticalAlign:`text-bottom`}})]}):r,d&&!h&&(0,s.jsx)(`button`,{onClick:C,title:`Copy message`,style:{position:`absolute`,top:8,right:8,background:`none`,border:`none`,cursor:`pointer`,fontSize:13,color:b?`#10b981`:m.textMuted,padding:`2px 4px`,borderRadius:4,transition:`color 0.2s`},children:b?`✓`:`⎘`})]}),!h&&u!==void 0&&(0,s.jsx)(`div`,{style:{paddingInline:4,width:`100%`,maxWidth:240},children:(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,s.jsx)(`div`,{style:{flex:1,height:3,borderRadius:3,background:m.border,overflow:`hidden`},children:(0,s.jsx)(`div`,{style:{height:`100%`,width:`${u}%`,background:yo(u,m.primary),borderRadius:3,transition:`width 0.8s ease`}})}),(0,s.jsxs)(`span`,{style:{fontSize:10,color:m.textMuted,whiteSpace:`nowrap`},children:[u,`% confident`]})]})})]}),(0,s.jsx)(`style`,{children:`
130
130
  @keyframes tkx-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
131
- `})]})}function Cl({color:t}){return e.jsx("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[0,1,2].map(n=>e.jsx("div",{style:{width:7,height:7,borderRadius:"50%",background:t,animation:`tkx-thinking-dot 1.2s ease-in-out ${n*.18}s infinite`}},n))})}function Il({color:t}){return e.jsxs("div",{style:{position:"relative",width:24,height:24},children:[e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:t,opacity:.15,animation:"tkx-thinking-pulse 1.5s ease-out infinite"}}),e.jsx("div",{style:{position:"absolute",inset:4,borderRadius:"50%",background:t,opacity:.6,animation:"tkx-thinking-pulse 1.5s ease-out 0.3s infinite"}}),e.jsx("div",{style:{position:"absolute",inset:8,borderRadius:"50%",background:t}})]})}function $l({color:t}){return e.jsx("div",{style:{display:"flex",gap:3,alignItems:"center",height:20},children:[0,1,2,3,4].map(n=>e.jsx("div",{style:{width:3,borderRadius:3,background:t,animation:`tkx-thinking-wave 1s ease-in-out ${n*.1}s infinite`}},n))})}function zl({color:t}){return e.jsxs("div",{style:{position:"relative",width:28,height:28},children:[e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"50%",border:`2px solid ${t}33`}}),e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"50%",border:"2px solid transparent",borderTopColor:t,animation:"tkx-thinking-orbit 0.8s linear infinite"}}),e.jsx("div",{style:{position:"absolute",inset:"38%",borderRadius:"50%",background:t,opacity:.8}})]})}const El={sm:12,md:14,lg:16};function Nl({label:t="Thinking…",steps:n,size:r="md",variant:o="dots",active:s=!0,className:a,style:l}){const d=O.useTheme(),[f,u]=i.useState(0);i.useEffect(()=>{if(!(n!=null&&n.length)||!s)return;const m=setInterval(()=>{u(b=>(b+1)%n.length)},1800);return()=>clearInterval(m)},[n,s]);const c=d.primary,h=El[r],p={dots:e.jsx(Cl,{color:c}),pulse:e.jsx(Il,{color:c}),wave:e.jsx($l,{color:c}),orbit:e.jsx(zl,{color:c})}[o];return e.jsxs("div",{className:x.cx(x.tkx("inline-flex flex-col gap-2"),a),style:l,role:"status","aria-live":"polite","aria-label":s?t:"Done thinking",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{opacity:s?1:.35,transition:"opacity 0.3s"},children:s?p:e.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:"#10b981",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{color:"#fff",fontSize:11,fontWeight:900},children:"✓"})})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx("span",{style:{fontSize:h,fontWeight:600,color:s?d.text:d.textMuted,transition:"color 0.3s"},children:s?n?n[f]:t:"Done"}),s&&e.jsx("span",{style:{fontSize:h-2,color:d.textMuted},children:"⚛ Quantum AI · Amplitude Amplification"})]})]}),n&&n.length>1&&e.jsx("div",{style:{display:"flex",gap:4,paddingLeft:2},children:n.map((m,b)=>e.jsx("div",{style:{width:b===f?16:6,height:4,borderRadius:4,background:b===f?c:`${c}44`,transition:"all 0.3s ease"}},b))}),e.jsx("style",{children:`
131
+ `})]})}function So({color:e}){return(0,s.jsx)(`div`,{style:{display:`flex`,gap:4,alignItems:`center`},children:[0,1,2].map(t=>(0,s.jsx)(`div`,{style:{width:7,height:7,borderRadius:`50%`,background:e,animation:`tkx-thinking-dot 1.2s ease-in-out ${t*.18}s infinite`}},t))})}function Co({color:e}){return(0,s.jsxs)(`div`,{style:{position:`relative`,width:24,height:24},children:[(0,s.jsx)(`div`,{style:{position:`absolute`,inset:0,borderRadius:`50%`,background:e,opacity:.15,animation:`tkx-thinking-pulse 1.5s ease-out infinite`}}),(0,s.jsx)(`div`,{style:{position:`absolute`,inset:4,borderRadius:`50%`,background:e,opacity:.6,animation:`tkx-thinking-pulse 1.5s ease-out 0.3s infinite`}}),(0,s.jsx)(`div`,{style:{position:`absolute`,inset:8,borderRadius:`50%`,background:e}})]})}function wo({color:e}){return(0,s.jsx)(`div`,{style:{display:`flex`,gap:3,alignItems:`center`,height:20},children:[0,1,2,3,4].map(t=>(0,s.jsx)(`div`,{style:{width:3,borderRadius:3,background:e,animation:`tkx-thinking-wave 1s ease-in-out ${t*.1}s infinite`}},t))})}function To({color:e}){return(0,s.jsxs)(`div`,{style:{position:`relative`,width:28,height:28},children:[(0,s.jsx)(`div`,{style:{position:`absolute`,inset:0,borderRadius:`50%`,border:`2px solid ${e}33`}}),(0,s.jsx)(`div`,{style:{position:`absolute`,inset:0,borderRadius:`50%`,border:`2px solid transparent`,borderTopColor:e,animation:`tkx-thinking-orbit 0.8s linear infinite`}}),(0,s.jsx)(`div`,{style:{position:`absolute`,inset:`38%`,borderRadius:`50%`,background:e,opacity:.8}})]})}var Eo={sm:12,md:14,lg:16};function Do({label:e=`Thinking…`,steps:r,size:i=`md`,variant:a=`dots`,active:c=!0,className:l,style:u}){let d=t.f(),[f,p]=(0,o.useState)(0);(0,o.useEffect)(()=>{if(!r?.length||!c)return;let e=setInterval(()=>{p(e=>(e+1)%r.length)},1800);return()=>clearInterval(e)},[r,c]);let m=d.primary,h=Eo[i],g={dots:(0,s.jsx)(So,{color:m}),pulse:(0,s.jsx)(Co,{color:m}),wave:(0,s.jsx)(wo,{color:m}),orbit:(0,s.jsx)(To,{color:m})}[a];return(0,s.jsxs)(`div`,{className:n.t(n.a(`inline-flex flex-col gap-2`),l),style:u,role:`status`,"aria-live":`polite`,"aria-label":c?e:`Done thinking`,children:[(0,s.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,s.jsx)(`div`,{style:{opacity:c?1:.35,transition:`opacity 0.3s`},children:c?g:(0,s.jsx)(`div`,{style:{width:20,height:20,borderRadius:`50%`,background:`#10b981`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,s.jsx)(`span`,{style:{color:`#fff`,fontSize:11,fontWeight:900},children:`✓`})})}),(0,s.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:2},children:[(0,s.jsx)(`span`,{style:{fontSize:h,fontWeight:600,color:c?d.text:d.textMuted,transition:`color 0.3s`},children:c?r?r[f]:e:`Done`}),c&&(0,s.jsx)(`span`,{style:{fontSize:h-2,color:d.textMuted},children:`⚛ Quantum AI · Amplitude Amplification`})]})]}),r&&r.length>1&&(0,s.jsx)(`div`,{style:{display:`flex`,gap:4,paddingLeft:2},children:r.map((e,t)=>(0,s.jsx)(`div`,{style:{width:t===f?16:6,height:4,borderRadius:4,background:t===f?m:`${m}44`,transition:`all 0.3s ease`}},t))}),(0,s.jsx)(`style`,{children:`
132
132
  @keyframes tkx-thinking-dot {
133
133
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
134
134
  40% { transform: scale(1); opacity: 1; }
@@ -144,4 +144,4 @@
144
144
  @keyframes tkx-thinking-orbit {
145
145
  to { transform: rotate(360deg); }
146
146
  }
147
- `})]})}exports.LRUCache=O.LRUCache;exports.Quantum=O.Quantum;exports.TKX=O.TKX;exports.ThemeContext=O.ThemeContext;exports.ThemeProvider=O.ThemeProvider;exports.WCAGEngine=O.WCAGEngine;exports.auroraLight=O.auroraLight;exports.batchUpdate=O.batchUpdate;exports.breakpoints=O.breakpoints;exports.contrastRatio=O.contrastRatio;exports.createFocusTrap=O.createFocusTrap;exports.createTheme=O.createTheme;exports.css=O.css;exports.cssVar=O.cssVar;exports.extractCSS=O.extractCSS;exports.fnv1aHash=O.fnv1aHash;exports.fromObject=O.fromObject;exports.generatePalette=O.generatePalette;exports.getAccessibleForeground=O.getAccessibleForeground;exports.injectStyles=O.injectStyles;exports.keyframes=O.keyframes;exports.meetsAA=O.meetsAA;exports.meetsAAA=O.meetsAAA;exports.memoize=O.memoize;exports.prefersHighContrast=O.prefersHighContrast;exports.prefersReducedMotion=O.prefersReducedMotion;exports.quantumDark=O.quantumDark;exports.radii=O.radii;exports.responsive=O.responsive;exports.shadows=O.shadows;exports.spacing=O.spacing;exports.typography=O.typography;exports.useTheme=O.useTheme;exports.zIndex=O.zIndex;exports.Shield=A.Shield;exports.audit=A.audit;exports.getAuditLog=A.getAuditLog;exports.sanitizeProps=A.sanitizeProps;exports.sanitizeString=A.sanitizeString;exports.validateProps=A.validateProps;exports.verifyAuditIntegrity=A.verifyAuditIntegrity;exports.useAnnounce=J.useAnnounce;exports.useClickOutside=J.useClickOutside;exports.useEscapeKey=J.useEscapeKey;exports.useFocusTrap=J.useFocusTrap;exports.useHighContrast=J.useHighContrast;exports.useReducedMotion=J.useReducedMotion;exports.cx=x.cx;exports.extractAtomicCSS=x.extractAtomicCSS;exports.resetAtomicCSS=x.resetAtomicCSS;exports.resolvePluginUtility=x.resolvePluginUtility;exports.tkx=x.tkx;exports.tkxListPlugins=x.tkxListPlugins;exports.tkxPlugin=x.tkxPlugin;exports.tkxRemovePlugin=x.tkxRemovePlugin;exports.tx=x.tx;exports.TkxForm=_t.TkxForm;exports.TkxFormField=_t.TkxFormField;exports.useTkxForm=_t.useTkxForm;exports.I18nContext=nt.I18nContext;exports.isRTL=nt.isRTL;exports.useDirection=nt.useDirection;exports.useI18n=nt.useI18n;exports.useLocale=nt.useLocale;exports.FocusTrap=ml;exports.I18nProvider=xl;exports.LiveRegion=hl;exports.SIZE_BORDER_RADIUS=ga;exports.SIZE_FONT=pa;exports.SIZE_HEIGHT=xa;exports.SIZE_ICON=ba;exports.SIZE_PADDING_X=ha;exports.SIZE_PADDING_Y=ma;exports.SkipNav=pl;exports.TkxAIChatBubble=Tl;exports.TkxAIConfidenceBar=jl;exports.TkxAIThinking=Nl;exports.TkxAccordion=ar;exports.TkxAffix=ol;exports.TkxAlert=rs;exports.TkxAnchor=il;exports.TkxAppBar=Ti;exports.TkxAutocomplete=ii;exports.TkxAvatar=Jn;exports.TkxBadge=Xn;exports.TkxBottomNav=zi;exports.TkxBreadcrumb=ti;exports.TkxButton=Yn;exports.TkxCard=Kn;exports.TkxCardBody=Zr;exports.TkxCardFooter=Gr;exports.TkxCardHeader=Xr;exports.TkxCarousel=jr;exports.TkxCascader=cl;exports.TkxChat=ho;exports.TkxChatBubble=fr;exports.TkxCheckbox=nr;exports.TkxClock=mr;exports.TkxCol=Rr;exports.TkxColorPicker=Vo;exports.TkxCommand=wr;exports.TkxConfigProvider=Lr;exports.TkxContent=zr;exports.TkxCountdown=Ha;exports.TkxDataGrid=Hi;exports.TkxDatePicker=lr;exports.TkxDivider=er;exports.TkxDrawer=Fs;exports.TkxDropdown=kl;exports.TkxEmpty=La;exports.TkxFileUpload=ro;exports.TkxFooter=Er;exports.TkxHeader=Ir;exports.TkxImage=Js;exports.TkxInput=Un;exports.TkxLayout=Cr;exports.TkxList=fl;exports.TkxMasonry=Yi;exports.TkxMentions=_a;exports.TkxMenu=hr;exports.TkxModal=is;exports.TkxNumberInput=kr;exports.TkxOTP=vr;exports.TkxPagination=dr;exports.TkxParagraph=Ta;exports.TkxPopover=ri;exports.TkxProgress=Zn;exports.TkxQRCode=Za;exports.TkxRadio=sr;exports.TkxRadioGroup=Ss;exports.TkxRating=uo;exports.TkxResult=Qa;exports.TkxRichTextDisplay=ra;exports.TkxRow=Nr;exports.TkxSegmented=Oa;exports.TkxSelect=tr;exports.TkxSider=$r;exports.TkxSkeleton=xt;exports.TkxSlider=cr;exports.TkxSnackbar=Ai;exports.TkxSpeedDial=wi;exports.TkxSpin=Ea;exports.TkxStatistic=Pa;exports.TkxStepper=br;exports.TkxTab=cs;exports.TkxTabList=ls;exports.TkxTabPanel=us;exports.TkxTabPanels=ds;exports.TkxTable=gs;exports.TkxTabs=as;exports.TkxTag=xr;exports.TkxTagInput=vo;exports.TkxText=Ma;exports.TkxThinkingIndicator=ur;exports.TkxTimeline=So;exports.TkxTitle=Sa;exports.TkxToastProvider=Ns;exports.TkxToggle=Gn;exports.TkxToolbar=fi;exports.TkxTooltip=xs;exports.TkxTour=tl;exports.TkxTransferList=mi;exports.TkxTreeView=di;exports.TkxVideoPlayer=gr;exports.TkxWatermark=rl;exports.VisuallyHidden=gl;exports.getLocaleDisplayName=wa;exports.isRtlLocale=va;exports.useComponentSize=fa;exports.useConfig=vt;exports.useLogicalSpacing=ka;exports.usePrefixCls=ua;exports.useRtlFlip=ya;exports.useTkxCommand=Zo;exports.useToast=Cs;
147
+ `})]})}exports.FocusTrap=so,exports.I18nContext=a.I18nContext,exports.I18nProvider=io,exports.LRUCache=t.N,exports.LiveRegion=oo,exports.Quantum=t.P,exports.SIZE_BORDER_RADIUS=Xi,exports.SIZE_FONT=qi,exports.SIZE_HEIGHT=Ki,exports.SIZE_ICON=Zi,exports.SIZE_PADDING_X=Ji,exports.SIZE_PADDING_Y=Yi,exports.Shield=n.u,exports.SkipNav=ao,exports.TKX=t.w,exports.ThemeContext=t.t,exports.ThemeProvider=t.n,exports.TkxAIChatBubble=xo,exports.TkxAIConfidenceBar=vo,exports.TkxAIThinking=Do,exports.TkxAccordion=Ae,exports.TkxAffix=Ka,exports.TkxAlert=A,exports.TkxAnchor=Xa,exports.TkxAppBar=zr,exports.TkxAutocomplete=pr,exports.TkxAvatar=ne,exports.TkxBadge=C,exports.TkxBottomNav=Wr,exports.TkxBreadcrumb=ir,exports.TkxButton=m,exports.TkxCard=g,exports.TkxCardBody=v,exports.TkxCardFooter=y,exports.TkxCardHeader=_,exports.TkxCarousel=tr,exports.TkxCascader=eo,exports.TkxChat=Ft,exports.TkxChatBubble=Pt,exports.TkxCheckbox=se,exports.TkxClock=pn,exports.TkxCol=Bi,exports.TkxColorPicker=Fn,exports.TkxCommand=$n,exports.TkxConfigProvider=Hi,exports.TkxContent=Mi,exports.TkxCountdown=Da,exports.TkxDataGrid=oi,exports.TkxDatePicker=tt,exports.TkxDivider=Y,exports.TkxDrawer=Re,exports.TkxDropdown=ho,exports.TkxEmpty=ya,exports.TkxFileUpload=yt,exports.TkxFooter=Ni,exports.TkxForm=i.t,exports.TkxFormField=i.n,exports.TkxHeader=ki,exports.TkxImage=mt,exports.TkxInput=b,exports.TkxLayout=Oi,exports.TkxList=ro,exports.TkxMasonry=fi,exports.TkxMentions=Aa,exports.TkxMenu=cn,exports.TkxModal=F,exports.TkxNumberInput=Vn,exports.TkxOTP=Gn,exports.TkxPagination=ut,exports.TkxParagraph=ua,exports.TkxPopover=cr,exports.TkxProgress=E,exports.TkxQRCode=Fa,exports.TkxRadio=de,exports.TkxRadioGroup=fe,exports.TkxRating=Ot,exports.TkxResult=Ra,exports.TkxRichTextDisplay=wi,exports.TkxRow=Ii,exports.TkxSegmented=ka,exports.TkxSelect=X,exports.TkxSider=ji,exports.TkxSkeleton=te,exports.TkxSlider=st,exports.TkxSnackbar=Xr,exports.TkxSpeedDial=Pr,exports.TkxSpin=ga,exports.TkxStatistic=Ea,exports.TkxStepper=wn,exports.TkxTab=B,exports.TkxTabList=z,exports.TkxTabPanel=H,exports.TkxTabPanels=V,exports.TkxTable=J,exports.TkxTabs=R,exports.TkxTag=Vt,exports.TkxTagInput=Ht,exports.TkxText=la,exports.TkxThinkingIndicator=Nt,exports.TkxTimeline=Xt,exports.TkxTitle=ca,exports.TkxToastProvider=Ee,exports.TkxToggle=O,exports.TkxToolbar=br,exports.TkxTooltip=W,exports.TkxTour=Va,exports.TkxTransferList=Er,exports.TkxTreeView=vr,exports.TkxVideoPlayer=vn,exports.TkxWatermark=Ua,exports.VisuallyHidden=co,exports.WCAGEngine=t.m,exports.audit=n.d,exports.auroraLight=t.r,exports.batchUpdate=t.F,exports.breakpoints=t.i,exports.contrastRatio=t.h,exports.createFocusTrap=t._,exports.createTheme=t.a,exports.css=t.T,exports.cssVar=t.E,exports.cx=n.t,exports.extractAtomicCSS=n.n,exports.extractCSS=t.D,exports.fnv1aHash=t.I,exports.fromObject=t.O,exports.generatePalette=t.o,exports.getAccessibleForeground=t.v,exports.getAuditLog=n.f,exports.getLocaleDisplayName=ra,exports.injectStyles=t.k,exports.isRTL=a.isRTL,exports.isRtlLocale=na,exports.keyframes=t.A,exports.meetsAA=t.b,exports.meetsAAA=t.x,exports.memoize=t.L,exports.prefersHighContrast=t.S,exports.prefersReducedMotion=t.C,exports.quantumDark=t.s,exports.radii=t.c,exports.resetAtomicCSS=n.r,exports.resolvePluginUtility=n.i,exports.responsive=t.M,exports.sanitizeProps=n.p,exports.sanitizeString=n.m,exports.shadows=t.l,exports.spacing=t.u,exports.tkx=n.a,exports.tkxListPlugins=n.o,exports.tkxPlugin=n.s,exports.tkxRemovePlugin=n.c,exports.tx=n.l,exports.typography=t.d,exports.useAnnounce=r.t,exports.useClickOutside=r.n,exports.useComponentSize=Gi,exports.useConfig=Ui,exports.useDirection=a.useDirection,exports.useEscapeKey=r.r,exports.useFocusTrap=r.i,exports.useHighContrast=r.a,exports.useI18n=a.useI18n,exports.useLocale=a.useLocale,exports.useLogicalSpacing=$i,exports.usePrefixCls=Wi,exports.useReducedMotion=r.o,exports.useRtlFlip=Qi,exports.useTheme=t.f,exports.useTkxCommand=Jn,exports.useTkxForm=i.r,exports.useToast=xe,exports.validateProps=n.h,exports.verifyAuditIntegrity=n.g,exports.zIndex=t.p;