tekivex-ui 2.5.7 → 2.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TkxForm-2tGLCPH6.js +326 -0
- package/dist/TkxForm-C2VqR2wC.cjs +12 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +264 -251
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +21 -20
- package/dist/index-BgHMZe4Z.js +66 -0
- package/dist/index-Bt5y50Qa.cjs +1 -0
- package/dist/index-DnqXtpwV.cjs +2 -0
- package/dist/{index-CAXjeKoK.js → index-iUUHRxqJ.js} +77 -75
- package/dist/index.cjs +21 -21
- package/dist/index.js +24 -25
- package/dist/quantum.cjs +2 -2
- package/dist/quantum.js +4 -4
- package/dist/realtime.cjs +8 -4
- package/dist/realtime.js +391 -377
- package/dist/{security-loRa1HyV.js → security-C-ZPGoyG.js} +1 -1
- package/dist/{security-DMqZVW5d.cjs → security-Uf0mjv8o.cjs} +1 -1
- package/dist/src/charts/TkxDonutChart.d.ts.map +1 -1
- package/dist/src/charts/TkxPieChart.d.ts.map +1 -1
- package/dist/src/components/TkxForm.d.ts +17 -16
- package/dist/src/components/TkxForm.d.ts.map +1 -1
- package/dist/src/components/TkxLiveMetrics.d.ts.map +1 -1
- package/dist/src/components/TkxPlayground.d.ts.map +1 -1
- package/dist/src/components/TkxProgress.d.ts.map +1 -1
- package/dist/src/themes/index.d.ts.map +1 -1
- package/dist/{tkx-C_AlpMt4.js → tkx-BtHzWKTl.js} +1 -1
- package/dist/{tkx-69KQ0myA.cjs → tkx-C7GvVUE9.cjs} +1 -1
- package/package.json +5 -5
- package/src/charts/TkxDonutChart.tsx +6 -2
- package/src/charts/TkxPieChart.tsx +7 -3
- package/src/charts/shared.ts +4 -4
- package/src/components/TkxForm.tsx +35 -32
- package/src/components/TkxLiveMetrics.tsx +24 -2
- package/src/components/TkxPlayground.tsx +40 -5
- package/src/components/TkxProgress.tsx +0 -2
- package/src/themes/index.ts +8 -1
- package/dist/TkxForm-BK5Sq7oj.cjs +0 -12
- package/dist/TkxForm-br3i_vo8.js +0 -388
- package/dist/index-DB_m7X7e.cjs +0 -2
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./index-DB_m7X7e.cjs"),e=require("react/jsx-runtime"),i=require("react"),A=require("./security-DMqZVW5d.cjs"),Q=require("./TkxForm-BK5Sq7oj.cjs"),x=require("./tkx-69KQ0myA.cjs"),Le=require("react-dom"),nt=require("./i18n.cjs"),Vr={sm:"text-xs font-semibold",md:"text-sm font-semibold",lg:"text-base font-semibold",xl:"text-lg font-semibold"},Or={sm:"py-1.5 px-3",md:"py-2 px-4",lg:"py-2.5 px-5",xl:"py-3 px-6"},Xt={sm:"min-h-[32px]",md:"min-h-[40px]",lg:"min-h-[48px]",xl:"min-h-[56px]"},_r={sm:14,md:16,lg:18,xl:20};function Yr({size:t}){const n=_r[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 _n=i.forwardRef(({variant:t="solid",size:n="md",colorScheme:r="primary",isLoading:o=!1,loadingText:s,leftIcon:l,rightIcon:a,isFullWidth:c=!1,glow:f=!1,disabled:u,children:d,className:h,style:p,...m},y)=>{const k=_.useTheme(),b=Q.useReducedMotion(),g=u||o,j={primary:k.primary,secondary:k.secondary,danger:k.danger,warning:k.warning,success:k.success}[r],w=_.getAccessibleForeground(j,["#ffffff","#000000",k.bg]),I=typeof d=="string"?A.sanitizeString(d):d,v=s?A.sanitizeString(s):void 0,N=t==="solid"?{backgroundColor:j,color:w,border:"none",boxShadow:f&&!b?`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"},$=x.tkx("inline-flex items-center justify-center gap-2","rounded-lg font-sans font-semibold","select-none relative overflow-hidden",Vr[n],Or[n],Xt[n],t!=="link"&&Xt[n],c&&"w-full",g?"cursor-not-allowed opacity-60":"cursor-pointer",!b&&"transition-all duration-200","focus-visible:focus-ring");return e.jsx("button",{ref:y,"aria-busy":o,"aria-disabled":g,disabled:g,className:x.cx($,h),style:{...N,...p},...m,children:o?e.jsxs(e.Fragment,{children:[e.jsx(Yr,{size:n}),v??I]}):e.jsxs(e.Fragment,{children:[l&&e.jsx("span",{"aria-hidden":"true",children:l}),I,a&&e.jsx("span",{"aria-hidden":"true",children:a})]})})});_n.displayName="TkxButton";const Kr={none:"",sm:"p-3",md:"p-5",lg:"p-7"},Yn=i.forwardRef(({variant:t="default",isHoverable:n,isClickable:r,padding:o="md",as:s,children:l,className:a,style:c,...f},u)=>{const d=_.useTheme(),h=Q.useReducedMotion(),p=s??(r?"button":"div"),m={default:{backgroundColor:d.surface,border:`1px solid ${d.border}`},glass:{backgroundColor:`${d.surface}cc`,backdropFilter:"blur(12px)",border:`1px solid ${d.border}55`,boxShadow:`0 4px 24px ${d.bg}40`},quantum:{backgroundColor:d.surfaceAlt,border:`1px solid ${d.primary}33`,boxShadow:`0 0 24px ${d.primary}18`},elevated:{backgroundColor:d.surface,boxShadow:`0 4px 20px ${d.bg}60`},outlined:{backgroundColor:"transparent",border:`2px solid ${d.border}`}}[t],y=x.tkx("rounded-xl w-full text-left block font-sans focus-visible:focus-ring",Kr[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",y,a),style:{color:d.text,...m,...c},...f,children:l})});Yn.displayName="TkxCard";function Ur({title:t,subtitle:n,action:r,children:o,className:s,...l}){const a=_.useTheme();return e.jsxs("div",{className:x.cx(x.tkx("flex justify-between items-start mb-4"),s),...l,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:a.text},children:t}),n&&e.jsx("p",{className:x.tkx("text-sm mt-1 mb-0"),style:{color:a.textMuted},children:n}),o]}),r&&e.jsx("div",{className:x.tkx("ml-3 shrink-0"),children:r})]})}function Xr({children:t,className:n,...r}){return e.jsx("div",{className:x.cx(x.tkx(""),n),...r,children:t})}function Zr({children:t,className:n,style:r,...o}){const s=_.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 Kn=i.forwardRef(({label:t,id:n,error:r,hint:o,leftAddon:s,rightAddon:l,isInvalid:a,isRequired:c,disabled:f,className:u,style:d,...h},p)=>{const m=_.useTheme(),y=i.useId(),k=n??y,b=`${k}-hint`,g=`${k}-error`,M=a||!!r,j=[o&&b,M&&g].filter(Boolean).join(" ")||void 0,w=A.sanitizeString(t),I=r?A.sanitizeString(r):void 0,v=o?A.sanitizeString(o):void 0,N=M?m.danger:m.border;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1 w-full"),u),style:d,children:[e.jsxs("label",{htmlFor:k,className:x.tkx("text-sm font-medium font-sans"),style:{color:m.text},children:[w,c&&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":M,"aria-required":c,"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}),l&&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:l})]}),v&&!I&&e.jsx("span",{id:b,className:x.tkx("text-xs"),style:{color:m.textMuted},children:v}),I&&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"})}),I]})]})});Kn.displayName="TkxInput";const Gr={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"},Un=i.forwardRef(({variant:t="default",size:n="md",dot:r=!1,pulse:o=!1,outlined:s=!1,children:l,className:a,style:c,...f},u)=>{const d=_.useTheme(),p={default:d.border,primary:d.primary,secondary:d.secondary,danger:d.danger,warning:d.warning,success:d.success,info:d.info}[t]||"#666666",m=_.getAccessibleForeground(p,["#ffffff","#000000",d.bg||"#000000"]),y=typeof l=="string"?A.sanitizeString(l):l;return r?e.jsx("span",{ref:u,"aria-label":typeof l=="string"?A.sanitizeString(l):void 0,className:x.cx(x.tkx("inline-block rounded-full",qr[n],o&&"animate-pulse"),a),style:{backgroundColor:p,...c},...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",Gr[n],o&&"animate-pulse"),a),style:{backgroundColor:s?"transparent":p,color:s?p:m,border:s?`1px solid ${p}`:"none",...c},...f,children:y})});Un.displayName="TkxBadge";const Qr={sm:"4px",md:"8px",lg:"12px"},Jr={sm:32,md:48,lg:64},Xn=i.forwardRef(({value:t,variant:n="linear",size:r="md",label:o,showValue:s,color:l,className:a,style:c,...f},u)=>{const d=_.useTheme(),h=Q.useReducedMotion(),p=l??d.primary,m=t===void 0,y=t!==void 0?Math.min(100,Math.max(0,t)):0;if(t!==void 0){const{errors:b}=A.validateProps({value:t},{value:{type:"number",min:0,max:100}});b.length>0&&console.warn("[TkxProgress]",b.join(", "))}if(n==="circular"){const b=Jr[r],g=r==="sm"?3:r==="md"?4:5,M=(b-g*2)/2,j=2*Math.PI*M,w=m?0:j-y/100*j;return e.jsxs("div",{ref:u,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m?void 0:y,"aria-label":o??(m?"Loading":`${y}%`),className:x.cx(x.tkx("inline-flex flex-col items-center gap-1"),a),style:c,...f,children:[e.jsxs("svg",{width:b,height:b,viewBox:`0 0 ${b} ${b}`,"aria-hidden":"true",children:[e.jsx("circle",{cx:b/2,cy:b/2,r:M,fill:"none",stroke:d.border,strokeWidth:g}),e.jsx("circle",{cx:b/2,cy:b/2,r:M,fill:"none",stroke:p,strokeWidth:g,strokeLinecap:"round",strokeDasharray:j,strokeDashoffset:w,transform:`rotate(-90 ${b/2} ${b/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:d.textMuted},children:[y,"%"]})]})}const k=Qr[r];return e.jsxs("div",{ref:u,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m?void 0:y,"aria-label":o??(m?"Loading":`${y}%`),className:x.cx(x.tkx("flex flex-col gap-1 w-full"),a),style:c,...f,children:[o&&e.jsxs("div",{className:x.tkx("flex justify-between text-sm"),style:{color:d.text},children:[e.jsx("span",{children:o}),s&&!m&&e.jsxs("span",{children:[y,"%"]})]}),e.jsx("div",{className:x.tkx("w-full overflow-hidden"),style:{height:k,borderRadius:k,backgroundColor:d.border},children:e.jsx("div",{style:{height:"100%",borderRadius:k,backgroundColor:p,width:m?"40%":`${y}%`,transition:h?"none":"width 300ms ease",animation:m&&!h?"tkx-shimmer 1.5s ease-in-out infinite":void 0}})})]})});Xn.displayName="TkxProgress";const es={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}},Zn=i.forwardRef(({checked:t,onChange:n,label:r,size:o="md",hideLabel:s,disabled:l,className:a,style:c,...f},u)=>{const d=_.useTheme(),h=Q.useReducedMotion(),p=i.useId();A.validateProps({label:r,checked:t},{label:{type:"string",required:!0},checked:{type:"boolean",required:!0}});const{tw:m,th:y,td:k,gap:b}=es[o],g=t?m-k-b:b,M=t?d.primary:d.border;return e.jsxs("div",{className:x.cx(x.tkx("inline-flex items-center gap-2",l?"opacity-50":""),a),style:c,children:[!s&&e.jsx("label",{htmlFor:p,className:x.tkx("text-sm font-sans",l?"cursor-not-allowed":"cursor-pointer","select-none"),style:{color:d.text},children:r}),e.jsx("button",{ref:u,id:p,role:"switch","aria-checked":t,"aria-label":s?r:void 0,disabled:l,onClick:()=>!l&&n(!t),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&!l&&(j.preventDefault(),n(!t))},className:x.cx(x.tkx("relative border-none p-0 outline-none shrink-0 focus-visible:focus-ring",l?"cursor-not-allowed":"cursor-pointer",!h&&"transition-colors duration-200")),style:{width:m,height:y,borderRadius:y,backgroundColor:M},...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"}})})]})});Zn.displayName="TkxToggle";const ts={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 ns({variant:t,title:n,children:r,dismissible:o,onDismiss:s,icon:l,style:a,className:c}){const f=_.useTheme(),u=Q.useAnnounce(),d=n?A.sanitizeString(n):void 0;i.useEffect(()=>{d&&u(d,t==="danger"||t==="warning"?"assertive":"polite")},[d,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",c??""),style:{backgroundColor:`${p}18`,borderColor:p,color:f.text,...a},children:[e.jsx("span",{className:x.tkx("shrink-0 mt-[1px]"),style:{color:p},children:l??ts[t]}),e.jsxs("div",{className:x.tkx("flex-1 min-w-0"),children:[d&&e.jsx("p",{className:x.tkx("m-0 font-semibold text-sm mb-1"),children:d}),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 rs={sm:"400px",md:"560px",lg:"720px",full:"100vw"};let Wt=0;function ss(){++Wt===1&&(document.body.style.overflow="hidden")}function Zt(){--Wt<=0&&(Wt=0,document.body.style.overflow="")}function os({isOpen:t,onClose:n,title:r,size:o="md",closeOnOverlayClick:s=!0,closeOnEscape:l=!0,children:a,footer:c}){const f=_.useTheme(),u=i.useId(),d=Q.useFocusTrap(t),h=Q.useReducedMotion(),p=Q.useAnnounce(),m=A.sanitizeString(r),y=o==="full";return Q.useEscapeKey(n,l&&t),i.useEffect(()=>(t?(ss(),p(m,"polite")):Zt(),()=>{t&&Zt()}),[t,m,p]),!t||typeof document>"u"?null:Le.createPortal(e.jsxs("div",{role:"presentation",className:x.tkx("fixed inset-0 z-[9000] flex",y?"items-stretch":"items-center justify-center",y?"":"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:d,role:"dialog","aria-modal":"true","aria-labelledby":u,className:x.tkx("relative z-10 flex flex-col overflow-hidden",!h&&"animate-slide-up",y?"":"rounded-xl"),style:{backgroundColor:f.surface,border:`1px solid ${f.border}`,width:rs[o],maxWidth:"100%",maxHeight:y?"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:a}),c&&e.jsx("div",{className:x.tkx("flex justify-end gap-2 px-6 py-4 shrink-0"),style:{borderTop:`1px solid ${f.border}`},children:c})]})]}),document.body)}const Gn=i.createContext(null);function qn(){const t=i.useContext(Gn);if(!t)throw new Error("TkxTab must be used inside TkxTabs");return t}function is({defaultIndex:t=0,activeIndex:n,onChange:r,children:o,tabCount:s=0,style:l,className:a}){const[c,f]=i.useState(t),u=i.useId(),d=n!==void 0?n:c,h=p=>{n===void 0&&f(p),r==null||r(p)};return e.jsx(Gn.Provider,{value:{activeIndex:d,setActiveIndex:h,baseId:u,tabCount:s},children:e.jsx("div",{className:a,style:l,children:o})})}function ls({children:t,className:n,style:r,...o}){const s=_.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 as({index:t,children:n,disabled:r=!1,className:o,style:s}){const l=_.useTheme(),{activeIndex:a,setActiveIndex:c,baseId:f,tabCount:u}=qn(),d=i.useRef(null),h=a===t;return e.jsx("button",{ref:d,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?l.primary:l.textMuted,fontWeight:h?600:400,borderBottom:h?`2px solid ${l.primary}`:"2px solid transparent",marginBottom:"-2px",...s},onClick:()=>!r&&c(t),onKeyDown:p=>_.handleTabsKeyboard(p,t,u,m=>{var y;c(m),(y=document.getElementById(`${f}-tab-${m}`))==null||y.focus()}),children:n})}function cs({children:t,className:n,...r}){return e.jsx("div",{className:n,...r,children:t})}function ds({index:t,children:n,style:r,className:o}){const{activeIndex:s,baseId:l}=qn();return s!==t?null:e.jsx("div",{role:"tabpanel",id:`${l}-panel-${t}`,"aria-labelledby":`${l}-tab-${t}`,tabIndex:0,className:x.cx(x.tkx("pt-4"),o),style:r,children:n})}const us={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 fs({content:t,children:n,placement:r="top",delay:o=300}){const s=_.useTheme(),[l,a]=i.useState(!1),c=i.useRef(null),f=i.useId(),u=i.useRef(null),d=Q.useReducedMotion(),h=A.sanitizeString(t),p=_.getAccessibleForeground(s.surfaceAlt,[s.text,"#ffffff","#000000"]);function m(){u.current=setTimeout(()=>a(!0),o)}function y(){u.current&&clearTimeout(u.current),a(!1)}Q.useEscapeKey(y,l),Q.useClickOutside(c,y);const k=i.cloneElement(n,{"aria-describedby":l?f:void 0,onMouseEnter:b=>{var g,M;(M=(g=n.props).onMouseEnter)==null||M.call(g,b),m()},onMouseLeave:b=>{var g,M;(M=(g=n.props).onMouseLeave)==null||M.call(g,b),y()},onFocus:b=>{var g,M;(M=(g=n.props).onFocus)==null||M.call(g,b),m()},onBlur:b=>{var g,M;(M=(g=n.props).onBlur)==null||M.call(g,b),y()}});return e.jsxs("span",{ref:c,className:x.tkx("relative inline-flex"),children:[k,l&&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",!d&&"animate-fade-in"),style:{backgroundColor:s.surfaceAlt,color:p,border:`1px solid ${s.border}`,boxShadow:`0 4px 12px ${s.bg}40`,maxWidth:280,...us[r]},children:h})]})}function Gt({variant:t,width:n,height:r,animation:o,bgColor:s,accentColor:l}){const a=n!==void 0?typeof n=="number"?`${n}px`:n:"100%",f=r!==void 0?typeof r=="number"?`${r}px`:r:{text:"1em",circular:a,rectangular:"80px"}[t],u=x.tkx(t==="circular"?"rounded-full":t==="text"?"rounded":"rounded-lg"),d=o==="pulse"?x.tkx("animate-pulse"):o==="wave"?x.tkx("animate-shimmer"):"",h=o==="wave"?{background:`linear-gradient(90deg,${s} 25%,${l} 50%,${s} 75%)`,backgroundSize:"200% 100%"}:{backgroundColor:s};return e.jsx("div",{className:x.cx(u,d),style:{width:a,height:f,...h}})}const xt=i.forwardRef(({variant:t="rectangular",width:n,height:r,lines:o,animation:s="pulse",className:l,style:a,...c},f)=>{const u=_.useTheme(),h=Q.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"),l),style:a,...c,children:Array.from({length:o},(p,m)=>e.jsx(Gt,{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:l,style:a,...c,children:e.jsx(Gt,{variant:t,width:n,height:r,animation:h,bgColor:u.surfaceAlt,accentColor:u.border})})});xt.displayName="TkxSkeleton";const xs={xs:24,sm:32,md:40,lg:56,xl:72},ps={online:"#06d6a0",offline:"#8888aa",away:"#ffbe0b",busy:"#f72585"},Qn=i.forwardRef(({src:t,alt:n,initials:r,size:o="md",shape:s="circle",status:l,className:a,style:c,...f},u)=>{const d=_.useTheme(),[h,p]=i.useState(!1),m=xs[o],y=s==="circle",k=d.surfaceAlt,b=_.getAccessibleForeground(k,[d.text,d.textMuted]),g=t&&!h,M=!g&&r,j=Math.max(8,m*.22),w=x.tkx("relative inline-flex shrink-0",y?"rounded-full":"rounded-lg"),I=x.tkx("block object-cover",y?"rounded-full":"rounded-lg"),v=x.tkx("flex items-center justify-center font-semibold font-sans select-none",y?"rounded-full":"rounded-lg");return e.jsxs("div",{ref:u,className:x.cx(w,a),style:{width:m,height:m,...c},...f,children:[g?e.jsx("img",{src:A.sanitizeString(t),alt:A.sanitizeString(n),onError:()=>p(!0),className:I,style:{width:m,height:m}}):e.jsx("div",{role:"img","aria-label":A.sanitizeString(n),className:v,style:{width:m,height:m,backgroundColor:k,color:b,fontSize:m*.38},children:M?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"})]})}),l&&e.jsx("span",{"aria-label":`Status: ${l}`,className:x.tkx("absolute bottom-0 right-0 rounded-full"),style:{width:j,height:j,backgroundColor:ps[l],border:`2px solid ${d.bg}`}})]})});Qn.displayName="TkxAvatar";function hs({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 ms({columns:t,data:n,caption:r,sortable:o,stickyHeader:s,isLoading:l,emptyState:a,style:c,className:f,striped:u,maxHeight:d,rowHeight:h=44,virtualScroll:p,onLoadMore:m,hasMore:y,loadingMore:k=!1,onRowClick:b,selectedRows:g,bordered:M,compact:j}){const w=_.useTheme(),[I,v]=i.useState(null),[N,$]=i.useState("asc"),S=i.useMemo(()=>!I||!o?n:[...n].sort((te,ce)=>{const Y=te[I],se=ce[I];let le=0;return typeof Y=="string"&&typeof se=="string"?le=Y.localeCompare(se):typeof Y=="number"&&typeof se=="number"&&(le=Y-se),N==="asc"?le:-le}),[n,I,N,o]),T=i.useCallback(te=>{I===te?$(ce=>ce==="asc"?"desc":"asc"):(v(te),$("asc"))},[I]);function E(te){return I!==te?"none":N}const C=5,H=p!==void 0?p:d!==void 0&&S.length>=50,z=i.useRef(null),[R,B]=i.useState(0),[V,D]=i.useState(400),O=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 L=H?Math.max(0,Math.floor(R/h)-C):0,P=H?Math.min(S.length,Math.ceil((R+V)/h)+C):S.length,W=H?S.slice(L,P):S,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&&y!==!1&&(ne.current=!0,m())},{root:z.current,rootMargin:"0px 0px 200px 0px",threshold:0});return ce.observe(te),()=>ce.disconnect()},[m,y]);const Z=j?"4px":"12px",ie=j?"8px":"16px",fe=M?`1px solid ${w.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 ${w.border}`,overflow:"hidden",...c},children:e.jsxs("div",{ref:z,onScroll:H?O:void 0,style:{overflowX:"auto",overflowY:d?"auto":"visible",maxHeight:d??"none"},children:[e.jsxs("table",{className:x.tkx("w-full font-sans text-sm"),style:{borderCollapse:"collapse",color:w.text},children:[r&&e.jsx("caption",{className:x.tkx("text-sm text-left p-2"),style:{color:w.textMuted},children:A.sanitizeString(r)}),e.jsx("thead",{style:s?{position:"sticky",top:0,backgroundColor:w.surfaceAlt,zIndex:1}:{backgroundColor:w.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:w.textMuted,borderBottom:`2px solid ${w.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(hs,{dir:Y})]})},String(te.key))})})}),e.jsx("tbody",{children:l?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)):S.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:x.tkx("text-center"),style:{padding:"32px 16px",color:w.textMuted},children:a??"No data available"})}):e.jsxs(e.Fragment,{children:[H&&L>0&&e.jsx("tr",{"aria-hidden":"true",style:{height:L*h},children:e.jsx("td",{colSpan:t.length,style:{padding:0,border:"none"}})}),W.map((te,ce)=>{const Y=L+ce,se=pe.has(Y);return e.jsx("tr",{"aria-rowindex":Y+1,"aria-selected":se||void 0,onClick:b?()=>b(te,Y):void 0,onKeyDown:b?le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),b(te,Y))}:void 0,tabIndex:b?0:void 0,className:x.tkx(b?"cursor-pointer":""),style:{backgroundColor:se?`${w.primary}22`:u&&Y%2===1?w.surfaceAlt:"transparent",borderBottom:`1px solid ${w.border}`,...H?{height:h,boxSizing:"border-box"}:{}},children:t.map(le=>{const ge=te[le.key],he=le.render?le.render(ge,te):typeof ge=="string"?A.sanitizeString(ge):String(ge??"");return e.jsx("td",{style:{padding:`${Z} ${ie}`,color:w.text,borderRight:fe},children:he},String(le.key))})},Y)}),H&&P<S.length&&e.jsx("tr",{"aria-hidden":"true",style:{height:(S.length-P)*h},children:e.jsx("td",{colSpan:t.length,style:{padding:0,border:"none"}})})]})})]}),(y||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))})})}),!y&&m&&e.jsx("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:w.textMuted},children:"✓ All rows loaded"})]})})}const Jn=i.forwardRef(({orientation:t="horizontal",label:n,variant:r="solid",className:o,style:s,...l},a)=>{const c=_.useTheme(),f=n?A.sanitizeString(n):void 0,u=t==="vertical",d=u?"borderLeft":"borderTop",h=`1px ${r} ${c.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:c.textMuted,...s},...l,children:[e.jsx("hr",{className:x.tkx("flex-1 m-0 border-none"),style:{[d]:h}}),e.jsx("span",{children:f}),e.jsx("hr",{className:x.tkx("flex-1 m-0 border-none"),style:{[d]:h}})]}):e.jsx("hr",{ref:a,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:{[d]:h,...s},...l})});Jn.displayName="TkxDivider";const gs={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 bs(t,n){const r=t.getBoundingClientRect(),o=window.innerHeight,s=6,l=o-r.bottom-s,a=r.top-s,c=l>=Math.min(n,200)||l>=a?"below":"above";return{top:c==="below"?r.bottom+window.scrollY+s:r.top+window.scrollY-s-Math.min(n,280),left:r.left+window.scrollX,width:r.width,placement:c}}function ys({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 er({options:t,value:n,defaultValue:r,placeholder:o="Select an option…",size:s="md",isDisabled:l=!1,isInvalid:a=!1,label:c,hint:f,errorMessage:u,multiple:d=!1,searchable:h=!1,clearable:p=!1,isLoading:m=!1,onChange:y,renderOption:k,maxMenuHeight:b=280,virtualScroll:g,optionHeight:M=36,id:j,className:w,style:I}){const v=_.useTheme(),N=i.useId(),$=j??N,S=`${$}-listbox`,T=`${$}-hint`,E=`${$}-error`,C=n!==void 0,[H,z]=i.useState(qt(r)),R=C?qt(n):H,[B,V]=i.useState(!1),[D,O]=i.useState(""),[L,P]=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=gs[s],se=a||!!u,le=i.useRef(null),[ge,he]=i.useState(0),[ye,de]=i.useState(0),xe=i.useCallback(()=>{le.current&&he(le.current.scrollTop)},[]);i.useEffect(()=>{if(!B){he(0);return}const F=le.current;if(!F)return;de(F.clientHeight);const J=new ResizeObserver(()=>{de(F.clientHeight)});return J.observe(F),()=>J.disconnect()},[B]);const oe=h&&D?t.filter(F=>F.label.toLowerCase().includes(D.toLowerCase())):t,G=oe.filter(F=>!F.disabled),ue=oe.some(F=>!!F.group),ve=(g!==void 0?g:oe.length>=100)&&!ue,Me=8,$e=oe.length*M,We=ve?Math.max(0,Math.floor(ge/M)-Me):0,Te=ve?Math.min(oe.length,Math.ceil((ge+ye)/M)+Me):oe.length,ze=ve?oe.slice(We,Te):oe,Ke=We*M,Ze=oe.reduce((F,J)=>{const re=J.group??"";return F[re]||(F[re]=[]),F[re].push(J),F},{}),Pe=i.useCallback(F=>{var re;let J;d?J=R.includes(F)?R.filter(ae=>ae!==F):[...R,F]:J=[F],C||z(J),y==null||y(d?J:J[0]??""),d||(V(!1),O(""),P(-1),(re=fe.current)==null||re.focus())},[C,d,y,R]),Oe=i.useCallback((F,J)=>{J.stopPropagation();const re=R.filter(ae=>ae!==F);C||z(re),y==null||y(d?re:re[0]??"")},[C,d,y,R]),Ge=i.useCallback(F=>{F.stopPropagation(),C||z([]),y==null||y(d?[]:"")},[C,d,y]),Ee=i.useCallback(()=>{!fe.current||!B||K(bs(fe.current,b))},[B,b]);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 F=J=>{var ae,Ce;const re=J.target;(ae=fe.current)!=null&&ae.contains(re)||(Ce=te.current)!=null&&Ce.contains(re)||(V(!1),O(""))};return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[B]),i.useEffect(()=>{B&&h&&setTimeout(()=>{var F;return(F=pe.current)==null?void 0:F.focus()},0)},[B,h]),i.useEffect(()=>{var F;if(!(!B||L<0))if(ve&&le.current){const J=L*M,re=J+M,ae=le.current;J<ae.scrollTop?ae.scrollTop=J:re>ae.scrollTop+ae.clientHeight&&(ae.scrollTop=re-ae.clientHeight)}else{const J=(F=ce.current)==null?void 0:F.querySelector(`[data-idx="${L}"]`);J==null||J.scrollIntoView({block:"nearest"})}},[L,B,ve,M]);const qe=F=>{switch(F.key){case"Enter":case" ":F.preventDefault(),B?L>=0&&G[L]&&Pe(G[L].value):Re();break;case"Escape":F.preventDefault(),V(!1),O("");break;case"ArrowDown":F.preventDefault(),B?P(J=>Math.min(J+1,G.length-1)):Re();break;case"ArrowUp":F.preventDefault(),B?P(J=>Math.max(J-1,0)):Re();break;case"Home":F.preventDefault(),B&&P(0);break;case"End":F.preventDefault(),B&&P(G.length-1);break;default:F.key.length===1&&!F.ctrlKey&&!F.metaKey&&(B||Re(),Qe(F.key))}},rt=F=>{var J;switch(F.key){case"Escape":F.preventDefault(),V(!1),O(""),(J=fe.current)==null||J.focus();break;case"ArrowDown":F.preventDefault(),P(re=>Math.min(re+1,G.length-1));break;case"ArrowUp":F.preventDefault(),P(re=>Math.max(re-1,0));break;case"Home":F.preventDefault(),P(0);break;case"End":F.preventDefault(),P(G.length-1);break;case"Enter":F.preventDefault(),L>=0&&G[L]&&Pe(G[L].value);break}};function Qe(F){ie.current&&clearTimeout(ie.current);const J=ne+F.toLowerCase();Z(J);const re=G.findIndex(ae=>ae.label.toLowerCase().startsWith(J));re>=0&&P(re),ie.current=setTimeout(()=>Z(""),800)}function Re(){if(l||m)return;V(!0);const F=G.findIndex(J=>R.includes(J.value));P(F>=0?F:0)}const Fe=se?v.danger:B?v.primary:v.border,Ae=L>=0&&G[L]?`${$}-opt-${G[L].value}`:void 0,Je=[f&&T,se&&E].filter(Boolean).join(" ")||void 0,Ue=R.map(F=>t.find(J=>J.value===F)).filter(Boolean),lt=B&&W?Le.createPortal(e.jsxs("div",{ref:te,role:"listbox",id:S,"aria-label":c?A.sanitizeString(c):"Options","aria-multiselectable":d,style:{position:"absolute",top:W.top,left:W.left,width:W.width,zIndex:9999,backgroundColor:v.surface,border:`1.5px solid ${v.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:b,display:"flex",flexDirection:"column"},children:[h&&e.jsxs("div",{style:{padding:"8px 10px",borderBottom:`1px solid ${v.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:v.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:F=>{O(F.target.value),P(0)},onKeyDown:rt,placeholder:"Search…","aria-label":"Search options",style:{border:"none",outline:"none",background:"transparent",color:v.text,fontSize:Y.fontSize,fontFamily:"inherit",width:"100%"}})]}),e.jsx("div",{ref:F=>{ce.current=F,le.current=F},onScroll:ve?xe:void 0,style:{overflowY:"auto",flexGrow:1,maxHeight:b-(h?48:0)},children:ve?e.jsxs("div",{style:{height:$e,position:"relative"},children:[e.jsx("div",{style:{position:"absolute",top:Ke,left:0,right:0},children:ze.map(F=>{const J=G.indexOf(F),re=J===L,ae=R.includes(F.value),Ce=k?k(F,ae):e.jsxs("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[F.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:F.icon}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(F.label)})]}),F.description&&e.jsx("span",{style:{fontSize:"12px",color:v.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(F.description)})]});return e.jsxs("div",{id:`${$}-opt-${F.value}`,"data-idx":J>=0?J:void 0,role:"option","aria-selected":ae,"aria-disabled":F.disabled||void 0,onClick:()=>!F.disabled&&Pe(F.value),onMouseEnter:()=>!F.disabled&&J>=0&&P(J),style:{height:M,boxSizing:"border-box",padding:`0 ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:F.disabled?v.textMuted:v.text,backgroundColor:re?`${v.primary}22`:ae?`${v.primary}12`:"transparent",cursor:F.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:F.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[Ce,ae&&!k&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})]},F.value)})}),oe.length===0&&e.jsx("div",{style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:v.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(([F,J])=>e.jsxs("div",{children:[F&&e.jsx("div",{"aria-hidden":"true",style:{padding:"8px 12px 4px",fontSize:"11px",fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:v.textMuted,fontFamily:"inherit",position:"sticky",top:0,backgroundColor:v.surface,zIndex:1,borderBottom:`1px solid ${v.border}`},children:A.sanitizeString(F)}),J.map(re=>{const ae=G.indexOf(re),Ce=ae===L,Ie=R.includes(re.value),we=k?k(re,Ie):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:v.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(re.description)})]});return e.jsxs("div",{id:`${$}-opt-${re.value}`,"data-idx":ae>=0?ae:void 0,role:"option","aria-selected":Ie,"aria-disabled":re.disabled||void 0,onClick:()=>!re.disabled&&Pe(re.value),onMouseEnter:()=>!re.disabled&&ae>=0&&P(ae),style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:re.disabled?v.textMuted:v.text,backgroundColor:Ce?`${v.primary}22`:Ie?`${v.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,Ie&&!k&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})]},re.value)})]},F)),oe.length===0&&e.jsx("div",{style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:v.textMuted,textAlign:"center"},children:m?"Loading…":"No options found"})]})})]}),document.body):null,q=p&&R.length>0&&!l&&!m;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1 w-full"),w),style:I,children:[c&&e.jsx("label",{htmlFor:$,style:{fontSize:"14px",fontWeight:500,fontFamily:"inherit",color:v.text,userSelect:"none"},children:A.sanitizeString(c)}),e.jsx("div",{style:{position:"relative",width:"100%",opacity:l?.55:1},children:e.jsxs("button",{ref:fe,id:$,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":B,"aria-controls":S,"aria-activedescendant":Ae,"aria-invalid":se||void 0,"aria-describedby":Je,"aria-multiselectable":d,disabled:l,onClick:()=>B?V(!1):Re(),onKeyDown:qe,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:d&&R.length>0?`4px ${Y.px}`:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",backgroundColor:v.surface,color:R.length>0?v.text:v.textMuted,border:`1.5px solid ${Fe}`,borderRadius:8,boxSizing:"border-box",transition:"border-color 150ms",textAlign:"left",cursor:l?"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:d&&Ue.length>0?Ue.map(F=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:`${Y.tagPy} ${Y.tagPx}`,fontSize:`calc(${Y.fontSize} - 1px)`,fontFamily:"inherit",backgroundColor:`${v.primary}22`,color:v.primary,borderRadius:6,border:`1px solid ${v.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(F.label)}),e.jsx("span",{role:"button","aria-label":`Remove ${A.sanitizeString(F.label)}`,tabIndex:-1,onClick:J=>Oe(F.value,J),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"})})})]},F.value)):!d&&R.length>0?(()=>{const F=t.find(J=>J.value===R[0]);return e.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:6},children:[(F==null?void 0:F.icon)&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:F.icon}),F?A.sanitizeString(F.label):""]})})():e.jsx("span",{style:{opacity:.6},children:A.sanitizeString(o)})}),e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0,color:v.textMuted},children:[m&&e.jsx(ys,{size:Y.iconSize,color:v.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:F=>F.currentTarget.style.opacity="1",onMouseLeave:F=>F.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:v.textMuted,fontFamily:"inherit"},children:A.sanitizeString(f)}),se&&u&&e.jsxs("span",{id:E,role:"alert",style:{fontSize:"12px",color:v.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)]}),lt]})}er.displayName="TkxSelect";const ks={sm:{box:16,fontSize:"13px",iconStroke:2.5},md:{box:20,fontSize:"14px",iconStroke:2.5},lg:{box:24,fontSize:"15px",iconStroke:2}},tr=i.forwardRef(({label:t,hint:n,isInvalid:r,errorMessage:o,isIndeterminate:s=!1,size:l="md",colorScheme:a="primary",checked:c,defaultChecked:f,onChange:u,disabled:d,className:h,style:p,id:m,...y},k)=>{const b=_.useTheme(),g=Q.useReducedMotion(),M=i.useId(),j=m??M,w=`${j}-hint`,I=`${j}-error`,v=i.useRef(null),[N,$]=i.useState(!1),S=ks[l],T=r||!!o,C={primary:b.primary,success:b.success,danger:b.danger,warning:b.warning}[a]??b.primary,H=c!==void 0?c:void 0;i.useEffect(()=>{const P=(k==null?void 0:k.current)??v.current;P&&(P.indeterminate=s)},[s,k]);const z=s||(H??!1),R=z?C:b.surface,B=T?b.danger:z?C:b.border,V=_.getAccessibleForeground(C),D=N?{outline:`2px solid ${C}`,outlineOffset:"2px"}:{},O=[n&&w,T&&I].filter(Boolean).join(" ")||void 0,L=!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:d?.5:1,...p},children:[e.jsx("style",{children:`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=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"),Le=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:l,rightIcon:a,isFullWidth:c=!1,glow:f=!1,disabled:u,children:d,className:h,style:p,...m},y)=>{const k=_.useTheme(),b=J.useReducedMotion(),g=u||o,j={primary:k.primary,secondary:k.secondary,danger:k.danger,warning:k.warning,success:k.success}[r],w=_.getAccessibleForeground(j,["#ffffff","#000000",k.bg]),I=typeof d=="string"?A.sanitizeString(d):d,v=s?A.sanitizeString(s):void 0,N=t==="solid"?{backgroundColor:j,color:w,border:"none",boxShadow:f&&!b?`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"},$=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],c&&"w-full",g?"cursor-not-allowed opacity-60":"cursor-pointer",!b&&"transition-all duration-200","focus-visible:focus-ring");return e.jsx("button",{ref:y,"aria-busy":o,"aria-disabled":g,disabled:g,className:x.cx($,h),style:{...N,...p},...m,children:o?e.jsxs(e.Fragment,{children:[e.jsx(Kr,{size:n}),v??I]}):e.jsxs(e.Fragment,{children:[l&&e.jsx("span",{"aria-hidden":"true",children:l}),I,a&&e.jsx("span",{"aria-hidden":"true",children:a})]})})});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:l,className:a,style:c,...f},u)=>{const d=_.useTheme(),h=J.useReducedMotion(),p=s??(r?"button":"div"),m={default:{backgroundColor:d.surface,border:`1px solid ${d.border}`},glass:{backgroundColor:`${d.surface}cc`,backdropFilter:"blur(12px)",border:`1px solid ${d.border}55`,boxShadow:`0 4px 24px ${d.bg}40`},quantum:{backgroundColor:d.surfaceAlt,border:`1px solid ${d.primary}33`,boxShadow:`0 0 24px ${d.primary}18`},elevated:{backgroundColor:d.surface,boxShadow:`0 4px 20px ${d.bg}60`},outlined:{backgroundColor:"transparent",border:`2px solid ${d.border}`}}[t],y=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",y,a),style:{color:d.text,...m,...c},...f,children:l})});Kn.displayName="TkxCard";function Xr({title:t,subtitle:n,action:r,children:o,className:s,...l}){const a=_.useTheme();return e.jsxs("div",{className:x.cx(x.tkx("flex justify-between items-start mb-4"),s),...l,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:a.text},children:t}),n&&e.jsx("p",{className:x.tkx("text-sm mt-1 mb-0"),style:{color:a.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=_.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:l,isInvalid:a,isRequired:c,disabled:f,className:u,style:d,...h},p)=>{const m=_.useTheme(),y=i.useId(),k=n??y,b=`${k}-hint`,g=`${k}-error`,M=a||!!r,j=[o&&b,M&&g].filter(Boolean).join(" ")||void 0,w=A.sanitizeString(t),I=r?A.sanitizeString(r):void 0,v=o?A.sanitizeString(o):void 0,N=M?m.danger:m.border;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1 w-full"),u),style:d,children:[e.jsxs("label",{htmlFor:k,className:x.tkx("text-sm font-medium font-sans"),style:{color:m.text},children:[w,c&&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":M,"aria-required":c,"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}),l&&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:l})]}),v&&!I&&e.jsx("span",{id:b,className:x.tkx("text-xs"),style:{color:m.textMuted},children:v}),I&&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"})}),I]})]})});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:l,className:a,style:c,...f},u)=>{const d=_.useTheme(),p={default:d.border,primary:d.primary,secondary:d.secondary,danger:d.danger,warning:d.warning,success:d.success,info:d.info}[t]||"#666666",m=_.getAccessibleForeground(p,["#ffffff","#000000",d.bg||"#000000"]),y=typeof l=="string"?A.sanitizeString(l):l;return r?e.jsx("span",{ref:u,"aria-label":typeof l=="string"?A.sanitizeString(l):void 0,className:x.cx(x.tkx("inline-block rounded-full",Qr[n],o&&"animate-pulse"),a),style:{backgroundColor:p,...c},...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"),a),style:{backgroundColor:s?"transparent":p,color:s?p:m,border:s?`1px solid ${p}`:"none",...c},...f,children:y})});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:l,className:a,style:c,...f},u)=>{const d=_.useTheme(),h=J.useReducedMotion(),p=l??d.primary,m=t===void 0,y=t!==void 0?Math.min(100,Math.max(0,t)):0;if(t!==void 0){const{errors:b}=A.validateProps({value:t},{value:{type:"number",min:0,max:100}});b.length>0&&console.warn("[TkxProgress]",b.join(", "))}if(n==="circular"){const b=es[r],g=r==="sm"?3:r==="md"?4:5,M=(b-g*2)/2,j=2*Math.PI*M,w=m?0:j-y/100*j;return e.jsxs("div",{ref:u,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m?void 0:y,"aria-label":o??(m?"Loading":`${y}%`),className:x.cx(x.tkx("inline-flex flex-col items-center gap-1"),a),style:c,children:[e.jsxs("svg",{width:b,height:b,viewBox:`0 0 ${b} ${b}`,"aria-hidden":"true",children:[e.jsx("circle",{cx:b/2,cy:b/2,r:M,fill:"none",stroke:d.border,strokeWidth:g}),e.jsx("circle",{cx:b/2,cy:b/2,r:M,fill:"none",stroke:p,strokeWidth:g,strokeLinecap:"round",strokeDasharray:j,strokeDashoffset:w,transform:`rotate(-90 ${b/2} ${b/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:d.textMuted},children:[y,"%"]})]})}const k=Jr[r];return e.jsxs("div",{ref:u,role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m?void 0:y,"aria-label":o??(m?"Loading":`${y}%`),className:x.cx(x.tkx("flex flex-col gap-1 w-full"),a),style:c,children:[o&&e.jsxs("div",{className:x.tkx("flex justify-between text-sm"),style:{color:d.text},children:[e.jsx("span",{children:o}),s&&!m&&e.jsxs("span",{children:[y,"%"]})]}),e.jsx("div",{className:x.tkx("w-full overflow-hidden"),style:{height:k,borderRadius:k,backgroundColor:d.border},children:e.jsx("div",{style:{height:"100%",borderRadius:k,backgroundColor:p,width:m?"40%":`${y}%`,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:l,className:a,style:c,...f},u)=>{const d=_.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:y,td:k,gap:b}=ts[o],g=t?m-k-b:b,M=t?d.primary:d.border;return e.jsxs("div",{className:x.cx(x.tkx("inline-flex items-center gap-2",l?"opacity-50":""),a),style:c,children:[!s&&e.jsx("label",{htmlFor:p,className:x.tkx("text-sm font-sans",l?"cursor-not-allowed":"cursor-pointer","select-none"),style:{color:d.text},children:r}),e.jsx("button",{ref:u,id:p,role:"switch","aria-checked":t,"aria-label":s?r:void 0,disabled:l,onClick:()=>!l&&n(!t),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&!l&&(j.preventDefault(),n(!t))},className:x.cx(x.tkx("relative border-none p-0 outline-none shrink-0 focus-visible:focus-ring",l?"cursor-not-allowed":"cursor-pointer",!h&&"transition-colors duration-200")),style:{width:m,height:y,borderRadius:y,backgroundColor:M},...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:l,style:a,className:c}){const f=_.useTheme(),u=J.useAnnounce(),d=n?A.sanitizeString(n):void 0;i.useEffect(()=>{d&&u(d,t==="danger"||t==="warning"?"assertive":"polite")},[d,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",c??""),style:{backgroundColor:`${p}18`,borderColor:p,color:f.text,...a},children:[e.jsx("span",{className:x.tkx("shrink-0 mt-[1px]"),style:{color:p},children:l??ns[t]}),e.jsxs("div",{className:x.tkx("flex-1 min-w-0"),children:[d&&e.jsx("p",{className:x.tkx("m-0 font-semibold text-sm mb-1"),children:d}),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:l=!0,children:a,footer:c}){const f=_.useTheme(),u=i.useId(),d=J.useFocusTrap(t),h=J.useReducedMotion(),p=J.useAnnounce(),m=A.sanitizeString(r),y=o==="full";return J.useEscapeKey(n,l&&t),i.useEffect(()=>(t?(os(),p(m,"polite")):Gt(),()=>{t&&Gt()}),[t,m,p]),!t||typeof document>"u"?null:Le.createPortal(e.jsxs("div",{role:"presentation",className:x.tkx("fixed inset-0 z-[9000] flex",y?"items-stretch":"items-center justify-center",y?"":"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:d,role:"dialog","aria-modal":"true","aria-labelledby":u,className:x.tkx("relative z-10 flex flex-col overflow-hidden",!h&&"animate-slide-up",y?"":"rounded-xl"),style:{backgroundColor:f.surface,border:`1px solid ${f.border}`,width:ss[o],maxWidth:"100%",maxHeight:y?"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:a}),c&&e.jsx("div",{className:x.tkx("flex justify-end gap-2 px-6 py-4 shrink-0"),style:{borderTop:`1px solid ${f.border}`},children:c})]})]}),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 ls({defaultIndex:t=0,activeIndex:n,onChange:r,children:o,tabCount:s=0,style:l,className:a}){const[c,f]=i.useState(t),u=i.useId(),d=n!==void 0?n:c,h=p=>{n===void 0&&f(p),r==null||r(p)};return e.jsx(qn.Provider,{value:{activeIndex:d,setActiveIndex:h,baseId:u,tabCount:s},children:e.jsx("div",{className:a,style:l,children:o})})}function as({children:t,className:n,style:r,...o}){const s=_.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 l=_.useTheme(),{activeIndex:a,setActiveIndex:c,baseId:f,tabCount:u}=Qn(),d=i.useRef(null),h=a===t;return e.jsx("button",{ref:d,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?l.primary:l.textMuted,fontWeight:h?600:400,borderBottom:h?`2px solid ${l.primary}`:"2px solid transparent",marginBottom:"-2px",...s},onClick:()=>!r&&c(t),onKeyDown:p=>_.handleTabsKeyboard(p,t,u,m=>{var y;c(m),(y=document.getElementById(`${f}-tab-${m}`))==null||y.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:l}=Qn();return s!==t?null:e.jsx("div",{role:"tabpanel",id:`${l}-panel-${t}`,"aria-labelledby":`${l}-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=_.useTheme(),[l,a]=i.useState(!1),c=i.useRef(null),f=i.useId(),u=i.useRef(null),d=J.useReducedMotion(),h=A.sanitizeString(t),p=_.getAccessibleForeground(s.surfaceAlt,[s.text,"#ffffff","#000000"]);function m(){u.current=setTimeout(()=>a(!0),o)}function y(){u.current&&clearTimeout(u.current),a(!1)}J.useEscapeKey(y,l),J.useClickOutside(c,y);const k=i.cloneElement(n,{"aria-describedby":l?f:void 0,onMouseEnter:b=>{var g,M;(M=(g=n.props).onMouseEnter)==null||M.call(g,b),m()},onMouseLeave:b=>{var g,M;(M=(g=n.props).onMouseLeave)==null||M.call(g,b),y()},onFocus:b=>{var g,M;(M=(g=n.props).onFocus)==null||M.call(g,b),m()},onBlur:b=>{var g,M;(M=(g=n.props).onBlur)==null||M.call(g,b),y()}});return e.jsxs("span",{ref:c,className:x.tkx("relative inline-flex"),children:[k,l&&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",!d&&"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:l}){const a=n!==void 0?typeof n=="number"?`${n}px`:n:"100%",f=r!==void 0?typeof r=="number"?`${r}px`:r:{text:"1em",circular:a,rectangular:"80px"}[t],u=x.tkx(t==="circular"?"rounded-full":t==="text"?"rounded":"rounded-lg"),d=o==="pulse"?x.tkx("animate-pulse"):o==="wave"?x.tkx("animate-shimmer"):"",h=o==="wave"?{background:`linear-gradient(90deg,${s} 25%,${l} 50%,${s} 75%)`,backgroundSize:"200% 100%"}:{backgroundColor:s};return e.jsx("div",{className:x.cx(u,d),style:{width:a,height:f,...h}})}const xt=i.forwardRef(({variant:t="rectangular",width:n,height:r,lines:o,animation:s="pulse",className:l,style:a,...c},f)=>{const u=_.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"),l),style:a,...c,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:l,style:a,...c,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:l,className:a,style:c,...f},u)=>{const d=_.useTheme(),[h,p]=i.useState(!1),m=ps[o],y=s==="circle",k=d.surfaceAlt,b=_.getAccessibleForeground(k,[d.text,d.textMuted]),g=t&&!h,M=!g&&r,j=Math.max(8,m*.22),w=x.tkx("relative inline-flex shrink-0",y?"rounded-full":"rounded-lg"),I=x.tkx("block object-cover",y?"rounded-full":"rounded-lg"),v=x.tkx("flex items-center justify-center font-semibold font-sans select-none",y?"rounded-full":"rounded-lg");return e.jsxs("div",{ref:u,className:x.cx(w,a),style:{width:m,height:m,...c},...f,children:[g?e.jsx("img",{src:A.sanitizeString(t),alt:A.sanitizeString(n),onError:()=>p(!0),className:I,style:{width:m,height:m}}):e.jsx("div",{role:"img","aria-label":A.sanitizeString(n),className:v,style:{width:m,height:m,backgroundColor:k,color:b,fontSize:m*.38},children:M?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"})]})}),l&&e.jsx("span",{"aria-label":`Status: ${l}`,className:x.tkx("absolute bottom-0 right-0 rounded-full"),style:{width:j,height:j,backgroundColor:hs[l],border:`2px solid ${d.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:l,emptyState:a,style:c,className:f,striped:u,maxHeight:d,rowHeight:h=44,virtualScroll:p,onLoadMore:m,hasMore:y,loadingMore:k=!1,onRowClick:b,selectedRows:g,bordered:M,compact:j}){const w=_.useTheme(),[I,v]=i.useState(null),[N,$]=i.useState("asc"),S=i.useMemo(()=>!I||!o?n:[...n].sort((te,ce)=>{const Y=te[I],se=ce[I];let le=0;return typeof Y=="string"&&typeof se=="string"?le=Y.localeCompare(se):typeof Y=="number"&&typeof se=="number"&&(le=Y-se),N==="asc"?le:-le}),[n,I,N,o]),T=i.useCallback(te=>{I===te?$(ce=>ce==="asc"?"desc":"asc"):(v(te),$("asc"))},[I]);function E(te){return I!==te?"none":N}const C=5,H=p!==void 0?p:d!==void 0&&S.length>=50,z=i.useRef(null),[R,B]=i.useState(0),[V,D]=i.useState(400),O=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 L=H?Math.max(0,Math.floor(R/h)-C):0,P=H?Math.min(S.length,Math.ceil((R+V)/h)+C):S.length,W=H?S.slice(L,P):S,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&&y!==!1&&(ne.current=!0,m())},{root:z.current,rootMargin:"0px 0px 200px 0px",threshold:0});return ce.observe(te),()=>ce.disconnect()},[m,y]);const Z=j?"4px":"12px",ie=j?"8px":"16px",fe=M?`1px solid ${w.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 ${w.border}`,overflow:"hidden",...c},children:e.jsxs("div",{ref:z,onScroll:H?O:void 0,style:{overflowX:"auto",overflowY:d?"auto":"visible",maxHeight:d??"none"},children:[e.jsxs("table",{className:x.tkx("w-full font-sans text-sm"),style:{borderCollapse:"collapse",color:w.text},children:[r&&e.jsx("caption",{className:x.tkx("text-sm text-left p-2"),style:{color:w.textMuted},children:A.sanitizeString(r)}),e.jsx("thead",{style:s?{position:"sticky",top:0,backgroundColor:w.surfaceAlt,zIndex:1}:{backgroundColor:w.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:w.textMuted,borderBottom:`2px solid ${w.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:l?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)):S.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:x.tkx("text-center"),style:{padding:"32px 16px",color:w.textMuted},children:a??"No data available"})}):e.jsxs(e.Fragment,{children:[H&&L>0&&e.jsx("tr",{"aria-hidden":"true",style:{height:L*h},children:e.jsx("td",{colSpan:t.length,style:{padding:0,border:"none"}})}),W.map((te,ce)=>{const Y=L+ce,se=pe.has(Y);return e.jsx("tr",{"aria-rowindex":Y+1,"aria-selected":se||void 0,onClick:b?()=>b(te,Y):void 0,onKeyDown:b?le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),b(te,Y))}:void 0,tabIndex:b?0:void 0,className:x.tkx(b?"cursor-pointer":""),style:{backgroundColor:se?`${w.primary}22`:u&&Y%2===1?w.surfaceAlt:"transparent",borderBottom:`1px solid ${w.border}`,...H?{height:h,boxSizing:"border-box"}:{}},children:t.map(le=>{const ge=te[le.key],he=le.render?le.render(ge,te):typeof ge=="string"?A.sanitizeString(ge):String(ge??"");return e.jsx("td",{style:{padding:`${Z} ${ie}`,color:w.text,borderRight:fe},children:he},String(le.key))})},Y)}),H&&P<S.length&&e.jsx("tr",{"aria-hidden":"true",style:{height:(S.length-P)*h},children:e.jsx("td",{colSpan:t.length,style:{padding:0,border:"none"}})})]})})]}),(y||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))})})}),!y&&m&&e.jsx("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:w.textMuted},children:"✓ All rows loaded"})]})})}const er=i.forwardRef(({orientation:t="horizontal",label:n,variant:r="solid",className:o,style:s,...l},a)=>{const c=_.useTheme(),f=n?A.sanitizeString(n):void 0,u=t==="vertical",d=u?"borderLeft":"borderTop",h=`1px ${r} ${c.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:c.textMuted,...s},...l,children:[e.jsx("hr",{className:x.tkx("flex-1 m-0 border-none"),style:{[d]:h}}),e.jsx("span",{children:f}),e.jsx("hr",{className:x.tkx("flex-1 m-0 border-none"),style:{[d]:h}})]}):e.jsx("hr",{ref:a,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:{[d]:h,...s},...l})});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,l=o-r.bottom-s,a=r.top-s,c=l>=Math.min(n,200)||l>=a?"below":"above";return{top:c==="below"?r.bottom+window.scrollY+s:r.top+window.scrollY-s-Math.min(n,280),left:r.left+window.scrollX,width:r.width,placement:c}}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:l=!1,isInvalid:a=!1,label:c,hint:f,errorMessage:u,multiple:d=!1,searchable:h=!1,clearable:p=!1,isLoading:m=!1,onChange:y,renderOption:k,maxMenuHeight:b=280,virtualScroll:g,optionHeight:M=36,id:j,className:w,style:I}){const v=_.useTheme(),N=i.useId(),$=j??N,S=`${$}-listbox`,T=`${$}-hint`,E=`${$}-error`,C=n!==void 0,[H,z]=i.useState(Qt(r)),R=C?Qt(n):H,[B,V]=i.useState(!1),[D,O]=i.useState(""),[L,P]=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=a||!!u,le=i.useRef(null),[ge,he]=i.useState(0),[ye,de]=i.useState(0),xe=i.useCallback(()=>{le.current&&he(le.current.scrollTop)},[]);i.useEffect(()=>{if(!B){he(0);return}const F=le.current;if(!F)return;de(F.clientHeight);const Q=new ResizeObserver(()=>{de(F.clientHeight)});return Q.observe(F),()=>Q.disconnect()},[B]);const oe=h&&D?t.filter(F=>F.label.toLowerCase().includes(D.toLowerCase())):t,G=oe.filter(F=>!F.disabled),ue=oe.some(F=>!!F.group),ve=(g!==void 0?g:oe.length>=100)&&!ue,Me=8,$e=oe.length*M,We=ve?Math.max(0,Math.floor(ge/M)-Me):0,Te=ve?Math.min(oe.length,Math.ceil((ge+ye)/M)+Me):oe.length,ze=ve?oe.slice(We,Te):oe,Ke=We*M,Ze=oe.reduce((F,Q)=>{const re=Q.group??"";return F[re]||(F[re]=[]),F[re].push(Q),F},{}),Pe=i.useCallback(F=>{var re;let Q;d?Q=R.includes(F)?R.filter(ae=>ae!==F):[...R,F]:Q=[F],C||z(Q),y==null||y(d?Q:Q[0]??""),d||(V(!1),O(""),P(-1),(re=fe.current)==null||re.focus())},[C,d,y,R]),Oe=i.useCallback((F,Q)=>{Q.stopPropagation();const re=R.filter(ae=>ae!==F);C||z(re),y==null||y(d?re:re[0]??"")},[C,d,y,R]),Ge=i.useCallback(F=>{F.stopPropagation(),C||z([]),y==null||y(d?[]:"")},[C,d,y]),Ee=i.useCallback(()=>{!fe.current||!B||K(ys(fe.current,b))},[B,b]);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 F=Q=>{var ae,Ce;const re=Q.target;(ae=fe.current)!=null&&ae.contains(re)||(Ce=te.current)!=null&&Ce.contains(re)||(V(!1),O(""))};return document.addEventListener("pointerdown",F),()=>document.removeEventListener("pointerdown",F)},[B]),i.useEffect(()=>{B&&h&&setTimeout(()=>{var F;return(F=pe.current)==null?void 0:F.focus()},0)},[B,h]),i.useEffect(()=>{var F;if(!(!B||L<0))if(ve&&le.current){const Q=L*M,re=Q+M,ae=le.current;Q<ae.scrollTop?ae.scrollTop=Q:re>ae.scrollTop+ae.clientHeight&&(ae.scrollTop=re-ae.clientHeight)}else{const Q=(F=ce.current)==null?void 0:F.querySelector(`[data-idx="${L}"]`);Q==null||Q.scrollIntoView({block:"nearest"})}},[L,B,ve,M]);const qe=F=>{switch(F.key){case"Enter":case" ":F.preventDefault(),B?L>=0&&G[L]&&Pe(G[L].value):Re();break;case"Escape":F.preventDefault(),V(!1),O("");break;case"ArrowDown":F.preventDefault(),B?P(Q=>Math.min(Q+1,G.length-1)):Re();break;case"ArrowUp":F.preventDefault(),B?P(Q=>Math.max(Q-1,0)):Re();break;case"Home":F.preventDefault(),B&&P(0);break;case"End":F.preventDefault(),B&&P(G.length-1);break;default:F.key.length===1&&!F.ctrlKey&&!F.metaKey&&(B||Re(),Qe(F.key))}},rt=F=>{var Q;switch(F.key){case"Escape":F.preventDefault(),V(!1),O(""),(Q=fe.current)==null||Q.focus();break;case"ArrowDown":F.preventDefault(),P(re=>Math.min(re+1,G.length-1));break;case"ArrowUp":F.preventDefault(),P(re=>Math.max(re-1,0));break;case"Home":F.preventDefault(),P(0);break;case"End":F.preventDefault(),P(G.length-1);break;case"Enter":F.preventDefault(),L>=0&&G[L]&&Pe(G[L].value);break}};function Qe(F){ie.current&&clearTimeout(ie.current);const Q=ne+F.toLowerCase();Z(Q);const re=G.findIndex(ae=>ae.label.toLowerCase().startsWith(Q));re>=0&&P(re),ie.current=setTimeout(()=>Z(""),800)}function Re(){if(l||m)return;V(!0);const F=G.findIndex(Q=>R.includes(Q.value));P(F>=0?F:0)}const Fe=se?v.danger:B?v.primary:v.border,Ae=L>=0&&G[L]?`${$}-opt-${G[L].value}`:void 0,Je=[f&&T,se&&E].filter(Boolean).join(" ")||void 0,Ue=R.map(F=>t.find(Q=>Q.value===F)).filter(Boolean),lt=B&&W?Le.createPortal(e.jsxs("div",{ref:te,role:"listbox",id:S,"aria-label":c?A.sanitizeString(c):"Options","aria-multiselectable":d,style:{position:"absolute",top:W.top,left:W.left,width:W.width,zIndex:9999,backgroundColor:v.surface,border:`1.5px solid ${v.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:b,display:"flex",flexDirection:"column"},children:[h&&e.jsxs("div",{style:{padding:"8px 10px",borderBottom:`1px solid ${v.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:v.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:F=>{O(F.target.value),P(0)},onKeyDown:rt,placeholder:"Search…","aria-label":"Search options",style:{border:"none",outline:"none",background:"transparent",color:v.text,fontSize:Y.fontSize,fontFamily:"inherit",width:"100%"}})]}),e.jsx("div",{ref:F=>{ce.current=F,le.current=F},onScroll:ve?xe:void 0,style:{overflowY:"auto",flexGrow:1,maxHeight:b-(h?48:0)},children:ve?e.jsxs("div",{style:{height:$e,position:"relative"},children:[e.jsx("div",{style:{position:"absolute",top:Ke,left:0,right:0},children:ze.map(F=>{const Q=G.indexOf(F),re=Q===L,ae=R.includes(F.value),Ce=k?k(F,ae):e.jsxs("span",{style:{display:"flex",flexDirection:"column",flex:1,minWidth:0},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[F.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:F.icon}),e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(F.label)})]}),F.description&&e.jsx("span",{style:{fontSize:"12px",color:v.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(F.description)})]});return e.jsxs("div",{id:`${$}-opt-${F.value}`,"data-idx":Q>=0?Q:void 0,role:"option","aria-selected":ae,"aria-disabled":F.disabled||void 0,onClick:()=>!F.disabled&&Pe(F.value),onMouseEnter:()=>!F.disabled&&Q>=0&&P(Q),style:{height:M,boxSizing:"border-box",padding:`0 ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:F.disabled?v.textMuted:v.text,backgroundColor:re?`${v.primary}22`:ae?`${v.primary}12`:"transparent",cursor:F.disabled?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,transition:"background-color 80ms",opacity:F.disabled?.5:1,userSelect:"none",touchAction:"manipulation"},children:[Ce,ae&&!k&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})]},F.value)})}),oe.length===0&&e.jsx("div",{style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:v.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(([F,Q])=>e.jsxs("div",{children:[F&&e.jsx("div",{"aria-hidden":"true",style:{padding:"8px 12px 4px",fontSize:"11px",fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:v.textMuted,fontFamily:"inherit",position:"sticky",top:0,backgroundColor:v.surface,zIndex:1,borderBottom:`1px solid ${v.border}`},children:A.sanitizeString(F)}),Q.map(re=>{const ae=G.indexOf(re),Ce=ae===L,Ie=R.includes(re.value),we=k?k(re,Ie):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:v.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(re.description)})]});return e.jsxs("div",{id:`${$}-opt-${re.value}`,"data-idx":ae>=0?ae:void 0,role:"option","aria-selected":Ie,"aria-disabled":re.disabled||void 0,onClick:()=>!re.disabled&&Pe(re.value),onMouseEnter:()=>!re.disabled&&ae>=0&&P(ae),style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:re.disabled?v.textMuted:v.text,backgroundColor:Ce?`${v.primary}22`:Ie?`${v.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,Ie&&!k&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:v.primary,strokeWidth:"2.5","aria-hidden":"true",style:{flexShrink:0},children:e.jsx("path",{d:"M20 6L9 17l-5-5"})})]},re.value)})]},F)),oe.length===0&&e.jsx("div",{style:{padding:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",color:v.textMuted,textAlign:"center"},children:m?"Loading…":"No options found"})]})})]}),document.body):null,q=p&&R.length>0&&!l&&!m;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1 w-full"),w),style:I,children:[c&&e.jsx("label",{htmlFor:$,style:{fontSize:"14px",fontWeight:500,fontFamily:"inherit",color:v.text,userSelect:"none"},children:A.sanitizeString(c)}),e.jsx("div",{style:{position:"relative",width:"100%",opacity:l?.55:1},children:e.jsxs("button",{ref:fe,id:$,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":B,"aria-controls":S,"aria-activedescendant":Ae,"aria-invalid":se||void 0,"aria-describedby":Je,"aria-multiselectable":d,disabled:l,onClick:()=>B?V(!1):Re(),onKeyDown:qe,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:d&&R.length>0?`4px ${Y.px}`:`${Y.py} ${Y.px}`,fontSize:Y.fontSize,fontFamily:"inherit",backgroundColor:v.surface,color:R.length>0?v.text:v.textMuted,border:`1.5px solid ${Fe}`,borderRadius:8,boxSizing:"border-box",transition:"border-color 150ms",textAlign:"left",cursor:l?"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:d&&Ue.length>0?Ue.map(F=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:`${Y.tagPy} ${Y.tagPx}`,fontSize:`calc(${Y.fontSize} - 1px)`,fontFamily:"inherit",backgroundColor:`${v.primary}22`,color:v.primary,borderRadius:6,border:`1px solid ${v.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(F.label)}),e.jsx("span",{role:"button","aria-label":`Remove ${A.sanitizeString(F.label)}`,tabIndex:-1,onClick:Q=>Oe(F.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"})})})]},F.value)):!d&&R.length>0?(()=>{const F=t.find(Q=>Q.value===R[0]);return e.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:6},children:[(F==null?void 0:F.icon)&&e.jsx("span",{style:{flexShrink:0,display:"flex"},children:F.icon}),F?A.sanitizeString(F.label):""]})})():e.jsx("span",{style:{opacity:.6},children:A.sanitizeString(o)})}),e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0,color:v.textMuted},children:[m&&e.jsx(ks,{size:Y.iconSize,color:v.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:F=>F.currentTarget.style.opacity="1",onMouseLeave:F=>F.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:v.textMuted,fontFamily:"inherit"},children:A.sanitizeString(f)}),se&&u&&e.jsxs("span",{id:E,role:"alert",style:{fontSize:"12px",color:v.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)]}),lt]})}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:l="md",colorScheme:a="primary",checked:c,defaultChecked:f,onChange:u,disabled:d,className:h,style:p,id:m,...y},k)=>{const b=_.useTheme(),g=J.useReducedMotion(),M=i.useId(),j=m??M,w=`${j}-hint`,I=`${j}-error`,v=i.useRef(null),[N,$]=i.useState(!1),S=vs[l],T=r||!!o,C={primary:b.primary,success:b.success,danger:b.danger,warning:b.warning}[a]??b.primary,H=c!==void 0?c:void 0;i.useEffect(()=>{const P=(k==null?void 0:k.current)??v.current;P&&(P.indeterminate=s)},[s,k]);const z=s||(H??!1),R=z?C:b.surface,B=T?b.danger:z?C:b.border,V=_.getAccessibleForeground(C),D=N?{outline:`2px solid ${C}`,outlineOffset:"2px"}:{},O=[n&&w,T&&I].filter(Boolean).join(" ")||void 0,L=!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:d?.5:1,...p},children:[e.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:d?"not-allowed":"pointer",fontFamily:"inherit"},children:[e.jsx("input",{ref:P=>{v.current=P,typeof k=="function"?k(P):k&&(k.current=P)},id:j,type:"checkbox",checked:c,defaultChecked:f,onChange:u,disabled:d,"aria-invalid":T,"aria-describedby":O,onFocus:P=>{P.target.matches(":focus-visible")&&$(!0)},onBlur:()=>$(!1),className:x.tkx("sr-only"),...y}),e.jsx("span",{"aria-hidden":"true",style:{width:S.box,height:S.box,minWidth:S.box,borderRadius:"4px",border:`2px solid ${B}`,backgroundColor:R,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:S.box*.5,height:2,backgroundColor:V,borderRadius:"1px",...L}}):z?e.jsx("svg",{width:S.box*.6,height:S.box*.6,viewBox:"0 0 24 24",fill:"none",stroke:V,strokeWidth:S.iconStroke,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:L,children:e.jsx("path",{d:"M20 6L9 17l-5-5"})}):null}),t&&e.jsx("span",{style:{fontSize:S.fontSize,color:b.text,lineHeight:1.4},children:typeof t=="string"?A.sanitizeString(t):t})]}),n&&!T&&e.jsx("span",{id:w,className:x.tkx("text-xs ml-7"),style:{color:b.textMuted,marginLeft:S.box+8},children:A.sanitizeString(n)}),T&&o&&e.jsxs("span",{id:I,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:b.danger,marginLeft:S.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)]})]})});
|
|
6
|
+
`}),e.jsxs("label",{htmlFor:j,className:x.tkx("flex items-center gap-2 select-none"),style:{cursor:d?"not-allowed":"pointer",fontFamily:"inherit"},children:[e.jsx("input",{ref:P=>{v.current=P,typeof k=="function"?k(P):k&&(k.current=P)},id:j,type:"checkbox",checked:c,defaultChecked:f,onChange:u,disabled:d,"aria-invalid":T,"aria-describedby":O,onFocus:P=>{P.target.matches(":focus-visible")&&$(!0)},onBlur:()=>$(!1),className:x.tkx("sr-only"),...y}),e.jsx("span",{"aria-hidden":"true",style:{width:S.box,height:S.box,minWidth:S.box,borderRadius:"4px",border:`2px solid ${B}`,backgroundColor:R,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:S.box*.5,height:2,backgroundColor:V,borderRadius:"1px",...L}}):z?e.jsx("svg",{width:S.box*.6,height:S.box*.6,viewBox:"0 0 24 24",fill:"none",stroke:V,strokeWidth:S.iconStroke,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:L,children:e.jsx("path",{d:"M20 6L9 17l-5-5"})}):null}),t&&e.jsx("span",{style:{fontSize:S.fontSize,color:b.text,lineHeight:1.4},children:typeof t=="string"?A.sanitizeString(t):t})]}),n&&!T&&e.jsx("span",{id:w,className:x.tkx("text-xs ml-7"),style:{color:b.textMuted,marginLeft:S.box+8},children:A.sanitizeString(n)}),T&&o&&e.jsxs("span",{id:I,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:b.danger,marginLeft:S.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:l,onChange:a,disabled:c,name:f,className:u,style:d,id:h,...p},m)=>{const y=_.useTheme(),k=J.useReducedMotion(),b=i.useId(),g=h??b,M=ws(),j=M?M.value===String(s??""):l??!1,w=c??(M==null?void 0:M.isDisabled)??!1,I=f??(M==null?void 0:M.name)??"",v=()=>{w||(M?M.onChange(String(s??"")):a==null||a({target:{value:String(s??"")}}))},N=js[r],S={primary:y.primary,success:y.success,danger:y.danger}[o]??y.primary;_.getAccessibleForeground(S);const T=j?S:y.border,E=y.surface;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-0.5"),u),style:{opacity:w?.5:1,...d},children:[e.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:w?"not-allowed":"pointer",fontFamily:"inherit"},children:[e.jsx("input",{ref:m,id:g,type:"radio",name:I,value:s,checked:j,onChange:v,disabled:w,"aria-invalid":M==null?void 0:M.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:S,transform:"translate(-50%, -50%)",transformOrigin:"center",...k?{}:{animation:"tkx-radio-dot-in 130ms ease forwards"}}})}),t&&e.jsx("span",{style:{fontSize:N.fontSize,color:y.text,lineHeight:1.4},children:typeof t=="string"?A.sanitizeString(t):t})]}),n&&e.jsx("span",{className:x.tkx("text-xs"),style:{color:y.textMuted,marginLeft:N.outer+8},children:A.sanitizeString(n)})]})});
|
|
11
|
+
`}),e.jsxs("label",{htmlFor:g,className:x.tkx("flex items-center gap-2 select-none"),style:{cursor:w?"not-allowed":"pointer",fontFamily:"inherit"},children:[e.jsx("input",{ref:m,id:g,type:"radio",name:I,value:s,checked:j,onChange:v,disabled:w,"aria-invalid":M==null?void 0:M.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:S,transform:"translate(-50%, -50%)",transformOrigin:"center",...k?{}:{animation:"tkx-radio-dot-in 130ms ease forwards"}}})}),t&&e.jsx("span",{style:{fontSize:N.fontSize,color:y.text,lineHeight:1.4},children:typeof t=="string"?A.sanitizeString(t):t})]}),n&&e.jsx("span",{className:x.tkx("text-xs"),style:{color:y.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:l="vertical",isDisabled:a=!1,isInvalid:c=!1,errorMessage:f,children:u}){const d=_.useTheme(),p=`${i.useId()}-error`,[m,y]=i.useState(r),k=n!==void 0,b=k?n:m,g=j=>{k||y(j),o==null||o(j)},M=c||!!f;return e.jsx(rr.Provider,{value:{name:t,value:b,onChange:g,isDisabled:a,isInvalid:c},children:e.jsxs("div",{role:"radiogroup","aria-label":s?A.sanitizeString(s):void 0,"aria-describedby":M?p:void 0,"aria-invalid":M,children:[s&&e.jsx("div",{className:x.tkx("text-sm font-medium font-sans mb-2"),style:{color:d.text},children:A.sanitizeString(s)}),e.jsx("div",{className:x.tkx(l==="horizontal"?"flex flex-row flex-wrap gap-4":"flex flex-col gap-2"),children:u}),M&&f&&e.jsxs("span",{id:p,role:"alert",className:x.tkx("text-xs flex items-center gap-1 mt-1"),style:{color:d.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 Pt=new Set,yt=new Map;function Yt(){const t=[...Ve];Pt.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 $s={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"})})},Is={"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=_.useTheme(),l=i.useId(),a={default:s.textMuted,success:s.success,danger:s.danger,warning:s.warning,info:s.info},c=t.variant??"default",f=a[c],u=c==="danger",d=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":d?l: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:$s[c]}),e.jsxs("div",{className:x.tkx("flex-1 min-w-0"),children:[d&&e.jsx("p",{id:l,className:x.tkx("m-0 font-semibold text-sm leading-snug"),children:d}),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=d=>o([...d]);return Pt.add(u),()=>{Pt.delete(u)}},[]);const l=t.startsWith("bottom"),a=Is[t],c=i.useRef(!1);if(i.useEffect(()=>{if(!(c.current||typeof document>"u")&&(c.current=!0,!document.getElementById("tkx-toast-kf"))){const u=document.createElement("style");u.id="tkx-toast-kf",u.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=l?[...r].reverse():r;return e.jsxs(e.Fragment,{children:[n,Le.createPortal(e.jsx("div",{"aria-label":"Notifications",className:x.tkx("fixed z-[9999] flex flex-col gap-2 pointer-events-none"),style:a,children:f.map(u=>e.jsx("div",{className:x.tkx("pointer-events-auto"),children:e.jsx(zs,{toast:u,position:t,onDismiss:Yt,reduced:s})},u.id))}),document.body)]})}const Ns={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 Qt({open:t,reduced:n,iconStyle:r,size:o,color:s}){const l=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:l,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:l,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:l,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 l=i.useRef(null),a=i.useRef(null),c=i.useRef(t),f=i.useRef(!1);i.useEffect(()=>{const d=l.current;d&&(t?(d.style.height="auto",d.style.overflow="visible"):(d.style.height="0px",d.style.overflow="hidden"))},[]),i.useEffect(()=>{if(c.current===t)return;c.current=t;const d=l.current,h=a.current;if(!(!d||!h)){if(n){d.style.height=t?"auto":"0px",d.style.overflow=t?"visible":"hidden";return}if(f.current){const p=d.getBoundingClientRect().height;d.style.transition="none",d.style.height=`${p}px`,d.offsetHeight}f.current=!0,d.style.overflow="hidden",t?(d.style.height="0px",d.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{d.style.height=`${h.scrollHeight}px`})})):(d.style.height=`${h.scrollHeight}px`,d.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{d.style.height="0px"})}))}},[t,n]);const u=d=>{if(d.propertyName!=="height")return;f.current=!1;const h=l.current;h&&(t?(h.style.height="auto",h.style.overflow="visible"):h.style.overflow="hidden")};return e.jsx("div",{ref:l,id:o,role:"region","aria-labelledby":s,onTransitionEnd:u,style:{willChange:"height"},children:e.jsx("div",{ref:a,children:r})})}function ir({items:t,multiple:n=!1,defaultOpen:r,value:o,onChange:s,variant:l="default",size:a="md",iconPosition:c="right",iconStyle:f="chevron",flush:u=!1,className:d,style:h}){const p=_.useTheme(),m=Q.useReducedMotion(),y=i.useId(),k=o!==void 0,b=T=>T?Array.isArray(T)?new Set(T):new Set([T]):new Set,[g,M]=i.useState(()=>b(r)),j=k?b(o):g,w=i.useCallback((T,E)=>{if(E)return;let C;if(k){const z=b(o);C=new Set(z),C.has(T)?C.delete(T):(n||C.clear(),C.add(T))}else{M(z=>{C=new Set(z),C.has(T)?C.delete(T):(n||C.clear(),C.add(T));const R=[...C];return s==null||s(n?R:R[0]??""),C});return}const H=[...C];s==null||s(n?H:H[0]??"")},[n,s,k,o]),I=Ns[a],v=()=>{if(u)return{};switch(l){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(l){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{}}},$=T=>l==="ghost"||l==="flush"?T?`${p.primary}10`:`${p.surfaceAlt}80`:T?`${p.primary}0d`:`${p.surfaceAlt}60`,S=l==="separated";return e.jsx("div",{className:x.tkx(d??""),style:{...v(),display:S?"flex":void 0,flexDirection:S?"column":void 0,gap:S?"8px":void 0,...h},children:t.map((T,E)=>{const C=j.has(T.id),H=E===t.length-1,z=`${y}-trigger-${T.id}`,R=`${y}-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":R,disabled:T.disabled,onClick:()=>w(T.id,T.disabled),style:{width:"100%",display:"flex",alignItems:T.subtitle?"flex-start":"center",gap:"8px",padding:I.triggerPadding,border:"none",background:"transparent",cursor:T.disabled?"not-allowed":"pointer",textAlign:"left",fontFamily:"inherit",fontSize:I.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=$(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}),c==="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(Qt,{open:C,reduced:m,iconStyle:f,size:I.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:I.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}),c==="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(Qt,{open:C,reduced:m,iconStyle:f,size:I.iconSize,color:C?p.primary:p.textMuted})})]}),e.jsx(Ls,{isOpen:C,reduced:m,id:R,triggerId:z,children:e.jsx("div",{style:{padding:I.contentPadding,fontSize:I.fontSize,lineHeight:1.6,color:p.textMuted,fontFamily:"inherit"},children:T.content})})]},T.id)})})}ir.displayName="TkxAccordion";const Rs={sm:"280px",md:"380px",lg:"480px",xl:"600px",full:"100%"};let Ft=0;function As(){++Ft===1&&(document.body.style.overflow="hidden")}function Jt(){--Ft<=0&&(Ft=0,document.body.style.overflow="")}function Ds(t){switch(t){case"left":return"translateX(-100%)";case"right":return"translateX(100%)";case"top":return"translateY(-100%)";case"bottom":return"translateY(100%)"}}function Bs(t,n){const r=Rs[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 en(){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 Ws({isOpen:t,onClose:n,placement:r="right",size:o="md",title:s,children:l,footer:a,closeOnOverlayClick:c=!0,closeOnEsc:f=!0}){const u=_.useTheme(),d=Q.useReducedMotion(),h=i.useId(),p=Q.useFocusTrap(t);if(Q.useEscapeKey(n,f&&t),i.useEffect(()=>(t?As():Jt(),()=>{t&&Jt()}),[t]),typeof document>"u")return null;const m=Bs(r,o),y=Ds(r),k=d?"none":"transform 280ms cubic-bezier(0.4,0,0.2,1), opacity 280ms ease",b=typeof s=="string"?A.sanitizeString(s):s;return Le.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:c?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:d?"none":"opacity 280ms ease",cursor:c?"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)":y,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:b}),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(en,{})})]}),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(en,{})})}),e.jsx("div",{className:x.tkx("flex-1 overflow-y-auto px-5 py-4"),style:{color:u.text},children:l}),a&&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:a})]})]}),document.body)}const Ps=["Su","Mo","Tu","We","Th","Fr","Sa"],tn=["January","February","March","April","May","June","July","August","September","October","November","December"],Fs=["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 Hs(t,n,r){if(!n||!r)return!1;const o=Be(t).getTime(),s=Be(n).getTime(),l=Be(r).getTime(),a=Math.min(s,l),c=Math.max(s,l);return o>a&&o<c}function nn(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 Vs(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 l=new Date(s,r-1,o);return l.getMonth()!==r-1?null:l}function rn(t,n){return new Date(t,n+1,0).getDate()}function Os(t,n){const r=new Date(t,n,1).getDay(),o=rn(t,n),s=[],l=rn(t,n-1);for(let c=r-1;c>=0;c--)s.push(new Date(t,n-1,l-c));for(let c=1;c<=o;c++)s.push(new Date(t,n,c));let a=1;for(;s.length<42;)s.push(new Date(t,n+1,a++));return s}function It(t){return Math.floor(t/10)*10}function _s(){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 Ys(t,n){const r=t.getBoundingClientRect(),o=window.innerHeight,s=window.scrollY,l=window.scrollX,c=o-r.bottom<n+8&&r.top>n+8;return{top:c?s+r.top-n-4:s+r.bottom+4,left:l+r.left,flipUp:c}}function sn({values:t,selected:n,onSelect:r,label:o,theme:s,format:l}){const a=i.useRef([]),c=i.useRef(null);i.useEffect(()=>{const u=a.current[n];u&&c.current&&u.scrollIntoView({block:"nearest"})},[n]);const f=l??(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:c,style:{height:"160px",overflowY:"auto",width:"52px",scrollbarWidth:"thin",border:`1px solid ${s.border}`,borderRadius:"8px",padding:"4px"},children:t.map(u=>{const d=u===n;return e.jsx("button",{ref:h=>{a.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:d?600:400,backgroundColor:d?s.primary:"transparent",color:d?s.bg:s.text,fontFamily:"monospace",transition:"background-color 100ms ease"},children:f(u)},u)})})]})}function on({year:t,month:n,today:r,mode:o,selectedDate:s,selectedRange:l,multiDates:a,hoverDate:c,focusedDate:f,isDateDisabled:u,onSelectDate:d,onHoverDate:h,onSetFocused:p,theme:m,locale:y}){const k=Os(t,n);return e.jsxs("div",{children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},children:Ps.map(b=>e.jsx("div",{style:{textAlign:"center",fontSize:"11px",fontWeight:600,color:m.textMuted,padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:b},b))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},children:k.map((b,g)=>{const M=b.getMonth()===n,j=Ye(b,r),w=b.getDay()===0||b.getDay()===6,I=u(b),v=o==="single"&&s!=null&&Ye(b,s),N=o==="multiple"&&a.some(P=>Ye(P,b)),$=o==="range"&&nn(b,l[0],null),S=o==="range"&&nn(b,null,l[1]),T=$||S,E=o==="range"&&l[0]&&!l[1]&&c?c:l[1],C=o==="range"&&Hs(b,l[0],E),H=o==="range"&&l[0]&&!l[1]&&c&&Ye(b,c),z=v||N||T,R=f!=null&&Ye(b,f);let B="transparent",V=M?w?`${m.text}cc`:m.text:`${m.textMuted}60`,D="none",O=400;z||H?(B=m.primary,V=m.bg,O=600):C&&(B=`${m.primary}18`),j&&!z&&(D=`2px solid ${m.primary}`,O=600),I&&(V=`${m.textMuted}50`),R&&!z&&(D=`2px solid ${m.secondary}`);const L=b.toLocaleDateString(y,{weekday:"long",year:"numeric",month:"long",day:"numeric"});return e.jsx("button",{type:"button","aria-label":L,"aria-pressed":z,"aria-disabled":I,disabled:I,onClick:()=>!I&&d(b),onMouseEnter:()=>h(b),onMouseLeave:()=>h(null),onFocus:()=>p(b),style:{width:"34px",height:"34px",borderRadius:"8px",backgroundColor:B,color:V,border:D,fontSize:"13px",fontWeight:O,cursor:I?"not-allowed":"pointer",opacity:I?.35:1,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit",position:"relative",outline:"none",textDecoration:I?"line-through":"none",transition:"background-color 80ms ease"},children:b.getDate()},g)})})]})}function lr({value:t,onChange:n,rangeValue:r,onRangeChange:o,multiValue:s,onMultiChange:l,mode:a="single",minDate:c,maxDate:f,disabledDates:u,locale:d="en-US",showTime:h=!1,timeValue:p,onTimeChange:m,showPresets:y=!1,customPresets:k,label:b,placeholder:g="MM/DD/YYYY",hint:M,isDisabled:j=!1,isInvalid:w=!1,errorMessage:I,numberOfMonths:v=1,id:N,className:$,style:S}){const T=_.useTheme(),E=i.useId(),C=N??E,H=Q.useReducedMotion(),z=Be(new Date),R=t!==void 0,[B,V]=i.useState(null),D=R?t??null:B,O=r!==void 0,[L,P]=i.useState([null,null]),W=O?r:L,K=s!==void 0,[ne,Z]=i.useState([]),ie=K?s:ne,[fe,pe]=i.useState("start"),te=a==="range"||a==="single"&&h,[ce,Y]=i.useState([null,null]),[se,le]=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,$e]=i.useState(!1),[We,Te]=i.useState(()=>{if(a==="single")return ot(D,d);if(a==="range"){const[X,ee]=W;if(X&&ee)return`${ot(X,d)} – ${ot(ee,d)}`}return""}),[ze,Ke]=i.useState(null),[Ze,Pe]=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),Re=y?420:h?480:360;i.useEffect(()=>{if(a==="single")Te(ot(D,d));else if(a==="range"){const[X,ee]=W;Te(X&&ee?`${ot(X,d)} – ${ot(ee,d)}`:X?ot(X,d):"")}else a==="multiple"&&Te(ie.length>0?`${ie.length} date${ie.length!==1?"s":""} selected`:"")},[D,W,ie,a,d]);const Fe=i.useCallback(()=>{qe.current&&Ge(Ys(qe.current,Re))},[Re]);i.useEffect(()=>{if(Me)return Fe(),window.addEventListener("scroll",Fe,!0),window.addEventListener("resize",Fe),()=>{window.removeEventListener("scroll",Fe,!0),window.removeEventListener("resize",Fe)}},[Me,Fe]),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)||$e(!1)};return document.addEventListener("pointerdown",X),()=>document.removeEventListener("pointerdown",X)},[Me]),i.useEffect(()=>{if(!Me)return;const X=ee=>{var me;ee.key==="Escape"&&($e(!1),(me=Qe.current)==null||me.focus())};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[Me]);const Ae=i.useCallback(X=>c&&Be(X)<Be(c)||f&&Be(X)>Be(f)?!0:u?typeof u=="function"?u(X):u.some(ee=>Ye(ee,X)):!1,[c,f,u]),Je=i.useCallback(X=>{if(!Ae(X)){if(a==="single")te?le(X):(R||V(X),n==null||n(X),Te(ot(X,d)),$e(!1));else if(a==="range")if(fe==="start"){const ee=[X,null];Y(ee),O||P(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"):(O||P(me),o==null||o(me),pe("start"),$e(!1))}else if(a==="multiple"){const me=ie.some(Se=>Ye(Se,X))?ie.filter(Se=>!Ye(Se,X)):[...ie,X];K||Z(me),l==null||l(me)}Ee()}},[a,Ae,R,O,K,n,o,l,fe,ce,W,ie,te,d]),Ue=i.useCallback(()=>{if(a==="single"){const X=se??D;R||V(X),n==null||n(X)}else a==="range"&&(O||P(ce),o==null||o(ce));$e(!1),pe("start")},[a,se,ce,D,R,O,n,o]),lt=i.useCallback(()=>{le(null),Y([null,null]),pe("start"),$e(!1)},[]),q=()=>{de===0?(xe(11),ye(X=>X-1)):xe(X=>X-1),G("day")},F=()=>{de===11?(xe(0),ye(X=>X+1)):xe(X=>X+1),G("day")},J=()=>ye(X=>X-1),re=()=>ye(X=>X+1),ae=()=>ye(X=>X-10),Ce=()=>ye(X=>X+10),Ie=X=>{if(Te(X),a==="single"){const ee=Vs(X);ee&&!Ae(ee)&&(R||V(ee),n==null||n(ee),ye(ee.getFullYear()),xe(ee.getMonth()))}},we=X=>{if(X.stopPropagation(),a==="single")R||V(null),n==null||n(null),Te("");else if(a==="range"){const ee=[null,null];O||P(ee),o==null||o(ee),Y(ee),Te(""),pe("start")}else a==="multiple"&&(K||Z([]),l==null||l([]),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??_s(),je=X=>{const[ee,me]=X.getValue(),Se=[ee,me];Y(Se),O||P(Se),o==null||o(Se),ye(ee.getFullYear()),xe(ee.getMonth()),pe("start"),te||$e(!1)},Ne=de===11?0:de+1,at=de===11?he+1:he,st=v>=2,pt=b?A.sanitizeString(b):void 0,ht=M?A.sanitizeString(M):void 0,mt=I?A.sanitizeString(I):void 0,wt=A.sanitizeString(g),jt=a==="single"&&D!=null||a==="range"&&(W[0]!=null||W[1]!=null)||a==="multiple"&&ie.length>0,et=a==="range"?te?ce:W:[null,null],Wr=w?T.danger:Me?T.primary:T.border,Pr=Array.from({length:24},(X,ee)=>ee),Fr=Array.from({length:60},(X,ee)=>ee),Hr=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&&y?"780px":st?"620px":y?"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:[y&&a==="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"?J():ae()},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:tn[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:[tn[Ne]," ",at]})]})]}),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:[It(he),"–",It(he)+9]})]}),e.jsx("button",{type:"button","aria-label":oe==="day"?"Next month":oe==="month"?"Next year":"Next decade",onClick:()=>{oe==="day"?F():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(on,{year:he,month:de,today:z,mode:a,selectedDate:D,selectedRange:et,multiDates:ie,hoverDate:Ze,focusedDate:ze,isDateDisabled:Ae,onSelectDate:Je,onHoverDate:Pe,onSetFocused:Ke,theme:T,locale:d}),st&&e.jsx(on,{year:at,month:Ne,today:z,mode:a,selectedDate:D,selectedRange:et,multiDates:ie,hoverDate:Ze,focusedDate:ze,isDateDisabled:Ae,onSelectDate:Je,onHoverDate:Pe,onSetFocused:Ke,theme:T,locale:d})]}),oe==="month"&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"6px"},children:Fs.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=It(he)-1+ee,Se=me===he,gt=me===z.getFullYear(),Ut=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:Ut?T.textMuted:T.text,fontFamily:"inherit",transition:"background-color 80ms ease",opacity:Ut?.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(sn,{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(sn,{values:Fr,selected:ve.m,onSelect:X=>{p||ke(ee=>({...ee,m:X})),m==null||m({...ve,m:X})},label:"Min",theme:T})]}),a==="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:lt,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:$,style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",position:"relative",...S},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 ${Wr}`,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":w,"aria-haspopup":"dialog","aria-expanded":Me,readOnly:a==="range"||a==="multiple",onChange:X=>Ie(X.target.value),onFocus:()=>{j||$e(!0)},style:{flex:1,backgroundColor:"transparent",border:"none",outline:"none",fontSize:"14px",padding:"9px 8px",color:T.text,cursor:a!=="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||$e(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&&!w&&e.jsx("span",{style:{fontSize:"12px",color:T.textMuted},children:ht}),w&&mt&&e.jsx("span",{role:"alert",style:{fontSize:"12px",color:T.danger},children:mt}),Me&&typeof document<"u"&&Le.createPortal(Hr,document.body)]})}lr.displayName="TkxDatePicker";const Ks={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:l,thumbSize:a,ariaLabel:c,tooltipMode:f,formatValue:u,orientation:d,onChange:h,onChangeEnd:p}){const[m,y]=i.useState(!1),[k,b]=i.useState(!1),[g,M]=i.useState(!1),j=S=>{s||(S.key==="ArrowRight"||S.key==="ArrowUp"?(S.preventDefault(),h(ut(Ht(t+o,n,o),n,r))):S.key==="ArrowLeft"||S.key==="ArrowDown"?(S.preventDefault(),h(ut(Ht(t-o,n,o),n,r))):S.key==="Home"?(S.preventDefault(),h(n)):S.key==="End"&&(S.preventDefault(),h(r)))},w=d==="vertical",I=tt(t,n,r),v=f==="always"||f==="hover"&&(g||k||m),N=w?{position:"absolute",bottom:`${I}%`,transform:"translateY(50%)",left:"50%",marginLeft:`-${a/2}px`,zIndex:2,cursor:s?"not-allowed":"grab"}:{position:"absolute",left:`${I}%`,transform:"translateX(-50%)",top:"50%",marginTop:`-${a/2}px`,zIndex:2,cursor:s?"not-allowed":"grab"},$=w?{position:"absolute",left:a+6,top:"50%",transform:"translateY(-50%)",backgroundColor:l,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"}:{position:"absolute",bottom:a+6,left:"50%",transform:"translateX(-50%)",backgroundColor:l,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"};return e.jsxs("div",{style:N,children:[v&&e.jsx("div",{style:$,children:u(t)}),e.jsx("div",{role:"slider",tabIndex:s?-1:0,"aria-label":c,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":t,"aria-disabled":s,"aria-orientation":d,onKeyDown:j,onFocus:()=>y(!0),onBlur:()=>y(!1),onPointerEnter:()=>M(!0),onPointerLeave:()=>M(!1),onPointerDown:S=>{s||(b(!0),S.target.setPointerCapture(S.pointerId))},onPointerUp:()=>{b(!1),p==null||p()},style:{width:a,height:a,borderRadius:"50%",backgroundColor:s?"#888":l,border:"3px solid #fff",boxShadow:m?`0 0 0 3px ${l}44`:"0 1px 4px rgba(0,0,0,0.3)",outline:"none",display:"block",transition:"box-shadow 150ms ease"}})]})}function ar({value:t,defaultValue:n=0,onChange:r,rangeValue:o,onRangeChange:s,min:l=0,max:a=100,step:c=1,isRange:f=!1,label:u,showValue:d=!1,showTicks:h=!1,tickCount:p=5,isDisabled:m=!1,colorScheme:y="primary",size:k="md",marks:b,orientation:g="horizontal",showTooltip:M=!1,formatValue:j,onChangeEnd:w,onRangeChangeEnd:I,gradient:v=!1}){const N=_.useTheme(),$=i.useId(),S=Q.useReducedMotion(),T=t!==void 0,[E,C]=i.useState(n),H=T?t:E,z=o!==void 0,[R,B]=i.useState([l,a]),V=z?o:R,D=i.useRef(null),O=i.useRef(H);O.current=H;const L=i.useRef(V);L.current=V;const P={primary:N.primary,success:N.success,danger:N.danger,warning:N.warning}[y],W=Ks[k],K=g==="vertical",ne=M===!0?"hover":M===!1?!1:M,Z=j??(de=>String(de)),ie=P+"66",fe=i.useCallback((de,xe)=>{const oe=D.current;if(!oe)return l;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*(a-l)+l;return ut(Ht(ke,l,c),l,a)},[l,a,c,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,l,V[1]),V[1]];z||B(xe),s==null||s(xe)},Y=de=>{const xe=[V[0],ut(de,V[0],a)];z||B(xe),s==null||s(xe)},se=f?tt(V[0],l,a):0,le=tt(f?V[1]:H,l,a),ge=h?Array.from({length:p},(de,xe)=>l+xe/(p-1)*(a-l)):[],he=u?A.sanitizeString(u):void 0,ye=S?"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||d)&&e.jsxs("div",{className:x.tkx("flex items-center justify-between"),children:[he&&e.jsx("label",{htmlFor:$,className:x.tkx("text-sm font-medium"),style:{color:N.text,fontSize:W.fontSize},children:he}),d&&!f&&e.jsx("span",{className:x.tkx("text-sm tabular-nums"),style:{color:N.textMuted,fontSize:W.fontSize},children:Z(H)}),d&&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:`${le-se}%`,width:"100%"}:{top:0,left:`${se}%`,width:`${le-se}%`,height:"100%"},borderRadius:9999,...m?{backgroundColor:N.textMuted}:v?{background:K?`linear-gradient(to top, ${ie}, ${P})`:`linear-gradient(to right, ${ie}, ${P})`}:{backgroundColor:P},transition:ye}}),ge.map((de,xe)=>e.jsx("div",{style:{position:"absolute",...K?{bottom:`${tt(de,l,a)}%`,left:"50%",transform:"translate(-50%, 50%)",height:3,width:W.track+4}:{left:`${tt(de,l,a)}%`,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:l,max:V[1],step:c,isDisabled:m,trackColor:P,trackHeight:W.track,thumbSize:W.thumb,ariaLabel:`${he??"Range"} start`,tooltipMode:ne,formatValue:Z,orientation:g,onChange:ce,onChangeEnd:I?()=>I(L.current):void 0}),e.jsx(zt,{value:V[1],min:V[0],max:a,step:c,isDisabled:m,trackColor:P,trackHeight:W.track,thumbSize:W.thumb,ariaLabel:`${he??"Range"} end`,tooltipMode:ne,formatValue:Z,orientation:g,onChange:Y,onChangeEnd:I?()=>I(L.current):void 0})]}):e.jsx(zt,{value:H,min:l,max:a,step:c,isDisabled:m,trackColor:P,trackHeight:W.track,thumbSize:W.thumb,ariaLabel:he??"Slider",tooltipMode:ne,formatValue:Z,orientation:g,onChange:te,onChangeEnd:w?()=>w(O.current):void 0})]}),b&&b.length>0&&e.jsx("div",{style:{position:K?"absolute":"relative",...K?{left:"100%",top:0,bottom:0,marginLeft:8}:{marginTop:8}},children:b.map((de,xe)=>e.jsx("div",{style:{position:"absolute",...K?{bottom:`${tt(de.value,l,a)}%`,transform:"translateY(50%)",left:0}:{left:`${tt(de.value,l,a)}%`,transform:"translateX(-50%)"},fontSize:"0.6875rem",color:N.textMuted,whiteSpace:"nowrap"},children:A.sanitizeString(de.label)},xe))})]}),h&&!b&&!K&&e.jsx("div",{style:{position:"relative",height:"1rem"},children:ge.map((de,xe)=>e.jsx("span",{style:{position:"absolute",left:`${tt(de,l,a)}%`,transform:"translateX(-50%)",fontSize:"0.6875rem",color:N.textMuted},children:Z(Math.round(de))},xe))})]})}ar.displayName="TkxSlider";const Us={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 Xs(t,n,r,o){if(n<=1)return[1];const s=(y,k)=>Array.from({length:Math.max(0,k-y+1)},(b,g)=>y+g),l=Math.max(t-r,1),a=Math.min(t+r,n);if(!o){const y=[];return l>1&&y.push("..."),y.push(...s(l,a)),a<n&&y.push("..."),y}const c=1,f=n,u=l>c+2,d=a<f-2,h=[];h.push(1),u?h.push("left-ellipsis"):h.push(...s(2,l-1)),h.push(...s(Math.max(l,2),Math.min(a,n-1))),d?h.push("right-ellipsis"):h.push(...s(a+1,n-1)),n>1&&h.push(n);const p=new Set,m=[];for(const y of h)typeof y=="number"?p.has(y)||(p.add(y),m.push(y)):m.push(y);return m}function cr({total:t,pageSize:n=10,page:r,defaultPage:o=1,onChange:s,siblingCount:l=1,showEdges:a=!0,showPageSize:c=!1,onPageSizeChange:f,pageSizeOptions:u=[10,25,50,100],size:d="md",variant:h="default"}){const p=_.useTheme(),m=i.useId(),y=r!==void 0,[k,b]=i.useState(o),g=y?r:k,[M,j]=i.useState(n),w=n,I=Math.max(1,Math.ceil(t/w)),v=z=>{const R=Math.min(Math.max(z,1),I);R!==g&&(y||b(R),s==null||s(R))},N=z=>{j(z),f==null||f(z),v(1)},$=Xs(g,I,l,a),S=Us[d],T=Math.min((g-1)*w+1,t),E=Math.min(g*w,t),C=(z,R)=>{const B={height:S.height,minWidth:S.minWidth,paddingLeft:S.px,paddingRight:S.px,fontSize:S.fontSize,borderRadius:"8px",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:R?"not-allowed":"pointer",border:"none",outline:"none",fontFamily:"inherit",transition:"background 120ms ease, color 120ms ease",opacity:R?.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:S.fontSize},children:A.sanitizeString(`Showing ${T}–${E} of ${t} items`)}),e.jsxs("div",{className:x.tkx("flex items-center gap-1 flex-wrap"),children:[a&&e.jsxs("button",{type:"button","aria-label":"First page",disabled:g===1,onClick:()=>v(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:()=>v(g-1),style:C(!1,g===1),children:e.jsx(H,{d:"15 18 9 12 15 6"})}),$.map((z,R)=>{if(typeof z=="string")return e.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:S.minWidth,height:S.height,fontSize:S.fontSize,color:p.textMuted,userSelect:"none"},children:"…"},`${z}-${R}`);const V=z,D=V===g;return e.jsx("button",{type:"button","aria-label":`Page ${V}`,"aria-current":D?"page":void 0,onClick:()=>v(V),style:C(D,!1),children:V},V)}),e.jsx("button",{type:"button","aria-label":"Next page",disabled:g===I,onClick:()=>v(g+1),style:C(!1,g===I),children:e.jsx(H,{d:"9 18 15 12 9 6"})}),a&&e.jsxs("button",{type:"button","aria-label":"Last page",disabled:g===I,onClick:()=>v(I),style:C(!1,g===I),children:[e.jsx(H,{d:"4 18 10 12 4 6"}),e.jsx(H,{d:"14 18 20 12 14 6"})]}),c&&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:S.fontSize,whiteSpace:"nowrap"},children:"Rows per page"}),e.jsx("select",{id:m,value:M,onChange:z=>N(Number(z.target.value)),style:{height:S.height,paddingLeft:S.px,paddingRight:S.px,fontSize:S.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))})]})]})]})}cr.displayName="TkxPagination";const Zs={"1/1":"100%","4/3":"75%","16/9":"56.25%","3/2":"66.666%","9/16":"177.777%"},Gs={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 Qs({src:t,alt:n,fallback:r,placeholder:o="skeleton",fit:s="cover",ratio:l="auto",radius:a="none",caption:c,lazy:f=!0,preview:u=!1,className:d,style:h,...p}){const m=_.useTheme(),y=Q.useReducedMotion(),[k,b]=i.useState(!1),[g,M]=i.useState(!1),[j,w]=i.useState(!1),I=i.useRef(null),v=A.sanitizeString(t),N=n?A.sanitizeString(n):"",$=c?A.sanitizeString(c):"",S=Gs[a];i.useEffect(()=>{var K;(K=I.current)!=null&&K.complete&&b(!0)},[]);const T=i.useCallback(()=>b(!0),[]),E=i.useCallback(()=>M(!0),[]),C=i.useCallback(()=>{u&&!g&&w(!0)},[u,g]),H=i.useCallback(()=>w(!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,R=z&&!y?{animation:"tkx-shimmer 1.5s ease-in-out infinite"}:{},B=g?null:e.jsx("img",{ref:I,src:v,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:S,opacity:k?1:0,transition:y?"none":"opacity 200ms ease",position:l==="auto"?void 0:"absolute",inset:l==="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:S,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:l==="auto"?void 0:"absolute",inset:l==="auto"?void 0:0,width:"100%",height:l==="auto"?"100%":void 0,minHeight:l==="auto"?"80px":void 0,borderRadius:S,backgroundColor:m.surfaceAlt,...R}}):null,O=l==="auto"?e.jsxs("div",{className:x.tkx("relative w-full"),style:{borderRadius:S},children:[D,B,V]}):e.jsxs("div",{className:x.tkx("relative w-full overflow-hidden"),style:{paddingBottom:Zs[l],borderRadius:S},children:[D,B,V]}),L=$?e.jsxs("figure",{className:x.tkx("m-0 p-0 flex flex-col gap-2"),style:{borderRadius:S},children:[O,e.jsx("figcaption",{className:x.tkx("text-sm text-center"),style:{color:m.textMuted},children:$})]}):O,P=e.jsx("div",{className:x.cx(x.tkx("inline-block w-full"),d),style:h,children:L}),W=j&&typeof document<"u"?Le.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:v,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:[P,W]})}function ln(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Js({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 eo=0;function to(){return`tkx-file-${++eo}`}function no({accept:t,multiple:n=!1,maxSize:r,maxFiles:o,onChange:s,onError:l,label:a="Upload files",hint:c,isDisabled:f=!1,preview:u=!0,dragDrop:d=!0,variant:h="dropzone"}){const p=_.useTheme(),m=Q.useReducedMotion(),y=i.useId(),k=i.useRef(null),[b,g]=i.useState(!1),[M,j]=i.useState([]);i.useEffect(()=>()=>{M.forEach(D=>{D.objectUrl&&URL.revokeObjectURL(D.objectUrl)})},[]);const w=i.useCallback(D=>{let O=0;const L=setInterval(()=>{O+=Math.floor(Math.random()*20)+10,O>=100&&(O=100,clearInterval(L)),j(P=>P.map(W=>W.id===D?{...W,progress:O}:W))},100)},[]),I=i.useCallback(D=>{if(r&&D.size>r)return`"${A.sanitizeString(D.name)}" exceeds max size of ${ln(r)}`;if(t&&!t.split(",").map(P=>P.trim()).some(P=>P.startsWith(".")?D.name.toLowerCase().endsWith(P.toLowerCase()):P.endsWith("/*")?D.type.startsWith(P.slice(0,-1)):D.type===P))return`"${A.sanitizeString(D.name)}" is not an accepted file type`},[t,r]),v=i.useCallback(D=>{const O=o?o-M.length:1/0;if(O<=0){l==null||l(`Maximum of ${o} file${o===1?"":"s"} allowed`);return}const P=D.slice(0,O).map(W=>{const K=I(W),ne=u&&W.type.startsWith("image/")&&!K?URL.createObjectURL(W):void 0;return{file:W,id:to(),objectUrl:ne,progress:0,error:K}});j(W=>{const K=n?[...W,...P]:P,ne=K.filter(Z=>!Z.error).map(Z=>Z.file);return s==null||s(ne),K}),P.forEach(W=>{W.error&&(l==null||l(W.error))}),P.forEach(W=>{W.error||w(W.id)})},[M.length,o,n,s,l,u,w,I]),N=i.useCallback(D=>{const O=Array.from(D.target.files??[]);O.length&&v(O),D.target.value=""},[v]),$=i.useCallback(D=>{if(D.preventDefault(),g(!1),f)return;const O=Array.from(D.dataTransfer.files);O.length&&v(O)},[f,v]),S=i.useCallback(D=>{D.preventDefault(),f||g(!0)},[f]),T=i.useCallback(()=>g(!1),[]),E=i.useCallback(D=>{j(O=>{const L=O.find(W=>W.id===D);L!=null&&L.objectUrl&&URL.revokeObjectURL(L.objectUrl);const P=O.filter(W=>W.id!==D);return s==null||s(P.filter(W=>!W.error).map(W=>W.file)),P})},[s]),C=i.useCallback(()=>{var D;f||(D=k.current)==null||D.click()},[f]),H=b?p.primary:p.border,z=A.sanitizeString(a),R=c?A.sanitizeString(c):"",B=e.jsxs("div",{role:"button",tabIndex:f?-1:0,"aria-label":z,"aria-describedby":c?y:void 0,"aria-disabled":f,onClick:C,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),C())},onDrop:d?$:void 0,onDragOver:d?S:void 0,onDragLeave:d?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:b?`${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:b?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:b?"Drop files here":z}),R&&e.jsx("p",{id:y,className:x.tkx("m-0 text-xs mt-1"),style:{color:p.textMuted},children:R})]})]}),V=e.jsxs("button",{type:"button",disabled:f,onClick:C,"aria-describedby":c?y: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,c&&e.jsx("span",{id:y,className:x.tkx("sr-only"),children:R})]});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,M.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:M.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(Js,{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 ro={sm:16,md:24,lg:32,xl:40};function so({size:t,filled:n,color:r,halfFilled:o,id:s}){const l=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&&l&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,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&&l?`url(#${l})`:n?r:"none",stroke:r,strokeWidth:1.5,strokeLinejoin:"round"})]})}function oo({size:t,filled:n,color:r,halfFilled:o,id:s}){const l=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&&l&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,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&&l?`url(#${l})`:n?r:"none",stroke:r,strokeWidth:1.5,strokeLinejoin:"round"})]})}function io({size:t,filled:n,color:r,halfFilled:o,id:s}){const l=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&&l&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,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&&l?`url(#${l})`:n?r:"none",stroke:r,strokeWidth:1.5})]})}function lo({type:t,size:n,filled:r,color:o,halfFilled:s,uid:l}){const a={size:n,filled:r,color:o,halfFilled:s,id:l};return t==="heart"?e.jsx(oo,{...a}):t==="circle"?e.jsx(io,{...a}):e.jsx(so,{...a})}function an(t,n,r){return Math.min(r,Math.max(n,t))}function ao(t,n){return n===1?Math.round(t):Math.round(t*2)/2}function cn(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 co({value:t,defaultValue:n=0,onChange:r,max:o=5,precision:s=1,size:l="md",isReadOnly:a=!1,isDisabled:c=!1,label:f,showValue:u=!1,colorScheme:d="warning",emptyIcon:h="star",filledIcon:p="star"}){const m=_.useTheme(),y=Q.useReducedMotion(),k=i.useId(),b=t!==void 0,[g,M]=i.useState(n),[j,w]=i.useState(null),I=i.useRef(null),v=b?t??0:g,N=j??v,S={warning:m.warning,primary:m.primary,danger:m.danger}[d]??m.warning,T=ro[l],E=!a&&!c,C=i.useCallback(D=>{b||M(D),r==null||r(D)},[b,r]),H=i.useCallback((D,O)=>{E&&w(cn(D,O,s))},[E,s]),z=i.useCallback(()=>{E&&w(null)},[E]),R=i.useCallback((D,O)=>{if(!E)return;const L=cn(D,O,s);C(L===v?0:L)},[E,s,v,C]),B=i.useCallback(D=>{if(!E)return;const O=s;let L=v;if(D.key==="ArrowRight"||D.key==="ArrowUp")D.preventDefault(),L=an(v+O,0,o);else if(D.key==="ArrowLeft"||D.key==="ArrowDown")D.preventDefault(),L=an(v-O,0,o);else if(D.key==="Home")D.preventDefault(),L=0;else if(D.key==="End")D.preventDefault(),L=o;else return;L=ao(L,s),C(L)},[E,v,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"),c?x.tkx("opacity-50"):""),children:[e.jsx("div",{ref:I,role:"radiogroup","aria-label":V,"aria-disabled":c,"aria-readonly":a,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,O)=>{const L=O+1,P=O+.5,W=N>=L,K=!W&&s===.5&&N>=P,ne=`${k}-${O}`;return e.jsx("span",{role:"radio","aria-checked":s===.5&&v===P||v===L,"aria-label":s===.5?`${P} star${P!==1?"s":""} / ${L} star${L!==1?"s":""}`:`${L} star${L!==1?"s":""}`,tabIndex:-1,onMouseMove:Z=>H(Z,O),onClick:Z=>R(Z,O),style:{display:"inline-flex",alignItems:"center",lineHeight:0,transition:y?"none":"transform 120ms ease",transform:j!==null&&N>=P&&E?"scale(1.15)":"scale(1)"},children:e.jsx(lo,{type:W||K?p:h,size:T,filled:W,halfFilled:K,color:W||K?S:m.border,uid:K?ne:void 0})},O)})}),u&&e.jsxs("span",{className:x.tkx("text-sm tabular-nums"),style:{color:m.textMuted},"aria-live":"polite","aria-atomic":"true",children:[v%1===0?v.toFixed(0):v.toFixed(1)," / ",o]})]})}let dn=!1;function uo(){if(dn||typeof document>"u")return;dn=!0;const t=document.createElement("style");t.textContent=`
|
|
20
|
+
`,document.head.appendChild(u)}},[]),typeof document>"u")return e.jsx(e.Fragment,{children:n});const f=l?[...r].reverse():r;return e.jsxs(e.Fragment,{children:[n,Le.createPortal(e.jsx("div",{"aria-label":"Notifications",className:x.tkx("fixed z-[9999] flex flex-col gap-2 pointer-events-none"),style:a,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 Ls={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 l=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:l,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:l,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:l,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 Rs({isOpen:t,reduced:n,children:r,id:o,triggerId:s}){const l=i.useRef(null),a=i.useRef(null),c=i.useRef(t),f=i.useRef(!1);i.useEffect(()=>{const d=l.current;d&&(t?(d.style.height="auto",d.style.overflow="visible"):(d.style.height="0px",d.style.overflow="hidden"))},[]),i.useEffect(()=>{if(c.current===t)return;c.current=t;const d=l.current,h=a.current;if(!(!d||!h)){if(n){d.style.height=t?"auto":"0px",d.style.overflow=t?"visible":"hidden";return}if(f.current){const p=d.getBoundingClientRect().height;d.style.transition="none",d.style.height=`${p}px`,d.offsetHeight}f.current=!0,d.style.overflow="hidden",t?(d.style.height="0px",d.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{d.style.height=`${h.scrollHeight}px`})})):(d.style.height=`${h.scrollHeight}px`,d.style.transition="height 280ms cubic-bezier(0.4, 0, 0.2, 1)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{d.style.height="0px"})}))}},[t,n]);const u=d=>{if(d.propertyName!=="height")return;f.current=!1;const h=l.current;h&&(t?(h.style.height="auto",h.style.overflow="visible"):h.style.overflow="hidden")};return e.jsx("div",{ref:l,id:o,role:"region","aria-labelledby":s,onTransitionEnd:u,style:{willChange:"height"},children:e.jsx("div",{ref:a,children:r})})}function lr({items:t,multiple:n=!1,defaultOpen:r,value:o,onChange:s,variant:l="default",size:a="md",iconPosition:c="right",iconStyle:f="chevron",flush:u=!1,className:d,style:h}){const p=_.useTheme(),m=J.useReducedMotion(),y=i.useId(),k=o!==void 0,b=T=>T?Array.isArray(T)?new Set(T):new Set([T]):new Set,[g,M]=i.useState(()=>b(r)),j=k?b(o):g,w=i.useCallback((T,E)=>{if(E)return;let C;if(k){const z=b(o);C=new Set(z),C.has(T)?C.delete(T):(n||C.clear(),C.add(T))}else{M(z=>{C=new Set(z),C.has(T)?C.delete(T):(n||C.clear(),C.add(T));const R=[...C];return s==null||s(n?R:R[0]??""),C});return}const H=[...C];s==null||s(n?H:H[0]??"")},[n,s,k,o]),I=Ls[a],v=()=>{if(u)return{};switch(l){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(l){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{}}},$=T=>l==="ghost"||l==="flush"?T?`${p.primary}10`:`${p.surfaceAlt}80`:T?`${p.primary}0d`:`${p.surfaceAlt}60`,S=l==="separated";return e.jsx("div",{className:x.tkx(d??""),style:{...v(),display:S?"flex":void 0,flexDirection:S?"column":void 0,gap:S?"8px":void 0,...h},children:t.map((T,E)=>{const C=j.has(T.id),H=E===t.length-1,z=`${y}-trigger-${T.id}`,R=`${y}-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":R,disabled:T.disabled,onClick:()=>w(T.id,T.disabled),style:{width:"100%",display:"flex",alignItems:T.subtitle?"flex-start":"center",gap:"8px",padding:I.triggerPadding,border:"none",background:"transparent",cursor:T.disabled?"not-allowed":"pointer",textAlign:"left",fontFamily:"inherit",fontSize:I.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=$(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}),c==="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:I.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:I.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}),c==="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:I.iconSize,color:C?p.primary:p.textMuted})})]}),e.jsx(Rs,{isOpen:C,reduced:m,id:R,triggerId:z,children:e.jsx("div",{style:{padding:I.contentPadding,fontSize:I.fontSize,lineHeight:1.6,color:p.textMuted,fontFamily:"inherit"},children:T.content})})]},T.id)})})}lr.displayName="TkxAccordion";const As={sm:"280px",md:"380px",lg:"480px",xl:"600px",full:"100%"};let Ft=0;function Ds(){++Ft===1&&(document.body.style.overflow="hidden")}function en(){--Ft<=0&&(Ft=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 Ps({isOpen:t,onClose:n,placement:r="right",size:o="md",title:s,children:l,footer:a,closeOnOverlayClick:c=!0,closeOnEsc:f=!0}){const u=_.useTheme(),d=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),y=Bs(r),k=d?"none":"transform 280ms cubic-bezier(0.4,0,0.2,1), opacity 280ms ease",b=typeof s=="string"?A.sanitizeString(s):s;return Le.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:c?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:d?"none":"opacity 280ms ease",cursor:c?"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)":y,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:b}),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:l}),a&&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:a})]})]}),document.body)}const Fs=["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(),l=Be(r).getTime(),a=Math.min(s,l),c=Math.max(s,l);return o>a&&o<c}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 l=new Date(s,r-1,o);return l.getMonth()!==r-1?null:l}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=[],l=sn(t,n-1);for(let c=r-1;c>=0;c--)s.push(new Date(t,n-1,l-c));for(let c=1;c<=o;c++)s.push(new Date(t,n,c));let a=1;for(;s.length<42;)s.push(new Date(t,n+1,a++));return s}function It(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,l=window.scrollX,c=o-r.bottom<n+8&&r.top>n+8;return{top:c?s+r.top-n-4:s+r.bottom+4,left:l+r.left,flipUp:c}}function on({values:t,selected:n,onSelect:r,label:o,theme:s,format:l}){const a=i.useRef([]),c=i.useRef(null);i.useEffect(()=>{const u=a.current[n];u&&c.current&&u.scrollIntoView({block:"nearest"})},[n]);const f=l??(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:c,style:{height:"160px",overflowY:"auto",width:"52px",scrollbarWidth:"thin",border:`1px solid ${s.border}`,borderRadius:"8px",padding:"4px"},children:t.map(u=>{const d=u===n;return e.jsx("button",{ref:h=>{a.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:d?600:400,backgroundColor:d?s.primary:"transparent",color:d?s.bg:s.text,fontFamily:"monospace",transition:"background-color 100ms ease"},children:f(u)},u)})})]})}function ln({year:t,month:n,today:r,mode:o,selectedDate:s,selectedRange:l,multiDates:a,hoverDate:c,focusedDate:f,isDateDisabled:u,onSelectDate:d,onHoverDate:h,onSetFocused:p,theme:m,locale:y}){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:Fs.map(b=>e.jsx("div",{style:{textAlign:"center",fontSize:"11px",fontWeight:600,color:m.textMuted,padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:b},b))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},children:k.map((b,g)=>{const M=b.getMonth()===n,j=Ye(b,r),w=b.getDay()===0||b.getDay()===6,I=u(b),v=o==="single"&&s!=null&&Ye(b,s),N=o==="multiple"&&a.some(P=>Ye(P,b)),$=o==="range"&&rn(b,l[0],null),S=o==="range"&&rn(b,null,l[1]),T=$||S,E=o==="range"&&l[0]&&!l[1]&&c?c:l[1],C=o==="range"&&Vs(b,l[0],E),H=o==="range"&&l[0]&&!l[1]&&c&&Ye(b,c),z=v||N||T,R=f!=null&&Ye(b,f);let B="transparent",V=M?w?`${m.text}cc`:m.text:`${m.textMuted}60`,D="none",O=400;z||H?(B=m.primary,V=m.bg,O=600):C&&(B=`${m.primary}18`),j&&!z&&(D=`2px solid ${m.primary}`,O=600),I&&(V=`${m.textMuted}50`),R&&!z&&(D=`2px solid ${m.secondary}`);const L=b.toLocaleDateString(y,{weekday:"long",year:"numeric",month:"long",day:"numeric"});return e.jsx("button",{type:"button","aria-label":L,"aria-pressed":z,"aria-disabled":I,disabled:I,onClick:()=>!I&&d(b),onMouseEnter:()=>h(b),onMouseLeave:()=>h(null),onFocus:()=>p(b),style:{width:"34px",height:"34px",borderRadius:"8px",backgroundColor:B,color:V,border:D,fontSize:"13px",fontWeight:O,cursor:I?"not-allowed":"pointer",opacity:I?.35:1,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit",position:"relative",outline:"none",textDecoration:I?"line-through":"none",transition:"background-color 80ms ease"},children:b.getDate()},g)})})]})}function ar({value:t,onChange:n,rangeValue:r,onRangeChange:o,multiValue:s,onMultiChange:l,mode:a="single",minDate:c,maxDate:f,disabledDates:u,locale:d="en-US",showTime:h=!1,timeValue:p,onTimeChange:m,showPresets:y=!1,customPresets:k,label:b,placeholder:g="MM/DD/YYYY",hint:M,isDisabled:j=!1,isInvalid:w=!1,errorMessage:I,numberOfMonths:v=1,id:N,className:$,style:S}){const T=_.useTheme(),E=i.useId(),C=N??E,H=J.useReducedMotion(),z=Be(new Date),R=t!==void 0,[B,V]=i.useState(null),D=R?t??null:B,O=r!==void 0,[L,P]=i.useState([null,null]),W=O?r:L,K=s!==void 0,[ne,Z]=i.useState([]),ie=K?s:ne,[fe,pe]=i.useState("start"),te=a==="range"||a==="single"&&h,[ce,Y]=i.useState([null,null]),[se,le]=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,$e]=i.useState(!1),[We,Te]=i.useState(()=>{if(a==="single")return ot(D,d);if(a==="range"){const[X,ee]=W;if(X&&ee)return`${ot(X,d)} – ${ot(ee,d)}`}return""}),[ze,Ke]=i.useState(null),[Ze,Pe]=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),Re=y?420:h?480:360;i.useEffect(()=>{if(a==="single")Te(ot(D,d));else if(a==="range"){const[X,ee]=W;Te(X&&ee?`${ot(X,d)} – ${ot(ee,d)}`:X?ot(X,d):"")}else a==="multiple"&&Te(ie.length>0?`${ie.length} date${ie.length!==1?"s":""} selected`:"")},[D,W,ie,a,d]);const Fe=i.useCallback(()=>{qe.current&&Ge(Ks(qe.current,Re))},[Re]);i.useEffect(()=>{if(Me)return Fe(),window.addEventListener("scroll",Fe,!0),window.addEventListener("resize",Fe),()=>{window.removeEventListener("scroll",Fe,!0),window.removeEventListener("resize",Fe)}},[Me,Fe]),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)||$e(!1)};return document.addEventListener("pointerdown",X),()=>document.removeEventListener("pointerdown",X)},[Me]),i.useEffect(()=>{if(!Me)return;const X=ee=>{var me;ee.key==="Escape"&&($e(!1),(me=Qe.current)==null||me.focus())};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[Me]);const Ae=i.useCallback(X=>c&&Be(X)<Be(c)||f&&Be(X)>Be(f)?!0:u?typeof u=="function"?u(X):u.some(ee=>Ye(ee,X)):!1,[c,f,u]),Je=i.useCallback(X=>{if(!Ae(X)){if(a==="single")te?le(X):(R||V(X),n==null||n(X),Te(ot(X,d)),$e(!1));else if(a==="range")if(fe==="start"){const ee=[X,null];Y(ee),O||P(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"):(O||P(me),o==null||o(me),pe("start"),$e(!1))}else if(a==="multiple"){const me=ie.some(Se=>Ye(Se,X))?ie.filter(Se=>!Ye(Se,X)):[...ie,X];K||Z(me),l==null||l(me)}Ee()}},[a,Ae,R,O,K,n,o,l,fe,ce,W,ie,te,d]),Ue=i.useCallback(()=>{if(a==="single"){const X=se??D;R||V(X),n==null||n(X)}else a==="range"&&(O||P(ce),o==null||o(ce));$e(!1),pe("start")},[a,se,ce,D,R,O,n,o]),lt=i.useCallback(()=>{le(null),Y([null,null]),pe("start"),$e(!1)},[]),q=()=>{de===0?(xe(11),ye(X=>X-1)):xe(X=>X-1),G("day")},F=()=>{de===11?(xe(0),ye(X=>X+1)):xe(X=>X+1),G("day")},Q=()=>ye(X=>X-1),re=()=>ye(X=>X+1),ae=()=>ye(X=>X-10),Ce=()=>ye(X=>X+10),Ie=X=>{if(Te(X),a==="single"){const ee=Os(X);ee&&!Ae(ee)&&(R||V(ee),n==null||n(ee),ye(ee.getFullYear()),xe(ee.getMonth()))}},we=X=>{if(X.stopPropagation(),a==="single")R||V(null),n==null||n(null),Te("");else if(a==="range"){const ee=[null,null];O||P(ee),o==null||o(ee),Y(ee),Te(""),pe("start")}else a==="multiple"&&(K||Z([]),l==null||l([]),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),O||P(Se),o==null||o(Se),ye(ee.getFullYear()),xe(ee.getMonth()),pe("start"),te||$e(!1)},Ne=de===11?0:de+1,at=de===11?he+1:he,st=v>=2,pt=b?A.sanitizeString(b):void 0,ht=M?A.sanitizeString(M):void 0,mt=I?A.sanitizeString(I):void 0,wt=A.sanitizeString(g),jt=a==="single"&&D!=null||a==="range"&&(W[0]!=null||W[1]!=null)||a==="multiple"&&ie.length>0,et=a==="range"?te?ce:W:[null,null],Pr=w?T.danger:Me?T.primary:T.border,Fr=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&&y?"780px":st?"620px":y?"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:[y&&a==="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():ae()},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]," ",at]})]})]}),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:[It(he),"–",It(he)+9]})]}),e.jsx("button",{type:"button","aria-label":oe==="day"?"Next month":oe==="month"?"Next year":"Next decade",onClick:()=>{oe==="day"?F():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(ln,{year:he,month:de,today:z,mode:a,selectedDate:D,selectedRange:et,multiDates:ie,hoverDate:Ze,focusedDate:ze,isDateDisabled:Ae,onSelectDate:Je,onHoverDate:Pe,onSetFocused:Ke,theme:T,locale:d}),st&&e.jsx(ln,{year:at,month:Ne,today:z,mode:a,selectedDate:D,selectedRange:et,multiDates:ie,hoverDate:Ze,focusedDate:ze,isDateDisabled:Ae,onSelectDate:Je,onHoverDate:Pe,onSetFocused:Ke,theme:T,locale:d})]}),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=It(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:Fr,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})]}),a==="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:lt,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:$,style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",position:"relative",...S},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 ${Pr}`,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":w,"aria-haspopup":"dialog","aria-expanded":Me,readOnly:a==="range"||a==="multiple",onChange:X=>Ie(X.target.value),onFocus:()=>{j||$e(!0)},style:{flex:1,backgroundColor:"transparent",border:"none",outline:"none",fontSize:"14px",padding:"9px 8px",color:T.text,cursor:a!=="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||$e(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&&!w&&e.jsx("span",{style:{fontSize:"12px",color:T.textMuted},children:ht}),w&&mt&&e.jsx("span",{role:"alert",style:{fontSize:"12px",color:T.danger},children:mt}),Me&&typeof document<"u"&&Le.createPortal(Vr,document.body)]})}ar.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:l,thumbSize:a,ariaLabel:c,tooltipMode:f,formatValue:u,orientation:d,onChange:h,onChangeEnd:p}){const[m,y]=i.useState(!1),[k,b]=i.useState(!1),[g,M]=i.useState(!1),j=S=>{s||(S.key==="ArrowRight"||S.key==="ArrowUp"?(S.preventDefault(),h(ut(Ht(t+o,n,o),n,r))):S.key==="ArrowLeft"||S.key==="ArrowDown"?(S.preventDefault(),h(ut(Ht(t-o,n,o),n,r))):S.key==="Home"?(S.preventDefault(),h(n)):S.key==="End"&&(S.preventDefault(),h(r)))},w=d==="vertical",I=tt(t,n,r),v=f==="always"||f==="hover"&&(g||k||m),N=w?{position:"absolute",bottom:`${I}%`,transform:"translateY(50%)",left:"50%",marginLeft:`-${a/2}px`,zIndex:2,cursor:s?"not-allowed":"grab"}:{position:"absolute",left:`${I}%`,transform:"translateX(-50%)",top:"50%",marginTop:`-${a/2}px`,zIndex:2,cursor:s?"not-allowed":"grab"},$=w?{position:"absolute",left:a+6,top:"50%",transform:"translateY(-50%)",backgroundColor:l,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"}:{position:"absolute",bottom:a+6,left:"50%",transform:"translateX(-50%)",backgroundColor:l,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"};return e.jsxs("div",{style:N,children:[v&&e.jsx("div",{style:$,children:u(t)}),e.jsx("div",{role:"slider",tabIndex:s?-1:0,"aria-label":c,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":t,"aria-disabled":s,"aria-orientation":d,onKeyDown:j,onFocus:()=>y(!0),onBlur:()=>y(!1),onPointerEnter:()=>M(!0),onPointerLeave:()=>M(!1),onPointerDown:S=>{s||(b(!0),S.target.setPointerCapture(S.pointerId))},onPointerUp:()=>{b(!1),p==null||p()},style:{width:a,height:a,borderRadius:"50%",backgroundColor:s?"#888":l,border:"3px solid #fff",boxShadow:m?`0 0 0 3px ${l}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:l=0,max:a=100,step:c=1,isRange:f=!1,label:u,showValue:d=!1,showTicks:h=!1,tickCount:p=5,isDisabled:m=!1,colorScheme:y="primary",size:k="md",marks:b,orientation:g="horizontal",showTooltip:M=!1,formatValue:j,onChangeEnd:w,onRangeChangeEnd:I,gradient:v=!1}){const N=_.useTheme(),$=i.useId(),S=J.useReducedMotion(),T=t!==void 0,[E,C]=i.useState(n),H=T?t:E,z=o!==void 0,[R,B]=i.useState([l,a]),V=z?o:R,D=i.useRef(null),O=i.useRef(H);O.current=H;const L=i.useRef(V);L.current=V;const P={primary:N.primary,success:N.success,danger:N.danger,warning:N.warning}[y],W=Us[k],K=g==="vertical",ne=M===!0?"hover":M===!1?!1:M,Z=j??(de=>String(de)),ie=P+"66",fe=i.useCallback((de,xe)=>{const oe=D.current;if(!oe)return l;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*(a-l)+l;return ut(Ht(ke,l,c),l,a)},[l,a,c,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,l,V[1]),V[1]];z||B(xe),s==null||s(xe)},Y=de=>{const xe=[V[0],ut(de,V[0],a)];z||B(xe),s==null||s(xe)},se=f?tt(V[0],l,a):0,le=tt(f?V[1]:H,l,a),ge=h?Array.from({length:p},(de,xe)=>l+xe/(p-1)*(a-l)):[],he=u?A.sanitizeString(u):void 0,ye=S?"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||d)&&e.jsxs("div",{className:x.tkx("flex items-center justify-between"),children:[he&&e.jsx("label",{htmlFor:$,className:x.tkx("text-sm font-medium"),style:{color:N.text,fontSize:W.fontSize},children:he}),d&&!f&&e.jsx("span",{className:x.tkx("text-sm tabular-nums"),style:{color:N.textMuted,fontSize:W.fontSize},children:Z(H)}),d&&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:`${le-se}%`,width:"100%"}:{top:0,left:`${se}%`,width:`${le-se}%`,height:"100%"},borderRadius:9999,...m?{backgroundColor:N.textMuted}:v?{background:K?`linear-gradient(to top, ${ie}, ${P})`:`linear-gradient(to right, ${ie}, ${P})`}:{backgroundColor:P},transition:ye}}),ge.map((de,xe)=>e.jsx("div",{style:{position:"absolute",...K?{bottom:`${tt(de,l,a)}%`,left:"50%",transform:"translate(-50%, 50%)",height:3,width:W.track+4}:{left:`${tt(de,l,a)}%`,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:l,max:V[1],step:c,isDisabled:m,trackColor:P,trackHeight:W.track,thumbSize:W.thumb,ariaLabel:`${he??"Range"} start`,tooltipMode:ne,formatValue:Z,orientation:g,onChange:ce,onChangeEnd:I?()=>I(L.current):void 0}),e.jsx(zt,{value:V[1],min:V[0],max:a,step:c,isDisabled:m,trackColor:P,trackHeight:W.track,thumbSize:W.thumb,ariaLabel:`${he??"Range"} end`,tooltipMode:ne,formatValue:Z,orientation:g,onChange:Y,onChangeEnd:I?()=>I(L.current):void 0})]}):e.jsx(zt,{value:H,min:l,max:a,step:c,isDisabled:m,trackColor:P,trackHeight:W.track,thumbSize:W.thumb,ariaLabel:he??"Slider",tooltipMode:ne,formatValue:Z,orientation:g,onChange:te,onChangeEnd:w?()=>w(O.current):void 0})]}),b&&b.length>0&&e.jsx("div",{style:{position:K?"absolute":"relative",...K?{left:"100%",top:0,bottom:0,marginLeft:8}:{marginTop:8}},children:b.map((de,xe)=>e.jsx("div",{style:{position:"absolute",...K?{bottom:`${tt(de.value,l,a)}%`,transform:"translateY(50%)",left:0}:{left:`${tt(de.value,l,a)}%`,transform:"translateX(-50%)"},fontSize:"0.6875rem",color:N.textMuted,whiteSpace:"nowrap"},children:A.sanitizeString(de.label)},xe))})]}),h&&!b&&!K&&e.jsx("div",{style:{position:"relative",height:"1rem"},children:ge.map((de,xe)=>e.jsx("span",{style:{position:"absolute",left:`${tt(de,l,a)}%`,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=(y,k)=>Array.from({length:Math.max(0,k-y+1)},(b,g)=>y+g),l=Math.max(t-r,1),a=Math.min(t+r,n);if(!o){const y=[];return l>1&&y.push("..."),y.push(...s(l,a)),a<n&&y.push("..."),y}const c=1,f=n,u=l>c+2,d=a<f-2,h=[];h.push(1),u?h.push("left-ellipsis"):h.push(...s(2,l-1)),h.push(...s(Math.max(l,2),Math.min(a,n-1))),d?h.push("right-ellipsis"):h.push(...s(a+1,n-1)),n>1&&h.push(n);const p=new Set,m=[];for(const y of h)typeof y=="number"?p.has(y)||(p.add(y),m.push(y)):m.push(y);return m}function dr({total:t,pageSize:n=10,page:r,defaultPage:o=1,onChange:s,siblingCount:l=1,showEdges:a=!0,showPageSize:c=!1,onPageSizeChange:f,pageSizeOptions:u=[10,25,50,100],size:d="md",variant:h="default"}){const p=_.useTheme(),m=i.useId(),y=r!==void 0,[k,b]=i.useState(o),g=y?r:k,[M,j]=i.useState(n),w=n,I=Math.max(1,Math.ceil(t/w)),v=z=>{const R=Math.min(Math.max(z,1),I);R!==g&&(y||b(R),s==null||s(R))},N=z=>{j(z),f==null||f(z),v(1)},$=Zs(g,I,l,a),S=Xs[d],T=Math.min((g-1)*w+1,t),E=Math.min(g*w,t),C=(z,R)=>{const B={height:S.height,minWidth:S.minWidth,paddingLeft:S.px,paddingRight:S.px,fontSize:S.fontSize,borderRadius:"8px",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:R?"not-allowed":"pointer",border:"none",outline:"none",fontFamily:"inherit",transition:"background 120ms ease, color 120ms ease",opacity:R?.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:S.fontSize},children:A.sanitizeString(`Showing ${T}–${E} of ${t} items`)}),e.jsxs("div",{className:x.tkx("flex items-center gap-1 flex-wrap"),children:[a&&e.jsxs("button",{type:"button","aria-label":"First page",disabled:g===1,onClick:()=>v(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:()=>v(g-1),style:C(!1,g===1),children:e.jsx(H,{d:"15 18 9 12 15 6"})}),$.map((z,R)=>{if(typeof z=="string")return e.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:S.minWidth,height:S.height,fontSize:S.fontSize,color:p.textMuted,userSelect:"none"},children:"…"},`${z}-${R}`);const V=z,D=V===g;return e.jsx("button",{type:"button","aria-label":`Page ${V}`,"aria-current":D?"page":void 0,onClick:()=>v(V),style:C(D,!1),children:V},V)}),e.jsx("button",{type:"button","aria-label":"Next page",disabled:g===I,onClick:()=>v(g+1),style:C(!1,g===I),children:e.jsx(H,{d:"9 18 15 12 9 6"})}),a&&e.jsxs("button",{type:"button","aria-label":"Last page",disabled:g===I,onClick:()=>v(I),style:C(!1,g===I),children:[e.jsx(H,{d:"4 18 10 12 4 6"}),e.jsx(H,{d:"14 18 20 12 14 6"})]}),c&&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:S.fontSize,whiteSpace:"nowrap"},children:"Rows per page"}),e.jsx("select",{id:m,value:M,onChange:z=>N(Number(z.target.value)),style:{height:S.height,paddingLeft:S.px,paddingRight:S.px,fontSize:S.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:l="auto",radius:a="none",caption:c,lazy:f=!0,preview:u=!1,className:d,style:h,...p}){const m=_.useTheme(),y=J.useReducedMotion(),[k,b]=i.useState(!1),[g,M]=i.useState(!1),[j,w]=i.useState(!1),I=i.useRef(null),v=A.sanitizeString(t),N=n?A.sanitizeString(n):"",$=c?A.sanitizeString(c):"",S=qs[a];i.useEffect(()=>{var K;(K=I.current)!=null&&K.complete&&b(!0)},[]);const T=i.useCallback(()=>b(!0),[]),E=i.useCallback(()=>M(!0),[]),C=i.useCallback(()=>{u&&!g&&w(!0)},[u,g]),H=i.useCallback(()=>w(!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,R=z&&!y?{animation:"tkx-shimmer 1.5s ease-in-out infinite"}:{},B=g?null:e.jsx("img",{ref:I,src:v,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:S,opacity:k?1:0,transition:y?"none":"opacity 200ms ease",position:l==="auto"?void 0:"absolute",inset:l==="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:S,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:l==="auto"?void 0:"absolute",inset:l==="auto"?void 0:0,width:"100%",height:l==="auto"?"100%":void 0,minHeight:l==="auto"?"80px":void 0,borderRadius:S,backgroundColor:m.surfaceAlt,...R}}):null,O=l==="auto"?e.jsxs("div",{className:x.tkx("relative w-full"),style:{borderRadius:S},children:[D,B,V]}):e.jsxs("div",{className:x.tkx("relative w-full overflow-hidden"),style:{paddingBottom:Gs[l],borderRadius:S},children:[D,B,V]}),L=$?e.jsxs("figure",{className:x.tkx("m-0 p-0 flex flex-col gap-2"),style:{borderRadius:S},children:[O,e.jsx("figcaption",{className:x.tkx("text-sm text-center"),style:{color:m.textMuted},children:$})]}):O,P=e.jsx("div",{className:x.cx(x.tkx("inline-block w-full"),d),style:h,children:L}),W=j&&typeof document<"u"?Le.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:v,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:[P,W]})}function an(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:l,label:a="Upload files",hint:c,isDisabled:f=!1,preview:u=!0,dragDrop:d=!0,variant:h="dropzone"}){const p=_.useTheme(),m=J.useReducedMotion(),y=i.useId(),k=i.useRef(null),[b,g]=i.useState(!1),[M,j]=i.useState([]);i.useEffect(()=>()=>{M.forEach(D=>{D.objectUrl&&URL.revokeObjectURL(D.objectUrl)})},[]);const w=i.useCallback(D=>{let O=0;const L=setInterval(()=>{O+=Math.floor(Math.random()*20)+10,O>=100&&(O=100,clearInterval(L)),j(P=>P.map(W=>W.id===D?{...W,progress:O}:W))},100)},[]),I=i.useCallback(D=>{if(r&&D.size>r)return`"${A.sanitizeString(D.name)}" exceeds max size of ${an(r)}`;if(t&&!t.split(",").map(P=>P.trim()).some(P=>P.startsWith(".")?D.name.toLowerCase().endsWith(P.toLowerCase()):P.endsWith("/*")?D.type.startsWith(P.slice(0,-1)):D.type===P))return`"${A.sanitizeString(D.name)}" is not an accepted file type`},[t,r]),v=i.useCallback(D=>{const O=o?o-M.length:1/0;if(O<=0){l==null||l(`Maximum of ${o} file${o===1?"":"s"} allowed`);return}const P=D.slice(0,O).map(W=>{const K=I(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,...P]:P,ne=K.filter(Z=>!Z.error).map(Z=>Z.file);return s==null||s(ne),K}),P.forEach(W=>{W.error&&(l==null||l(W.error))}),P.forEach(W=>{W.error||w(W.id)})},[M.length,o,n,s,l,u,w,I]),N=i.useCallback(D=>{const O=Array.from(D.target.files??[]);O.length&&v(O),D.target.value=""},[v]),$=i.useCallback(D=>{if(D.preventDefault(),g(!1),f)return;const O=Array.from(D.dataTransfer.files);O.length&&v(O)},[f,v]),S=i.useCallback(D=>{D.preventDefault(),f||g(!0)},[f]),T=i.useCallback(()=>g(!1),[]),E=i.useCallback(D=>{j(O=>{const L=O.find(W=>W.id===D);L!=null&&L.objectUrl&&URL.revokeObjectURL(L.objectUrl);const P=O.filter(W=>W.id!==D);return s==null||s(P.filter(W=>!W.error).map(W=>W.file)),P})},[s]),C=i.useCallback(()=>{var D;f||(D=k.current)==null||D.click()},[f]),H=b?p.primary:p.border,z=A.sanitizeString(a),R=c?A.sanitizeString(c):"",B=e.jsxs("div",{role:"button",tabIndex:f?-1:0,"aria-label":z,"aria-describedby":c?y:void 0,"aria-disabled":f,onClick:C,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),C())},onDrop:d?$:void 0,onDragOver:d?S:void 0,onDragLeave:d?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:b?`${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:b?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:b?"Drop files here":z}),R&&e.jsx("p",{id:y,className:x.tkx("m-0 text-xs mt-1"),style:{color:p.textMuted},children:R})]})]}),V=e.jsxs("button",{type:"button",disabled:f,onClick:C,"aria-describedby":c?y: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,c&&e.jsx("span",{id:y,className:x.tkx("sr-only"),children:R})]});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,M.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:M.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:[an(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 l=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&&l&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,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&&l?`url(#${l})`:n?r:"none",stroke:r,strokeWidth:1.5,strokeLinejoin:"round"})]})}function io({size:t,filled:n,color:r,halfFilled:o,id:s}){const l=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&&l&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,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&&l?`url(#${l})`:n?r:"none",stroke:r,strokeWidth:1.5,strokeLinejoin:"round"})]})}function lo({size:t,filled:n,color:r,halfFilled:o,id:s}){const l=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&&l&&e.jsx("defs",{children:e.jsxs("linearGradient",{id:l,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&&l?`url(#${l})`:n?r:"none",stroke:r,strokeWidth:1.5})]})}function ao({type:t,size:n,filled:r,color:o,halfFilled:s,uid:l}){const a={size:n,filled:r,color:o,halfFilled:s,id:l};return t==="heart"?e.jsx(io,{...a}):t==="circle"?e.jsx(lo,{...a}):e.jsx(oo,{...a})}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:l="md",isReadOnly:a=!1,isDisabled:c=!1,label:f,showValue:u=!1,colorScheme:d="warning",emptyIcon:h="star",filledIcon:p="star"}){const m=_.useTheme(),y=J.useReducedMotion(),k=i.useId(),b=t!==void 0,[g,M]=i.useState(n),[j,w]=i.useState(null),I=i.useRef(null),v=b?t??0:g,N=j??v,S={warning:m.warning,primary:m.primary,danger:m.danger}[d]??m.warning,T=so[l],E=!a&&!c,C=i.useCallback(D=>{b||M(D),r==null||r(D)},[b,r]),H=i.useCallback((D,O)=>{E&&w(dn(D,O,s))},[E,s]),z=i.useCallback(()=>{E&&w(null)},[E]),R=i.useCallback((D,O)=>{if(!E)return;const L=dn(D,O,s);C(L===v?0:L)},[E,s,v,C]),B=i.useCallback(D=>{if(!E)return;const O=s;let L=v;if(D.key==="ArrowRight"||D.key==="ArrowUp")D.preventDefault(),L=cn(v+O,0,o);else if(D.key==="ArrowLeft"||D.key==="ArrowDown")D.preventDefault(),L=cn(v-O,0,o);else if(D.key==="Home")D.preventDefault(),L=0;else if(D.key==="End")D.preventDefault(),L=o;else return;L=co(L,s),C(L)},[E,v,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"),c?x.tkx("opacity-50"):""),children:[e.jsx("div",{ref:I,role:"radiogroup","aria-label":V,"aria-disabled":c,"aria-readonly":a,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,O)=>{const L=O+1,P=O+.5,W=N>=L,K=!W&&s===.5&&N>=P,ne=`${k}-${O}`;return e.jsx("span",{role:"radio","aria-checked":s===.5&&v===P||v===L,"aria-label":s===.5?`${P} star${P!==1?"s":""} / ${L} star${L!==1?"s":""}`:`${L} star${L!==1?"s":""}`,tabIndex:-1,onMouseMove:Z=>H(Z,O),onClick:Z=>R(Z,O),style:{display:"inline-flex",alignItems:"center",lineHeight:0,transition:y?"none":"transform 120ms ease",transform:j!==null&&N>=P&&E?"scale(1.15)":"scale(1)"},children:e.jsx(ao,{type:W||K?p:h,size:T,filled:W,halfFilled:K,color:W||K?S:m.border,uid:K?ne:void 0})},O)})}),u&&e.jsxs("span",{className:x.tkx("text-sm tabular-nums"),style:{color:m.textMuted},"aria-live":"polite","aria-atomic":"true",children:[v%1===0?v.toFixed(0):v.toFixed(1)," / ",o]})]})}let un=!1;function fo(){if(un||typeof document>"u")return;un=!0;const t=document.createElement("style");t.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
|
|
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=_.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=_.useTheme(),l=J.useReducedMotion(),{role:a,content:c,timestamp:f,isStreaming:u,error:d}=t,h=A.sanitizeString(c),p=f?new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}).format(f):null;if(a==="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=a==="user",y=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 ${d?s.danger:s.border}`};return d&&(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:y}),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&&!l?"tkx-cursor":""),style:k,children:[h,d&&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:l=!1,avatarUser:a,avatarAssistant:c,height:f=480,inputPosition:u="bottom"}){const d=_.useTheme(),h=J.useReducedMotion(),[p,m]=i.useState(""),y=i.useRef(null),k=i.useRef(null);i.useEffect(()=>{fo()},[]),i.useEffect(()=>{const N=y.current;N&&N.scrollTo({top:N.scrollHeight,behavior:h?"auto":"smooth"})},[t,r,h]);const b=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(),b())},[b]),M=i.useCallback(N=>{const $=s?N.target.value.slice(0,s):N.target.value;m($);const S=k.current;if(S){S.style.height="auto";const E=24*4+24;S.style.height=`${Math.min(S.scrollHeight,E)}px`}},[s]),j=p.trim().length>0&&!r,w=typeof f=="number"?`${f}px`:f,I=u==="floating",v=e.jsxs("div",{className:x.tkx("flex flex-col gap-1 p-3"),style:I?{position:"absolute",bottom:12,left:12,right:12,borderRadius:16,backgroundColor:d.surface,border:`1px solid ${d.border}`,boxShadow:"0 4px 24px rgba(0,0,0,0.18)"}:{borderTop:`1px solid ${d.border}`,backgroundColor:d.surface},children:[e.jsxs("div",{className:x.tkx("flex items-end gap-2"),children:[e.jsx("textarea",{ref:k,rows:1,value:p,onChange:M,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:d.text,caretColor:d.primary,minHeight:32,maxHeight:120}}),e.jsx("button",{onClick:b,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:d.primary,color:d.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:d.textMuted},children:[p.length,"/",s]})]});return e.jsxs("div",{className:x.tkx("flex flex-col overflow-hidden rounded-2xl"),style:{height:w,backgroundColor:d.bg,border:`1px solid ${d.border}`,position:"relative"},children:[e.jsx("div",{ref:y,role:"log","aria-live":"polite","aria-label":"Chat messages",className:x.tkx("flex-1 overflow-y-auto p-4"),style:{paddingBottom:I?80:void 0},children:e.jsxs("div",{role:"list",children:[t.map(N=>e.jsx(fr,{message:N,showTimestamp:l,avatarUser:a,avatarAssistant:c},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,{})]})]})}),v]})}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=_.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:l=!1,clickable:a=!1,children:c,className:f,style:u,onClick:d,...h}){_.useTheme();const p=J.useReducedMotion(),m=ko(r,t),y=typeof c=="string"?A.sanitizeString(c):c,k=yo[n],b=x.tkx("inline-flex items-center font-medium rounded-full select-none",mo[n],go[n],bo[n],l?"opacity-50 cursor-not-allowed":a?"cursor-pointer":"cursor-default",a&&!p&&"transition-opacity duration-150");return e.jsxs("span",{role:a?"button":void 0,tabIndex:a&&!l?0:void 0,"aria-disabled":l||void 0,className:x.cx(b,f),style:{backgroundColor:m.bg,color:m.color,border:`1px solid ${m.border==="transparent"?"transparent":m.border}`,...u},onClick:l?void 0:d,onKeyDown:a&&!l&&d?g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),d(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:y}),o&&!l&&e.jsx("button",{type:"button","aria-label":`Remove ${typeof c=="string"?c:"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:l=!1,validate:a,colorScheme:c="primary",size:f="md",label:u,hint:d,isDisabled:h=!1}){const p=_.useTheme(),m=J.useReducedMotion(),[y,k]=i.useState(n),[b,g]=i.useState(""),[M,j]=i.useState(null),w=i.useRef(null),I=t!==void 0,v=I?t:y,N=i.useCallback(z=>{I||k(z),r==null||r(z)},[I,r]),$=i.useCallback(z=>{const R=z.trim();if(R){if(s!==void 0&&v.length>=s){j(`Maximum ${s} tags allowed`);return}if(!l&&v.includes(R)){j("Duplicate tags are not allowed");return}if(a){const B=a(R);if(B===!1){j("Invalid tag");return}if(typeof B=="string"){j(B);return}}j(null),N([...v,R]),g("")}},[v,s,l,a,N]),S=i.useCallback(z=>{const R=v.filter((B,V)=>V!==z);N(R),j(null)},[v,N]),T=i.useCallback(z=>{z.key==="Enter"||z.key===","?(z.preventDefault(),$(b)):z.key==="Backspace"&&b===""&&v.length>0&&S(v.length-1)},[b,v,$,S]),E=i.useCallback(z=>{const R=z.target.value;R.endsWith(",")?$(R.slice(0,-1)):(g(R),M&&j(null))},[$,M]),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=w.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 ${M?p.danger:p.border}`,opacity:h?.55:1,minHeight:f==="sm"?36:f==="lg"?48:40},onClick:()=>{var z;return!h&&((z=w.current)==null?void 0:z.focus())},children:[v.map((z,R)=>e.jsx(xr,{size:f,variant:"subtle",colorScheme:c,onRemove:h?void 0:()=>S(R),isDisabled:h,children:z},`${z}-${R}`)),(!s||v.length<s)&&!h&&e.jsx("input",{ref:w,type:"text",value:b,onChange:E,onKeyDown:T,placeholder:v.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"})]}),M&&e.jsx("p",{className:x.tkx("text-xs"),style:{color:p.danger},role:"alert",children:M}),d&&!M&&e.jsx("p",{className:x.tkx("text-xs"),style:{color:p.textMuted},children:A.sanitizeString(d)})]})}let fn=!1;function wo(){if(fn||typeof document>"u")return;fn=!0;const t=document.createElement("style");t.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
|
|
34
|
+
`,document.head.appendChild(t)}function jo(t="pending"){const n=_.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=_.useTheme(),s=J.useReducedMotion(),l=jo(t),a=t==="active";return e.jsx("div",{className:x.cx(x.tkx("relative flex items-center justify-center rounded-full shrink-0 z-10"),a&&!s?"tkx-pulse-dot":""),style:{width:r,height:r,backgroundColor:t==="pending"?o.surface:l,border:`2px solid ${l}`,color:t==="pending"?l: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"?l:o.bg,display:"block"}})})}function xn({style:t,color:n,animate:r}){return _.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=_.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=_.useTheme(),l=J.useReducedMotion(),a=i.useRef(!1);i.useEffect(()=>{wo(),a.current=!0},[]);const c=!l,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",y=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:y,animate:c}),e.jsx(Et,{status:m,icon:h.icon,size:24}),!k&&e.jsx(pn,{style:o,color:y,animate:c})]}),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",y=p===t.length-1,k=m==="completed"?s.success:s.border,b=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",b?"":"invisible"),children:b&&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}),!y&&e.jsx(xn,{style:o,color:k,animate:c})]}),e.jsx("div",{className:x.tkx("flex-1 flex flex-col items-start pl-4",b?"invisible":""),children:!b&&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}),!y&&e.jsx(xn,{style:o,color:k,animate:c})]}),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,l=window.innerHeight,a=6;let c=0,f=0,u="top left";switch(n){case"bottom-start":c=t.bottom+a,f=t.left,u="top left",c+o>l&&t.top-a-o>0&&(c=t.top-a-o,u="bottom left"),f+r>s&&(f=Math.max(0,s-r-8));break;case"bottom-end":c=t.bottom+a,f=t.right-r,u="top right",c+o>l&&t.top-a-o>0&&(c=t.top-a-o,u="bottom right"),f<0&&(f=8);break;case"top-start":c=t.top-a-o,f=t.left,u="bottom left",c<0&&(c=t.bottom+a,u="top left"),f+r>s&&(f=Math.max(0,s-r-8));break;case"top-end":c=t.top-a-o,f=t.right-r,u="bottom right",c<0&&(c=t.bottom+a,u="top right"),f<0&&(f=8);break;case"right-start":c=t.top,f=t.right+a,u="top left",f+r>s&&(f=t.left-a-r,u="top right"),c+o>l&&(c=Math.max(8,l-o-8));break;case"left-start":c=t.top,f=t.left-a-r,u="top right",f<0&&(f=t.right+a,u="top left"),c+o>l&&(c=Math.max(8,l-o-8));break}return{top:c+window.scrollY,left:f+window.scrollX,transformOrigin:u}}function Mo(t,n,r){const o=window.innerWidth,s=window.innerHeight,l=4;let a=t.right+l,c="top left";a+n>o&&(a=t.left-l-n,c="top right");let f=t.top;return f+r>s&&(f=Math.max(8,s-r-8)),{top:f+window.scrollY,left:a+window.scrollX,transformOrigin:c}}const To=`
|
|
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 To(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 Co({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 Io({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 zo(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 xr({items:t,pos:n,panelId:r,onClose:o,onCloseAll:s,isSubmenu:l=!1}){const a=_.useTheme(),[c,f]=i.useState(-1),[u,d]=i.useState(null),[h,p]=i.useState(null),m=i.useRef(null),[y,k]=i.useState(""),b=i.useRef(null),g=zo(t);i.useEffect(()=>{var $;($=m.current)==null||$.focus()},[]),i.useEffect(()=>{var S;if(c<0)return;const $=(S=m.current)==null?void 0:S.querySelector(`[data-midx="${c}"]`);$==null||$.scrollIntoView({block:"nearest"})},[c]);const M=i.useCallback($=>{var S,T,E,C,H,z;if($.kind==="action"){if($.item.disabled)return;(T=(S=$.item).onClick)==null||T.call(S),s()}else if($.kind==="check"){if($.item.disabled)return;(C=(E=$.item).onChange)==null||C.call(E,!$.item.checked)}else if($.kind==="radio"){if($.item.disabled)return;(z=(H=$.item).onChange)==null||z.call(H,$.item.options[$.optionIdx].value)}else if($.kind==="submenu"){if($.item.disabled)return;d($.item.id)}},[s]),j=$=>{var S;switch($.key){case"ArrowDown":$.preventDefault(),f(T=>{const E=T+1;return E<g.length?E:0});break;case"ArrowUp":$.preventDefault(),f(T=>{const E=T-1;return E>=0?E:g.length-1});break;case"Home":$.preventDefault(),f(0);break;case"End":$.preventDefault(),f(g.length-1);break;case"Enter":case" ":$.preventDefault(),c>=0&&g[c]&&M(g[c]);break;case"Escape":$.preventDefault(),l?o():s();break;case"Tab":$.preventDefault(),s();break;case"ArrowRight":$.preventDefault(),c>=0&&((S=g[c])==null?void 0:S.kind)==="submenu"&&d(g[c].item.id);break;case"ArrowLeft":$.preventDefault(),l&&o();break;default:$.key.length===1&&!$.ctrlKey&&!$.metaKey&&w($.key)}};function w($){b.current&&clearTimeout(b.current);const S=y+$.toLowerCase();k(S);const T=g.findIndex(E=>(E.kind==="radio"?E.item.options[E.optionIdx].label:E.item.label).toLowerCase().startsWith(S));T>=0&&f(T),b.current=setTimeout(()=>k(""),800)}function I($,S){const T=S.getBoundingClientRect();d($.id);const E=Math.min($.items.length*38+12,360);p(So(T,220,E))}function v(){d(null),p(null)}const N=()=>{let $=-1;return t.map(S=>{if(S.type==="separator")return e.jsx("div",{role:"separator",style:{margin:(S.label,"4px 0"),display:"flex",alignItems:"center",gap:8},children:S.label?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1,height:1,backgroundColor:a.border,marginLeft:14}}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:a.textMuted,fontFamily:"inherit",whiteSpace:"nowrap"},children:A.sanitizeString(S.label)}),e.jsx("div",{style:{flex:1,height:1,backgroundColor:a.border,marginRight:14}})]}):e.jsx("div",{style:{flex:1,height:1,backgroundColor:a.border,margin:"0 10px"}})},S.id);if(S.type==="radio-group")return e.jsxs("div",{role:"group","aria-label":S.label,children:[S.label&&e.jsx("div",{style:{padding:"6px 14px 2px",fontSize:"11px",fontWeight:700,letterSpacing:"0.07em",textTransform:"uppercase",color:a.textMuted,fontFamily:"inherit"},"aria-hidden":"true",children:A.sanitizeString(S.label)}),S.options.map((B,V)=>{$++;const D=$,O=D===c,L=B.value===S.value,P=!!S.disabled,W=St(a,O,!1,P);return e.jsxs("div",{role:"menuitemradio","aria-checked":L,"aria-disabled":P||void 0,"data-midx":D,tabIndex:-1,style:W,onClick:()=>{var K;return!P&&((K=S.onChange)==null?void 0:K.call(S,B.value))},onMouseEnter:()=>!P&&f(D),children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:L?e.jsx($o,{color:a.primary}):e.jsx("span",{style:{width:14,height:14,borderRadius:"50%",border:`2px solid ${a.border}`,display:"inline-block"}})}),B.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:a.textMuted},children:B.icon}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(B.label)})]},B.value)})]},S.id);if(S.type==="check"){$++;const B=$,V=B===c,D=!!S.disabled,O=St(a,V,!1,D);return e.jsxs("div",{role:"menuitemcheckbox","aria-checked":S.checked,"aria-disabled":D||void 0,"data-midx":B,tabIndex:-1,style:O,onClick:()=>{var L;return!D&&((L=S.onChange)==null?void 0:L.call(S,!S.checked))},onMouseEnter:()=>!D&&f(B),children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:S.checked?e.jsx(Co,{color:a.primary}):e.jsx("span",{style:{width:14,height:14,display:"inline-block"}})}),S.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:a.textMuted},children:S.icon}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(S.label)})]},S.id)}if(S.type==="submenu"){$++;const B=$,V=B===c,D=!!S.disabled,O=u===S.id,L=St(a,V||O,!1,D);return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("div",{role:"menuitem","aria-haspopup":"menu","aria-expanded":O,"aria-disabled":D||void 0,"data-midx":B,tabIndex:-1,style:L,onMouseEnter:P=>{D||(f(B),I(S,P.currentTarget))},onMouseLeave:()=>{},onClick:()=>{D||d(O?null:S.id)},children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:S.icon?e.jsx("span",{style:{display:"flex",color:a.textMuted},children:S.icon}):e.jsx("span",{style:{width:14}})}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(S.label)}),e.jsx(Io,{color:a.textMuted})]}),O&&h&&Le.createPortal(e.jsx(xr,{items:S.items,pos:h,panelId:`${r}-sub-${S.id}`,onClose:v,onCloseAll:s,isSubmenu:!0}),document.body)]},S.id)}const T=S;$++;const E=$,C=E===c,H=!!T.disabled,z=!!T.danger,R=St(a,C,z,H);return e.jsxs("div",{role:"menuitem","aria-disabled":H||void 0,"data-midx":E,tabIndex:-1,style:R,onClick:()=>{var B;H||((B=T.onClick)==null||B.call(T),s())},onMouseEnter:()=>{H||(f(E),v())},children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:T.icon?e.jsx("span",{style:{display:"flex",color:z?a.danger:a.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:a.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(T.description)})]}),T.shortcut&&e.jsx("span",{style:{fontSize:"12px",color:a.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:Mo}),e.jsx("div",{ref:m,id:r,role:"menu",tabIndex:-1,className:"tkx-menu-panel",onKeyDown:j,style:{...To(a,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 pr({trigger:t,items:n,placement:r="bottom-start",isDisabled:o=!1,onOpen:s,onClose:l,className:a,style:c}){const u=`tkx-menu-${i.useId().replace(/:/g,"")}`,[d,h]=i.useState(!1),[p,m]=i.useState(null),y=i.useRef(null),k=i.useCallback(()=>{if(o)return;const M=y.current;if(!M)return;const j=M.getBoundingClientRect(),w=Math.min(n.length*38+12,360);m(pn(j,r,220,w)),h(!0),s==null||s()},[o,n.length,s,r]),b=i.useCallback(()=>{var M,j,w;h(!1),l==null||l(),(w=(j=(M=y.current)==null?void 0:M.firstElementChild)==null?void 0:j.focus)==null||w.call(j)},[l]);i.useEffect(()=>{if(!d)return;const M=j=>{var v;const w=j.target;if((v=y.current)!=null&&v.contains(w))return;const I=document.querySelectorAll(".tkx-menu-panel");for(const N of I)if(N.contains(w))return;b()};return document.addEventListener("pointerdown",M),()=>document.removeEventListener("pointerdown",M)},[d,b]),i.useEffect(()=>{if(!d)return;const M=()=>{const j=y.current;if(!j)return;const w=j.getBoundingClientRect(),I=Math.min(n.length*38+12,360);m(pn(w,r,220,I))};return window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[d,n.length,r]);const g=M=>{(M.key==="Enter"||M.key===" "||M.key==="ArrowDown")&&(M.preventDefault(),d||k()),M.key==="Escape"&&d&&(M.preventDefault(),b())};return e.jsxs("span",{ref:y,className:a,style:{display:"inline-flex",...c},children:[e.jsx("span",{role:"button",tabIndex:o?-1:0,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?u:void 0,"aria-disabled":o||void 0,onClick:()=>d?b():k(),onKeyDown:g,style:{display:"inline-flex",cursor:o?"not-allowed":"pointer",opacity:o?.55:1,outline:"none"},children:t}),d&&p&&Le.createPortal(e.jsx(xr,{items:n,pos:p,panelId:u,onClose:b,onCloseAll:b}),document.body)]})}pr.displayName="TkxMenu";const Eo={sm:120,md:180,lg:240,xl:320};function Mt(t){const n=new Date;if(t)try{const a=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),c=b=>{var g;return((g=a.find(M=>M.type===b))==null?void 0:g.value)??"0"};let f=parseInt(c("hour"),10);f===24&&(f=0);const u=parseInt(c("minute"),10),d=parseInt(c("second"),10),h=c("weekday"),p=c("month"),m=c("day"),y=c("year"),k=`${h}, ${p} ${m}, ${y}`;return{hours:f,minutes:u,seconds:d,milliseconds:n.getMilliseconds(),dateString:k}}catch{}const r=n.getHours(),o=n.getMinutes(),s=n.getSeconds(),l=n.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"2-digit",year:"numeric"});return{hours:r,minutes:o,seconds:s,milliseconds:n.getMilliseconds(),dateString:l}}function No({time:t,size:n,analogStyle:r,showSeconds:o,reducedMotion:s,primary:l,danger:a,text:c,textMuted:f,border:u,surface:d,bg:h}){const p=n/2,m=n/2,y=n/2-4,{hours:k,minutes:b,seconds:g,milliseconds:M}=t,w=(g+(s?0:M)/1e3)/60*360,I=b/60*360+g/60*6,v=k%12/12*360+b/60*30,N=(z,R)=>{const B=(z-90)*Math.PI/180;return{x:p+Math.cos(B)*R,y:m+Math.sin(B)*R}},$=s?"none":"transform 0.15s cubic-bezier(0.4, 2.08, 0.55, 0.44)";if(r==="modern"){const z=(P,W)=>{const ne=-90+P*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=P>.5?1:0;return`M ${Z.x} ${Z.y} A ${W} ${W} 0 ${fe} 1 ${ie.x} ${ie.y}`},R=k%12/12+b/60/12,B=b/60+g/3600,V=(g+(s?0:M/1e3))/60,D=y-2,O=y-10,L=y-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:O,fill:"none",stroke:u,strokeWidth:4}),o&&e.jsx("circle",{cx:p,cy:m,r:L,fill:"none",stroke:u,strokeWidth:3}),e.jsx("path",{d:z(R,D),fill:"none",stroke:l,strokeWidth:4,strokeLinecap:"round"}),e.jsx("path",{d:z(B,O),fill:"none",stroke:c,strokeWidth:4,strokeLinecap:"round"}),o&&e.jsx("path",{d:z(V,L),fill:"none",stroke:a,strokeWidth:3,strokeLinecap:"round"}),e.jsx("circle",{cx:p,cy:m,r:4,fill:l}),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(b).padStart(2,"0")]})]})}const S=N(v,y*.5),T=N(I,y*.75),E=N(w,y*.85),C=N(w+180,y*.2),H=[];if(r==="classic"){for(let R=0;R<60;R++){const B=R/60*360,V=R%5===0,D=(B-90)*Math.PI/180,O=V?y-10:y-6,L=p+Math.cos(D)*y,P=m+Math.sin(D)*y,W=p+Math.cos(D)*O,K=m+Math.sin(D)*O;H.push(e.jsx("line",{x1:L,y1:P,x2:W,y2:K,stroke:V?c:f,strokeWidth:V?2:1,strokeLinecap:"round"},R))}const z=[{n:12,angle:0},{n:3,angle:90},{n:6,angle:180},{n:9,angle:270}];for(const{n:R,angle:B}of z){const V=(B-90)*Math.PI/180,D=y-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:c,fontFamily:"system-ui, sans-serif",fontWeight:"600",children:R},`n${R}`))}}else for(let z=0;z<12;z++){const B=(z/12*360-90)*Math.PI/180,V=y-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?c: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:y,fill:d,stroke:u,strokeWidth:2}),H,e.jsx("line",{x1:p,y1:m,x2:S.x,y2:S.y,stroke:l,strokeWidth:r==="minimal"?3:4,strokeLinecap:"round",style:{transformOrigin:`${p}px ${m}px`,transition:$}}),e.jsx("line",{x1:p,y1:m,x2:T.x,y2:T.y,stroke:c,strokeWidth:r==="minimal"?2:3,strokeLinecap:"round",style:{transformOrigin:`${p}px ${m}px`,transition:$}}),o&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:C.x,y1:C.y,x2:E.x,y2:E.y,stroke:a,strokeWidth:1.5,strokeLinecap:"round",style:{transformOrigin:`${p}px ${m}px`,transition:"none"}}),e.jsx("circle",{cx:p,cy:m,r:3,fill:a})]}),e.jsx("circle",{cx:p,cy:m,r:r==="minimal"?3:5,fill:l})]})}function hn({time:t,format:n,showSeconds:r,showDate:o,label:s,size:l,primary:a,text:c,textMuted:f,colonVisible:u}){const{hours:d,minutes:h,seconds:p,dateString:m}=t;let y=d,k="";n==="12h"&&(k=d>=12?"PM":"AM",y=d%12||12);const b=l*.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:b,color:a,fontWeight:700,letterSpacing:"0.05em",display:"flex",alignItems:"center",justifyContent:"center",gap:0},children:[e.jsx("span",{children:String(y).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:b*.45,color:f,marginLeft:"0.4ch",alignSelf:"flex-end",marginBottom:b*.05},children:k})]}),o&&e.jsx("div",{style:{fontSize:l*.072,color:f,marginTop:l*.025,letterSpacing:"0.03em"},children:m}),s&&e.jsx("div",{style:{fontSize:l*.065,color:f,marginTop:l*.015,textTransform:"uppercase",letterSpacing:"0.08em"},children:A.sanitizeString(s)})]})}function hr({variant:t="both",size:n="md",showSeconds:r=!0,showDate:o=!1,format:s="24h",timezone:l,timezone2:a,label:c,analogStyle:f="classic",className:u,style:d}){const h=_.useTheme(),p=Q.useReducedMotion(),[m,y]=i.useState(()=>Mt(l)),[k,b]=i.useState(()=>a?Mt(a):null),[g,M]=i.useState(!0),[j,w]=i.useState(!1),I=i.useRef(null);i.useEffect(()=>{w(!0)},[]),i.useEffect(()=>{const T=()=>{y(Mt(l)),a&&b(Mt(a))};T();const E=setInterval(T,1e3);return()=>clearInterval(E)},[l,a]),i.useEffect(()=>(I.current=setInterval(()=>{M(T=>!T)},500),()=>{I.current&&clearInterval(I.current)}),[]);const v=Eo[n],N=t==="analog"||t==="both",$=t==="digital"||t==="both",S={display:"inline-flex",flexDirection:"column",alignItems:"center",gap:t==="both"?`${v*.06}px`:0,opacity:j?1:0,transition:p?"none":"opacity 0.4s ease",...d};return e.jsxs("div",{className:u,style:S,role:"timer","aria-live":"off",children:[N&&e.jsx(No,{time:m,size:v,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}),$&&e.jsx(hn,{time:m,format:s,showSeconds:r,showDate:o,label:c,size:v,primary:h.primary,text:h.text,textMuted:h.textMuted,colonVisible:g}),k&&a&&e.jsx("div",{style:{marginTop:v*.04,padding:`${v*.03}px ${v*.06}px`,borderTop:`1px solid ${h.border}`,textAlign:"center"},children:e.jsx(hn,{time:k,format:s,showSeconds:!1,showDate:!1,label:a,size:v*.7,primary:h.secondary,text:h.text,textMuted:h.textMuted,colonVisible:g})})]})}hr.displayName="TkxClock";function Lt(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[l,a]=i.useState(!1);return e.jsx("button",{type:"button",onClick:t,title:n,"aria-label":n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{background:"none",border:"none",padding:"6px",cursor:"pointer",color:o||l?s:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",flexShrink:0,transition:"color 0.15s ease"},children:r})}function mr({src:t,poster:n,title:r,width:o="100%",height:s,autoPlay:l=!1,loop:a=!1,muted:c=!1,controls:f=!0,showTitle:u=!0,allowFullscreen:d=!0,allowPiP:h=!0,allowDownload:p=!1,chapters:m=[],subtitles:y=[],startTime:k,onPlay:b,onPause:g,onEnded:M,onTimeUpdate:j,className:w,style:I}){const v=_.useTheme(),N=Q.useReducedMotion(),$=i.useRef(null),S=i.useRef(null),T=i.useRef(null),E=i.useRef(null),[C,H]=i.useState(!1),[z,R]=i.useState(0),[B,V]=i.useState(0),[D,O]=i.useState(0),[L,P]=i.useState(1),[W,K]=i.useState(c),[ne,Z]=i.useState(!1),[ie,fe]=i.useState(!0),[pe,te]=i.useState(!1),[ce,Y]=i.useState(1),[se,le]=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,$e]=i.useState(!1),[We,Te]=i.useState(null),[ze,Ke]=i.useState(!1);i.useEffect(()=>{const U=$.current;if(!U)return;k!==void 0&&(U.currentTime=k);const be=()=>{R(U.currentTime),U.buffered.length>0&&O(U.buffered.end(U.buffered.length-1))},je=()=>V(U.duration),Ne=()=>H(!0),at=()=>{H(!1),te(!0)},st=()=>{H(!1),te(!0),M==null||M()},pt=()=>ve(!0),ht=()=>ve(!1),mt=()=>$e(!0),wt=()=>$e(!1),jt=()=>{const et=U.error;Te(et?`Error ${et.code}: ${et.message||"Failed to load video"}`:"Failed to load video"),$e(!1)};return U.addEventListener("timeupdate",be),U.addEventListener("durationchange",je),U.addEventListener("play",Ne),U.addEventListener("pause",at),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",at),U.removeEventListener("ended",st),U.removeEventListener("enterpictureinpicture",pt),U.removeEventListener("leavepictureinpicture",ht),U.removeEventListener("waiting",mt),U.removeEventListener("canplay",wt),U.removeEventListener("error",jt)}},[M,k]),i.useEffect(()=>{$.current&&(C?b==null||b():g==null||g())},[C,b,g]),i.useEffect(()=>{j==null||j(z,B)},[z,B,j]),i.useEffect(()=>{const U=$.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=S.current;if(!U)return;const be=je=>{const Ne=$.current;if(Ne&&je.target.tagName!=="INPUT")switch(je.key){case" ":case"k":je.preventDefault(),Pe();break;case"f":case"F":d&&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(),P(Math.min(L+.1,1)),$.current&&($.current.volume=Math.min(L+.1,1));break;case"ArrowDown":je.preventDefault(),P(Math.max(L-.1,0)),$.current&&($.current.volume=Math.max(L-.1,0));break}};return U.addEventListener("keydown",be),()=>U.removeEventListener("keydown",be)},[L,d]);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 Pe=i.useCallback(()=>{const U=$.current;U&&(U.paused?(U.play().catch(()=>{}),ue("play"),te(!1)):(U.pause(),ue("pause")),setTimeout(()=>ue(null),600))},[]),Oe=i.useCallback(()=>{const U=$.current;if(!U)return;const be=!W;K(be),U.muted=be},[W]),Ge=i.useCallback(()=>{const U=S.current;U&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):U.requestFullscreen().catch(()=>{}))},[]),Ee=i.useCallback(async()=>{const U=$.current;if(U)try{document.pictureInPictureElement?await document.exitPictureInPicture():await U.requestPictureInPicture()}catch{}},[]),qe=i.useCallback(()=>{y.length!==0&&(he(U=>(U+1)%(y.length+1)-1),he(U=>{const be=U+1;return be>=y.length?-1:be}))},[y.length]),rt=i.useCallback(()=>{const U=$.current;U&&(U.currentTime=Math.min(U.currentTime+10,U.duration||0))},[]),Qe=i.useCallback(()=>{const U=$.current;U&&(U.currentTime=Math.max(U.currentTime-10,0))},[]),Re=i.useCallback(()=>{const U=$.current;U&&(Te(null),U.load())},[]),Fe=i.useCallback(()=>{d&&Ge()},[d,Ge]),Ae=i.useCallback(U=>{const be=$.current,je=T.current;if(!be||!je||!B)return;const Ne=je.getBoundingClientRect(),at=Math.max(0,Math.min(1,(U.clientX-Ne.left)/Ne.width));be.currentTime=at*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);P(be),$.current&&($.current.volume=be,$.current.muted=be===0,K(be===0))},[]),lt=i.useCallback(U=>{Y(U),$.current&&($.current.playbackRate=U),le(!1)},[]),q=m.length>0?[...m].reverse().find(U=>z>=U.time):null,F=U=>[...m].reverse().find(be=>U>=be.time)??null,J=Array.isArray(t)?t:[{src:t,type:"video/mp4"}],re=Array.isArray(t)?t[0].src:t,ae=ie||pe||!C,Ce=N?"none":"opacity 0.25s ease",Ie=W||L===0?De.volumeMute:L<.5?De.volumeDown:De.volumeUp,we=B>0?z/B*100:0,_e=B>0?D/B*100:0;return e.jsxs("div",{ref:S,className:w,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",...I},children:[e.jsxs("video",{ref:$,style:{width:"100%",height:"100%",display:"block",objectFit:"contain"},poster:n,autoPlay:l,loop:a,muted:c,playsInline:!0,onClick:Pe,onDoubleClick:Fe,children:[J.map((U,be)=>e.jsx("source",{src:U.src,type:U.type},be)),y.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:ae?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:v.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:Re,style:{display:"flex",alignItems:"center",gap:6,background:v.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:ae?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:v.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:v.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 ${v.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:[Lt(ye),F(ye)&&e.jsx("span",{style:{display:"block",fontSize:"0.65rem",color:"rgba(255,255,255,0.7)"},children:A.sanitizeString(F(ye).label)})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(ct,{onClick:Pe,title:C?"Pause":"Play",primary:v.primary,children:e.jsx(Xe,{path:C?De.pause:De.play,size:22})}),e.jsx(ct,{onClick:Qe,title:"Skip back 10 seconds",primary:v.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:v.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:v.primary,children:e.jsx(Xe,{path:Ie,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:L,onChange:Ue,"aria-label":"Volume",style:{width:64,accentColor:v.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:[Lt(z)," / ",Lt(B)]}),e.jsx("div",{style:{flex:1}}),y.length>0&&e.jsx(ct,{onClick:qe,title:"Subtitles",primary:v.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:()=>le(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:v.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 ${v.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:()=>lt(U),style:{display:"block",width:"100%",padding:"6px 14px",background:U===ce?v.primary+"30":"none",border:"none",color:U===ce?v.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:v.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})}),d&&e.jsx(ct,{onClick:Ge,title:ne?"Exit fullscreen":"Fullscreen",primary:v.primary,children:e.jsx(Xe,{path:ne?De.fullscreenExit:De.fullscreen,size:20})})]})]}),e.jsx("style",{children:`
|
|
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 $o({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 Io({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:l=!1}){const a=_.useTheme(),[c,f]=i.useState(-1),[u,d]=i.useState(null),[h,p]=i.useState(null),m=i.useRef(null),[y,k]=i.useState(""),b=i.useRef(null),g=Eo(t);i.useEffect(()=>{var $;($=m.current)==null||$.focus()},[]),i.useEffect(()=>{var S;if(c<0)return;const $=(S=m.current)==null?void 0:S.querySelector(`[data-midx="${c}"]`);$==null||$.scrollIntoView({block:"nearest"})},[c]);const M=i.useCallback($=>{var S,T,E,C,H,z;if($.kind==="action"){if($.item.disabled)return;(T=(S=$.item).onClick)==null||T.call(S),s()}else if($.kind==="check"){if($.item.disabled)return;(C=(E=$.item).onChange)==null||C.call(E,!$.item.checked)}else if($.kind==="radio"){if($.item.disabled)return;(z=(H=$.item).onChange)==null||z.call(H,$.item.options[$.optionIdx].value)}else if($.kind==="submenu"){if($.item.disabled)return;d($.item.id)}},[s]),j=$=>{var S;switch($.key){case"ArrowDown":$.preventDefault(),f(T=>{const E=T+1;return E<g.length?E:0});break;case"ArrowUp":$.preventDefault(),f(T=>{const E=T-1;return E>=0?E:g.length-1});break;case"Home":$.preventDefault(),f(0);break;case"End":$.preventDefault(),f(g.length-1);break;case"Enter":case" ":$.preventDefault(),c>=0&&g[c]&&M(g[c]);break;case"Escape":$.preventDefault(),l?o():s();break;case"Tab":$.preventDefault(),s();break;case"ArrowRight":$.preventDefault(),c>=0&&((S=g[c])==null?void 0:S.kind)==="submenu"&&d(g[c].item.id);break;case"ArrowLeft":$.preventDefault(),l&&o();break;default:$.key.length===1&&!$.ctrlKey&&!$.metaKey&&w($.key)}};function w($){b.current&&clearTimeout(b.current);const S=y+$.toLowerCase();k(S);const T=g.findIndex(E=>(E.kind==="radio"?E.item.options[E.optionIdx].label:E.item.label).toLowerCase().startsWith(S));T>=0&&f(T),b.current=setTimeout(()=>k(""),800)}function I($,S){const T=S.getBoundingClientRect();d($.id);const E=Math.min($.items.length*38+12,360);p(Mo(T,220,E))}function v(){d(null),p(null)}const N=()=>{let $=-1;return t.map(S=>{if(S.type==="separator")return e.jsx("div",{role:"separator",style:{margin:(S.label,"4px 0"),display:"flex",alignItems:"center",gap:8},children:S.label?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1,height:1,backgroundColor:a.border,marginLeft:14}}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:a.textMuted,fontFamily:"inherit",whiteSpace:"nowrap"},children:A.sanitizeString(S.label)}),e.jsx("div",{style:{flex:1,height:1,backgroundColor:a.border,marginRight:14}})]}):e.jsx("div",{style:{flex:1,height:1,backgroundColor:a.border,margin:"0 10px"}})},S.id);if(S.type==="radio-group")return e.jsxs("div",{role:"group","aria-label":S.label,children:[S.label&&e.jsx("div",{style:{padding:"6px 14px 2px",fontSize:"11px",fontWeight:700,letterSpacing:"0.07em",textTransform:"uppercase",color:a.textMuted,fontFamily:"inherit"},"aria-hidden":"true",children:A.sanitizeString(S.label)}),S.options.map((B,V)=>{$++;const D=$,O=D===c,L=B.value===S.value,P=!!S.disabled,W=St(a,O,!1,P);return e.jsxs("div",{role:"menuitemradio","aria-checked":L,"aria-disabled":P||void 0,"data-midx":D,tabIndex:-1,style:W,onClick:()=>{var K;return!P&&((K=S.onChange)==null?void 0:K.call(S,B.value))},onMouseEnter:()=>!P&&f(D),children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:L?e.jsx(Io,{color:a.primary}):e.jsx("span",{style:{width:14,height:14,borderRadius:"50%",border:`2px solid ${a.border}`,display:"inline-block"}})}),B.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:a.textMuted},children:B.icon}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(B.label)})]},B.value)})]},S.id);if(S.type==="check"){$++;const B=$,V=B===c,D=!!S.disabled,O=St(a,V,!1,D);return e.jsxs("div",{role:"menuitemcheckbox","aria-checked":S.checked,"aria-disabled":D||void 0,"data-midx":B,tabIndex:-1,style:O,onClick:()=>{var L;return!D&&((L=S.onChange)==null?void 0:L.call(S,!S.checked))},onMouseEnter:()=>!D&&f(B),children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:S.checked?e.jsx($o,{color:a.primary}):e.jsx("span",{style:{width:14,height:14,display:"inline-block"}})}),S.icon&&e.jsx("span",{style:{flexShrink:0,display:"flex",color:a.textMuted},children:S.icon}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(S.label)})]},S.id)}if(S.type==="submenu"){$++;const B=$,V=B===c,D=!!S.disabled,O=u===S.id,L=St(a,V||O,!1,D);return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("div",{role:"menuitem","aria-haspopup":"menu","aria-expanded":O,"aria-disabled":D||void 0,"data-midx":B,tabIndex:-1,style:L,onMouseEnter:P=>{D||(f(B),I(S,P.currentTarget))},onMouseLeave:()=>{},onClick:()=>{D||d(O?null:S.id)},children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:S.icon?e.jsx("span",{style:{display:"flex",color:a.textMuted},children:S.icon}):e.jsx("span",{style:{width:14}})}),e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(S.label)}),e.jsx(zo,{color:a.textMuted})]}),O&&h&&Le.createPortal(e.jsx(pr,{items:S.items,pos:h,panelId:`${r}-sub-${S.id}`,onClose:v,onCloseAll:s,isSubmenu:!0}),document.body)]},S.id)}const T=S;$++;const E=$,C=E===c,H=!!T.disabled,z=!!T.danger,R=St(a,C,z,H);return e.jsxs("div",{role:"menuitem","aria-disabled":H||void 0,"data-midx":E,tabIndex:-1,style:R,onClick:()=>{var B;H||((B=T.onClick)==null||B.call(T),s())},onMouseEnter:()=>{H||(f(E),v())},children:[e.jsx("span",{style:{width:16,flexShrink:0,display:"flex",alignItems:"center"},children:T.icon?e.jsx("span",{style:{display:"flex",color:z?a.danger:a.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:a.textMuted,marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.sanitizeString(T.description)})]}),T.shortcut&&e.jsx("span",{style:{fontSize:"12px",color:a.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(a,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:l,className:a,style:c}){const u=`tkx-menu-${i.useId().replace(/:/g,"")}`,[d,h]=i.useState(!1),[p,m]=i.useState(null),y=i.useRef(null),k=i.useCallback(()=>{if(o)return;const M=y.current;if(!M)return;const j=M.getBoundingClientRect(),w=Math.min(n.length*38+12,360);m(hn(j,r,220,w)),h(!0),s==null||s()},[o,n.length,s,r]),b=i.useCallback(()=>{var M,j,w;h(!1),l==null||l(),(w=(j=(M=y.current)==null?void 0:M.firstElementChild)==null?void 0:j.focus)==null||w.call(j)},[l]);i.useEffect(()=>{if(!d)return;const M=j=>{var v;const w=j.target;if((v=y.current)!=null&&v.contains(w))return;const I=document.querySelectorAll(".tkx-menu-panel");for(const N of I)if(N.contains(w))return;b()};return document.addEventListener("pointerdown",M),()=>document.removeEventListener("pointerdown",M)},[d,b]),i.useEffect(()=>{if(!d)return;const M=()=>{const j=y.current;if(!j)return;const w=j.getBoundingClientRect(),I=Math.min(n.length*38+12,360);m(hn(w,r,220,I))};return window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[d,n.length,r]);const g=M=>{(M.key==="Enter"||M.key===" "||M.key==="ArrowDown")&&(M.preventDefault(),d||k()),M.key==="Escape"&&d&&(M.preventDefault(),b())};return e.jsxs("span",{ref:y,className:a,style:{display:"inline-flex",...c},children:[e.jsx("span",{role:"button",tabIndex:o?-1:0,"aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?u:void 0,"aria-disabled":o||void 0,onClick:()=>d?b():k(),onKeyDown:g,style:{display:"inline-flex",cursor:o?"not-allowed":"pointer",opacity:o?.55:1,outline:"none"},children:t}),d&&p&&Le.createPortal(e.jsx(pr,{items:n,pos:p,panelId:u,onClose:b,onCloseAll:b}),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 a=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),c=b=>{var g;return((g=a.find(M=>M.type===b))==null?void 0:g.value)??"0"};let f=parseInt(c("hour"),10);f===24&&(f=0);const u=parseInt(c("minute"),10),d=parseInt(c("second"),10),h=c("weekday"),p=c("month"),m=c("day"),y=c("year"),k=`${h}, ${p} ${m}, ${y}`;return{hours:f,minutes:u,seconds:d,milliseconds:n.getMilliseconds(),dateString:k}}catch{}const r=n.getHours(),o=n.getMinutes(),s=n.getSeconds(),l=n.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"2-digit",year:"numeric"});return{hours:r,minutes:o,seconds:s,milliseconds:n.getMilliseconds(),dateString:l}}function Lo({time:t,size:n,analogStyle:r,showSeconds:o,reducedMotion:s,primary:l,danger:a,text:c,textMuted:f,border:u,surface:d,bg:h}){const p=n/2,m=n/2,y=n/2-4,{hours:k,minutes:b,seconds:g,milliseconds:M}=t,w=(g+(s?0:M)/1e3)/60*360,I=b/60*360+g/60*6,v=k%12/12*360+b/60*30,N=(z,R)=>{const B=(z-90)*Math.PI/180;return{x:p+Math.cos(B)*R,y:m+Math.sin(B)*R}},$=s?"none":"transform 0.15s cubic-bezier(0.4, 2.08, 0.55, 0.44)";if(r==="modern"){const z=(P,W)=>{const ne=-90+P*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=P>.5?1:0;return`M ${Z.x} ${Z.y} A ${W} ${W} 0 ${fe} 1 ${ie.x} ${ie.y}`},R=k%12/12+b/60/12,B=b/60+g/3600,V=(g+(s?0:M/1e3))/60,D=y-2,O=y-10,L=y-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:O,fill:"none",stroke:u,strokeWidth:4}),o&&e.jsx("circle",{cx:p,cy:m,r:L,fill:"none",stroke:u,strokeWidth:3}),e.jsx("path",{d:z(R,D),fill:"none",stroke:l,strokeWidth:4,strokeLinecap:"round"}),e.jsx("path",{d:z(B,O),fill:"none",stroke:c,strokeWidth:4,strokeLinecap:"round"}),o&&e.jsx("path",{d:z(V,L),fill:"none",stroke:a,strokeWidth:3,strokeLinecap:"round"}),e.jsx("circle",{cx:p,cy:m,r:4,fill:l}),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(b).padStart(2,"0")]})]})}const S=N(v,y*.5),T=N(I,y*.75),E=N(w,y*.85),C=N(w+180,y*.2),H=[];if(r==="classic"){for(let R=0;R<60;R++){const B=R/60*360,V=R%5===0,D=(B-90)*Math.PI/180,O=V?y-10:y-6,L=p+Math.cos(D)*y,P=m+Math.sin(D)*y,W=p+Math.cos(D)*O,K=m+Math.sin(D)*O;H.push(e.jsx("line",{x1:L,y1:P,x2:W,y2:K,stroke:V?c:f,strokeWidth:V?2:1,strokeLinecap:"round"},R))}const z=[{n:12,angle:0},{n:3,angle:90},{n:6,angle:180},{n:9,angle:270}];for(const{n:R,angle:B}of z){const V=(B-90)*Math.PI/180,D=y-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:c,fontFamily:"system-ui, sans-serif",fontWeight:"600",children:R},`n${R}`))}}else for(let z=0;z<12;z++){const B=(z/12*360-90)*Math.PI/180,V=y-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?c: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:y,fill:d,stroke:u,strokeWidth:2}),H,e.jsx("line",{x1:p,y1:m,x2:S.x,y2:S.y,stroke:l,strokeWidth:r==="minimal"?3:4,strokeLinecap:"round",style:{transformOrigin:`${p}px ${m}px`,transition:$}}),e.jsx("line",{x1:p,y1:m,x2:T.x,y2:T.y,stroke:c,strokeWidth:r==="minimal"?2:3,strokeLinecap:"round",style:{transformOrigin:`${p}px ${m}px`,transition:$}}),o&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:C.x,y1:C.y,x2:E.x,y2:E.y,stroke:a,strokeWidth:1.5,strokeLinecap:"round",style:{transformOrigin:`${p}px ${m}px`,transition:"none"}}),e.jsx("circle",{cx:p,cy:m,r:3,fill:a})]}),e.jsx("circle",{cx:p,cy:m,r:r==="minimal"?3:5,fill:l})]})}function mn({time:t,format:n,showSeconds:r,showDate:o,label:s,size:l,primary:a,text:c,textMuted:f,colonVisible:u}){const{hours:d,minutes:h,seconds:p,dateString:m}=t;let y=d,k="";n==="12h"&&(k=d>=12?"PM":"AM",y=d%12||12);const b=l*.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:b,color:a,fontWeight:700,letterSpacing:"0.05em",display:"flex",alignItems:"center",justifyContent:"center",gap:0},children:[e.jsx("span",{children:String(y).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:b*.45,color:f,marginLeft:"0.4ch",alignSelf:"flex-end",marginBottom:b*.05},children:k})]}),o&&e.jsx("div",{style:{fontSize:l*.072,color:f,marginTop:l*.025,letterSpacing:"0.03em"},children:m}),s&&e.jsx("div",{style:{fontSize:l*.065,color:f,marginTop:l*.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:l,timezone2:a,label:c,analogStyle:f="classic",className:u,style:d}){const h=_.useTheme(),p=J.useReducedMotion(),[m,y]=i.useState(()=>Mt(l)),[k,b]=i.useState(()=>a?Mt(a):null),[g,M]=i.useState(!0),[j,w]=i.useState(!1),I=i.useRef(null);i.useEffect(()=>{w(!0)},[]),i.useEffect(()=>{const T=()=>{y(Mt(l)),a&&b(Mt(a))};T();const E=setInterval(T,1e3);return()=>clearInterval(E)},[l,a]),i.useEffect(()=>(I.current=setInterval(()=>{M(T=>!T)},500),()=>{I.current&&clearInterval(I.current)}),[]);const v=No[n],N=t==="analog"||t==="both",$=t==="digital"||t==="both",S={display:"inline-flex",flexDirection:"column",alignItems:"center",gap:t==="both"?`${v*.06}px`:0,opacity:j?1:0,transition:p?"none":"opacity 0.4s ease",...d};return e.jsxs("div",{className:u,style:S,role:"timer","aria-live":"off",children:[N&&e.jsx(Lo,{time:m,size:v,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}),$&&e.jsx(mn,{time:m,format:s,showSeconds:r,showDate:o,label:c,size:v,primary:h.primary,text:h.text,textMuted:h.textMuted,colonVisible:g}),k&&a&&e.jsx("div",{style:{marginTop:v*.04,padding:`${v*.03}px ${v*.06}px`,borderTop:`1px solid ${h.border}`,textAlign:"center"},children:e.jsx(mn,{time:k,format:s,showSeconds:!1,showDate:!1,label:a,size:v*.7,primary:h.secondary,text:h.text,textMuted:h.textMuted,colonVisible:g})})]})}mr.displayName="TkxClock";function Lt(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[l,a]=i.useState(!1);return e.jsx("button",{type:"button",onClick:t,title:n,"aria-label":n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{background:"none",border:"none",padding:"6px",cursor:"pointer",color:o||l?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:l=!1,loop:a=!1,muted:c=!1,controls:f=!0,showTitle:u=!0,allowFullscreen:d=!0,allowPiP:h=!0,allowDownload:p=!1,chapters:m=[],subtitles:y=[],startTime:k,onPlay:b,onPause:g,onEnded:M,onTimeUpdate:j,className:w,style:I}){const v=_.useTheme(),N=J.useReducedMotion(),$=i.useRef(null),S=i.useRef(null),T=i.useRef(null),E=i.useRef(null),[C,H]=i.useState(!1),[z,R]=i.useState(0),[B,V]=i.useState(0),[D,O]=i.useState(0),[L,P]=i.useState(1),[W,K]=i.useState(c),[ne,Z]=i.useState(!1),[ie,fe]=i.useState(!0),[pe,te]=i.useState(!1),[ce,Y]=i.useState(1),[se,le]=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,$e]=i.useState(!1),[We,Te]=i.useState(null),[ze,Ke]=i.useState(!1);i.useEffect(()=>{const U=$.current;if(!U)return;k!==void 0&&(U.currentTime=k);const be=()=>{R(U.currentTime),U.buffered.length>0&&O(U.buffered.end(U.buffered.length-1))},je=()=>V(U.duration),Ne=()=>H(!0),at=()=>{H(!1),te(!0)},st=()=>{H(!1),te(!0),M==null||M()},pt=()=>ve(!0),ht=()=>ve(!1),mt=()=>$e(!0),wt=()=>$e(!1),jt=()=>{const et=U.error;Te(et?`Error ${et.code}: ${et.message||"Failed to load video"}`:"Failed to load video"),$e(!1)};return U.addEventListener("timeupdate",be),U.addEventListener("durationchange",je),U.addEventListener("play",Ne),U.addEventListener("pause",at),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",at),U.removeEventListener("ended",st),U.removeEventListener("enterpictureinpicture",pt),U.removeEventListener("leavepictureinpicture",ht),U.removeEventListener("waiting",mt),U.removeEventListener("canplay",wt),U.removeEventListener("error",jt)}},[M,k]),i.useEffect(()=>{$.current&&(C?b==null||b():g==null||g())},[C,b,g]),i.useEffect(()=>{j==null||j(z,B)},[z,B,j]),i.useEffect(()=>{const U=$.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=S.current;if(!U)return;const be=je=>{const Ne=$.current;if(Ne&&je.target.tagName!=="INPUT")switch(je.key){case" ":case"k":je.preventDefault(),Pe();break;case"f":case"F":d&&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(),P(Math.min(L+.1,1)),$.current&&($.current.volume=Math.min(L+.1,1));break;case"ArrowDown":je.preventDefault(),P(Math.max(L-.1,0)),$.current&&($.current.volume=Math.max(L-.1,0));break}};return U.addEventListener("keydown",be),()=>U.removeEventListener("keydown",be)},[L,d]);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 Pe=i.useCallback(()=>{const U=$.current;U&&(U.paused?(U.play().catch(()=>{}),ue("play"),te(!1)):(U.pause(),ue("pause")),setTimeout(()=>ue(null),600))},[]),Oe=i.useCallback(()=>{const U=$.current;if(!U)return;const be=!W;K(be),U.muted=be},[W]),Ge=i.useCallback(()=>{const U=S.current;U&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):U.requestFullscreen().catch(()=>{}))},[]),Ee=i.useCallback(async()=>{const U=$.current;if(U)try{document.pictureInPictureElement?await document.exitPictureInPicture():await U.requestPictureInPicture()}catch{}},[]),qe=i.useCallback(()=>{y.length!==0&&(he(U=>(U+1)%(y.length+1)-1),he(U=>{const be=U+1;return be>=y.length?-1:be}))},[y.length]),rt=i.useCallback(()=>{const U=$.current;U&&(U.currentTime=Math.min(U.currentTime+10,U.duration||0))},[]),Qe=i.useCallback(()=>{const U=$.current;U&&(U.currentTime=Math.max(U.currentTime-10,0))},[]),Re=i.useCallback(()=>{const U=$.current;U&&(Te(null),U.load())},[]),Fe=i.useCallback(()=>{d&&Ge()},[d,Ge]),Ae=i.useCallback(U=>{const be=$.current,je=T.current;if(!be||!je||!B)return;const Ne=je.getBoundingClientRect(),at=Math.max(0,Math.min(1,(U.clientX-Ne.left)/Ne.width));be.currentTime=at*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);P(be),$.current&&($.current.volume=be,$.current.muted=be===0,K(be===0))},[]),lt=i.useCallback(U=>{Y(U),$.current&&($.current.playbackRate=U),le(!1)},[]),q=m.length>0?[...m].reverse().find(U=>z>=U.time):null,F=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,ae=ie||pe||!C,Ce=N?"none":"opacity 0.25s ease",Ie=W||L===0?De.volumeMute:L<.5?De.volumeDown:De.volumeUp,we=B>0?z/B*100:0,_e=B>0?D/B*100:0;return e.jsxs("div",{ref:S,className:w,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",...I},children:[e.jsxs("video",{ref:$,style:{width:"100%",height:"100%",display:"block",objectFit:"contain"},poster:n,autoPlay:l,loop:a,muted:c,playsInline:!0,onClick:Pe,onDoubleClick:Fe,children:[Q.map((U,be)=>e.jsx("source",{src:U.src,type:U.type},be)),y.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:ae?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:v.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:Re,style:{display:"flex",alignItems:"center",gap:6,background:v.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:ae?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:v.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:v.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 ${v.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:[Lt(ye),F(ye)&&e.jsx("span",{style:{display:"block",fontSize:"0.65rem",color:"rgba(255,255,255,0.7)"},children:A.sanitizeString(F(ye).label)})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(ct,{onClick:Pe,title:C?"Pause":"Play",primary:v.primary,children:e.jsx(Xe,{path:C?De.pause:De.play,size:22})}),e.jsx(ct,{onClick:Qe,title:"Skip back 10 seconds",primary:v.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:v.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:v.primary,children:e.jsx(Xe,{path:Ie,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:L,onChange:Ue,"aria-label":"Volume",style:{width:64,accentColor:v.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:[Lt(z)," / ",Lt(B)]}),e.jsx("div",{style:{flex:1}}),y.length>0&&e.jsx(ct,{onClick:qe,title:"Subtitles",primary:v.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:()=>le(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:v.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 ${v.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:()=>lt(U),style:{display:"block",width:"100%",padding:"6px 14px",background:U===ce?v.primary+"30":"none",border:"none",color:U===ce?v.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:v.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})}),d&&e.jsx(ct,{onClick:Ge,title:ne?"Exit fullscreen":"Fullscreen",primary:v.primary,children:e.jsx(Xe,{path:ne?De.fullscreenExit:De.fullscreen,size:20})})]})]}),e.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
|
-
`})]})}
|
|
62
|
+
`})]})}gr.displayName="TkxVideoPlayer";const Ro={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:l,primary:a,danger:c,success:f,text:u,textMuted:d,border:h,surface:p,variant:m,reducedMotion:y,clickable:k}){const b=t==="completed",g=t==="active",M=t==="error",j=t==="pending";let w=p,I=h,v=d,N=2;b?(w=m==="filled"?f:p,I=f,v=m==="filled"?"#fff":f):g?(w=m==="outlined"?p:a,I=a,v=m==="outlined"?a:"#fff",N=2):M?(w=m==="filled"?c:p,I=c,v=m==="filled"?"#fff":c):j&&(w=p,I=h,v=d);const $=g&&!y?{boxShadow:`0 0 0 4px ${a}30`,animation:"tkxstepper-pulse 2s ease-in-out infinite"}:{},S=k?{cursor:"pointer",transition:"transform 0.15s ease, box-shadow 0.15s ease"}:{};let T;return o&&!b&&!M?T=e.jsx("span",{style:{fontSize:l,lineHeight:1},children:o}):b?T=e.jsx(Ao,{size:s}):M?T=e.jsx(Do,{size:s}):r?T=e.jsx("span",{style:{fontSize:l,fontWeight:600,lineHeight:1},children:n+1}):T=e.jsx("span",{style:{fontSize:s*.22,lineHeight:1,background:v,borderRadius:"50%",width:s*.22,height:s*.22,display:"block"}}),e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
|
|
63
63
|
@keyframes tkxstepper-pulse {
|
|
64
64
|
0%, 100% { box-shadow: 0 0 0 0 ${a}50; }
|
|
65
65
|
50% { box-shadow: 0 0 0 6px ${a}20; }
|
|
66
66
|
}
|
|
67
|
-
`}),e.jsx("div",{style:{width:s,height:s,minWidth:s,borderRadius:"50%",border:`${N}px solid ${I}`,backgroundColor:w,color:v,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:y?"none":"background-color 0.2s, border-color 0.2s",...$,...S},children:T})]})}function mn({completed:t,orientation:n,connectorStyle:r,connectorWidth:o,primary:s,border:l,reducedMotion:a}){const c=t?s:l;return n==="horizontal"?e.jsx("div",{"aria-hidden":"true",style:{flex:1,height:o,background:r==="solid"?c:"none",backgroundImage:r!=="solid"?`repeating-linear-gradient(90deg, ${c} 0, ${c} 6px, transparent 6px, transparent ${r==="dashed"?12:9}px)`:"none",borderRadius:1,transition:a?"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"?c:"none",backgroundImage:r!=="solid"?`repeating-linear-gradient(180deg, ${c} 0, ${c} 6px, transparent 6px, transparent ${r==="dashed"?12:9}px)`:"none",borderRadius:1,transition:a?"none":"background 0.3s ease",alignSelf:"stretch",marginTop:4,marginBottom:4,marginLeft:"auto",marginRight:"auto"}})}function gr({steps:t,activeStep:n=0,orientation:r="horizontal",variant:o="default",size:s="md",clickable:l=!1,onStepClick:a,showStepNumbers:c=!0,alternateLabel:f=!1,connector:u="solid",className:d,style:h}){const p=_.useTheme(),m=Q.useReducedMotion(),y=Lo[s],k=(g,M)=>g.status?g.status:M<n?"completed":M===n?"active":"pending",b=r==="horizontal";return e.jsx("div",{className:d,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:t.map((g,M)=>{const j=k(g,M),w=M===t.length-1,I=j==="completed"||M<n,v=M%2===0,N=()=>{l&&(a==null||a(M))},$=e.jsx(Do,{status:j,index:M,showStepNumbers:c,icon:g.icon,circleSize:y.circle,fontSize:y.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:l}),S=e.jsxs("div",{style:{textAlign:b&&!f?"center":"left",maxWidth:b?120:void 0},children:[e.jsxs("div",{style:{fontSize:y.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:y.descSize,color:p.textMuted,fontWeight:400,marginLeft:4},children:"(optional)"})]}),g.description&&e.jsx("div",{style:{fontSize:y.descSize,color:p.textMuted,marginTop:2,lineHeight:1.4},children:A.sanitizeString(g.description)}),g.error&&j==="error"&&e.jsx("div",{style:{fontSize:y.descSize,color:p.danger,marginTop:2},children:A.sanitizeString(g.error)})]});return b?e.jsxs("div",{role:"listitem",style:{display:"flex",flex:w?0:1,alignItems:"center",minWidth:0},children:[e.jsxs("div",{onClick:N,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,cursor:l?"pointer":"default",flexShrink:0},"aria-current":j==="active"?"step":void 0,children:[f&&!v&&e.jsx("div",{style:{minHeight:y.circle*1.5+6,display:"flex",alignItems:"flex-end",paddingBottom:6},children:S}),$,!f&&S,f&&v&&e.jsx("div",{style:{marginTop:6},children:S})]}),!w&&e.jsx(mn,{completed:I,orientation:"horizontal",connectorStyle:u,connectorWidth:y.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:l?"pointer":"default"},"aria-current":j==="active"?"step":void 0,children:$}),!w&&e.jsx(mn,{completed:I,orientation:"vertical",connectorStyle:u,connectorWidth:y.connectorWidth,primary:p.primary,border:p.border,reducedMotion:m})]}),e.jsx("div",{style:{paddingTop:(y.circle-parseFloat(y.titleSize)*16)/2,paddingBottom:w?0:16,flex:1,minWidth:0},children:S})]},g.id)})})}gr.displayName="TkxStepper";function br(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 l=Math.max(n,r,o),a=Math.min(n,r,o);let c=0,f=0;const u=(l+a)/2;if(l!==a){const d=l-a;switch(f=u>.5?d/(2-l-a):d/(l+a),l){case n:c=((r-o)/d+(r<o?6:0))/6;break;case r:c=((o-n)/d+2)/6;break;case o:c=((n-r)/d+4)/6;break}}return[Math.round(c*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=l=>{const a=(l+t/30)%12,c=r-o*Math.max(Math.min(a-3,9-a,1),-1);return Math.round(255*c).toString(16).padStart(2,"0")};return`#${s(0)}${s(8)}${s(4)}`}function $t(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 Rt(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,l]=$t(t);if(r==="rgb")return n<1?`rgba(${o}, ${s}, ${l}, ${n.toFixed(2)})`:`rgb(${o}, ${s}, ${l})`;const[a,c,f]=br(t);return r==="hsl"?n<1?`hsla(${a}, ${c}%, ${f}%, ${n.toFixed(2)})`:`hsl(${a}, ${c}%, ${f}%)`:t}const Bo=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#ffffff","#94a3b8","#475569","#0f172a"];function Wo({hue:t,sat:n,bright:r,onChange:o}){const s=i.useRef(null),l=i.useRef(!1),a=i.useCallback(u=>{const d=s.current;if(!d)return;const h=d.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=>{l.current&&a(h)},d=()=>{l.current=!1};return document.addEventListener("mousemove",u),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",d)}},[a]);const c=`${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=>{l.current=!0,a(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:c,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(l=>{const a=r.current;if(!a)return;const c=a.getBoundingClientRect(),f=Math.max(0,Math.min(1,(l.clientX-c.left)/c.width));n(Math.round(f*360))},[n]);return i.useEffect(()=>{const l=c=>{o.current&&s(c)},a=()=>{o.current=!1};return document.addEventListener("mousemove",l),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}},[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:l=>{o.current=!0,s(l)},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 Fo({alpha:t,hex:n,onChange:r}){const o=i.useRef(null),s=i.useRef(!1),l=i.useCallback(u=>{const d=o.current;if(!d)return;const h=d.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&&l(h)},d=()=>{s.current=!1};return document.addEventListener("mousemove",u),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",d)}},[l]);const[a,c,f]=$t(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(${a},${c},${f},0), rgba(${a},${c},${f},1))`},onMouseDown:u=>{s.current=!0,l(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(${a},${c},${f},${t})`,pointerEvents:"none"}})})]})}function Ho({value:t,defaultValue:n="#3b82f6",onChange:r,format:o="hex",showAlpha:s=!1,presets:l=Bo,disabled:a=!1,size:c="md",placeholder:f,label:u,style:d}){const h=_.useTheme(),p=i.useRef(null),m=i.useRef(null),[y,k]=i.useState(!1),b=t!==void 0,[g,M]=i.useState(b&&t||n),j=b?t||n:g,[w,I]=i.useState(1),[v,N]=i.useState(j),[$,S]=i.useState({top:0,left:0}),[T,E,C]=br(dt(j)?j:n),H=i.useCallback((Y,se=w)=>{dt(Y)&&(N(Y),b||M(Y),r==null||r(At(Y,se,o),o))},[w,b,o,r]);i.useEffect(()=>{b&&t&&dt(t)&&N(t)},[b,t]);const z=()=>{if(a)return;const Y=p.current;if(!Y)return;const se=Y.getBoundingClientRect(),ge=window.innerHeight-se.bottom>320?se.bottom+6:se.top-326;S({top:ge+window.scrollY,left:se.left+window.scrollX}),k(!0)};i.useEffect(()=>{if(!y)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)},[y]),i.useEffect(()=>{if(!y)return;const Y=se=>{se.key==="Escape"&&k(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[y]);const R=(Y,se)=>{const le=se/100,ge=Y/100,he=le*(1-ge/2),ye=he===0||he===1?0:(le-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=>{I(Y),r==null||r(At(j,Y,o),o)},D=Y=>{const se=Y.target.value;N(se),dt(se)&&H(se)},O=(Y,se)=>{const le=Math.max(0,Math.min(255,parseInt(se)||0)),[ge,he,ye]=$t(j),de=Y==="r"?Rt(le,he,ye):Y==="g"?Rt(ge,le,ye):Rt(ge,he,le);H(de)},P={sm:28,md:34,lg:40}[c],[W,K,ne]=$t(dt(j)?j:n),Z={display:"inline-flex",alignItems:"center",gap:"8px",height:`${P}px`,padding:"4px 10px 4px 6px",borderRadius:"8px",border:`1px solid ${h.border}`,backgroundColor:h.surface,cursor:a?"not-allowed":"pointer",opacity:a?.5:1,color:h.text,fontSize:"13px",fontFamily:"inherit",transition:"border-color 0.15s",...d},ie={width:`${P-8}px`,height:`${P-8}px`,borderRadius:"4px",backgroundColor:`rgba(${W},${K},${ne},${w})`,border:`1px solid ${h.border}`,flexShrink:0},fe={position:"absolute",top:$.top,left:$.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:a,"aria-label":`Color picker, current color ${j}`,"aria-haspopup":"dialog","aria-expanded":y,children:[e.jsx("div",{style:ie}),e.jsx("span",{style:{fontFamily:"monospace",fontSize:"12px",color:h.textMuted},children:f??At(dt(j)?j:n,w,o)})]}),y&&Le.createPortal(e.jsxs("div",{ref:m,style:fe,role:"dialog","aria-label":"Color picker",children:[e.jsx(Wo,{hue:T,sat:E,bright:C,onChange:R}),e.jsx(Po,{hue:T,onChange:B}),s&&e.jsx(Fo,{alpha:w,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},${w})`,border:`1px solid ${h.border}`}}),e.jsx("input",{style:pe,value:v,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:le=>O(Y,le.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(w*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%"})]})]}),l.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:l.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 Vo={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 gn(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 Oo(t,n,r,o,s){const l=o??"en-US";return n==="currency"?new Intl.NumberFormat(l,{style:"currency",currency:r??"USD",minimumFractionDigits:s??2,maximumFractionDigits:s??2}).format(t):n==="percent"?new Intl.NumberFormat(l,{style:"percent",minimumFractionDigits:s??0,maximumFractionDigits:s??0}).format(t/100):n==="decimal"||s!==void 0?new Intl.NumberFormat(l,{minimumFractionDigits:s??0,maximumFractionDigits:s??20}).format(t):String(t)}function bn({direction:t,isDisabled:n,btnW:r,height:o,primaryColor:s,borderColor:l,textMuted:a,iconSz:c,onStep:f}){const u=i.useRef(null),d=i.useRef(null),h=t==="inc"?1:-1,p=i.useCallback(()=>{f(h),u.current=setTimeout(()=>{d.current=setInterval(()=>f(h),60)},400)},[h,f]),m=i.useCallback(()=>{u.current&&(clearTimeout(u.current),u.current=null),d.current&&(clearInterval(d.current),d.current=null)},[]);i.useEffect(()=>()=>m(),[m]);const y=t==="inc";return e.jsx("button",{type:"button","aria-label":y?"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:y?void 0:`1px solid ${l}`,borderLeft:y?`1px solid ${l}`:void 0,cursor:n?"not-allowed":"pointer",color:n?a: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:y?e.jsxs("svg",{width:c,height:c,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:c,height:c,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 yr({value:t,defaultValue:n=0,onChange:r,min:o,max:s,step:l=1,precision:a,prefix:c,suffix:f,format:u,currency:d,locale:h,clampOnBlur:p=!0,allowMouseWheel:m=!1,size:y="md",label:k,hint:b,isDisabled:g=!1,isReadOnly:M=!1,isInvalid:j=!1,errorMessage:w,id:I,className:v,style:N}){const $=_.useTheme(),S=i.useId(),T=I??S,E=`${T}-hint`,C=`${T}-error`,H=t!==void 0,[z,R]=i.useState(n),B=H?t:z,[V,D]=i.useState(!1),[O,L]=i.useState(""),P=Vo[y],W=j||!!w,K=W?$.danger:V?$.primary:$.border,ne=[b&&E,W&&C].filter(Boolean).join(" ")||void 0,Z=k?A.sanitizeString(k):void 0,ie=b?A.sanitizeString(b):void 0,fe=w?A.sanitizeString(w):void 0,pe=c?A.sanitizeString(c):void 0,te=f?A.sanitizeString(f):void 0,ce=i.useCallback(oe=>{const G=Dt(oe,a);H||R(G),r==null||r(G)},[H,r,a]),Y=i.useCallback(oe=>{if(g||M)return;const G=gn(Dt(B+oe*l,a),o,s);ce(G)},[g,M,B,l,a,o,s,ce]),se=()=>{D(!0),L(String(B))},le=()=>{D(!1);const oe=parseFloat(O);if(isNaN(oe)){r==null||r(null),L(String(B));return}let G=Dt(oe,a);p&&(G=gn(G,o,s)),ce(G)},ge=oe=>{L(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:Oo(B,u,d,h,a),xe=(pe||te)&&!V;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1 w-full"),v),style:N,children:[Z&&e.jsx("label",{htmlFor:T,className:x.tkx("text-sm font-medium font-sans"),style:{color:$.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?$.surfaceAlt:$.surface,opacity:g?.65:1,height:P.height},children:[e.jsx(bn,{direction:"dec",isDisabled:g||M,btnW:P.btnW,height:P.height,primaryColor:$.primary,borderColor:$.border,textMuted:$.textMuted,iconSz:P.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:P.px,fontSize:P.fontSize,color:$.textMuted,pointerEvents:"none",userSelect:"none"},children:pe}),e.jsx("input",{id:T,type:"text",inputMode:"decimal",value:V?O:de,readOnly:M,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:P.fontSize,fontFamily:"inherit",color:$.text,paddingLeft:xe&&pe?`calc(${P.px} + 1.2em)`:P.px,paddingRight:xe&&te?`calc(${P.px} + 1.2em)`:P.px,cursor:g?"not-allowed":M?"default":"text"},onFocus:se,onBlur:le,onChange:ge,onKeyDown:he,onWheel:ye}),xe&&te&&e.jsx("span",{style:{position:"absolute",right:P.px,fontSize:P.fontSize,color:$.textMuted,pointerEvents:"none",userSelect:"none"},children:te})]}),e.jsx(bn,{direction:"inc",isDisabled:g||M,btnW:P.btnW,height:P.height,primaryColor:$.primary,borderColor:$.border,textMuted:$.textMuted,iconSz:P.iconSz,onStep:Y})]}),ie&&!fe&&e.jsx("span",{id:E,className:x.tkx("text-xs"),style:{color:$.textMuted},children:ie}),fe&&e.jsxs("span",{id:C,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:$.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]})]})}yr.displayName="TkxNumberInput";const _o={sm:{box:"36px",fontSize:"1rem",gap:"6px"},md:{box:"44px",fontSize:"1.25rem",gap:"8px"},lg:{box:"52px",fontSize:"1.5rem",gap:"10px"}},Yo={number:/^\d$/,alphanumeric:/^[a-zA-Z0-9]$/,alpha:/^[a-zA-Z]$/};function yn(t,n){return Yo[n].test(t)?t.toUpperCase():""}function kr({length:t=6,value:n,onChange:r,onComplete:o,type:s="number",mask:l=!1,autoFocus:a=!1,isDisabled:c=!1,isInvalid:f=!1,errorMessage:u,hint:d,size:h="md",separator:p,separatorPosition:m,className:y,style:k}){const b=_.useTheme(),g=i.useId(),M=`${g}-hint`,j=`${g}-error`,w=n!==void 0,I=W=>{const K=W.split("").slice(0,t);for(;K.length<t;)K.push("");return K},[v,N]=i.useState(()=>I(w?n:"")),$=w?I(n):v,S=i.useRef([]),T=_o[h],E=f||!!u,C=$.every(W=>W!==""),H=d?A.sanitizeString(d):void 0,z=u?A.sanitizeString(u):void 0,R=W=>E?b.danger:C?b.success:b.border;i.useEffect(()=>{var W;a&&((W=S.current[0])==null||W.focus())},[]);const B=i.useCallback(W=>{w||N(W);const K=W.join("");r==null||r(K),W.every(ne=>ne!=="")&&(o==null||o(K))},[w,r,o]),V=W=>{var ne;const K=Math.max(0,Math.min(t-1,W));(ne=S.current[K])==null||ne.focus()},D=W=>K=>{if(!c){if(K.key==="Backspace"){if(K.preventDefault(),$[W]!==""){const ne=[...$];ne[W]="",B(ne)}else if(W>0){const ne=[...$];ne[W-1]="",B(ne),V(W-1)}return}if(K.key==="Delete"){K.preventDefault();const ne=[...$];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}}},O=W=>K=>{if(c)return;const Z=K.target.value.slice(-1);if(!Z)return;const ie=yn(Z,s);if(!ie)return;const fe=[...$];fe[W]=ie,B(fe),W<t-1&&V(W+1)},L=W=>K=>{if(K.preventDefault(),c)return;const Z=K.clipboardData.getData("text").split("").map(pe=>yn(pe,s)).filter(Boolean);if(!Z.length)return;const ie=[...$];let fe=W;for(const pe of Z){if(fe>=t)break;ie[fe]=pe,fe++}B(ie),V(Math.min(fe,t-1))},P=[H&&M,E&&j].filter(Boolean).join(" ")||void 0;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-2 w-fit"),y),style:k,children:[e.jsx("div",{role:"group","aria-label":"One-time password","aria-describedby":P,className:x.tkx("flex items-center"),style:{gap:T.gap},children:Array.from({length:t},(W,K)=>{const ne=R();return typeof document<"u"&&(document.activeElement,S.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:b.textMuted,userSelect:"none",flexShrink:0},children:p}),e.jsx("input",{ref:Z=>{S.current[K]=Z},type:l?"password":"text",inputMode:s==="number"?"numeric":"text",maxLength:1,value:$[K],disabled:c,"aria-label":`Digit ${K+1} of ${t}`,autoComplete:"one-time-code",spellCheck:!1,onChange:O(K),onKeyDown:D(K),onPaste:L(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:c?b.surfaceAlt:b.surface,color:b.text,outline:"none",boxShadow:"none",cursor:c?"not-allowed":"text",transition:"border-color 150ms ease, box-shadow 150ms ease",opacity:c?.6:1},onFocusCapture:Z=>{c||(Z.currentTarget.style.borderColor=E?b.danger:b.primary,Z.currentTarget.style.boxShadow=`0 0 0 3px ${E?b.danger:b.primary}33`)},onBlurCapture:Z=>{Z.currentTarget.style.borderColor=R(),Z.currentTarget.style.boxShadow="none"}})]},K)})}),H&&!z&&e.jsx("span",{id:M,className:x.tkx("text-xs"),style:{color:b.textMuted},children:H}),z&&e.jsxs("span",{id:j,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:b.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]})]})}kr.displayName="TkxOTP";function Ko(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 Uo(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],l=o[o.length-1],a=c=>{c.key==="Tab"&&(c.shiftKey?document.activeElement===s&&(c.preventDefault(),l==null||l.focus()):document.activeElement===l&&(c.preventDefault(),s==null||s.focus()))};return r.addEventListener("keydown",a),()=>r.removeEventListener("keydown",a)},[t]),n}function Xo(){const[t,n]=i.useState(!1),r=i.useCallback(()=>n(!0),[]),o=i.useCallback(()=>n(!1),[]),s=i.useCallback(()=>n(l=>!l),[]);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 l=[];let a=0,c=-1,f=-1;for(let u=0;u<o.length&&a<r.length;u++)o[u]===r[a]&&((f===-1||u!==f+1)&&(c!==-1&&l.push([c,f]),c=u),f=u,a++);return c!==-1&&f!==-1&&l.push([c,f]),a<r.length?{matched:!1,ranges:[],score:0}:{matched:!0,ranges:l,score:40}}function Zo(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),l=o.description?Bt(t,o.description):{matched:!1,score:0},a=(o.keywords??[]).some(c=>Bt(t,c).matched);s.matched?r.push({item:o,score:s.score+20,labelRanges:s.ranges}):l.matched?r.push({item:o,score:l.score,labelRanges:[]}):a&&r.push({item:o,score:20,labelRanges:[]})}return r.sort((o,s)=>s.score-o.score)}function Go({text:t,ranges:n,color:r}){if(!n.length)return e.jsx(e.Fragment,{children:t});const o=[];let s=0;for(const[l,a]of n)s<l&&o.push(e.jsx("span",{children:t.slice(s,l)},`t-${s}`)),o.push(e.jsx("span",{style:{color:r,fontWeight:700},children:t.slice(l,a+1)},`h-${l}`)),s=a+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 vr({items:t,isOpen:n=!1,onClose:r,placeholder:o="Type a command or search…",emptyMessage:s,maxItems:l=8,onItemSelect:a,className:c,style:f}){const u=_.useTheme(),[d,h]=i.useState(""),[p,m]=i.useState(0),[y,k]=i.useState(!1),b=i.useRef(null),g=i.useRef(null),M=i.useId(),j=Uo(n),w=Zo(d,t).slice(0,l),I=[];for(const C of w){const H=C.item.group,z=I.find(R=>R.group===H);z?z.items.push(C):I.push({group:H,items:[C]})}const v=I.flatMap(C=>C.items);Ko(()=>{r==null||r()},n),i.useEffect(()=>{n&&(h(""),m(0),setTimeout(()=>{var C;return(C=b.current)==null?void 0:C.focus()},30))},[n]),i.useEffect(()=>{p>=v.length&&m(Math.max(0,v.length-1))},[v.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"})},[]),$=C=>{if(C.key==="ArrowDown"){C.preventDefault();const H=Math.min(v.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=v[p];H&&S(H.item)}},S=C=>{var H;C.disabled||((H=C.onSelect)==null||H.call(C),a==null||a(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(d)}"`;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 Le.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:M,className:x.cx(c),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:b,type:"text",role:"combobox","aria-expanded":!0,"aria-autocomplete":"list","aria-controls":`${M}-list`,"aria-activedescendant":v[p]?`${M}-item-${v[p].item.id}`:void 0,value:d,onChange:C=>{h(C.target.value),m(0)},onKeyDown:$,placeholder:T,style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:16,fontFamily:"inherit",color:u.text}}),d&&e.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>{var C;h(""),m(0),(C=b.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:`${M}-list`,ref:g,role:"listbox","aria-label":"Command results",style:{overflowY:"auto",flex:1,padding:"6px 8px"},children:y?Array.from({length:4},(C,H)=>e.jsx(qo,{surface:u.surface,border:u.border},H)):v.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})]}):I.map(({group:C,items:H},z)=>{const R=I.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=R+V,O=D===p,L=B.item;return e.jsxs("div",{id:`${M}-item-${L.id}`,role:"option","aria-selected":O,"aria-disabled":L.disabled,"data-command-item":!0,onClick:()=>S(L),onMouseEnter:()=>m(D),style:{display:"flex",alignItems:"center",gap:10,padding:"9px 12px",borderRadius:8,cursor:L.disabled?"not-allowed":"pointer",opacity:L.disabled?.45:1,backgroundColor:O?`${u.primary}18`:"transparent",borderLeft:O?`2px solid ${u.primary}`:"2px solid transparent",transition:"background 80ms ease",userSelect:"none"},children:[L.icon&&e.jsx("span",{style:{width:20,height:20,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",color:O?u.primary:u.textMuted},children:L.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(Go,{text:L.label,ranges:B.labelRanges,color:u.primary})}),L.description&&e.jsx("div",{style:{fontSize:"0.75rem",color:u.textMuted,marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:A.sanitizeString(L.description)})]}),L.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(L.shortcut)})]},L.id)})]},C??"__default__")})}),v.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)}vr.displayName="TkxCommand";function Tt({direction:t,onClick:n,isDisabled:r,primaryColor:o,position:s,orientation:l}){const a=l==="vertical",c=t==="prev",f=s==="inside"?{position:"absolute",zIndex:3,...a?{[c?"top":"bottom"]:10,left:"50%",transform:"translateX(-50%)"}:{[c?"left":"right"]:10,top:"50%",transform:"translateY(-50%)"}}:{flexShrink:0,position:"relative"};return e.jsx("button",{type:"button","aria-label":c?"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:a?c?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"})}):c?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 wr({slides:t,autoPlay:n=!1,autoPlayInterval:r=4e3,pauseOnHover:o=!0,loop:s=!0,showArrows:l=!0,showDots:a=!0,showThumbnails:c=!1,orientation:f="horizontal",slidesToShow:u=1,gap:d=0,transitionDuration:h=400,swipeable:p=!0,initialIndex:m=0,onChange:y,arrowPosition:k="inside",height:b=320,className:g,style:M}){const j=_.useTheme(),w=Q.useReducedMotion(),I=i.useId(),v=t.length,[N,$]=i.useState(m),[S,T]=i.useState(s?m+1:m),[E,C]=i.useState(!1),[H,z]=i.useState(!1),R=i.useRef(null),B=i.useRef(null),V=i.useRef(null),D=i.useRef(0),O=i.useRef(!1),L=f==="vertical",P=w?0:h,W=s&&v>1?[t[v-1],...t,t[0]]:t,K=W.length,ne=100/u,Z=(G,ue=0)=>{const ke=ue!==0?` - ${ue}px`:"";return L?`translateY(calc(-${G*ne}%${ke}))`:`translateX(calc(-${G*ne}%${ke}))`},ie=i.useCallback((G,ue=!1)=>{const ke=s?(G%v+v)%v:Math.max(0,Math.min(v-1,G)),ve=s?ke+1:ke;ue&&R.current?(R.current.style.transition="none",T(ve),$(ke),R.current.offsetHeight,R.current.style.transition=""):(C(!0),T(ve),$(ke)),y==null||y(ke)},[v,s,y]),fe=i.useCallback(()=>ie(N-1),[N,ie]),pe=i.useCallback(()=>ie(N+1),[N,ie]),te=i.useCallback(()=>{C(!1),!(!s||v<=1)&&(S===0?ie(v-1,!0):S===K-1&&ie(0,!0))},[s,v,S,K,ie]);i.useEffect(()=>{if(!(!n||H||v<=1))return B.current=setInterval(pe,r),()=>{B.current&&clearInterval(B.current)}},[n,H,r,pe,v]),i.useEffect(()=>{const G=ue=>{const ke=document.activeElement,ve=document.getElementById(I);ve!=null&&ve.contains(ke)&&(ue.key===(L?"ArrowUp":"ArrowLeft")&&(ue.preventDefault(),fe()),ue.key===(L?"ArrowDown":"ArrowRight")&&(ue.preventDefault(),pe()))};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[I,L,fe,pe]);const ce=G=>"touches"in G?L?G.touches[0].clientY:G.touches[0].clientX:L?G.clientY:G.clientX,Y=G=>{p&&(V.current=ce(G),D.current=0,O.current=!0)},se=G=>{if(!O.current||V.current===null)return;const ue=ce(G)-V.current;D.current=ue,R.current&&(R.current.style.transition="none",R.current.style.transform=Z(S,-ue))},le=()=>{if(!O.current)return;O.current=!1;const G=D.current,ue=50;R.current&&(R.current.style.transition="",R.current.style.transform=""),G<-ue?pe():G>ue?fe():R.current&&(R.current.style.transform=Z(S)),V.current=null,D.current=0},ge=typeof b=="number"?`${b}px`:b,he={display:"flex",flexDirection:L?"column":"row",width:L?"100%":`${K/u*100}%`,height:L?`${K/u*100}%`:"100%",transform:Z(S),transition:E||!w?`transform ${P}ms cubic-bezier(0.4, 0, 0.2, 1)`:"none",willChange:"transform",gap:d>0?d:void 0},ye={flexShrink:0,width:L?"100%":`${ne/(K/u)}%`,height:L?`${ne/(K/u)}%`:"100%",overflow:"hidden",position:"relative"},de=s||N>0,xe=s||N<v-1,oe=k==="outside";return e.jsxs("div",{id:I,className:x.cx(x.tkx("flex flex-col gap-2"),g),style:M,"aria-roledescription":"carousel","aria-label":"Content carousel",children:[e.jsxs("div",{className:x.tkx("flex items-center gap-2"),style:{gap:oe&&l?8:0},children:[l&&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?O.current?"grabbing":"grab":"default",userSelect:"none"},onMouseEnter:()=>o&&z(!0),onMouseLeave:()=>{z(!1),le()},onTouchStart:Y,onTouchMove:se,onTouchEnd:le,onMouseDown:Y,onMouseMove:se,onMouseUp:le,"aria-live":"polite","aria-atomic":"false",children:[l&&!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:R,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)+v)%v+1} of ${v}`,"aria-hidden":(ue-(s?1:0)+v)%v!==N,children:G.content},`${G.id}-${ue}`))}),a&&!c&&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))})]}),l&&oe&&e.jsx(Tt,{direction:"next",onClick:pe,isDisabled:!xe,primaryColor:j.primary,position:"outside",orientation:f})]}),c&&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))})]})}wr.displayName="TkxCarousel";function Qo({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 Jo({onClick:t,bgColor:n,hoverColor:r,textColor:o}){const s=l=>{(l.key==="Enter"||l.key===" ")&&(l.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:l=>{l.currentTarget.style.backgroundColor=r},onMouseLeave:l=>{l.currentTarget.style.backgroundColor=n},children:"…"})}function ei({items:t,separator:n,maxItems:r,onNavigate:o,className:s,style:l}){const a=_.useTheme(),c=Q.useReducedMotion(),f=r!==void 0&&r>1&&t.length>r,d=i.useCallback(()=>{if(!f||!r)return t.map((N,$)=>({item:N,originalIndex:$}));const j=Math.ceil((r-1)/2),w=r-1-j,I=t.slice(0,j).map((N,$)=>({item:N,originalIndex:$})),v=t.slice(t.length-w).map((N,$)=>({item:N,originalIndex:t.length-w+$}));return I.concat(v)},[t,r,f])(),h=f&&r?Math.ceil((r-1)/2):-1,p=(j,w)=>{o==null||o(j,w)},m=(j,w,I)=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),p(w,I))},y=c?{}:{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(Qo,{color:a.textMuted})},j),b=(j,w,I)=>{const v=A.sanitizeString(j.label);if(I)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:a.text},children:[j.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:j.icon}),v]})},`item-${w}`);const N=!!j.href,$={color:a.textMuted,textDecoration:"none",...y},S={onMouseEnter:E=>{E.currentTarget.style.color=a.primary},onMouseLeave:E=>{E.currentTarget.style.color=a.textMuted}},T=e.jsxs(e.Fragment,{children:[j.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:j.icon}),v]});return N?e.jsx("li",{children:e.jsx("a",{href:j.href,onClick:E=>{o&&(E.preventDefault(),p(j,w))},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:{...$,focusRingColor:a.primary},...S,children:T})},`item-${w}`):e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>p(j,w),onKeyDown:E=>m(E,j,w),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:$,...S,children:T})},`item-${w}`)},g=[];let M=!1;for(let j=0;j<d.length;j++){const{item:w,originalIndex:I}=d[j],v=I===t.length-1;f&&!M&&j===h&&(g.length>0&&g.push(k("sep-ellipsis-before")),g.push(e.jsx("li",{role:"presentation",children:e.jsx(Jo,{onClick:()=>{},bgColor:a.surfaceAlt,hoverColor:a.surface,textColor:a.textMuted})},"ellipsis")),M=!0),g.length>0&&g[g.length-1]!==null&&g.push(k(`sep-${I}`)),g.push(b(w,I,v))}return e.jsx("nav",{"aria-label":"Breadcrumb",className:x.tkx("font-sans",s??""),style:{...l},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 ti(t,n,r){const o=n.getBoundingClientRect(),s=window.scrollX,l=window.scrollY,a=window.innerWidth,c=window.innerHeight;let f=0,u=0,d=r;const h={top:t.top-o.height-it-He>0,bottom:t.bottom+o.height+it+He<c,left:t.left-o.width-it-He>0,right:t.right+o.width+it+He<a};if(!h[r]){const m={top:"bottom",bottom:"top",left:"right",right:"left"};h[m[r]]&&(d=m[r])}switch(d){case"top":f=t.top+l-o.height-it-He,u=t.left+s+t.width/2-o.width/2;break;case"bottom":f=t.bottom+l+it+He,u=t.left+s+t.width/2-o.width/2;break;case"left":f=t.top+l+t.height/2-o.height/2,u=t.left+s-o.width-it-He;break;case"right":f=t.top+l+t.height/2-o.height/2,u=t.right+s+it+He;break}u=Math.max(8,Math.min(u,a+s-o.width-8)),f=Math.max(8,Math.min(f,c+l-o.height-8));const p={position:"absolute",width:0,height:0,borderStyle:"solid",borderWidth:He};switch(d){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:d}}function ni({trigger:t,content:n,placement:r="bottom",isOpen:o,onOpenChange:s,closeOnClickOutside:l=!0,className:a,style:c}){const f=_.useTheme(),u=Q.useReducedMotion(),d=i.useId(),h=o!==void 0,[p,m]=i.useState(!1),y=h?o:p,k=i.useRef(null),b=i.useRef(null);i.useRef(null);const[g,M]=i.useState(null),j=i.useCallback($=>{h||m($),s==null||s($)},[h,s]),w=i.useCallback(()=>j(!1),[j]),I=i.useCallback(()=>j(!y),[j,y]);Q.useEscapeKey(w,y),i.useEffect(()=>{if(!y||!l)return;const $=S=>{var E,C;const T=S.target;(E=k.current)!=null&&E.contains(T)||(C=b.current)!=null&&C.contains(T)||w()};return document.addEventListener("pointerdown",$),()=>document.removeEventListener("pointerdown",$)},[y,l,w]),i.useEffect(()=>{if(!y||!k.current)return;const $=()=>{if(!k.current||!b.current)return;const S=k.current.getBoundingClientRect();M(ti(S,b.current,r))};return requestAnimationFrame($),window.addEventListener("scroll",$,!0),window.addEventListener("resize",$),()=>{window.removeEventListener("scroll",$,!0),window.removeEventListener("resize",$)}},[y,r]);const v=u?{opacity:1}:{animation:"tkxPopoverFadeIn 150ms ease forwards",opacity:0},N=y&&typeof document<"u"?Le.createPortal(e.jsxs("div",{ref:b,id:d,role:"dialog","aria-modal":"false",className:x.tkx("absolute z-[9100] rounded-lg font-sans",a??""),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,...v,...c},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:I,onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),I())},"aria-expanded":y,"aria-haspopup":"dialog","aria-controls":y?d:void 0,children:t}),N,y&&!u&&e.jsx("style",{children:`
|
|
67
|
+
`}),e.jsx("div",{style:{width:s,height:s,minWidth:s,borderRadius:"50%",border:`${N}px solid ${I}`,backgroundColor:w,color:v,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:y?"none":"background-color 0.2s, border-color 0.2s",...$,...S},children:T})]})}function gn({completed:t,orientation:n,connectorStyle:r,connectorWidth:o,primary:s,border:l,reducedMotion:a}){const c=t?s:l;return n==="horizontal"?e.jsx("div",{"aria-hidden":"true",style:{flex:1,height:o,background:r==="solid"?c:"none",backgroundImage:r!=="solid"?`repeating-linear-gradient(90deg, ${c} 0, ${c} 6px, transparent 6px, transparent ${r==="dashed"?12:9}px)`:"none",borderRadius:1,transition:a?"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"?c:"none",backgroundImage:r!=="solid"?`repeating-linear-gradient(180deg, ${c} 0, ${c} 6px, transparent 6px, transparent ${r==="dashed"?12:9}px)`:"none",borderRadius:1,transition:a?"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:l=!1,onStepClick:a,showStepNumbers:c=!0,alternateLabel:f=!1,connector:u="solid",className:d,style:h}){const p=_.useTheme(),m=J.useReducedMotion(),y=Ro[s],k=(g,M)=>g.status?g.status:M<n?"completed":M===n?"active":"pending",b=r==="horizontal";return e.jsx("div",{className:d,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:t.map((g,M)=>{const j=k(g,M),w=M===t.length-1,I=j==="completed"||M<n,v=M%2===0,N=()=>{l&&(a==null||a(M))},$=e.jsx(Bo,{status:j,index:M,showStepNumbers:c,icon:g.icon,circleSize:y.circle,fontSize:y.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:l}),S=e.jsxs("div",{style:{textAlign:b&&!f?"center":"left",maxWidth:b?120:void 0},children:[e.jsxs("div",{style:{fontSize:y.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:y.descSize,color:p.textMuted,fontWeight:400,marginLeft:4},children:"(optional)"})]}),g.description&&e.jsx("div",{style:{fontSize:y.descSize,color:p.textMuted,marginTop:2,lineHeight:1.4},children:A.sanitizeString(g.description)}),g.error&&j==="error"&&e.jsx("div",{style:{fontSize:y.descSize,color:p.danger,marginTop:2},children:A.sanitizeString(g.error)})]});return b?e.jsxs("div",{role:"listitem",style:{display:"flex",flex:w?0:1,alignItems:"center",minWidth:0},children:[e.jsxs("div",{onClick:N,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,cursor:l?"pointer":"default",flexShrink:0},"aria-current":j==="active"?"step":void 0,children:[f&&!v&&e.jsx("div",{style:{minHeight:y.circle*1.5+6,display:"flex",alignItems:"flex-end",paddingBottom:6},children:S}),$,!f&&S,f&&v&&e.jsx("div",{style:{marginTop:6},children:S})]}),!w&&e.jsx(gn,{completed:I,orientation:"horizontal",connectorStyle:u,connectorWidth:y.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:l?"pointer":"default"},"aria-current":j==="active"?"step":void 0,children:$}),!w&&e.jsx(gn,{completed:I,orientation:"vertical",connectorStyle:u,connectorWidth:y.connectorWidth,primary:p.primary,border:p.border,reducedMotion:m})]}),e.jsx("div",{style:{paddingTop:(y.circle-parseFloat(y.titleSize)*16)/2,paddingBottom:w?0:16,flex:1,minWidth:0},children:S})]},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 l=Math.max(n,r,o),a=Math.min(n,r,o);let c=0,f=0;const u=(l+a)/2;if(l!==a){const d=l-a;switch(f=u>.5?d/(2-l-a):d/(l+a),l){case n:c=((r-o)/d+(r<o?6:0))/6;break;case r:c=((o-n)/d+2)/6;break;case o:c=((n-r)/d+4)/6;break}}return[Math.round(c*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=l=>{const a=(l+t/30)%12,c=r-o*Math.max(Math.min(a-3,9-a,1),-1);return Math.round(255*c).toString(16).padStart(2,"0")};return`#${s(0)}${s(8)}${s(4)}`}function $t(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 Rt(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,l]=$t(t);if(r==="rgb")return n<1?`rgba(${o}, ${s}, ${l}, ${n.toFixed(2)})`:`rgb(${o}, ${s}, ${l})`;const[a,c,f]=yr(t);return r==="hsl"?n<1?`hsla(${a}, ${c}%, ${f}%, ${n.toFixed(2)})`:`hsl(${a}, ${c}%, ${f}%)`:t}const Wo=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#ffffff","#94a3b8","#475569","#0f172a"];function Po({hue:t,sat:n,bright:r,onChange:o}){const s=i.useRef(null),l=i.useRef(!1),a=i.useCallback(u=>{const d=s.current;if(!d)return;const h=d.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=>{l.current&&a(h)},d=()=>{l.current=!1};return document.addEventListener("mousemove",u),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",d)}},[a]);const c=`${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=>{l.current=!0,a(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:c,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 Fo({hue:t,onChange:n}){const r=i.useRef(null),o=i.useRef(!1),s=i.useCallback(l=>{const a=r.current;if(!a)return;const c=a.getBoundingClientRect(),f=Math.max(0,Math.min(1,(l.clientX-c.left)/c.width));n(Math.round(f*360))},[n]);return i.useEffect(()=>{const l=c=>{o.current&&s(c)},a=()=>{o.current=!1};return document.addEventListener("mousemove",l),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}},[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:l=>{o.current=!0,s(l)},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),l=i.useCallback(u=>{const d=o.current;if(!d)return;const h=d.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&&l(h)},d=()=>{s.current=!1};return document.addEventListener("mousemove",u),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",d)}},[l]);const[a,c,f]=$t(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(${a},${c},${f},0), rgba(${a},${c},${f},1))`},onMouseDown:u=>{s.current=!0,l(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(${a},${c},${f},${t})`,pointerEvents:"none"}})})]})}function Vo({value:t,defaultValue:n="#3b82f6",onChange:r,format:o="hex",showAlpha:s=!1,presets:l=Wo,disabled:a=!1,size:c="md",placeholder:f,label:u,style:d}){const h=_.useTheme(),p=i.useRef(null),m=i.useRef(null),[y,k]=i.useState(!1),b=t!==void 0,[g,M]=i.useState(b&&t||n),j=b?t||n:g,[w,I]=i.useState(1),[v,N]=i.useState(j),[$,S]=i.useState({top:0,left:0}),[T,E,C]=yr(dt(j)?j:n),H=i.useCallback((Y,se=w)=>{dt(Y)&&(N(Y),b||M(Y),r==null||r(At(Y,se,o),o))},[w,b,o,r]);i.useEffect(()=>{b&&t&&dt(t)&&N(t)},[b,t]);const z=()=>{if(a)return;const Y=p.current;if(!Y)return;const se=Y.getBoundingClientRect(),ge=window.innerHeight-se.bottom>320?se.bottom+6:se.top-326;S({top:ge+window.scrollY,left:se.left+window.scrollX}),k(!0)};i.useEffect(()=>{if(!y)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)},[y]),i.useEffect(()=>{if(!y)return;const Y=se=>{se.key==="Escape"&&k(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[y]);const R=(Y,se)=>{const le=se/100,ge=Y/100,he=le*(1-ge/2),ye=he===0||he===1?0:(le-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=>{I(Y),r==null||r(At(j,Y,o),o)},D=Y=>{const se=Y.target.value;N(se),dt(se)&&H(se)},O=(Y,se)=>{const le=Math.max(0,Math.min(255,parseInt(se)||0)),[ge,he,ye]=$t(j),de=Y==="r"?Rt(le,he,ye):Y==="g"?Rt(ge,le,ye):Rt(ge,he,le);H(de)},P={sm:28,md:34,lg:40}[c],[W,K,ne]=$t(dt(j)?j:n),Z={display:"inline-flex",alignItems:"center",gap:"8px",height:`${P}px`,padding:"4px 10px 4px 6px",borderRadius:"8px",border:`1px solid ${h.border}`,backgroundColor:h.surface,cursor:a?"not-allowed":"pointer",opacity:a?.5:1,color:h.text,fontSize:"13px",fontFamily:"inherit",transition:"border-color 0.15s",...d},ie={width:`${P-8}px`,height:`${P-8}px`,borderRadius:"4px",backgroundColor:`rgba(${W},${K},${ne},${w})`,border:`1px solid ${h.border}`,flexShrink:0},fe={position:"absolute",top:$.top,left:$.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:a,"aria-label":`Color picker, current color ${j}`,"aria-haspopup":"dialog","aria-expanded":y,children:[e.jsx("div",{style:ie}),e.jsx("span",{style:{fontFamily:"monospace",fontSize:"12px",color:h.textMuted},children:f??At(dt(j)?j:n,w,o)})]}),y&&Le.createPortal(e.jsxs("div",{ref:m,style:fe,role:"dialog","aria-label":"Color picker",children:[e.jsx(Po,{hue:T,sat:E,bright:C,onChange:R}),e.jsx(Fo,{hue:T,onChange:B}),s&&e.jsx(Ho,{alpha:w,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},${w})`,border:`1px solid ${h.border}`}}),e.jsx("input",{style:pe,value:v,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:le=>O(Y,le.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(w*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%"})]})]}),l.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:l.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 l=o??"en-US";return n==="currency"?new Intl.NumberFormat(l,{style:"currency",currency:r??"USD",minimumFractionDigits:s??2,maximumFractionDigits:s??2}).format(t):n==="percent"?new Intl.NumberFormat(l,{style:"percent",minimumFractionDigits:s??0,maximumFractionDigits:s??0}).format(t/100):n==="decimal"||s!==void 0?new Intl.NumberFormat(l,{minimumFractionDigits:s??0,maximumFractionDigits:s??20}).format(t):String(t)}function yn({direction:t,isDisabled:n,btnW:r,height:o,primaryColor:s,borderColor:l,textMuted:a,iconSz:c,onStep:f}){const u=i.useRef(null),d=i.useRef(null),h=t==="inc"?1:-1,p=i.useCallback(()=>{f(h),u.current=setTimeout(()=>{d.current=setInterval(()=>f(h),60)},400)},[h,f]),m=i.useCallback(()=>{u.current&&(clearTimeout(u.current),u.current=null),d.current&&(clearInterval(d.current),d.current=null)},[]);i.useEffect(()=>()=>m(),[m]);const y=t==="inc";return e.jsx("button",{type:"button","aria-label":y?"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:y?void 0:`1px solid ${l}`,borderLeft:y?`1px solid ${l}`:void 0,cursor:n?"not-allowed":"pointer",color:n?a: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:y?e.jsxs("svg",{width:c,height:c,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:c,height:c,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:l=1,precision:a,prefix:c,suffix:f,format:u,currency:d,locale:h,clampOnBlur:p=!0,allowMouseWheel:m=!1,size:y="md",label:k,hint:b,isDisabled:g=!1,isReadOnly:M=!1,isInvalid:j=!1,errorMessage:w,id:I,className:v,style:N}){const $=_.useTheme(),S=i.useId(),T=I??S,E=`${T}-hint`,C=`${T}-error`,H=t!==void 0,[z,R]=i.useState(n),B=H?t:z,[V,D]=i.useState(!1),[O,L]=i.useState(""),P=Oo[y],W=j||!!w,K=W?$.danger:V?$.primary:$.border,ne=[b&&E,W&&C].filter(Boolean).join(" ")||void 0,Z=k?A.sanitizeString(k):void 0,ie=b?A.sanitizeString(b):void 0,fe=w?A.sanitizeString(w):void 0,pe=c?A.sanitizeString(c):void 0,te=f?A.sanitizeString(f):void 0,ce=i.useCallback(oe=>{const G=Dt(oe,a);H||R(G),r==null||r(G)},[H,r,a]),Y=i.useCallback(oe=>{if(g||M)return;const G=bn(Dt(B+oe*l,a),o,s);ce(G)},[g,M,B,l,a,o,s,ce]),se=()=>{D(!0),L(String(B))},le=()=>{D(!1);const oe=parseFloat(O);if(isNaN(oe)){r==null||r(null),L(String(B));return}let G=Dt(oe,a);p&&(G=bn(G,o,s)),ce(G)},ge=oe=>{L(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:_o(B,u,d,h,a),xe=(pe||te)&&!V;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-1 w-full"),v),style:N,children:[Z&&e.jsx("label",{htmlFor:T,className:x.tkx("text-sm font-medium font-sans"),style:{color:$.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?$.surfaceAlt:$.surface,opacity:g?.65:1,height:P.height},children:[e.jsx(yn,{direction:"dec",isDisabled:g||M,btnW:P.btnW,height:P.height,primaryColor:$.primary,borderColor:$.border,textMuted:$.textMuted,iconSz:P.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:P.px,fontSize:P.fontSize,color:$.textMuted,pointerEvents:"none",userSelect:"none"},children:pe}),e.jsx("input",{id:T,type:"text",inputMode:"decimal",value:V?O:de,readOnly:M,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:P.fontSize,fontFamily:"inherit",color:$.text,paddingLeft:xe&&pe?`calc(${P.px} + 1.2em)`:P.px,paddingRight:xe&&te?`calc(${P.px} + 1.2em)`:P.px,cursor:g?"not-allowed":M?"default":"text"},onFocus:se,onBlur:le,onChange:ge,onKeyDown:he,onWheel:ye}),xe&&te&&e.jsx("span",{style:{position:"absolute",right:P.px,fontSize:P.fontSize,color:$.textMuted,pointerEvents:"none",userSelect:"none"},children:te})]}),e.jsx(yn,{direction:"inc",isDisabled:g||M,btnW:P.btnW,height:P.height,primaryColor:$.primary,borderColor:$.border,textMuted:$.textMuted,iconSz:P.iconSz,onStep:Y})]}),ie&&!fe&&e.jsx("span",{id:E,className:x.tkx("text-xs"),style:{color:$.textMuted},children:ie}),fe&&e.jsxs("span",{id:C,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:$.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:l=!1,autoFocus:a=!1,isDisabled:c=!1,isInvalid:f=!1,errorMessage:u,hint:d,size:h="md",separator:p,separatorPosition:m,className:y,style:k}){const b=_.useTheme(),g=i.useId(),M=`${g}-hint`,j=`${g}-error`,w=n!==void 0,I=W=>{const K=W.split("").slice(0,t);for(;K.length<t;)K.push("");return K},[v,N]=i.useState(()=>I(w?n:"")),$=w?I(n):v,S=i.useRef([]),T=Yo[h],E=f||!!u,C=$.every(W=>W!==""),H=d?A.sanitizeString(d):void 0,z=u?A.sanitizeString(u):void 0,R=W=>E?b.danger:C?b.success:b.border;i.useEffect(()=>{var W;a&&((W=S.current[0])==null||W.focus())},[]);const B=i.useCallback(W=>{w||N(W);const K=W.join("");r==null||r(K),W.every(ne=>ne!=="")&&(o==null||o(K))},[w,r,o]),V=W=>{var ne;const K=Math.max(0,Math.min(t-1,W));(ne=S.current[K])==null||ne.focus()},D=W=>K=>{if(!c){if(K.key==="Backspace"){if(K.preventDefault(),$[W]!==""){const ne=[...$];ne[W]="",B(ne)}else if(W>0){const ne=[...$];ne[W-1]="",B(ne),V(W-1)}return}if(K.key==="Delete"){K.preventDefault();const ne=[...$];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}}},O=W=>K=>{if(c)return;const Z=K.target.value.slice(-1);if(!Z)return;const ie=kn(Z,s);if(!ie)return;const fe=[...$];fe[W]=ie,B(fe),W<t-1&&V(W+1)},L=W=>K=>{if(K.preventDefault(),c)return;const Z=K.clipboardData.getData("text").split("").map(pe=>kn(pe,s)).filter(Boolean);if(!Z.length)return;const ie=[...$];let fe=W;for(const pe of Z){if(fe>=t)break;ie[fe]=pe,fe++}B(ie),V(Math.min(fe,t-1))},P=[H&&M,E&&j].filter(Boolean).join(" ")||void 0;return e.jsxs("div",{className:x.cx(x.tkx("flex flex-col gap-2 w-fit"),y),style:k,children:[e.jsx("div",{role:"group","aria-label":"One-time password","aria-describedby":P,className:x.tkx("flex items-center"),style:{gap:T.gap},children:Array.from({length:t},(W,K)=>{const ne=R();return typeof document<"u"&&(document.activeElement,S.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:b.textMuted,userSelect:"none",flexShrink:0},children:p}),e.jsx("input",{ref:Z=>{S.current[K]=Z},type:l?"password":"text",inputMode:s==="number"?"numeric":"text",maxLength:1,value:$[K],disabled:c,"aria-label":`Digit ${K+1} of ${t}`,autoComplete:"one-time-code",spellCheck:!1,onChange:O(K),onKeyDown:D(K),onPaste:L(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:c?b.surfaceAlt:b.surface,color:b.text,outline:"none",boxShadow:"none",cursor:c?"not-allowed":"text",transition:"border-color 150ms ease, box-shadow 150ms ease",opacity:c?.6:1},onFocusCapture:Z=>{c||(Z.currentTarget.style.borderColor=E?b.danger:b.primary,Z.currentTarget.style.boxShadow=`0 0 0 3px ${E?b.danger:b.primary}33`)},onBlurCapture:Z=>{Z.currentTarget.style.borderColor=R(),Z.currentTarget.style.boxShadow="none"}})]},K)})}),H&&!z&&e.jsx("span",{id:M,className:x.tkx("text-xs"),style:{color:b.textMuted},children:H}),z&&e.jsxs("span",{id:j,role:"alert",className:x.tkx("text-xs flex items-center gap-1"),style:{color:b.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],l=o[o.length-1],a=c=>{c.key==="Tab"&&(c.shiftKey?document.activeElement===s&&(c.preventDefault(),l==null||l.focus()):document.activeElement===l&&(c.preventDefault(),s==null||s.focus()))};return r.addEventListener("keydown",a),()=>r.removeEventListener("keydown",a)},[t]),n}function Zo(){const[t,n]=i.useState(!1),r=i.useCallback(()=>n(!0),[]),o=i.useCallback(()=>n(!1),[]),s=i.useCallback(()=>n(l=>!l),[]);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 l=[];let a=0,c=-1,f=-1;for(let u=0;u<o.length&&a<r.length;u++)o[u]===r[a]&&((f===-1||u!==f+1)&&(c!==-1&&l.push([c,f]),c=u),f=u,a++);return c!==-1&&f!==-1&&l.push([c,f]),a<r.length?{matched:!1,ranges:[],score:0}:{matched:!0,ranges:l,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),l=o.description?Bt(t,o.description):{matched:!1,score:0},a=(o.keywords??[]).some(c=>Bt(t,c).matched);s.matched?r.push({item:o,score:s.score+20,labelRanges:s.ranges}):l.matched?r.push({item:o,score:l.score,labelRanges:[]}):a&&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[l,a]of n)s<l&&o.push(e.jsx("span",{children:t.slice(s,l)},`t-${s}`)),o.push(e.jsx("span",{style:{color:r,fontWeight:700},children:t.slice(l,a+1)},`h-${l}`)),s=a+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:l=8,onItemSelect:a,className:c,style:f}){const u=_.useTheme(),[d,h]=i.useState(""),[p,m]=i.useState(0),[y,k]=i.useState(!1),b=i.useRef(null),g=i.useRef(null),M=i.useId(),j=Xo(n),w=Go(d,t).slice(0,l),I=[];for(const C of w){const H=C.item.group,z=I.find(R=>R.group===H);z?z.items.push(C):I.push({group:H,items:[C]})}const v=I.flatMap(C=>C.items);Uo(()=>{r==null||r()},n),i.useEffect(()=>{n&&(h(""),m(0),setTimeout(()=>{var C;return(C=b.current)==null?void 0:C.focus()},30))},[n]),i.useEffect(()=>{p>=v.length&&m(Math.max(0,v.length-1))},[v.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"})},[]),$=C=>{if(C.key==="ArrowDown"){C.preventDefault();const H=Math.min(v.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=v[p];H&&S(H.item)}},S=C=>{var H;C.disabled||((H=C.onSelect)==null||H.call(C),a==null||a(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(d)}"`;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 Le.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:M,className:x.cx(c),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:b,type:"text",role:"combobox","aria-expanded":!0,"aria-autocomplete":"list","aria-controls":`${M}-list`,"aria-activedescendant":v[p]?`${M}-item-${v[p].item.id}`:void 0,value:d,onChange:C=>{h(C.target.value),m(0)},onKeyDown:$,placeholder:T,style:{flex:1,border:"none",background:"transparent",outline:"none",fontSize:16,fontFamily:"inherit",color:u.text}}),d&&e.jsx("button",{type:"button","aria-label":"Clear search",onClick:()=>{var C;h(""),m(0),(C=b.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:`${M}-list`,ref:g,role:"listbox","aria-label":"Command results",style:{overflowY:"auto",flex:1,padding:"6px 8px"},children:y?Array.from({length:4},(C,H)=>e.jsx(Qo,{surface:u.surface,border:u.border},H)):v.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})]}):I.map(({group:C,items:H},z)=>{const R=I.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=R+V,O=D===p,L=B.item;return e.jsxs("div",{id:`${M}-item-${L.id}`,role:"option","aria-selected":O,"aria-disabled":L.disabled,"data-command-item":!0,onClick:()=>S(L),onMouseEnter:()=>m(D),style:{display:"flex",alignItems:"center",gap:10,padding:"9px 12px",borderRadius:8,cursor:L.disabled?"not-allowed":"pointer",opacity:L.disabled?.45:1,backgroundColor:O?`${u.primary}18`:"transparent",borderLeft:O?`2px solid ${u.primary}`:"2px solid transparent",transition:"background 80ms ease",userSelect:"none"},children:[L.icon&&e.jsx("span",{style:{width:20,height:20,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",color:O?u.primary:u.textMuted},children:L.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:L.label,ranges:B.labelRanges,color:u.primary})}),L.description&&e.jsx("div",{style:{fontSize:"0.75rem",color:u.textMuted,marginTop:1,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:A.sanitizeString(L.description)})]}),L.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(L.shortcut)})]},L.id)})]},C??"__default__")})}),v.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:l}){const a=l==="vertical",c=t==="prev",f=s==="inside"?{position:"absolute",zIndex:3,...a?{[c?"top":"bottom"]:10,left:"50%",transform:"translateX(-50%)"}:{[c?"left":"right"]:10,top:"50%",transform:"translateY(-50%)"}}:{flexShrink:0,position:"relative"};return e.jsx("button",{type:"button","aria-label":c?"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:a?c?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"})}):c?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:l=!0,showDots:a=!0,showThumbnails:c=!1,orientation:f="horizontal",slidesToShow:u=1,gap:d=0,transitionDuration:h=400,swipeable:p=!0,initialIndex:m=0,onChange:y,arrowPosition:k="inside",height:b=320,className:g,style:M}){const j=_.useTheme(),w=J.useReducedMotion(),I=i.useId(),v=t.length,[N,$]=i.useState(m),[S,T]=i.useState(s?m+1:m),[E,C]=i.useState(!1),[H,z]=i.useState(!1),R=i.useRef(null),B=i.useRef(null),V=i.useRef(null),D=i.useRef(0),O=i.useRef(!1),L=f==="vertical",P=w?0:h,W=s&&v>1?[t[v-1],...t,t[0]]:t,K=W.length,ne=100/u,Z=(G,ue=0)=>{const ke=ue!==0?` - ${ue}px`:"";return L?`translateY(calc(-${G*ne}%${ke}))`:`translateX(calc(-${G*ne}%${ke}))`},ie=i.useCallback((G,ue=!1)=>{const ke=s?(G%v+v)%v:Math.max(0,Math.min(v-1,G)),ve=s?ke+1:ke;ue&&R.current?(R.current.style.transition="none",T(ve),$(ke),R.current.offsetHeight,R.current.style.transition=""):(C(!0),T(ve),$(ke)),y==null||y(ke)},[v,s,y]),fe=i.useCallback(()=>ie(N-1),[N,ie]),pe=i.useCallback(()=>ie(N+1),[N,ie]),te=i.useCallback(()=>{C(!1),!(!s||v<=1)&&(S===0?ie(v-1,!0):S===K-1&&ie(0,!0))},[s,v,S,K,ie]);i.useEffect(()=>{if(!(!n||H||v<=1))return B.current=setInterval(pe,r),()=>{B.current&&clearInterval(B.current)}},[n,H,r,pe,v]),i.useEffect(()=>{const G=ue=>{const ke=document.activeElement,ve=document.getElementById(I);ve!=null&&ve.contains(ke)&&(ue.key===(L?"ArrowUp":"ArrowLeft")&&(ue.preventDefault(),fe()),ue.key===(L?"ArrowDown":"ArrowRight")&&(ue.preventDefault(),pe()))};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[I,L,fe,pe]);const ce=G=>"touches"in G?L?G.touches[0].clientY:G.touches[0].clientX:L?G.clientY:G.clientX,Y=G=>{p&&(V.current=ce(G),D.current=0,O.current=!0)},se=G=>{if(!O.current||V.current===null)return;const ue=ce(G)-V.current;D.current=ue,R.current&&(R.current.style.transition="none",R.current.style.transform=Z(S,-ue))},le=()=>{if(!O.current)return;O.current=!1;const G=D.current,ue=50;R.current&&(R.current.style.transition="",R.current.style.transform=""),G<-ue?pe():G>ue?fe():R.current&&(R.current.style.transform=Z(S)),V.current=null,D.current=0},ge=typeof b=="number"?`${b}px`:b,he={display:"flex",flexDirection:L?"column":"row",width:L?"100%":`${K/u*100}%`,height:L?`${K/u*100}%`:"100%",transform:Z(S),transition:E||!w?`transform ${P}ms cubic-bezier(0.4, 0, 0.2, 1)`:"none",willChange:"transform",gap:d>0?d:void 0},ye={flexShrink:0,width:L?"100%":`${ne/(K/u)}%`,height:L?`${ne/(K/u)}%`:"100%",overflow:"hidden",position:"relative"},de=s||N>0,xe=s||N<v-1,oe=k==="outside";return e.jsxs("div",{id:I,className:x.cx(x.tkx("flex flex-col gap-2"),g),style:M,"aria-roledescription":"carousel","aria-label":"Content carousel",children:[e.jsxs("div",{className:x.tkx("flex items-center gap-2"),style:{gap:oe&&l?8:0},children:[l&&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?O.current?"grabbing":"grab":"default",userSelect:"none"},onMouseEnter:()=>o&&z(!0),onMouseLeave:()=>{z(!1),le()},onTouchStart:Y,onTouchMove:se,onTouchEnd:le,onMouseDown:Y,onMouseMove:se,onMouseUp:le,"aria-live":"polite","aria-atomic":"false",children:[l&&!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:R,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)+v)%v+1} of ${v}`,"aria-hidden":(ue-(s?1:0)+v)%v!==N,children:G.content},`${G.id}-${ue}`))}),a&&!c&&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))})]}),l&&oe&&e.jsx(Tt,{direction:"next",onClick:pe,isDisabled:!xe,primaryColor:j.primary,position:"outside",orientation:f})]}),c&&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=l=>{(l.key==="Enter"||l.key===" ")&&(l.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:l=>{l.currentTarget.style.backgroundColor=r},onMouseLeave:l=>{l.currentTarget.style.backgroundColor=n},children:"…"})}function ti({items:t,separator:n,maxItems:r,onNavigate:o,className:s,style:l}){const a=_.useTheme(),c=J.useReducedMotion(),f=r!==void 0&&r>1&&t.length>r,d=i.useCallback(()=>{if(!f||!r)return t.map((N,$)=>({item:N,originalIndex:$}));const j=Math.ceil((r-1)/2),w=r-1-j,I=t.slice(0,j).map((N,$)=>({item:N,originalIndex:$})),v=t.slice(t.length-w).map((N,$)=>({item:N,originalIndex:t.length-w+$}));return I.concat(v)},[t,r,f])(),h=f&&r?Math.ceil((r-1)/2):-1,p=(j,w)=>{o==null||o(j,w)},m=(j,w,I)=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),p(w,I))},y=c?{}:{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:a.textMuted})},j),b=(j,w,I)=>{const v=A.sanitizeString(j.label);if(I)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:a.text},children:[j.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:j.icon}),v]})},`item-${w}`);const N=!!j.href,$={color:a.textMuted,textDecoration:"none",...y},S={onMouseEnter:E=>{E.currentTarget.style.color=a.primary},onMouseLeave:E=>{E.currentTarget.style.color=a.textMuted}},T=e.jsxs(e.Fragment,{children:[j.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:j.icon}),v]});return N?e.jsx("li",{children:e.jsx("a",{href:j.href,onClick:E=>{o&&(E.preventDefault(),p(j,w))},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:{...$,focusRingColor:a.primary},...S,children:T})},`item-${w}`):e.jsx("li",{children:e.jsx("button",{type:"button",onClick:()=>p(j,w),onKeyDown:E=>m(E,j,w),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:$,...S,children:T})},`item-${w}`)},g=[];let M=!1;for(let j=0;j<d.length;j++){const{item:w,originalIndex:I}=d[j],v=I===t.length-1;f&&!M&&j===h&&(g.length>0&&g.push(k("sep-ellipsis-before")),g.push(e.jsx("li",{role:"presentation",children:e.jsx(ei,{onClick:()=>{},bgColor:a.surfaceAlt,hoverColor:a.surface,textColor:a.textMuted})},"ellipsis")),M=!0),g.length>0&&g[g.length-1]!==null&&g.push(k(`sep-${I}`)),g.push(b(w,I,v))}return e.jsx("nav",{"aria-label":"Breadcrumb",className:x.tkx("font-sans",s??""),style:{...l},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,l=window.scrollY,a=window.innerWidth,c=window.innerHeight;let f=0,u=0,d=r;const h={top:t.top-o.height-it-He>0,bottom:t.bottom+o.height+it+He<c,left:t.left-o.width-it-He>0,right:t.right+o.width+it+He<a};if(!h[r]){const m={top:"bottom",bottom:"top",left:"right",right:"left"};h[m[r]]&&(d=m[r])}switch(d){case"top":f=t.top+l-o.height-it-He,u=t.left+s+t.width/2-o.width/2;break;case"bottom":f=t.bottom+l+it+He,u=t.left+s+t.width/2-o.width/2;break;case"left":f=t.top+l+t.height/2-o.height/2,u=t.left+s-o.width-it-He;break;case"right":f=t.top+l+t.height/2-o.height/2,u=t.right+s+it+He;break}u=Math.max(8,Math.min(u,a+s-o.width-8)),f=Math.max(8,Math.min(f,c+l-o.height-8));const p={position:"absolute",width:0,height:0,borderStyle:"solid",borderWidth:He};switch(d){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:d}}function ri({trigger:t,content:n,placement:r="bottom",isOpen:o,onOpenChange:s,closeOnClickOutside:l=!0,className:a,style:c}){const f=_.useTheme(),u=J.useReducedMotion(),d=i.useId(),h=o!==void 0,[p,m]=i.useState(!1),y=h?o:p,k=i.useRef(null),b=i.useRef(null);i.useRef(null);const[g,M]=i.useState(null),j=i.useCallback($=>{h||m($),s==null||s($)},[h,s]),w=i.useCallback(()=>j(!1),[j]),I=i.useCallback(()=>j(!y),[j,y]);J.useEscapeKey(w,y),i.useEffect(()=>{if(!y||!l)return;const $=S=>{var E,C;const T=S.target;(E=k.current)!=null&&E.contains(T)||(C=b.current)!=null&&C.contains(T)||w()};return document.addEventListener("pointerdown",$),()=>document.removeEventListener("pointerdown",$)},[y,l,w]),i.useEffect(()=>{if(!y||!k.current)return;const $=()=>{if(!k.current||!b.current)return;const S=k.current.getBoundingClientRect();M(ni(S,b.current,r))};return requestAnimationFrame($),window.addEventListener("scroll",$,!0),window.addEventListener("resize",$),()=>{window.removeEventListener("scroll",$,!0),window.removeEventListener("resize",$)}},[y,r]);const v=u?{opacity:1}:{animation:"tkxPopoverFadeIn 150ms ease forwards",opacity:0},N=y&&typeof document<"u"?Le.createPortal(e.jsxs("div",{ref:b,id:d,role:"dialog","aria-modal":"false",className:x.tkx("absolute z-[9100] rounded-lg font-sans",a??""),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,...v,...c},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:I,onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),I())},"aria-expanded":y,"aria-haspopup":"dialog","aria-controls":y?d:void 0,children:t}),N,y&&!u&&e.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
|
|
72
|
+
`})]})}function si(t,n){if(!n)return!0;const r=n.toLowerCase(),o=t.label.toLowerCase();let s=0;for(let l=0;l<o.length&&s<r.length;l++)o[l]===r[s]&&s++;return s===r.length}function oi(t,n){const r=t.getBoundingClientRect(),o=4,s=window.innerHeight-r.bottom,l=r.top,a=s>=n+o||s>=l?"below":"above";return{top:a==="below"?r.bottom+window.scrollY+o:r.top+window.scrollY-n-o,left:r.left+window.scrollX,width:r.width,placement:a}}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:l,isLoading:a=!1,emptyMessage:c="No results found",filterFn:f,freeSolo:u=!1,className:d,style:h}){const p=_.useTheme(),m=J.useReducedMotion(),y=i.useId(),k=i.useId(),b=i.useRef(null),g=i.useRef(null),[M,j]=i.useState(""),[w,I]=i.useState(!1),[v,N]=i.useState(-1),[$,S]=i.useState(null);i.useEffect(()=>{if(n!==void 0){const L=t.find(P=>P.value===n);j(L?L.label:n)}},[n,t]);const T=f??si,E=i.useMemo(()=>w?t.filter(L=>T(L,M)):[],[t,M,w,T]),C=A.sanitizeString(l),H=A.sanitizeString(c);i.useEffect(()=>{if(!w||!g.current)return;const L=()=>{g.current&&S(oi(g.current,wn))};return L(),window.addEventListener("scroll",L,!0),window.addEventListener("resize",L),()=>{window.removeEventListener("scroll",L,!0),window.removeEventListener("resize",L)}},[w]),i.useEffect(()=>{if(!w)return;const L=P=>{var ne;const W=P.target;if((ne=g.current)!=null&&ne.contains(W))return;const K=document.getElementById(k);K!=null&&K.contains(W)||I(!1)};return document.addEventListener("pointerdown",L),()=>document.removeEventListener("pointerdown",L)},[w,k]),J.useEscapeKey(()=>I(!1),w);const z=i.useCallback(L=>{var P;L.disabled||(j(L.label),r==null||r(L.value),I(!1),N(-1),(P=b.current)==null||P.focus())},[r]),R=L=>{const P=L.target.value;j(P),o==null||o(P),w||I(!0),N(-1),u&&(r==null||r(P))},B=L=>{if(!w&&(L.key==="ArrowDown"||L.key==="ArrowUp")){I(!0);return}switch(L.key){case"ArrowDown":{L.preventDefault(),N(P=>{let W=P+1;for(;W<E.length&&E[W].disabled;)W++;return W<E.length?W:P});break}case"ArrowUp":{L.preventDefault(),N(P=>{let W=P-1;for(;W>=0&&E[W].disabled;)W--;return W>=0?W:P});break}case"Enter":{L.preventDefault(),v>=0&&v<E.length?z(E[v]):u&&M&&(r==null||r(M),I(!1));break}case"Escape":{I(!1),N(-1);break}}};i.useEffect(()=>{var P;if(v<0)return;const L=`${k}-opt-${v}`;(P=document.getElementById(L))==null||P.scrollIntoView({block:"nearest"})},[v,k]);const V=v>=0?`${k}-opt-${v}`:void 0,D=m?{}:{animation:"tkxAutoFadeIn 120ms ease forwards"},O=w&&typeof document<"u"&&$?Le.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:$.top,left:$.left,width:$.width,maxHeight:wn,backgroundColor:p.surface,border:`1px solid ${p.border}`,boxShadow:"0 8px 24px rgba(0,0,0,0.15)",...D},children:a?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((L,P)=>{const W=P===v,K=A.sanitizeString(L.label),ne=L.description?A.sanitizeString(L.description):null;return e.jsxs("li",{id:`${k}-opt-${P}`,role:"option","aria-selected":L.value===n,"aria-disabled":L.disabled||void 0,className:x.tkx("flex items-center gap-2 px-3 py-2 text-sm rounded-md cursor-pointer",L.disabled?"opacity-50 cursor-not-allowed":""),style:{backgroundColor:W?p.surfaceAlt:"transparent",color:L.disabled?p.textMuted:p.text,transition:m?"none":"background-color 100ms ease"},onMouseEnter:()=>!L.disabled&&N(P),onMouseDown:Z=>{Z.preventDefault(),z(L)},children:[L.icon&&e.jsx("span",{"aria-hidden":"true",className:x.tkx("flex-shrink-0"),children:L.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})]}),L.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"})})]},L.value)})}),document.body):null;return e.jsxs("div",{ref:g,className:x.tkx("relative font-sans",d??""),style:h,children:[e.jsx("label",{htmlFor:y,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 ${w?p.primary:p.border}`,borderRadius:8,transition:m?"none":"border-color 150ms ease"},children:[e.jsx("input",{ref:b,id:y,type:"text",role:"combobox","aria-expanded":w,"aria-controls":k,"aria-activedescendant":V,"aria-autocomplete":"list","aria-label":C,value:M,placeholder:s,onChange:R,onFocus:()=>I(!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}}),a&&e.jsx("span",{className:x.tkx("pr-3"),children:e.jsx(vn,{color:p.primary})})]}),O,w&&!m&&e.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 ii(t,n){const r=[];function o(s,l){var a;for(const c of s)r.push({node:c,depth:l}),(a=c.children)!=null&&a.length&&n.has(c.id)&&o(c.children,l+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 ai({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 wn=24;function ci({data:t,selected:n,onSelect:r,expanded:o,onExpand:s,multiSelect:l=!1,showCheckboxes:a=!1,showLines:c=!1,className:f,style:u}){const d=_.useTheme(),h=Q.useReducedMotion();i.useId();const[p,m]=i.useState([]),[y,k]=i.useState([]),b=new Set(n??p),g=new Set(o??y),M=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]),w=i.useCallback(E=>{const C=Array.from(g);g.has(E)?M(C.filter(H=>H!==E)):M([...C,E])},[g,M]),I=i.useCallback(E=>{if(l){const C=Array.from(b);b.has(E)?j(C.filter(H=>H!==E)):j([...C,E])}else j(b.has(E)?[]:[E])},[l,b,j]),v=ii(t,g),N=i.useRef(0),$=i.useRef(new Map),S=E=>{var C;N.current=E,(C=$.current.get(E))==null||C.focus()},T=(E,C)=>{var B;const H=v[C];if(!H)return;const{node:z}=H,R=(((B=z.children)==null?void 0:B.length)??0)>0;switch(E.key){case"ArrowDown":{E.preventDefault(),C<v.length-1&&S(C+1);break}case"ArrowUp":{E.preventDefault(),C>0&&S(C-1);break}case"ArrowRight":{E.preventDefault(),R&&!g.has(z.id)?w(z.id):R&&g.has(z.id)&&C<v.length-1&&S(C+1);break}case"ArrowLeft":{if(E.preventDefault(),R&&g.has(z.id))w(z.id);else for(let V=C-1;V>=0;V--)if(v[V].depth<H.depth){S(V);break}break}case"Enter":case" ":{E.preventDefault(),z.disabled||I(z.id);break}case"Home":{E.preventDefault(),S(0);break}case"End":{E.preventDefault(),S(v.length-1);break}}};return e.jsx("ul",{role:"tree","aria-label":"Tree view","aria-multiselectable":l||void 0,className:x.tkx("list-none m-0 p-0 font-sans select-none",f??""),style:{color:d.text,...u},children:v.map(({node:E,depth:C},H)=>{var D;const z=(((D=E.children)==null?void 0:D.length)??0)>0,R=g.has(E.id),B=b.has(E.id),V=A.sanitizeString(E.label);return e.jsxs("li",{role:"treeitem","aria-selected":B,"aria-expanded":z?R:void 0,"aria-disabled":E.disabled||void 0,"aria-level":C+1,"aria-setsize":v.filter(O=>O.depth===C).length,tabIndex:H===0?0:-1,ref:O=>{O?$.current.set(H,O):$.current.delete(H)},onKeyDown:O=>T(O,H),onClick:()=>{E.disabled||(z&&w(E.id),I(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*wn+8,backgroundColor:B?`${d.primary}18`:"transparent",transition:h?"none":"background-color 100ms ease",minHeight:32},onMouseEnter:O=>{!B&&!E.disabled&&(O.currentTarget.style.backgroundColor=d.surfaceAlt)},onMouseLeave:O=>{O.currentTarget.style.backgroundColor=B?`${d.primary}18`:"transparent"},children:[c&&C>0&&e.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:(C-1)*wn+16,top:0,bottom:0,width:1,backgroundColor:d.border}}),z?e.jsx("span",{role:"presentation",onClick:O=>{O.stopPropagation(),w(E.id)},className:x.tkx("inline-flex items-center justify-center cursor-pointer"),style:{width:20,height:20},children:e.jsx(li,{expanded:R,color:d.textMuted,reducedMotion:h})}):e.jsx("span",{style:{width:20,height:20},"aria-hidden":"true"}),a&&e.jsx(ai,{checked:B,color:d.primary,borderColor:d.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?d.textMuted:d.text},children:V})]},E.id)})})}const di={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 ui({items:t,orientation:n="horizontal",size:r="md",variant:o="default",ariaLabel:s="Toolbar",className:l,style:a}){const c=_.useTheme(),f=Q.useReducedMotion(),u=di[r],d=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 M;(M=h.current.get(g))==null||M.focus()},[]),y=i.useCallback((g,M)=>{const j=p.indexOf(M);if(j<0)return;const w=d?"ArrowRight":"ArrowDown",I=d?"ArrowLeft":"ArrowUp";switch(g.key){case w:{g.preventDefault();const v=j+1<p.length?j+1:0;m(p[v]);break}case I:{g.preventDefault();const v=j-1>=0?j-1:p.length-1;m(p[v]);break}case"Home":{g.preventDefault(),m(p[0]);break}case"End":{g.preventDefault(),m(p[p.length-1]);break}}},[p,m,d]),k=()=>{switch(o){case"outlined":return{backgroundColor:"transparent",border:`1px solid ${c.border}`};case"filled":return{backgroundColor:c.surfaceAlt,border:"none"};default:return{backgroundColor:c.surface,border:`1px solid ${c.border}`}}},b=g=>{g.type;const M=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:M?`${c.primary}20`:"transparent",color:M?c.primary:g.disabled?c.textMuted:c.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",d?"flex-row":"flex-col",l??""),style:{...k(),padding:u.gap,gap:u.gap,...a},children:t.map((g,M)=>{if(g.type==="separator")return e.jsx("div",{role:"separator","aria-orientation":d?"vertical":"horizontal",className:x.tkx("flex-shrink-0"),style:{...d?{width:1,height:u.separatorSize,marginLeft:2,marginRight:2}:{height:1,width:u.separatorSize,marginTop:2,marginBottom:2},backgroundColor:c.border}},g.id);const j=A.sanitizeString(g.label),w=!g.disabled,I=p[0]===g.id;return e.jsxs("button",{ref:v=>{v?h.current.set(g.id,v):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:w&&I?0:-1,disabled:g.disabled,onClick:()=>{var v;g.disabled||(v=g.onClick)==null||v.call(g)},onKeyDown:v=>{var N;y(v,g.id),(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),g.disabled||(N=g.onClick)==null||N.call(g))},className:x.tkx("focus-visible:ring-2 focus-visible:ring-offset-1"),style:b(g),onMouseEnter:v=>{!g.disabled&&!g.active&&(v.currentTarget.style.backgroundColor=c.surfaceAlt)},onMouseLeave:v=>{g.disabled||(v.currentTarget.style.backgroundColor=g.active?`${c.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 fi({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 jn({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 xi({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 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:"M13 8H3M7 4l-4 4 4 4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Sn({title:t,items:n,selected:r,onToggle:o,onToggleAll:s,search:l,onSearchChange:a,searchable:c,height:f,listId:u}){const d=_.useTheme(),h=Q.useReducedMotion(),p=A.sanitizeString(t),m=i.useMemo(()=>{if(!l)return n;const g=l.toLowerCase();return n.filter(M=>M.label.toLowerCase().includes(g))},[n,l]),y=m.filter(g=>!g.disabled),k=y.length>0&&y.every(g=>r.has(g.value));y.some(g=>r.has(g.value));const b=(g,M)=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),o(M))};return e.jsxs("div",{className:x.tkx("flex flex-col rounded-lg overflow-hidden flex-1 min-w-0"),style:{border:`1px solid ${d.border}`,backgroundColor:d.surface},children:[e.jsxs("div",{className:x.tkx("flex items-center gap-2 px-3 py-2 border-b"),style:{borderColor:d.border,backgroundColor:d.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(jn,{checked:k,primaryColor:d.primary,borderColor:d.border})}),e.jsx("span",{className:x.tkx("text-sm font-medium flex-1 truncate"),style:{color:d.text},children:p}),e.jsxs("span",{className:x.tkx("text-xs"),style:{color:d.textMuted},children:[r.size,"/",n.length]})]}),c&&e.jsxs("div",{className:x.tkx("flex items-center gap-1.5 px-3 py-1.5 border-b"),style:{borderColor:d.border},children:[e.jsx(fi,{color:d.textMuted}),e.jsx("input",{type:"text","aria-label":`Search ${p}`,value:l,onChange:g=>a(g.target.value),placeholder:"Search...",className:x.tkx("flex-1 bg-transparent border-none outline-none text-xs"),style:{color:d.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:d.textMuted},"aria-disabled":"true",children:"No items"}):m.map(g=>{const M=r.has(g.value),j=A.sanitizeString(g.label);return e.jsxs("li",{role:"option","aria-selected":M,"aria-disabled":g.disabled||void 0,tabIndex:0,onClick:()=>!g.disabled&&o(g.value),onKeyDown:w=>!g.disabled&&b(w,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?d.textMuted:d.text,backgroundColor:M?`${d.primary}10`:"transparent",transition:h?"none":"background-color 100ms ease"},onMouseEnter:w=>{!g.disabled&&!M&&(w.currentTarget.style.backgroundColor=d.surfaceAlt)},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=M?`${d.primary}10`:"transparent"},children:[e.jsx(jn,{checked:M,primaryColor:d.primary,borderColor:d.border}),e.jsx("span",{className:x.tkx("truncate"),children:j})]},g.value)})})]})}function hi({sourceItems:t,targetItems:n,onTransfer:r,sourceTitle:o="Available",targetTitle:s="Selected",searchable:l=!1,height:a=300,className:c,style:f}){const u=_.useTheme(),d=Q.useReducedMotion(),h=i.useId(),p=i.useId(),[m,y]=i.useState(new Set),[k,b]=i.useState(new Set),[g,M]=i.useState(""),[j,w]=i.useState(""),I=i.useCallback(C=>{y(H=>{const z=new Set(H);return z.has(C)?z.delete(C):z.add(C),z})},[]),v=i.useCallback(C=>{b(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));y(H?new Set:new Set(C))},[t,m]),$=i.useCallback(()=>{const C=n.filter(z=>!z.disabled).map(z=>z.value),H=C.every(z=>k.has(z));b(H?new Set:new Set(C))},[n,k]),S=i.useCallback(()=>{if(m.size===0)return;const C=t.filter(R=>m.has(R.value)&&!R.disabled),H=t.filter(R=>!m.has(R.value)||R.disabled),z=[...n,...C];r(H,z),y(new Set)},[t,n,m,r]),T=i.useCallback(()=>{if(k.size===0)return;const C=n.filter(R=>k.has(R.value)&&!R.disabled),H=n.filter(R=>!k.has(R.value)||R.disabled),z=[...t,...C];r(z,H),b(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:d?"none":"all 100ms ease",outline:"none"});return e.jsxs("div",{className:x.tkx("flex gap-3 font-sans","flex-col sm:flex-row",c??""),style:{color:u.text,...f},children:[e.jsx(Sn,{title:o,items:t,selected:m,onToggle:I,onToggleAll:N,search:g,onSearchChange:M,searchable:l,height:a,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:S,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),S())},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(xi,{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(pi,{color:u.text})})]}),e.jsx(Sn,{title:s,items:n,selected:k,onToggle:v,onToggleAll:$,search:j,onSearchChange:w,searchable:l,height:a,listId:p})]})}function mi({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 gi={"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 bi(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 yi(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 Mn=56,Tn=48,ki=64;function vi({actions:t,icon:n,direction:r="up",position:o="bottom-right",className:s,style:l}){const a=_.useTheme(),c=Q.useReducedMotion(),f=i.useId(),[u,d]=i.useState(!1),[h,p]=i.useState(-1),m=i.useRef(null),y=i.useRef(new Map),k=i.useCallback(()=>{d(w=>!w),p(-1)},[]),b=i.useCallback(()=>{d(!1),p(-1)},[]);Q.useEscapeKey(b,u),i.useEffect(()=>{if(!u)return;const w=I=>{var v;(v=m.current)!=null&&v.contains(I.target)||b()};return document.addEventListener("pointerdown",w),()=>document.removeEventListener("pointerdown",w)},[u,b]),i.useEffect(()=>{var w;h>=0&&((w=y.current.get(h))==null||w.focus())},[h]);const g=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),k()),u&&((w.key==="ArrowUp"||w.key==="ArrowLeft")&&(w.preventDefault(),p(0)),(w.key==="ArrowDown"||w.key==="ArrowRight")&&(w.preventDefault(),p(0)))},M=(w,I)=>{var v,N;switch(w.key){case"ArrowUp":case"ArrowLeft":{w.preventDefault(),p(I>0?I-1:t.length-1);break}case"ArrowDown":case"ArrowRight":{w.preventDefault(),p(I<t.length-1?I+1:0);break}case"Enter":case" ":{w.preventDefault(),(N=(v=t[I]).onClick)==null||N.call(v),b();break}case"Escape":{b();break}case"Home":{w.preventDefault(),p(0);break}case"End":{w.preventDefault(),p(t.length-1);break}}},j=w=>c?"0ms":`${w*40}ms`;return e.jsxs(e.Fragment,{children:[u&&typeof document<"u"&&Le.createPortal(e.jsx("div",{"aria-hidden":"true",onClick:b,style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.3)",zIndex:9e3,transition:c?"none":"opacity 200ms ease"}}),document.body),e.jsxs("div",{ref:m,className:x.tkx("fixed z-[9100] font-sans",s??""),style:{...gi[o],...l},children:[u&&t.map((w,I)=>{const v=A.sanitizeString(w.label),N=bi(r,I,ki),$=yi(r);return e.jsx("div",{className:x.tkx("absolute"),style:{...N,opacity:c?1:0,animation:c?"none":"tkxSpeedDialIn 180ms ease forwards",animationDelay:j(I)},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:{...$,backgroundColor:a.surfaceAlt,color:a.text,border:`1px solid ${a.border}`,boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},role:"tooltip",children:v}),e.jsx("button",{ref:S=>{S?y.current.set(I,S):y.current.delete(I)},type:"button","aria-label":v,tabIndex:u?0:-1,onClick:()=>{var S;(S=w.onClick)==null||S.call(w),b()},onKeyDown:S=>M(S,I),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:Tn,height:Tn,backgroundColor:a.surface,color:a.text,border:`1px solid ${a.border}`,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",transition:c?"none":"all 150ms ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=a.surfaceAlt,S.currentTarget.style.transform="scale(1.1)"},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=a.surface,S.currentTarget.style.transform="scale(1)"},children:w.icon})]})},w.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:Mn,height:Mn,backgroundColor:a.primary,color:a.bg,boxShadow:`0 6px 20px ${a.primary}40`,transition:c?"none":"all 200ms ease",position:"relative",zIndex:1},onMouseEnter:w=>{w.currentTarget.style.boxShadow=`0 8px 28px ${a.primary}60`,c||(w.currentTarget.style.transform="scale(1.05)")},onMouseLeave:w=>{w.currentTarget.style.boxShadow=`0 6px 20px ${a.primary}40`,w.currentTarget.style.transform="scale(1)"},children:n??e.jsx(mi,{color:a.bg,rotated:u,reducedMotion:c})}),e.jsx("div",{id:f,role:"menu","aria-label":"Speed dial actions",style:{display:"none"},children:t.map(w=>e.jsx("div",{role:"menuitem",children:A.sanitizeString(w.label)},w.id))})]}),u&&!c&&e.jsx("style",{children:`
|
|
77
|
+
`})]})}function li(t,n){const r=[];function o(s,l){var a;for(const c of s)r.push({node:c,depth:l}),(a=c.children)!=null&&a.length&&n.has(c.id)&&o(c.children,l+1)}return o(t,0),r}function ai({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:l=!1,showCheckboxes:a=!1,showLines:c=!1,className:f,style:u}){const d=_.useTheme(),h=J.useReducedMotion();i.useId();const[p,m]=i.useState([]),[y,k]=i.useState([]),b=new Set(n??p),g=new Set(o??y),M=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]),w=i.useCallback(E=>{const C=Array.from(g);g.has(E)?M(C.filter(H=>H!==E)):M([...C,E])},[g,M]),I=i.useCallback(E=>{if(l){const C=Array.from(b);b.has(E)?j(C.filter(H=>H!==E)):j([...C,E])}else j(b.has(E)?[]:[E])},[l,b,j]),v=li(t,g),N=i.useRef(0),$=i.useRef(new Map),S=E=>{var C;N.current=E,(C=$.current.get(E))==null||C.focus()},T=(E,C)=>{var B;const H=v[C];if(!H)return;const{node:z}=H,R=(((B=z.children)==null?void 0:B.length)??0)>0;switch(E.key){case"ArrowDown":{E.preventDefault(),C<v.length-1&&S(C+1);break}case"ArrowUp":{E.preventDefault(),C>0&&S(C-1);break}case"ArrowRight":{E.preventDefault(),R&&!g.has(z.id)?w(z.id):R&&g.has(z.id)&&C<v.length-1&&S(C+1);break}case"ArrowLeft":{if(E.preventDefault(),R&&g.has(z.id))w(z.id);else for(let V=C-1;V>=0;V--)if(v[V].depth<H.depth){S(V);break}break}case"Enter":case" ":{E.preventDefault(),z.disabled||I(z.id);break}case"Home":{E.preventDefault(),S(0);break}case"End":{E.preventDefault(),S(v.length-1);break}}};return e.jsx("ul",{role:"tree","aria-label":"Tree view","aria-multiselectable":l||void 0,className:x.tkx("list-none m-0 p-0 font-sans select-none",f??""),style:{color:d.text,...u},children:v.map(({node:E,depth:C},H)=>{var D;const z=(((D=E.children)==null?void 0:D.length)??0)>0,R=g.has(E.id),B=b.has(E.id),V=A.sanitizeString(E.label);return e.jsxs("li",{role:"treeitem","aria-selected":B,"aria-expanded":z?R:void 0,"aria-disabled":E.disabled||void 0,"aria-level":C+1,"aria-setsize":v.filter(O=>O.depth===C).length,tabIndex:H===0?0:-1,ref:O=>{O?$.current.set(H,O):$.current.delete(H)},onKeyDown:O=>T(O,H),onClick:()=>{E.disabled||(z&&w(E.id),I(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?`${d.primary}18`:"transparent",transition:h?"none":"background-color 100ms ease",minHeight:32},onMouseEnter:O=>{!B&&!E.disabled&&(O.currentTarget.style.backgroundColor=d.surfaceAlt)},onMouseLeave:O=>{O.currentTarget.style.backgroundColor=B?`${d.primary}18`:"transparent"},children:[c&&C>0&&e.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:(C-1)*jn+16,top:0,bottom:0,width:1,backgroundColor:d.border}}),z?e.jsx("span",{role:"presentation",onClick:O=>{O.stopPropagation(),w(E.id)},className:x.tkx("inline-flex items-center justify-center cursor-pointer"),style:{width:20,height:20},children:e.jsx(ai,{expanded:R,color:d.textMuted,reducedMotion:h})}):e.jsx("span",{style:{width:20,height:20},"aria-hidden":"true"}),a&&e.jsx(ci,{checked:B,color:d.primary,borderColor:d.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?d.textMuted:d.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:l,style:a}){const c=_.useTheme(),f=J.useReducedMotion(),u=ui[r],d=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 M;(M=h.current.get(g))==null||M.focus()},[]),y=i.useCallback((g,M)=>{const j=p.indexOf(M);if(j<0)return;const w=d?"ArrowRight":"ArrowDown",I=d?"ArrowLeft":"ArrowUp";switch(g.key){case w:{g.preventDefault();const v=j+1<p.length?j+1:0;m(p[v]);break}case I:{g.preventDefault();const v=j-1>=0?j-1:p.length-1;m(p[v]);break}case"Home":{g.preventDefault(),m(p[0]);break}case"End":{g.preventDefault(),m(p[p.length-1]);break}}},[p,m,d]),k=()=>{switch(o){case"outlined":return{backgroundColor:"transparent",border:`1px solid ${c.border}`};case"filled":return{backgroundColor:c.surfaceAlt,border:"none"};default:return{backgroundColor:c.surface,border:`1px solid ${c.border}`}}},b=g=>{g.type;const M=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:M?`${c.primary}20`:"transparent",color:M?c.primary:g.disabled?c.textMuted:c.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",d?"flex-row":"flex-col",l??""),style:{...k(),padding:u.gap,gap:u.gap,...a},children:t.map((g,M)=>{if(g.type==="separator")return e.jsx("div",{role:"separator","aria-orientation":d?"vertical":"horizontal",className:x.tkx("flex-shrink-0"),style:{...d?{width:1,height:u.separatorSize,marginLeft:2,marginRight:2}:{height:1,width:u.separatorSize,marginTop:2,marginBottom:2},backgroundColor:c.border}},g.id);const j=A.sanitizeString(g.label),w=!g.disabled,I=p[0]===g.id;return e.jsxs("button",{ref:v=>{v?h.current.set(g.id,v):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:w&&I?0:-1,disabled:g.disabled,onClick:()=>{var v;g.disabled||(v=g.onClick)==null||v.call(g)},onKeyDown:v=>{var N;y(v,g.id),(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),g.disabled||(N=g.onClick)==null||N.call(g))},className:x.tkx("focus-visible:ring-2 focus-visible:ring-offset-1"),style:b(g),onMouseEnter:v=>{!g.disabled&&!g.active&&(v.currentTarget.style.backgroundColor=c.surfaceAlt)},onMouseLeave:v=>{g.disabled||(v.currentTarget.style.backgroundColor=g.active?`${c.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:l,onSearchChange:a,searchable:c,height:f,listId:u}){const d=_.useTheme(),h=J.useReducedMotion(),p=A.sanitizeString(t),m=i.useMemo(()=>{if(!l)return n;const g=l.toLowerCase();return n.filter(M=>M.label.toLowerCase().includes(g))},[n,l]),y=m.filter(g=>!g.disabled),k=y.length>0&&y.every(g=>r.has(g.value));y.some(g=>r.has(g.value));const b=(g,M)=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),o(M))};return e.jsxs("div",{className:x.tkx("flex flex-col rounded-lg overflow-hidden flex-1 min-w-0"),style:{border:`1px solid ${d.border}`,backgroundColor:d.surface},children:[e.jsxs("div",{className:x.tkx("flex items-center gap-2 px-3 py-2 border-b"),style:{borderColor:d.border,backgroundColor:d.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:d.primary,borderColor:d.border})}),e.jsx("span",{className:x.tkx("text-sm font-medium flex-1 truncate"),style:{color:d.text},children:p}),e.jsxs("span",{className:x.tkx("text-xs"),style:{color:d.textMuted},children:[r.size,"/",n.length]})]}),c&&e.jsxs("div",{className:x.tkx("flex items-center gap-1.5 px-3 py-1.5 border-b"),style:{borderColor:d.border},children:[e.jsx(xi,{color:d.textMuted}),e.jsx("input",{type:"text","aria-label":`Search ${p}`,value:l,onChange:g=>a(g.target.value),placeholder:"Search...",className:x.tkx("flex-1 bg-transparent border-none outline-none text-xs"),style:{color:d.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:d.textMuted},"aria-disabled":"true",children:"No items"}):m.map(g=>{const M=r.has(g.value),j=A.sanitizeString(g.label);return e.jsxs("li",{role:"option","aria-selected":M,"aria-disabled":g.disabled||void 0,tabIndex:0,onClick:()=>!g.disabled&&o(g.value),onKeyDown:w=>!g.disabled&&b(w,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?d.textMuted:d.text,backgroundColor:M?`${d.primary}10`:"transparent",transition:h?"none":"background-color 100ms ease"},onMouseEnter:w=>{!g.disabled&&!M&&(w.currentTarget.style.backgroundColor=d.surfaceAlt)},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=M?`${d.primary}10`:"transparent"},children:[e.jsx(Sn,{checked:M,primaryColor:d.primary,borderColor:d.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:l=!1,height:a=300,className:c,style:f}){const u=_.useTheme(),d=J.useReducedMotion(),h=i.useId(),p=i.useId(),[m,y]=i.useState(new Set),[k,b]=i.useState(new Set),[g,M]=i.useState(""),[j,w]=i.useState(""),I=i.useCallback(C=>{y(H=>{const z=new Set(H);return z.has(C)?z.delete(C):z.add(C),z})},[]),v=i.useCallback(C=>{b(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));y(H?new Set:new Set(C))},[t,m]),$=i.useCallback(()=>{const C=n.filter(z=>!z.disabled).map(z=>z.value),H=C.every(z=>k.has(z));b(H?new Set:new Set(C))},[n,k]),S=i.useCallback(()=>{if(m.size===0)return;const C=t.filter(R=>m.has(R.value)&&!R.disabled),H=t.filter(R=>!m.has(R.value)||R.disabled),z=[...n,...C];r(H,z),y(new Set)},[t,n,m,r]),T=i.useCallback(()=>{if(k.size===0)return;const C=n.filter(R=>k.has(R.value)&&!R.disabled),H=n.filter(R=>!k.has(R.value)||R.disabled),z=[...t,...C];r(z,H),b(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:d?"none":"all 100ms ease",outline:"none"});return e.jsxs("div",{className:x.tkx("flex gap-3 font-sans","flex-col sm:flex-row",c??""),style:{color:u.text,...f},children:[e.jsx(Mn,{title:o,items:t,selected:m,onToggle:I,onToggleAll:N,search:g,onSearchChange:M,searchable:l,height:a,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:S,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),S())},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:v,onToggleAll:$,search:j,onSearchChange:w,searchable:l,height:a,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:l}){const a=_.useTheme(),c=J.useReducedMotion(),f=i.useId(),[u,d]=i.useState(!1),[h,p]=i.useState(-1),m=i.useRef(null),y=i.useRef(new Map),k=i.useCallback(()=>{d(w=>!w),p(-1)},[]),b=i.useCallback(()=>{d(!1),p(-1)},[]);J.useEscapeKey(b,u),i.useEffect(()=>{if(!u)return;const w=I=>{var v;(v=m.current)!=null&&v.contains(I.target)||b()};return document.addEventListener("pointerdown",w),()=>document.removeEventListener("pointerdown",w)},[u,b]),i.useEffect(()=>{var w;h>=0&&((w=y.current.get(h))==null||w.focus())},[h]);const g=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),k()),u&&((w.key==="ArrowUp"||w.key==="ArrowLeft")&&(w.preventDefault(),p(0)),(w.key==="ArrowDown"||w.key==="ArrowRight")&&(w.preventDefault(),p(0)))},M=(w,I)=>{var v,N;switch(w.key){case"ArrowUp":case"ArrowLeft":{w.preventDefault(),p(I>0?I-1:t.length-1);break}case"ArrowDown":case"ArrowRight":{w.preventDefault(),p(I<t.length-1?I+1:0);break}case"Enter":case" ":{w.preventDefault(),(N=(v=t[I]).onClick)==null||N.call(v),b();break}case"Escape":{b();break}case"Home":{w.preventDefault(),p(0);break}case"End":{w.preventDefault(),p(t.length-1);break}}},j=w=>c?"0ms":`${w*40}ms`;return e.jsxs(e.Fragment,{children:[u&&typeof document<"u"&&Le.createPortal(e.jsx("div",{"aria-hidden":"true",onClick:b,style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.3)",zIndex:9e3,transition:c?"none":"opacity 200ms ease"}}),document.body),e.jsxs("div",{ref:m,className:x.tkx("fixed z-[9100] font-sans",s??""),style:{...bi[o],...l},children:[u&&t.map((w,I)=>{const v=A.sanitizeString(w.label),N=yi(r,I,vi),$=ki(r);return e.jsx("div",{className:x.tkx("absolute"),style:{...N,opacity:c?1:0,animation:c?"none":"tkxSpeedDialIn 180ms ease forwards",animationDelay:j(I)},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:{...$,backgroundColor:a.surfaceAlt,color:a.text,border:`1px solid ${a.border}`,boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},role:"tooltip",children:v}),e.jsx("button",{ref:S=>{S?y.current.set(I,S):y.current.delete(I)},type:"button","aria-label":v,tabIndex:u?0:-1,onClick:()=>{var S;(S=w.onClick)==null||S.call(w),b()},onKeyDown:S=>M(S,I),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:a.surface,color:a.text,border:`1px solid ${a.border}`,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",transition:c?"none":"all 150ms ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=a.surfaceAlt,S.currentTarget.style.transform="scale(1.1)"},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=a.surface,S.currentTarget.style.transform="scale(1)"},children:w.icon})]})},w.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:a.primary,color:a.bg,boxShadow:`0 6px 20px ${a.primary}40`,transition:c?"none":"all 200ms ease",position:"relative",zIndex:1},onMouseEnter:w=>{w.currentTarget.style.boxShadow=`0 8px 28px ${a.primary}60`,c||(w.currentTarget.style.transform="scale(1.05)")},onMouseLeave:w=>{w.currentTarget.style.boxShadow=`0 6px 20px ${a.primary}40`,w.currentTarget.style.transform="scale(1)"},children:n??e.jsx(gi,{color:a.bg,rotated:u,reducedMotion:c})}),e.jsx("div",{id:f,role:"menu","aria-label":"Speed dial actions",style:{display:"none"},children:t.map(w=>e.jsx("div",{role:"menuitem",children:A.sanitizeString(w.label)},w.id))})]}),u&&!c&&e.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
|
|
82
|
+
`})]})}const $n=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<$n);return i.useEffect(()=>{if(typeof window>"u")return;const r=()=>n(window.innerWidth<$n);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),t}function Ti({title:t,logo:n,actions:r,navigation:o,position:s="sticky",variant:l="default",color:a="surface"}){const c=_.useTheme(),f=J.useReducedMotion(),u=Mi(),[d,h]=i.useState(!1),p=i.useRef(null),m=i.useId();J.useEscapeKey(()=>h(!1),d),i.useEffect(()=>{!u&&d&&h(!1)},[u,d]),i.useEffect(()=>{if(!d)return;const I=v=>{p.current&&!p.current.contains(v.target)&&h(!1)};return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[d]);const y=i.useCallback(()=>{h(I=>!I)},[]),k=a==="primary"?c.primary:c.surface,b=a==="primary"?c.bg:c.text,g={default:{backgroundColor:k,borderBottom:`1px solid ${c.border}`},transparent:{backgroundColor:"transparent",borderBottom:"none"},elevated:{backgroundColor:k,boxShadow:`0 2px 8px ${c.bg}66`,borderBottom:"none"}},M={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,w=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:{...M[s],...g[l],color:b,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:b},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:y,"aria-expanded":d,"aria-controls":m,"aria-label":d?"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:b},children:e.jsx(Si,{open:d})})]}),u&&o&&e.jsx("nav",{id:m,"aria-label":"Main navigation",style:{maxHeight:d?400:0,opacity:d?1:0,overflow:"hidden",transition:w,backgroundColor:c.surface,borderBottom:d?`1px solid ${c.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,$i=56;let In=!1;function Ii(){if(In||typeof document>"u")return;In=!0;const t=document.createElement("style");t.id="tkx-bottom-nav-kf",t.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
|
|
88
|
+
`,document.head.appendChild(t)}function zi({items:t,activeId:n,onChange:r,showLabels:o=!0}){const s=_.useTheme(),l=J.useReducedMotion(),a=i.useRef(null);i.useEffect(()=>{Ii()},[]);const c=t.slice(0,Ci),f=i.useCallback(h=>{r==null||r(h)},[r]),u=i.useCallback(h=>{const p=a.current;if(!p)return;const m=Array.from(p.querySelectorAll('[role="tab"]')),y=m.findIndex(b=>b===document.activeElement);if(y===-1)return;let k=y;h.key==="ArrowRight"||h.key==="ArrowDown"?(h.preventDefault(),k=(y+1)%m.length):h.key==="ArrowLeft"||h.key==="ArrowUp"?(h.preventDefault(),k=(y-1+m.length)%m.length):h.key==="Home"?(h.preventDefault(),k=0):h.key==="End"&&(h.preventDefault(),k=m.length-1),k!==y&&(m[k].focus(),f(c[k].id))},[f,c]),d=l?"none":"color 200ms ease, transform 150ms ease";return e.jsx("nav",{ref:a,role:"navigation","aria-label":"Bottom navigation",className:x.tkx("fixed bottom-0 left-0 right-0 z-[1000] font-sans"),style:{height:$i,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:c.map(h=>{const p=h.id===n,m=A.sanitizeString(h.label),y=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:y,transition:d,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:l?"none":"width 200ms ease"}}),e.jsxs("div",{className:x.tkx("relative flex items-center justify-center"),style:{animation:p&&!l?"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=`
|
|
89
89
|
@keyframes tkx-snackbar-slide-up {
|
|
90
90
|
from { opacity: 0; transform: translateY(24px); }
|
|
91
91
|
to { opacity: 1; transform: translateY(0); }
|
|
@@ -98,27 +98,27 @@
|
|
|
98
98
|
from { opacity: 1; }
|
|
99
99
|
to { opacity: 0; transform: translateY(8px); }
|
|
100
100
|
}
|
|
101
|
-
`,document.head.appendChild(t)}const
|
|
102
|
-
`)?`"${n.replace(/"/g,'""')}"`:n}function
|
|
103
|
-
`),re=new Blob([
|
|
101
|
+
`,document.head.appendChild(t)}const Li={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"})})},Ri={"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:l="bottom-center",autoHideDuration:a=Ei,icon:c}){const f=_.useTheme(),u=J.useReducedMotion(),d=i.useId(),h=i.useRef(null),[p,m]=i.useState(!1),[y,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 S=setTimeout(()=>{m(!1),k(!1)},250);return()=>clearTimeout(S)}},[n,u,p]),i.useEffect(()=>{if(!(!n||a<=0||!r))return h.current=setTimeout(()=>{r()},a),()=>{h.current&&clearTimeout(h.current)}},[n,a,r]);const b=i.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),g=i.useCallback(()=>{n&&a>0&&r&&(h.current=setTimeout(()=>r(),a))},[n,a,r]),j={default:f.textMuted,success:f.success,error:f.danger,warning:f.warning,info:f.info}[s],w=A.sanitizeString(t);if(!p||typeof document>"u")return null;const v=l==="top-center"?"tkx-snackbar-slide-down":"tkx-snackbar-slide-up";let N={};u||(y?N={animation:"tkx-snackbar-fade-out 250ms ease forwards"}:N={animation:`${v} 250ms cubic-bezier(0.16,1,0.3,1) both`});const $=c??Li[s]??null;return Le.createPortal(e.jsx("div",{role:s==="error"?"alert":"status","aria-live":s==="error"?"assertive":"polite","aria-atomic":"true","aria-labelledby":d,className:x.tkx("fixed z-[9500] font-sans"),style:{...Ri[l],...N,pointerEvents:"auto"},onMouseEnter:b,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:[$&&e.jsx("span",{className:x.tkx("shrink-0 flex items-center"),style:{color:j},children:$}),e.jsx("span",{id:d,className:x.tkx("flex-1 text-sm leading-snug"),children:w}),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=_.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 Ln(t){const n=String(t??"");return n.includes(",")||n.includes('"')||n.includes(`
|
|
102
|
+
`)?`"${n.replace(/"/g,'""')}"`:n}function Wi({colCount:t}){const n=_.useTheme();return e.jsx("tbody",{children:Array.from({length:5},(r,o)=>e.jsx("tr",{children:Array.from({length:t},(s,l)=>e.jsx("td",{className:x.tkx("px-3 py-2"),style:{borderBottom:`1px solid ${n.border}`},children:e.jsx(xt,{height:16})},l))},o))})}function Pi({label:t,showExport:n,onExport:r,totalRows:o,selectedCount:s,theme:l}){return!n&&s===0?null:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderBottom:`1px solid ${l.border}`,backgroundColor:l.surface,gap:8},children:[e.jsx("span",{style:{fontSize:13,color:l.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 ${l.border}`,backgroundColor:"transparent",color:l.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 Fi({page:t,totalPages:n,pageSize:r,totalRows:o,onPageChange:s,theme:l}){const a=(t-1)*r+1,c=Math.min(t*r,o),f={display:"inline-flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:6,border:`1px solid ${l.border}`,backgroundColor:"transparent",color:l.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 ${l.border}`,backgroundColor:l.surface,gap:8,flexWrap:"wrap"},role:"navigation","aria-label":"Pagination",children:[e.jsx("span",{style:{fontSize:13,color:l.textMuted},children:o===0?"0 rows":`${a}–${c} 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,d)=>{let h=d+1;if(n>5){const p=Math.floor(2.5);h=Math.max(1,Math.min(t-p,n-4))+d}return e.jsx("button",{onClick:()=>s(h),"aria-label":`Page ${h}`,"aria-current":h===t?"page":void 0,style:{...f,backgroundColor:h===t?l.primary:"transparent",color:h===t?l.bg:l.text,borderColor:h===t?l.primary:l.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:l,sortable:a=!1,onSort:c,loading:f=!1,emptyMessage:u="No data to display",stickyHeader:d=!1,striped:h=!1,bordered:p=!1,compact:m=!1,maxHeight:y,onRowClick:k,virtualScroll:b,rowHeight:g=40,showFilters:M=!1,filterValues:j,onFilterChange:w,pageSize:I=0,showExport:v=!1,exportFileName:N="export",onLoadMore:$,hasMore:S,loadingMore:T=!1,loadMoreThreshold:E=200}){const C=_.useTheme(),H=J.useReducedMotion(),z=i.useId(),[R,B]=i.useState(null),[V,D]=i.useState("asc"),O=i.useCallback(q=>{const F=R===q&&V==="asc"?"desc":"asc";B(q),D(F),c==null||c(q,F)},[R,V,c]),L=i.useMemo(()=>c||!R?n:[...n].sort((q,F)=>{const Q=bt(q,R),re=bt(F,R),ae=Bi(Q,re);return V==="asc"?ae:-ae}),[n,R,V,c]),[P,W]=i.useState({}),K=j??P,ne=i.useCallback((q,F)=>{w?w(q,F):W(Q=>({...Q,[q]:F}))},[w]),Z=i.useMemo(()=>{const q=Object.entries(K).filter(([,F])=>F.trim()!=="");return q.length===0?L:L.filter(F=>q.every(([Q,re])=>{const ae=bt(F,Q);return String(ae??"").toLowerCase().includes(re.toLowerCase())}))},[L,K]),[ie,fe]=i.useState(1),pe=I>0,te=Z.length,ce=pe?Math.max(1,Math.ceil(te/I)):1;i.useEffect(()=>{fe(1)},[K,R,V]);const Y=i.useMemo(()=>pe?Z.slice((ie-1)*I,ie*I):Z,[Z,pe,ie,I]),se=10,le=b!==void 0?b:!pe&&y!==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(!le||!ge.current)return;const q=ge.current;xe(q.clientHeight);const F=new ResizeObserver(()=>xe(q.clientHeight));return F.observe(q),()=>F.disconnect()},[le]),Y.length*g;const G=le?Math.max(0,Math.floor(he/g)-se):0,ue=le?Math.min(Y.length,Math.ceil((he+de)/g)+se):Y.length,ke=le?Y.slice(G,ue):Y,ve=G*g,Me=i.useRef(null),$e=i.useRef(!1);i.useEffect(()=>{$e.current=!1},[n.length]),i.useEffect(()=>{if(!$)return;const q=Me.current;if(!q)return;const F=new IntersectionObserver(Q=>{Q[0].isIntersecting&&!$e.current&&S!==!1&&($e.current=!0,$())},{root:ge.current,rootMargin:`0px 0px ${E}px 0px`,threshold:0});return F.observe(q),()=>F.disconnect()},[$,S,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(()=>{l==null||l(ze?[]:Te)},[ze,Te,l]),Pe=i.useCallback(q=>{const F=We.has(q)?s.filter(Q=>Q!==q):[...s,q];l==null||l(F)},[We,s,l]),[Oe,Ge]=i.useState({}),Ee=i.useRef(null),qe=i.useCallback((q,F)=>{F.preventDefault(),F.stopPropagation();const Q=F.target.closest("th");if(!Q)return;const re=Oe[q]||Q.getBoundingClientRect().width;Ee.current={key:q,startX:F.clientX,startWidth:re};const ae=Ie=>{if(!Ee.current)return;const we=Math.max(50,Ee.current.startWidth+Ie.clientX-Ee.current.startX);Ge(_e=>({..._e,[Ee.current.key]:we}))},Ce=()=>{Ee.current=null,document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",Ce)};document.addEventListener("mousemove",ae),document.addEventListener("mouseup",Ce)},[Oe]),rt=i.useCallback(()=>{const q=t.map(Ie=>Ln(Ie.header)).join(","),F=Z.map(Ie=>t.map(we=>{const _e=bt(Ie,we.key);return Ln(_e)}).join(",")),Q=[q,...F].join(`
|
|
103
|
+
`),re=new Blob([Q],{type:"text/csv;charset=utf-8;"}),ae=URL.createObjectURL(re),Ce=document.createElement("a");Ce.href=ae,Ce.download=`${N}.csv`,Ce.click(),URL.revokeObjectURL(ae)},[t,Z,N]),Qe=m?"4px":"8px",Re=m?"8px":"12px",Fe=q=>{const F=Oe[q.key]||q.width;return{width:F??void 0,minWidth:F??80,textAlign:q.align??"left",padding:`${Qe} ${Re}`}},Ae=p?`1px solid ${C.border}`:"none",Je=A.sanitizeString(u),Ue=t.length+(o?1:0),lt=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(Pi,{label:"data grid",showExport:v,onExport:rt,totalRows:te,selectedCount:s.length,theme:C}),e.jsxs("div",{ref:ge,onScroll:le?oe:void 0,style:{maxHeight:y??"none",overflowX:"auto",overflowY:y?"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:d?"sticky":"static",top:0,zIndex:2,backgroundColor:C.surface,borderBottom:`2px solid ${C.border}`,borderRight:Ae,padding:`${Qe} ${Re}`,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 F=(q.sortable??a)&&q.sortable!==!1,Q=R===q.key,re=A.sanitizeString(q.header);return e.jsx("th",{scope:"col",role:"columnheader","aria-sort":Q?V==="asc"?"ascending":"descending":F?"none":void 0,className:x.tkx("text-xs font-semibold uppercase tracking-wider"),style:{...Fe(q),position:d?"sticky":"static",top:0,zIndex:2,backgroundColor:C.surface,color:C.textMuted,borderBottom:`2px solid ${C.border}`,borderRight:Ae,cursor:F?"pointer":"default",userSelect:"none",whiteSpace:"nowrap",transition:H?"none":"background-color 150ms ease"},onClick:F?()=>O(q.key):void 0,onKeyDown:F?ae=>{(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),O(q.key))}:void 0,tabIndex:F?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,F&&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:ae=>qe(q.key,ae)})]})},q.key)})]}),(M||lt)&&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 ${Re}`,width:40}}),t.map(q=>e.jsx("th",{scope:"col",style:{backgroundColor:C.surfaceAlt,borderBottom:`1px solid ${C.border}`,borderRight:Ae,padding:`4px ${Re}`},children:(q.filterable||M)&&e.jsx("input",{type:"text",value:K[q.key]??"",onChange:F=>ne(q.key,F.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:[le&&ve>0&&e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:Ue,style:{height:ve,padding:0,border:"none"}})}),ke.map((q,F)=>{const Q=G+F,re=Nn(q,r),ae=We.has(re),Ce=h&&Q%2===1;let Ie="transparent";return ae?Ie=`${C.primary}22`:Ce&&(Ie=C.surfaceAlt),e.jsxs("tr",{role:"row","aria-rowindex":Q+1,"aria-selected":o?ae: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:Ie,transition:H?"none":"background-color 120ms ease",...le?{height:g,boxSizing:"border-box"}:{}},onMouseEnter:k?we=>{we.currentTarget.style.backgroundColor=ae?`${C.primary}30`:C.surfaceAlt}:void 0,onMouseLeave:k?we=>{we.currentTarget.style.backgroundColor=Ie}:void 0,children:[o&&e.jsx("td",{role:"gridcell",style:{borderBottom:`1px solid ${C.border}`,borderRight:Ae,padding:`${Qe} ${Re}`,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:ae,onChange:()=>Pe(re),"aria-label":ae?`Deselect row ${re}`:`Select row ${re}`,style:{position:"absolute",opacity:0,width:16,height:16,cursor:"pointer",margin:0}}),e.jsx(En,{checked:ae})]})}),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:{...Fe(we),borderBottom:`1px solid ${C.border}`,borderRight:Ae,color:C.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U},we.key)})]},re)}),le&&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"}})})]})})]}),(S||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,F)=>e.jsx("tr",{children:t.map(Q=>e.jsx("td",{style:{padding:"10px 16px"},children:e.jsx(xt,{variant:"text",height:"16px"})},Q.key))},F))})})}),!S&&$&&e.jsx("div",{style:{padding:"16px",textAlign:"center",fontSize:13,color:C.textMuted},children:"✓ All rows loaded"})]}),pe&&!f&&e.jsx(Fi,{page:ie,totalPages:ce,pageSize:I,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 Rn=!1;function _i(){if(Rn||typeof document>"u")return;Rn=!0;const t=document.createElement("style");t.id="tkx-masonry-kf",t.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
|
|
108
|
+
`,document.head.appendChild(t)}function Yi({columns:t,gap:n=16,children:r}){_.useTheme();const o=J.useReducedMotion(),s=Vi();i.useEffect(()=>{_i()},[]);const l=Oi(t,s),a=i.Children.toArray(r),c=i.useMemo(()=>{const u=Array.from({length:l},()=>[]);return a.forEach((d,h)=>{u[h%l].push(d)}),u},[a,l]),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:c.map((u,d)=>e.jsx("div",{className:x.tkx("flex flex-col"),style:{flex:1,gap:n,minWidth:0},children:u.map((h,p)=>{const m=p*l+d;return e.jsx("div",{role:"listitem",style:f(m),children:h},p)})},d))})}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=_.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=_.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=_.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=_.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=_.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,l)=>e.jsx("li",{role:"listitem",style:{marginBottom:4},children:s},l))})}function Ji(){const t=_.useTheme();return e.jsx("hr",{"aria-hidden":"true",style:{border:"none",borderTop:`1px solid ${t.border}`,marginTop:20,marginBottom:20}})}function el({block:t}){const n=_.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 tl({block:t}){const n=_.useTheme(),r=t.variant??"info",o=A.sanitizeString(t.content??""),l={info:n.info,warning:n.warning,success:n.success,danger:n.danger}[r],a=Ki[r],c={info:"note",warning:"alert",success:"status",danger:"alert"};return e.jsxs("div",{role:c[r],className:x.tkx("flex gap-3 px-4 py-3 rounded-lg"),style:{backgroundColor:`${l}12`,border:`1px solid ${l}33`,marginTop:12,marginBottom:12},children:[e.jsx("span",{className:x.tkx("shrink-0 mt-[2px]"),style:{color:l},children:a}),e.jsx("div",{className:x.tkx("flex-1"),style:{fontSize:"0.9rem",lineHeight:1.6,color:n.text},children:o})]})}const nl={heading:Xi,paragraph:Zi,blockquote:Gi,code:qi,list:Qi,divider:Ji,image:el,callout:tl};function rl({blocks:t,className:n,style:r}){const o=_.useTheme(),s=J.useReducedMotion(),l=i.useMemo(()=>t.map((a,c)=>{const f=nl[a.type];return f?e.jsx("div",{style:s?void 0:{animation:"tkx-rich-text-fade-in 300ms ease both",animationDelay:`${Math.min(c*30,300)}ms`},children:e.jsx(f,{block:a,index:c})},c):null}),[t,s]);return i.useMemo(()=>{if(typeof document>"u"||document.getElementById("tkx-rich-text-kf"))return;const a=document.createElement("style");a.id="tkx-rich-text-kf",a.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(a)},[]),e.jsx("article",{"aria-label":"Rich text content",className:x.tkx("font-sans",n??""),style:{color:o.text,maxWidth:720,...r},children:l})}const
|
|
114
|
-
`),document.head.appendChild(n)}function
|
|
113
|
+
`,document.head.appendChild(a)},[]),e.jsx("article",{"aria-label":"Rich text content",className:x.tkx("font-sans",n??""),style:{color:o.text,maxWidth:720,...r},children:l})}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},l)=>{const a=_.useTheme(),c=x.tkx("flex min-h-0 w-full font-sans"),f=n?{flexDirection:"row"}:{flexDirection:"column"};return e.jsx("section",{ref:l,className:x.cx("tkx-layout",c,r),style:{minHeight:"100%",color:a.text,backgroundColor:a.bg,...f,...o},...s,children:t})});Cr.displayName="TkxLayout";const $r=i.forwardRef(({children:t,height:n=64,fixed:r=!1,className:o,style:s,...l},a)=>{const c=_.useTheme(),f=Mr(n),u=x.tkx("flex items-center px-6 shrink-0 w-full"),d=r?{position:"fixed",top:0,left:0,right:0,zIndex:1e3}:{};return e.jsx("header",{ref:a,className:x.cx("tkx-layout-header",u,o),style:{height:f,minHeight:f,backgroundColor:c.surface,borderBottom:`1px solid ${c.border}`,...d,...s},...l,children:t})});$r.displayName="TkxHeader";function sl({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 Ir=i.forwardRef(({children:t,width:n=240,collapsedWidth:r=64,collapsed:o,onCollapse:s,collapsible:l=!1,breakpoint:a,trigger:c,className:f,style:u,...d},h)=>{const p=_.useTheme(),m=J.useReducedMotion(),[y,k]=i.useState(!1),b=o??y,g=i.useCallback(v=>{o===void 0&&k(v),s==null||s(v)},[o,s]);i.useEffect(()=>{if(!a)return;const v=Sr[a];if(!v)return;const N=window.matchMedia(`(max-width: ${v-1}px)`),$=S=>{g(S.matches)};return g(N.matches),N.addEventListener("change",$),()=>N.removeEventListener("change",$)},[a,g]);const M=Mr(n),j=b?`${r}px`:M,w=l&&c!==null,I=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:I,...u},...d,children:[e.jsx("div",{className:x.tkx("flex-1 overflow-y-auto overflow-x-hidden"),style:{width:j,transition:I},children:t}),w&&e.jsx("div",{className:x.tkx("shrink-0"),style:{borderTop:`1px solid ${p.border}`},children:c!==void 0?c:e.jsx(sl,{collapsed:b,onClick:()=>g(!b),color:p.textMuted})})]})});Ir.displayName="TkxSider";const zr=i.forwardRef(({children:t,className:n,style:r,...o},s)=>{const l=_.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:l.bg,padding:"24px",...r},...o,children:t})});zr.displayName="TkxContent";const Er=i.forwardRef(({children:t,className:n,style:r,...o},s)=>{const l=_.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:l.surface,borderTop:`1px solid ${l.border}`,color:l.textMuted,...r},...o,children:t})});Er.displayName="TkxFooter";const ol={start:"flex-start",center:"center",end:"flex-end","space-between":"space-between","space-around":"space-around","space-evenly":"space-evenly"},il={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:l,style:a,...c},f)=>{const[u,d]=Array.isArray(n)?n:[n??0,0],h=u/2,p=d/2,m=u||d?{marginLeft:-h,marginRight:-h,marginTop:-p,marginBottom:-p}:{},y={h,v:p};return e.jsx(Tr.Provider,{value:y,children:e.jsx("div",{ref:f,className:x.cx("tkx-row",x.tkx("flex w-full"),l),style:{flexWrap:s?"wrap":"nowrap",justifyContent:ol[r]??"flex-start",alignItems:il[o]??"flex-start",...m,...a},...c,children:t})})});Nr.displayName="TkxRow";let An=!1;function ll(){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 l=`${s/24*100}%`;t.push(`@media (min-width: ${o}px) { .tkx-col-${r}-${s} { flex: 0 0 ${l} !important; max-width: ${l} !important; } }`)}for(let s=0;s<=24;s++){const l=`${s/24*100}%`;t.push(`@media (min-width: ${o}px) { .tkx-col-${r}-offset-${s} { margin-left: ${l} !important; } }`)}}const n=document.createElement("style");n.id="tkx-col-responsive",n.textContent=t.join(`
|
|
114
|
+
`),document.head.appendChild(n)}function al(t){if(t!==void 0)return typeof t=="number"?{span:t}:t}const Lr=i.forwardRef(({children:t,span:n,offset:r=0,push:o,pull:s,order:l,sm:a,md:c,lg:f,xl:u,className:d,style:h,...p},m)=>{i.useEffect(()=>{ll()},[]);const y=i.useContext(Tr),k=n!==void 0?`${n/24*100}%`:void 0,b=r?`${r/24*100}%`:void 0,g=[],M=[["sm",a],["md",c],["lg",f],["xl",u]];for(const[w,I]of M){const v=al(I);v&&(g.push(`tkx-col-${w}-${v.span}`),v.offset!==void 0&&v.offset>0&&g.push(`tkx-col-${w}-offset-${v.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"),l!==void 0&&(j.order=l),e.jsx("div",{ref:m,className:x.cx("tkx-col",x.tkx("box-border min-h-[1px]"),...g,d),style:{flex:k?`0 0 ${k}`:"1",maxWidth:k??"100%",marginLeft:b,paddingLeft:y.h||void 0,paddingRight:y.h||void 0,paddingTop:y.v||void 0,paddingBottom:y.v||void 0,...j,...h},...p,children:t})});Lr.displayName="TkxCol";const cl={size:"md",variant:"default",animation:!0,bordered:!0},dl={locale:"en-US",direction:"ltr",componentDefaults:cl,componentOverrides:{},prefixCls:"tkx",configured:!1,cls:t=>`tkx-${t}`,getSize:()=>"md",getAnimation:()=>!0,getBordered:()=>!0},Ot=i.createContext(dl);function Rr({children:t,locale:n,direction:r,componentDefaults:o,componentOverrides:s,prefixCls:l}){const a=i.useContext(Ot),c=i.useMemo(()=>({size:(o==null?void 0:o.size)??a.componentDefaults.size,variant:(o==null?void 0:o.variant)??a.componentDefaults.variant,animation:(o==null?void 0:o.animation)??a.componentDefaults.animation,bordered:(o==null?void 0:o.bordered)??a.componentDefaults.bordered}),[o,a.componentDefaults]),f=i.useMemo(()=>{const g=a.componentOverrides,M=s??{};return{button:{...g.button,...M.button},input:{...g.input,...M.input},table:{...g.table,...M.table},modal:{...g.modal,...M.modal}}},[s,a.componentOverrides]),u=n??a.locale,d=r??a.direction,h=l??a.prefixCls,p=i.useCallback(g=>`${h}-${g}`,[h]),m=i.useCallback((g,M)=>{if(M!==void 0)return M;if(g){const j=f[g];if(j!=null&&j.size)return j.size}return c.size},[c.size,f]),y=i.useCallback(g=>g!==void 0?g:c.animation,[c.animation]),k=i.useCallback((g,M)=>{if(M!==void 0)return M;if(g){const j=f[g];if((j==null?void 0:j.bordered)!==void 0)return j.bordered}return c.bordered},[c.bordered,f]),b=i.useMemo(()=>({locale:u,direction:d,componentDefaults:c,componentOverrides:f,prefixCls:h,configured:!0,cls:p,getSize:m,getAnimation:y,getBordered:k}),[u,d,c,f,h,p,m,y,k]);return e.jsx(Ot.Provider,{value:b,children:e.jsx("div",{dir:d,lang:u,className:`${h}-config-root`,style:{direction:d},children:t})})}Rr.displayName="TkxConfigProvider";function vt(){return i.useContext(Ot)}function ul(t,n){const{prefixCls:r}=vt();return`${n??r}-${t}`}function fl(t,n){const{getSize:r}=vt();return r(t,n)}const xl={sm:32,md:40,lg:48},pl={sm:"0.75rem",md:"0.875rem",lg:"1rem"},hl={sm:8,md:12,lg:16},ml={sm:4,md:8,lg:12},gl={sm:4,md:6,lg:8},bl={sm:14,md:16,lg:20};function yl(){const{direction:t}=vt();if(t==="rtl")return{transform:"scaleX(-1)"}}function kl(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 vl(t){return Bn.has(t)||Bn.has(t.split("-")[0])}function wl(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=_.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=_.useTheme();return{default:n.text,secondary:n.textMuted,success:n.success,warning:n.warning,danger:n.danger}[t]}const jl={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 Sl({level:t=1,children:n,copyable:r=!1,type:o="default",style:s}){const l=Ar(o);_.useTheme();const a=jl[t],c=`h${t}`,f=typeof n=="string"?A.sanitizeString(n):n,u=kt(n);return i.createElement(c,{style:{color:l,fontSize:a.fontSize,lineHeight:a.lineHeight,fontWeight:a.fontWeight,margin:"0 0 0.5em 0",fontFamily:"inherit",...s}},f,r&&i.createElement(Ut,{text:u}))}function Ml({children:t,type:n="default",strong:r=!1,italic:o=!1,underline:s=!1,delete:l=!1,code:a=!1,mark:c=!1,copyable:f=!1,style:u}){const d=Ar(n),h=_.useTheme(),p=kt(t),m=typeof t=="string"?A.sanitizeString(t):t,y=[];s&&y.push("underline"),l&&y.push("line-through");let k=m;a&&(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)),c&&(k=i.createElement("mark",{style:{backgroundColor:`${h.warning}33`,color:d,padding:"0 2px",borderRadius:"2px"}},k));const b=r?"strong":o?"em":"span";return i.createElement(b,{style:{color:d,fontStyle:o?"italic":"normal",textDecoration:y.length>0?y.join(" "):"none",...u}},k,f&&i.createElement(Ut,{text:p}))}function Tl({children:t,type:n="default",copyable:r=!1,ellipsis:o=!1,style:s}){const l=_.useTheme(),a=n==="secondary"?l.textMuted:l.text,c=kt(t),f=typeof t=="string"?A.sanitizeString(t):t,u={};if(o){const d=typeof o=="object"?o.rows??3:3;u.display="-webkit-box",u.WebkitLineClamp=d,u.WebkitBoxOrient="vertical",u.overflow="hidden"}return i.createElement("div",{style:{color:a,fontSize:"1rem",lineHeight:"1.6",margin:"0 0 1em 0",...u,...s}},f,r&&i.createElement(Ut,{text:c}))}const Cl={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 $l(){if(Wn||typeof document>"u")return;Wn=!0;const t=document.createElement("style");t.id="tkx-spin-styles",t.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 $l({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 Il({size:t,borderWidth:n,color:r,reducedMotion:o}){return o?i.createElement($l,{size:t,color:r}):(Cl(),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 zl({spinning:t=!0,size:n="md",tip:r,indicator:o,children:s,fullscreen:l=!1,delay:a=0,style:c}){const f=_.useTheme(),u=Q.useReducedMotion(),[d,h]=i.useState(a===0&&t),p=i.useRef(null);if(i.useEffect(()=>(t&&a>0?p.current=setTimeout(()=>h(!0),a):h(t),()=>{p.current!==null&&clearTimeout(p.current)}),[t,a]),!d)return s?i.createElement("div",{style:c},s):null;const m=Tl[n],y=r?A.sanitizeString(r):void 0,k=i.createElement("div",{role:"status","aria-live":"polite","aria-label":y??"Loading",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},o??i.createElement(Il,{size:m.dimension,borderWidth:m.borderWidth,color:f.primary,reducedMotion:u}),y&&i.createElement("span",{style:{color:f.primary,fontSize:m.fontSize,marginTop:"4px"}},y));return l?i.createElement("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${f.bg}cc`,zIndex:9999,...c}},k):s?i.createElement("div",{style:{position:"relative",...c}},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",...c}},k)}function El({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 Nl({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 Ll({image:t="default",description:n="No data",children:r,style:o}){const s=_.useTheme(),l=typeof n=="string"?A.sanitizeString(n):n;let a;return t==="default"?a=i.createElement(El,{color:s.primary,mutedColor:s.textMuted}):t==="simple"?a=i.createElement(Nl,{mutedColor:s.textMuted}):a=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}},a),l&&i.createElement("div",{style:{color:s.textMuted,fontSize:"0.875rem",lineHeight:"1.5",maxWidth:"320px"}},l),r&&i.createElement("div",{style:{marginTop:"16px"}},r))}function Rl(t,n,r=","){if(typeof t=="string")return t;const o=n!==void 0?t.toFixed(n):String(t),[s,l]=o.split("."),a=s.replace(/\B(?=(\d{3})+(?!\d))/g,r);return l!==void 0?`${a}.${l}`:a}function Al(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),l=Math.floor(r%3600/60),a=r%60,c=f=>String(f).padStart(2,"0");return n.replace(/DD/g,c(o)).replace(/D/g,String(o)).replace(/HH/g,c(s)).replace(/H/g,String(s)).replace(/mm/g,c(l)).replace(/m/g,String(l)).replace(/ss/g,c(a)).replace(/s/g,String(a))}function Dl({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 Wn=!1;function Bl(){if(Wn||typeof document>"u")return;Wn=!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 Wl({w:t,h:n,alt:r,bdr:o,rm:s}){return s||Bl(),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 Pl({title:t,value:n,prefix:r,suffix:o,precision:s,groupSeparator:l=",",valueStyle:a,loading:c=!1,trend:f,trendValue:u,style:d}){const h=_.useTheme(),p=Q.useReducedMotion(),m=A.sanitizeString(t),y=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",...d}},i.createElement("div",{style:{color:h.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},m),c?i.createElement(Wl,{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",...a}},r&&i.createElement("span",{style:{fontSize:"0.75em",fontWeight:400}},r),i.createElement("span",null,Rl(n,s,l)),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(Dl,{direction:f,color:k}),y&&i.createElement("span",null,y)))}function Fl({title:t,value:n,format:r="HH:mm:ss",onFinish:o,prefix:s,suffix:l,style:a}){const c=_.useTheme(),f=A.sanitizeString(t),u=i.useRef(o);u.current=o;const d=i.useRef(!1),[h,p]=i.useState(()=>Math.max(0,n-Date.now()));i.useEffect(()=>{d.current=!1;const y=()=>{var g;const b=Math.max(0,n-Date.now());p(b),b<=0&&!d.current&&(d.current=!0,(g=u.current)==null||g.call(u))};y();const k=setInterval(y,1e3);return()=>clearInterval(k)},[n]);const m=Al(h,r);return i.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...a}},i.createElement("div",{style:{color:c.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?c.danger:c.text,fontVariantNumeric:"tabular-nums"}},s&&i.createElement("span",{style:{fontSize:"0.75em",fontWeight:400}},s),i.createElement("span",null,m),l&&i.createElement("span",{style:{fontSize:"0.6em",fontWeight:400,color:c.textMuted}},l)))}const Hl={sm:{height:28,fontSize:12,px:10},md:{height:36,fontSize:14,px:16},lg:{height:44,fontSize:16,px:20}};function Vl({options:t,value:n,onChange:r,size:o="md",block:s=!1}){const l=_.useTheme(),a=Q.useReducedMotion(),c=i.useRef(null),[f,u]=i.useState(()=>Math.max(0,t.findIndex(k=>k.value===n))),[d,h]=i.useState({}),p=Hl[o];i.useEffect(()=>{const k=t.findIndex(b=>b.value===n);k>=0&&u(k)},[n,t]),i.useEffect(()=>{const k=c.current;if(!k)return;const g=k.querySelectorAll("[data-seg-btn]")[f];g&&h({left:g.offsetLeft,width:g.offsetWidth,height:g.offsetHeight,transition:a?"none":"left 0.2s ease, width 0.2s ease"})},[f,t,a]);const m=i.useCallback(k=>{const b=t[k];!b||b.disabled||(u(k),r==null||r(b.value))},[t,r]),y=i.useCallback(k=>{var g,M,j;let b=f;if(k.key==="ArrowRight"||k.key==="ArrowDown")for(k.preventDefault(),b=(f+1)%t.length;(g=t[b])!=null&&g.disabled&&b!==f;)b=(b+1)%t.length;else if(k.key==="ArrowLeft"||k.key==="ArrowUp")for(k.preventDefault(),b=(f-1+t.length)%t.length;(M=t[b])!=null&&M.disabled&&b!==f;)b=(b-1+t.length)%t.length;if(b!==f){m(b);const w=c.current,I=w==null?void 0:w.querySelectorAll("[data-seg-btn]");(j=I==null?void 0:I[b])==null||j.focus()}},[f,t,m]);return e.jsxs("div",{ref:c,role:"radiogroup","aria-label":"Segmented control",className:x.tkx("relative inline-flex items-center rounded-lg p-1"),style:{backgroundColor:l.surfaceAlt,border:`1px solid ${l.border}`,width:s?"100%":void 0},onKeyDown:y,children:[e.jsx("div",{"aria-hidden":"true",className:x.tkx("absolute top-1 rounded-md"),style:{...d,backgroundColor:l.surface,boxShadow:`0 1px 3px ${l.border}`,zIndex:0}}),t.map((k,b)=>{const g=b===f,M=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?l.text:l.textMuted,backgroundColor:"transparent",opacity:k.disabled?.4:1,fontWeight:g?600:400,transition:a?"none":"color 0.15s ease"},onClick:()=>m(b),children:[k.icon&&e.jsx("span",{"aria-hidden":"true",children:k.icon}),M]},k.value)})]})}function Ol({options:t,value:n="",onChange:r,trigger:o="@",placeholder:s,label:l}){const a=_.useTheme(),c=Q.useReducedMotion(),f=i.useRef(null),u=i.useRef(null),[d,h]=i.useState(n),[p,m]=i.useState(!1),[y,k]=i.useState(""),[b,g]=i.useState(0),[M,j]=i.useState(-1);i.useEffect(()=>{n!==void 0&&h(n)},[n]);const w=t.filter(T=>T.label.toLowerCase().includes(y.toLowerCase())),I=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 R=H.slice(z+o.length);if(!/\s/.test(R)){k(R),j(z),m(!0),g(0);return}}m(!1)},[o,r]),v=i.useCallback(T=>{var z;const E=d.slice(0,M),C=d.slice(M+o.length+y.length),H=`${E}${o}${T.value} ${C}`;h(H),r==null||r(H),m(!1),(z=f.current)==null||z.focus()},[d,M,o,y,r]),N=i.useCallback(T=>{p&&(T.key==="ArrowDown"?(T.preventDefault(),g(E=>(E+1)%w.length)):T.key==="ArrowUp"?(T.preventDefault(),g(E=>(E-1+w.length)%w.length)):T.key==="Enter"&&w[b]?(T.preventDefault(),v(w[b])):T.key==="Escape"&&m(!1))},[p,w,b,v]);i.useEffect(()=>{if(!p||!u.current)return;const T=u.current.children[b];T==null||T.scrollIntoView({block:"nearest"})},[b,p]);const $=l?A.sanitizeString(l):void 0,S=s?A.sanitizeString(s):void 0;return e.jsxs("div",{className:x.tkx("relative font-sans"),style:{width:"100%"},children:[$&&e.jsx("label",{className:x.tkx("block text-sm font-medium mb-1"),style:{color:a.text},children:$}),e.jsx("textarea",{ref:f,role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-label":$??"Mentions input",value:d,placeholder:S,onChange:I,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:a.surface,borderColor:a.border,color:a.text,minHeight:80,outline:"none"},rows:3}),p&&w.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:a.surface,borderColor:a.border,maxHeight:200,top:"100%",marginTop:4,listStyle:"none",padding:0,boxShadow:`0 4px 12px ${a.bg}80`,animation:c?"none":"tkxFadeIn 0.15s ease"},children:w.map((T,E)=>e.jsxs("li",{role:"option","aria-selected":E===b,className:x.tkx("flex items-center gap-3 px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:E===b?a.surfaceAlt:"transparent",color:a.text},onMouseDown:C=>{C.preventDefault(),v(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:a.textMuted,marginLeft:"auto"},children:[o,A.sanitizeString(T.value)]})]},T.value))})]})}function _l(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 Yl(t){let n=t;return()=>(n=n*1664525+1013904223|0,(n>>>0)/4294967295)}const Kl={L:.38,M:.42,Q:.48,H:.55};function Ul(t,n,r){const o=_l(t),s=Yl(o),l=Kl[r]??.42,a=Array.from({length:n},()=>Array.from({length:n},()=>!1)),c=(f,u)=>{for(let d=0;d<7;d++)for(let h=0;h<7;h++){const p=d===0||d===6||h===0||h===6,m=d>=2&&d<=4&&h>=2&&h<=4;a[f+d][u+h]=p||m}};c(0,0),c(0,n-7),c(n-7,0);for(let f=7;f<n-7;f++)a[6][f]=f%2===0,a[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)||(a[f][u]=s()<l);return a}function Xl({value:t,size:n=160,color:r,bgColor:o,errorLevel:s="M",icon:l,bordered:a=!0}){const c=_.useTheme(),f=Q.useReducedMotion(),u=i.useRef(null),d=A.sanitizeString(t),h=r??c.text,p=o??c.surface,m=25,y=i.useMemo(()=>Ul(d,m,s),[d,s]);return i.useEffect(()=>{const k=u.current;if(!k)return;const b=k.getContext("2d");if(!b)return;const g=window.devicePixelRatio||1;k.width=n*g,k.height=n*g,b.scale(g,g);const M=n/m;b.fillStyle=p,b.fillRect(0,0,n,n),b.fillStyle=h;for(let j=0;j<m;j++)for(let w=0;w<m;w++)y[j][w]&&b.fillRect(w*M,j*M,M,M);if(l){const j=n*.22,w=(n-j)/2;b.fillStyle=p,b.fillRect(w-2,w-2,j+4,j+4);const I=new Image;I.crossOrigin="anonymous",I.onload=()=>{b.drawImage(I,w,w,j,j)},I.src=A.sanitizeString(l)}},[y,n,h,p,l]),e.jsx("div",{role:"img","aria-label":`QR code for: ${d}`,className:x.tkx("inline-block rounded-lg"),style:{padding:a?12:0,backgroundColor:a?p:"transparent",border:a?`1px solid ${c.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 Zl={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 Gl(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 ql({status:t,title:n,subTitle:r,icon:o,extra:s}){const l=_.useTheme(),a=Q.useReducedMotion(),c=Gl(t,l),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:a?"none":"tkxFadeIn 0.3s ease"},children:[e.jsx("div",{className:x.tkx("mb-6"),children:o??Zl[t](c)}),e.jsx("h2",{className:x.tkx("text-xl font-semibold m-0 mb-2"),style:{color:l.text},children:f}),u&&e.jsx("p",{className:x.tkx("text-sm m-0 mb-6 max-w-md leading-relaxed"),style:{color:l.textMuted},children:u}),s&&e.jsx("div",{className:x.tkx("flex items-center gap-3 mt-4"),children:s})]})}function Ql(t){const n=document.querySelector(t);return n?n.getBoundingClientRect():null}function Jl(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 ea({steps:t,isOpen:n=!1,onClose:r,current:o,onChange:s}){const l=_.useTheme(),a=Q.useReducedMotion(),[c,f]=i.useState(0),u=o??c,d=i.useRef(null),[h,p]=i.useState({top:0,left:0}),[m,y]=i.useState(null),k=t[u],b=i.useCallback(()=>{if(!k)return;const S=Ql(k.target);if(y(S),S&&d.current){const T=d.current.offsetWidth,E=d.current.offsetHeight;p(Jl(S,k.placement??"bottom",T,E))}},[k]);i.useEffect(()=>{if(n)return b(),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[n,u,b]),i.useEffect(()=>{var S;n&&((S=d.current)==null||S.focus())},[n,u]);const g=i.useCallback(S=>{f(S),s==null||s(S)},[s]),M=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 w=6,I=A.sanitizeString(k.title),v=A.sanitizeString(k.description),$=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-w}px 100%, ${m.left-w}px ${m.top-w}px, ${m.right+w}px ${m.top-w}px, ${m.right+w}px ${m.bottom+w}px, ${m.left-w}px ${m.bottom+w}px, ${m.left-w}px 100%, 100% 100%, 100% 0%)`:void 0,transition:a?"none":"clip-path 0.25s ease"},onClick:r}),e.jsxs("div",{ref:d,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:l.surface,border:`1px solid ${l.border}`,borderRadius:10,padding:20,boxShadow:`0 8px 24px ${l.bg}80`,animation:a?"none":"tkxFadeIn 0.2s ease",fontFamily:"inherit"},onKeyDown:S=>{S.key==="Escape"&&(r==null||r())},children:[e.jsx("h3",{className:x.tkx("m-0 mb-2 text-base font-semibold"),style:{color:l.text},children:I}),e.jsx("p",{className:x.tkx("m-0 mb-4 text-sm leading-relaxed"),style:{color:l.textMuted},children:v}),e.jsx("div",{className:x.tkx("flex items-center gap-1 mb-4"),"aria-label":"Tour progress",children:t.map((S,T)=>e.jsx("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",backgroundColor:T===u?l.primary:l.border,transition:a?"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:l.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:l.border,color:l.text},children:"Prev"}),e.jsx("button",{type:"button","aria-label":u===t.length-1?"Finish tour":"Next step",onClick:M,className:x.tkx("rounded-md border-0 px-4 py-1 text-sm cursor-pointer font-medium"),style:{backgroundColor:l.primary,color:"#fff"},children:u===t.length-1?"Finish":"Next"})]})]})]})]});return Le.createPortal($,document.body)}function ta(t,n,r,o,s){const l=document.createElement("canvas"),a=l.getContext("2d");if(!a)return"";const c=o*1.5,f=t.length*c,u=Math.max(...t.map(m=>m.length))*o*.6,d=r[0]+u,h=r[1]+f,p=2;return l.width=d*p,l.height=h*p,a.scale(p,p),a.translate(d/2,h/2),a.rotate(n*Math.PI/180),a.font=`${o}px sans-serif`,a.fillStyle=s,a.textAlign="center",a.textBaseline="middle",t.forEach((m,y)=>{const k=(y-(t.length-1)/2)*c;a.fillText(m,0,k)}),l.toDataURL()}function na({text:t,children:n,rotate:r=-22,gap:o=[100,100],fontSize:s=14,color:l,zIndex:a=10}){const c=_.useTheme(),f=Q.useReducedMotion(),u=i.useRef(null),[d,h]=i.useState(""),p=i.useMemo(()=>(Array.isArray(t)?t:[t]).map(k=>A.sanitizeString(k)),[t]),m=l??`${c.textMuted}22`,y=i.useCallback(()=>ta(p,r,o,s,m),[p,r,o,s,m]);return i.useEffect(()=>{const k=y();k&&h(`url(${k})`)},[y]),i.useEffect(()=>{var g;const k=(g=u.current)==null?void 0:g.querySelector("[data-watermark]");if(!k)return;const b=new MutationObserver(()=>{const M=y();M&&(k.style.backgroundImage=`url(${M})`)});return b.observe(k,{attributes:!0,attributeFilter:["style"]}),()=>b.disconnect()},[y]),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:a,backgroundImage:d,backgroundRepeat:"repeat",animation:f?"none":"tkxFadeIn 0.3s ease"}})]})}function Pn(t){if(t)try{return t()}catch{return window}return window}function ra(t){if(t instanceof Window)return{top:0,bottom:t.innerHeight};const n=t.getBoundingClientRect();return{top:n.top,bottom:n.bottom}}function sa({children:t,offsetTop:n,offsetBottom:r,onChange:o,target:s}){const l=_.useTheme(),a=Q.useReducedMotion(),c=i.useRef(null),f=i.useRef(null),[u,d]=i.useState(!1),[h,p]=i.useState({width:0,height:0}),m=i.useRef(!1),y=i.useMemo(()=>A.sanitizeString("Sticky content"),[]),k=i.useCallback(()=>{const M=c.current;if(!M)return;const j=M.getBoundingClientRect(),w=ra(Pn(s));let I=!1;n!==void 0?I=j.top-w.top<=n:r!==void 0&&(I=w.bottom-j.bottom<=r),I!==m.current&&(m.current=I,d(I),p({width:j.width,height:j.height}),o==null||o(I))},[n,r,o,s]);i.useEffect(()=>{const M=Pn(s);return k(),M.addEventListener("scroll",k,{passive:!0}),window.addEventListener("resize",k),()=>{M.removeEventListener("scroll",k),window.removeEventListener("resize",k)}},[k,s]);const b=u?{position:"fixed",zIndex:100,...n!==void 0?{top:n}:{},...r!==void 0?{bottom:r}:{},width:h.width||void 0,transition:a?"none":"box-shadow 0.2s ease",boxShadow:`0 2px 8px ${l.border}`}:{},g=u?{height:h.height,width:h.width}:{};return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:c,"aria-hidden":u,style:g}),e.jsx("div",{ref:f,role:"region","aria-label":y,className:x.tkx(u?"tkx-affixed":""),style:b,children:t})]})}function Ar(t){const n=[];for(const r of t)n.push(r),r.children&&n.push(...Ar(r.children));return n}function Fn(t){return t.startsWith("#")?t.slice(1):t}function Dr({item:t,activeKey:n,depth:r,onClick:o,theme:s,reducedMotion:l}){const a=t.key===n,c=A.sanitizeString(t.title);return e.jsxs("li",{role:"none",style:{listStyle:"none"},children:[e.jsx("a",{role:"treeitem","aria-current":a?"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:a?s.primary:s.textMuted,fontWeight:a?600:400,borderLeft:`2px solid ${a?s.primary:"transparent"}`,transition:l?"none":"color 0.15s ease, border-color 0.15s ease"},children:c}),t.children&&t.children.length>0&&e.jsx("ul",{role:"group",style:{margin:0,padding:0},children:t.children.map(f=>e.jsx(Dr,{item:f,activeKey:n,depth:r+1,onClick:o,theme:s,reducedMotion:l},f.key))})]})}function oa({items:t,offsetTop:n=0,getCurrentAnchor:r,onChange:o}){var p;const s=_.useTheme(),l=Q.useReducedMotion(),[a,c]=i.useState(((p=t[0])==null?void 0:p.key)??""),f=i.useRef(!1),u=Ar(t),d=i.useCallback(()=>{var y;if(f.current)return;let m=((y=u[0])==null?void 0:y.key)??"";for(const k of u){const b=Fn(k.href),g=document.getElementById(b);g&&g.getBoundingClientRect().top<=n+10&&(m=k.key)}r&&(m=r(m)),m!==a&&(c(m),o==null||o(m))},[u,n,r,a,o]);i.useEffect(()=>(window.addEventListener("scroll",d,{passive:!0}),d(),()=>window.removeEventListener("scroll",d)),[d]);const h=i.useCallback(m=>{const y=Fn(m),k=document.getElementById(y);if(!k)return;f.current=!0;const b=k.getBoundingClientRect().top+window.scrollY-n;window.scrollTo({top:b,behavior:l?"auto":"smooth"});const g=u.find(M=>M.href===m);g&&(c(g.key),o==null||o(g.key)),setTimeout(()=>{f.current=!1},800)},[u,n,l,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(Dr,{item:m,activeKey:a,depth:0,onClick:h,theme:s,reducedMotion:l},m.key))})})}function ia(t,n){var s;const r=[t];let o=t;for(const l of n){const a=o.find(c=>c.value===l);if((s=a==null?void 0:a.children)!=null&&s.length)r.push(a.children),o=a.children;else break}return r}function Br(t,n){const r=[];let o=t;for(const s of n){const l=o.find(a=>a.value===s);if(l)r.push(l),o=l.children??[];else break}return r}function la(t,n){return Br(t,n).map(r=>A.sanitizeString(r.label)).join(" / ")}function aa({options:t,value:n=[],onChange:r,placeholder:o="Select...",label:s,multiple:l=!1}){const a=_.useTheme(),c=Q.useReducedMotion(),f=i.useRef(null),u=i.useRef(null),[d,h]=i.useState(!1),[p,m]=i.useState(n),[y,k]=i.useState({top:0,left:0,width:0}),b=s?A.sanitizeString(s):void 0,g=A.sanitizeString(o),M=n.length>0?la(t,n):"";i.useEffect(()=>{if(!d||!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)})},[d]),i.useEffect(()=>{if(!d)return;const N=$=>{var S,T;!((S=f.current)!=null&&S.contains($.target))&&!((T=u.current)!=null&&T.contains($.target))&&h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[d]);const j=i.useCallback((N,$)=>{var T;if($.disabled)return;const S=[...p.slice(0,N),$.value];if(m(S),!((T=$.children)!=null&&T.length)){const E=Br(t,S);r==null||r(S,E),l||h(!1)}},[p,t,r,l]),w=i.useCallback(N=>{var $;N.key==="Escape"?(h(!1),($=f.current)==null||$.focus()):(N.key==="Enter"||N.key===" ")&&(d||(N.preventDefault(),h(!0)))},[d]),I=ia(t,p),v=d?Le.createPortal(e.jsx("div",{ref:u,role:"tree","aria-label":b??"Cascader options",className:x.tkx("flex rounded-lg border overflow-hidden"),style:{position:"absolute",zIndex:9999,top:y.top,left:y.left,backgroundColor:a.surface,borderColor:a.border,boxShadow:`0 4px 16px ${a.bg}80`,animation:c?"none":"tkxFadeIn 0.15s ease"},children:I.map((N,$)=>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 ${a.border}`:"none"},children:N.map(S=>{var C;const T=p[$]===S.value,E=A.sanitizeString(S.label);return e.jsxs("li",{role:"treeitem","aria-selected":T,"aria-disabled":S.disabled||void 0,"aria-expanded":(C=S.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?a.surfaceAlt:"transparent",color:S.disabled?a.textMuted:a.text,opacity:S.disabled?.5:1,cursor:S.disabled?"not-allowed":"pointer"},onClick:()=>j($,S),onMouseEnter:()=>{S.disabled||m(H=>[...H.slice(0,$),S.value])},children:[e.jsx("span",{children:E}),S.children&&S.children.length>0&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:a.textMuted,flexShrink:0},children:e.jsx("path",{d:"M10 6l6 6-6 6V6z"})})]},S.value)})},$))}),document.body):null;return e.jsxs("div",{className:x.tkx("relative font-sans"),onKeyDown:w,children:[b&&e.jsx("label",{className:x.tkx("block text-sm font-medium mb-1"),style:{color:a.text},children:b}),e.jsxs("button",{ref:f,type:"button",role:"combobox","aria-expanded":d,"aria-haspopup":"tree","aria-label":b??"Cascader",className:x.tkx("w-full flex items-center justify-between rounded-lg border px-3 py-2 text-sm cursor-pointer"),style:{backgroundColor:a.surface,borderColor:d?a.primary:a.border,color:M?a.text:a.textMuted,outline:"none",minHeight:38,textAlign:"left"},onClick:()=>h(N=>!N),children:[e.jsx("span",{className:x.tkx("truncate"),children:M||g}),e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:a.textMuted,transform:d?"rotate(180deg)":"rotate(0deg)",transition:c?"none":"transform 0.2s ease",flexShrink:0},children:e.jsx("path",{d:"M7 10l5 5 5-5H7z"})})]}),v]})}const ca={sm:"8px 12px",md:"12px 16px",lg:"16px 20px"};function da({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 ua({items:t,header:n,footer:r,bordered:o=!0,size:s="md",loading:l=!1,emptyText:a="No data",grid:c}){const f=_.useTheme(),u=Q.useReducedMotion(),d=A.sanitizeString(a),h=ca[s],p=!!c,m=(c==null?void 0:c.column)??1,y=(c==null?void 0:c.gutter)??16;return e.jsxs("div",{role:"list","aria-label":"List","aria-busy":l,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}),l&&e.jsx("div",{children:Array.from({length:3}).map((k,b)=>e.jsx(da,{theme:f,reducedMotion:u},b))}),!l&&t.length===0&&e.jsx("div",{role:"status",className:x.tkx("text-center py-12 text-sm"),style:{color:f.textMuted},children:d}),!l&&t.length>0&&e.jsx("div",{style:p?{display:"grid",gridTemplateColumns:`repeat(${m}, 1fr)`,gap:y,padding:y}:void 0,children:t.map((k,b)=>{const g=A.sanitizeString(k.title),M=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&&b<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 ${b*.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}),M&&e.jsx("div",{className:x.tkx("text-xs mt-1 leading-relaxed"),style:{color:f.textMuted},children:M})]}),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 fa({locale:t="en-US",direction:n,strings:r,children:o}){const s=i.useMemo(()=>{const l=nt.LOCALES[t]??nt.enUS,a=r?{...l,...r}:l,c=n??(nt.isRTL(t)?"rtl":"ltr");return{locale:t,direction:c,strings:a}},[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 xa({contentId:t="tkx-main-content",label:n="Skip to main content"}){return e.jsx("a",{href:`#${t}`,className:"tkx-skip-nav",children:n})}function pa({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 ha({active:t,children:n,as:r="div"}){const o=Q.useFocusTrap(t);return e.jsx(r,{ref:o,children:n})}function ma({as:t,children:n,...r}){const o=t??"span";return e.jsx(o,{className:"tkx-sr-only",...r,children:n})}function Hn(t,n,r,o){const s=t.getBoundingClientRect(),l=n?n.offsetHeight:320,a=n?n.offsetWidth:200,c=window.innerWidth,f=window.innerHeight,u=window.scrollX,d=window.scrollY;let h=0,p=0;switch(r){case"bottom-start":h=s.bottom+d+o,p=s.left+u;break;case"bottom-end":h=s.bottom+d+o,p=s.right+u-a;break;case"top-start":h=s.top+d-o-l,p=s.left+u;break;case"top-end":h=s.top+d-o-l,p=s.right+u-a;break;case"right":h=s.top+d,p=s.right+u+o;break;case"left":h=s.top+d,p=s.left+u-o-a;break;default:h=s.bottom+d+o,p=s.left+u}return r.startsWith("bottom")&&s.bottom+l>f&&(h=s.top+d-o-l),r.startsWith("top")&&s.top-l<0&&(h=s.bottom+d+o),p+a>c+u&&(p=c+u-a-8),p<u&&(p=u+8),{top:h,left:p,minWidth:s.width}}function Vn(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 ga(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 ba({groups:t,position:n,maxHeight:r,minWidth:o,selectedKeys:s,multiSelect:l,searchable:a,searchPlaceholder:c,onSelect:f,onClose:u,renderItem:d,menuRef:h,isPortal:p,menuId:m}){const y=_.useTheme(),[k,b]=i.useState(""),[g,M]=i.useState(0),[j,w]=i.useState(null),[I,v]=i.useState(0),N=i.useRef(null),$=i.useRef([]),S=i.useRef([]),T=k?t.map(R=>({...R,items:R.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(O=>O.label.toLowerCase().includes(k.toLowerCase())))})})).filter(R=>R.items.length>0):t,E=ga(T,k);i.useEffect(()=>{var R;a&&N.current?N.current.focus():(R=$.current[0])==null||R.focus(),M(0)},[a]),i.useEffect(()=>{var R;(!a||k!=="")&&((R=$.current[g])==null||R.focus())},[g,a,k]);const C=i.useCallback(R=>{var B,V,D;switch(R.key){case"ArrowDown":if(R.preventDefault(),j){const L=(((B=E.find(P=>P.key===j))==null?void 0:B.children)??[]).filter(P=>!P.disabled);v(P=>Math.min(P+1,L.length-1))}else M(O=>Math.min(O+1,E.length-1));break;case"ArrowUp":R.preventDefault(),j?v(O=>Math.max(O-1,0)):M(O=>Math.max(O-1,0));break;case"ArrowRight":{R.preventDefault();const O=E[g];(V=O==null?void 0:O.children)!=null&&V.length&&(w(O.key),v(0));break}case"ArrowLeft":R.preventDefault(),w(null);break;case"Enter":case" ":if(R.preventDefault(),j){const P=(((D=E.find(W=>W.key===j))==null?void 0:D.children)??[]).filter(W=>!W.disabled)[I];P&&f(P.key,P)}else{const O=E[g];O&&f(O.key,O)}break;case"Escape":R.preventDefault(),j?w(null):u();break;case"Tab":u();break}},[E,g,u,f,j,I]);i.useEffect(()=>{var R;j&&((R=S.current[I])==null||R.focus())},[I,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:y.surface,border:`1px solid ${y.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(t)}function Il({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 zl({size:t,borderWidth:n,color:r,reducedMotion:o}){return o?i.createElement(Il,{size:t,color:r}):($l(),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 El({spinning:t=!0,size:n="md",tip:r,indicator:o,children:s,fullscreen:l=!1,delay:a=0,style:c}){const f=_.useTheme(),u=J.useReducedMotion(),[d,h]=i.useState(a===0&&t),p=i.useRef(null);if(i.useEffect(()=>(t&&a>0?p.current=setTimeout(()=>h(!0),a):h(t),()=>{p.current!==null&&clearTimeout(p.current)}),[t,a]),!d)return s?i.createElement("div",{style:c},s):null;const m=Cl[n],y=r?A.sanitizeString(r):void 0,k=i.createElement("div",{role:"status","aria-live":"polite","aria-label":y??"Loading",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},o??i.createElement(zl,{size:m.dimension,borderWidth:m.borderWidth,color:f.primary,reducedMotion:u}),y&&i.createElement("span",{style:{color:f.primary,fontSize:m.fontSize,marginTop:"4px"}},y));return l?i.createElement("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`${f.bg}cc`,zIndex:9999,...c}},k):s?i.createElement("div",{style:{position:"relative",...c}},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",...c}},k)}function Nl({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 Ll({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 Rl({image:t="default",description:n="No data",children:r,style:o}){const s=_.useTheme(),l=typeof n=="string"?A.sanitizeString(n):n;let a;return t==="default"?a=i.createElement(Nl,{color:s.primary,mutedColor:s.textMuted}):t==="simple"?a=i.createElement(Ll,{mutedColor:s.textMuted}):a=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}},a),l&&i.createElement("div",{style:{color:s.textMuted,fontSize:"0.875rem",lineHeight:"1.5",maxWidth:"320px"}},l),r&&i.createElement("div",{style:{marginTop:"16px"}},r))}function Al(t,n,r=","){if(typeof t=="string")return t;const o=n!==void 0?t.toFixed(n):String(t),[s,l]=o.split("."),a=s.replace(/\B(?=(\d{3})+(?!\d))/g,r);return l!==void 0?`${a}.${l}`:a}function Dl(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),l=Math.floor(r%3600/60),a=r%60,c=f=>String(f).padStart(2,"0");return n.replace(/DD/g,c(o)).replace(/D/g,String(o)).replace(/HH/g,c(s)).replace(/H/g,String(s)).replace(/mm/g,c(l)).replace(/m/g,String(l)).replace(/ss/g,c(a)).replace(/s/g,String(a))}function Bl({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 Pn=!1;function Wl(){if(Pn||typeof document>"u")return;Pn=!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 Pl({w:t,h:n,alt:r,bdr:o,rm:s}){return s||Wl(),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 Fl({title:t,value:n,prefix:r,suffix:o,precision:s,groupSeparator:l=",",valueStyle:a,loading:c=!1,trend:f,trendValue:u,style:d}){const h=_.useTheme(),p=J.useReducedMotion(),m=A.sanitizeString(t),y=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",...d}},i.createElement("div",{style:{color:h.textMuted,fontSize:"0.875rem",lineHeight:"1.4"}},m),c?i.createElement(Pl,{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",...a}},r&&i.createElement("span",{style:{fontSize:"0.75em",fontWeight:400}},r),i.createElement("span",null,Al(n,s,l)),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(Bl,{direction:f,color:k}),y&&i.createElement("span",null,y)))}function Hl({title:t,value:n,format:r="HH:mm:ss",onFinish:o,prefix:s,suffix:l,style:a}){const c=_.useTheme(),f=A.sanitizeString(t),u=i.useRef(o);u.current=o;const d=i.useRef(!1),[h,p]=i.useState(()=>Math.max(0,n-Date.now()));i.useEffect(()=>{d.current=!1;const y=()=>{var g;const b=Math.max(0,n-Date.now());p(b),b<=0&&!d.current&&(d.current=!0,(g=u.current)==null||g.call(u))};y();const k=setInterval(y,1e3);return()=>clearInterval(k)},[n]);const m=Dl(h,r);return i.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"4px",...a}},i.createElement("div",{style:{color:c.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?c.danger:c.text,fontVariantNumeric:"tabular-nums"}},s&&i.createElement("span",{style:{fontSize:"0.75em",fontWeight:400}},s),i.createElement("span",null,m),l&&i.createElement("span",{style:{fontSize:"0.6em",fontWeight:400,color:c.textMuted}},l)))}const Vl={sm:{height:28,fontSize:12,px:10},md:{height:36,fontSize:14,px:16},lg:{height:44,fontSize:16,px:20}};function Ol({options:t,value:n,onChange:r,size:o="md",block:s=!1}){const l=_.useTheme(),a=J.useReducedMotion(),c=i.useRef(null),[f,u]=i.useState(()=>Math.max(0,t.findIndex(k=>k.value===n))),[d,h]=i.useState({}),p=Vl[o];i.useEffect(()=>{const k=t.findIndex(b=>b.value===n);k>=0&&u(k)},[n,t]),i.useEffect(()=>{const k=c.current;if(!k)return;const g=k.querySelectorAll("[data-seg-btn]")[f];g&&h({left:g.offsetLeft,width:g.offsetWidth,height:g.offsetHeight,transition:a?"none":"left 0.2s ease, width 0.2s ease"})},[f,t,a]);const m=i.useCallback(k=>{const b=t[k];!b||b.disabled||(u(k),r==null||r(b.value))},[t,r]),y=i.useCallback(k=>{var g,M,j;let b=f;if(k.key==="ArrowRight"||k.key==="ArrowDown")for(k.preventDefault(),b=(f+1)%t.length;(g=t[b])!=null&&g.disabled&&b!==f;)b=(b+1)%t.length;else if(k.key==="ArrowLeft"||k.key==="ArrowUp")for(k.preventDefault(),b=(f-1+t.length)%t.length;(M=t[b])!=null&&M.disabled&&b!==f;)b=(b-1+t.length)%t.length;if(b!==f){m(b);const w=c.current,I=w==null?void 0:w.querySelectorAll("[data-seg-btn]");(j=I==null?void 0:I[b])==null||j.focus()}},[f,t,m]);return e.jsxs("div",{ref:c,role:"radiogroup","aria-label":"Segmented control",className:x.tkx("relative inline-flex items-center rounded-lg p-1"),style:{backgroundColor:l.surfaceAlt,border:`1px solid ${l.border}`,width:s?"100%":void 0},onKeyDown:y,children:[e.jsx("div",{"aria-hidden":"true",className:x.tkx("absolute top-1 rounded-md"),style:{...d,backgroundColor:l.surface,boxShadow:`0 1px 3px ${l.border}`,zIndex:0}}),t.map((k,b)=>{const g=b===f,M=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?l.text:l.textMuted,backgroundColor:"transparent",opacity:k.disabled?.4:1,fontWeight:g?600:400,transition:a?"none":"color 0.15s ease"},onClick:()=>m(b),children:[k.icon&&e.jsx("span",{"aria-hidden":"true",children:k.icon}),M]},k.value)})]})}function _l({options:t,value:n="",onChange:r,trigger:o="@",placeholder:s,label:l}){const a=_.useTheme(),c=J.useReducedMotion(),f=i.useRef(null),u=i.useRef(null),[d,h]=i.useState(n),[p,m]=i.useState(!1),[y,k]=i.useState(""),[b,g]=i.useState(0),[M,j]=i.useState(-1);i.useEffect(()=>{n!==void 0&&h(n)},[n]);const w=t.filter(T=>T.label.toLowerCase().includes(y.toLowerCase())),I=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 R=H.slice(z+o.length);if(!/\s/.test(R)){k(R),j(z),m(!0),g(0);return}}m(!1)},[o,r]),v=i.useCallback(T=>{var z;const E=d.slice(0,M),C=d.slice(M+o.length+y.length),H=`${E}${o}${T.value} ${C}`;h(H),r==null||r(H),m(!1),(z=f.current)==null||z.focus()},[d,M,o,y,r]),N=i.useCallback(T=>{p&&(T.key==="ArrowDown"?(T.preventDefault(),g(E=>(E+1)%w.length)):T.key==="ArrowUp"?(T.preventDefault(),g(E=>(E-1+w.length)%w.length)):T.key==="Enter"&&w[b]?(T.preventDefault(),v(w[b])):T.key==="Escape"&&m(!1))},[p,w,b,v]);i.useEffect(()=>{if(!p||!u.current)return;const T=u.current.children[b];T==null||T.scrollIntoView({block:"nearest"})},[b,p]);const $=l?A.sanitizeString(l):void 0,S=s?A.sanitizeString(s):void 0;return e.jsxs("div",{className:x.tkx("relative font-sans"),style:{width:"100%"},children:[$&&e.jsx("label",{className:x.tkx("block text-sm font-medium mb-1"),style:{color:a.text},children:$}),e.jsx("textarea",{ref:f,role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-label":$??"Mentions input",value:d,placeholder:S,onChange:I,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:a.surface,borderColor:a.border,color:a.text,minHeight:80,outline:"none"},rows:3}),p&&w.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:a.surface,borderColor:a.border,maxHeight:200,top:"100%",marginTop:4,listStyle:"none",padding:0,boxShadow:`0 4px 12px ${a.bg}80`,animation:c?"none":"tkxFadeIn 0.15s ease"},children:w.map((T,E)=>e.jsxs("li",{role:"option","aria-selected":E===b,className:x.tkx("flex items-center gap-3 px-3 py-2 cursor-pointer text-sm"),style:{backgroundColor:E===b?a.surfaceAlt:"transparent",color:a.text},onMouseDown:C=>{C.preventDefault(),v(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:a.textMuted,marginLeft:"auto"},children:[o,A.sanitizeString(T.value)]})]},T.value))})]})}function Yl(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 Kl(t){let n=t;return()=>(n=n*1664525+1013904223|0,(n>>>0)/4294967295)}const Ul={L:.38,M:.42,Q:.48,H:.55};function Xl(t,n,r){const o=Yl(t),s=Kl(o),l=Ul[r]??.42,a=Array.from({length:n},()=>Array.from({length:n},()=>!1)),c=(f,u)=>{for(let d=0;d<7;d++)for(let h=0;h<7;h++){const p=d===0||d===6||h===0||h===6,m=d>=2&&d<=4&&h>=2&&h<=4;a[f+d][u+h]=p||m}};c(0,0),c(0,n-7),c(n-7,0);for(let f=7;f<n-7;f++)a[6][f]=f%2===0,a[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)||(a[f][u]=s()<l);return a}function Zl({value:t,size:n=160,color:r,bgColor:o,errorLevel:s="M",icon:l,bordered:a=!0}){const c=_.useTheme(),f=J.useReducedMotion(),u=i.useRef(null),d=A.sanitizeString(t),h=r??c.text,p=o??c.surface,m=25,y=i.useMemo(()=>Xl(d,m,s),[d,s]);return i.useEffect(()=>{const k=u.current;if(!k)return;const b=k.getContext("2d");if(!b)return;const g=window.devicePixelRatio||1;k.width=n*g,k.height=n*g,b.scale(g,g);const M=n/m;b.fillStyle=p,b.fillRect(0,0,n,n),b.fillStyle=h;for(let j=0;j<m;j++)for(let w=0;w<m;w++)y[j][w]&&b.fillRect(w*M,j*M,M,M);if(l){const j=n*.22,w=(n-j)/2;b.fillStyle=p,b.fillRect(w-2,w-2,j+4,j+4);const I=new Image;I.crossOrigin="anonymous",I.onload=()=>{b.drawImage(I,w,w,j,j)},I.src=A.sanitizeString(l)}},[y,n,h,p,l]),e.jsx("div",{role:"img","aria-label":`QR code for: ${d}`,className:x.tkx("inline-block rounded-lg"),style:{padding:a?12:0,backgroundColor:a?p:"transparent",border:a?`1px solid ${c.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 Gl={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 ql(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 Ql({status:t,title:n,subTitle:r,icon:o,extra:s}){const l=_.useTheme(),a=J.useReducedMotion(),c=ql(t,l),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:a?"none":"tkxFadeIn 0.3s ease"},children:[e.jsx("div",{className:x.tkx("mb-6"),children:o??Gl[t](c)}),e.jsx("h2",{className:x.tkx("text-xl font-semibold m-0 mb-2"),style:{color:l.text},children:f}),u&&e.jsx("p",{className:x.tkx("text-sm m-0 mb-6 max-w-md leading-relaxed"),style:{color:l.textMuted},children:u}),s&&e.jsx("div",{className:x.tkx("flex items-center gap-3 mt-4"),children:s})]})}function Jl(t){const n=document.querySelector(t);return n?n.getBoundingClientRect():null}function ea(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 ta({steps:t,isOpen:n=!1,onClose:r,current:o,onChange:s}){const l=_.useTheme(),a=J.useReducedMotion(),[c,f]=i.useState(0),u=o??c,d=i.useRef(null),[h,p]=i.useState({top:0,left:0}),[m,y]=i.useState(null),k=t[u],b=i.useCallback(()=>{if(!k)return;const S=Jl(k.target);if(y(S),S&&d.current){const T=d.current.offsetWidth,E=d.current.offsetHeight;p(ea(S,k.placement??"bottom",T,E))}},[k]);i.useEffect(()=>{if(n)return b(),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[n,u,b]),i.useEffect(()=>{var S;n&&((S=d.current)==null||S.focus())},[n,u]);const g=i.useCallback(S=>{f(S),s==null||s(S)},[s]),M=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 w=6,I=A.sanitizeString(k.title),v=A.sanitizeString(k.description),$=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-w}px 100%, ${m.left-w}px ${m.top-w}px, ${m.right+w}px ${m.top-w}px, ${m.right+w}px ${m.bottom+w}px, ${m.left-w}px ${m.bottom+w}px, ${m.left-w}px 100%, 100% 100%, 100% 0%)`:void 0,transition:a?"none":"clip-path 0.25s ease"},onClick:r}),e.jsxs("div",{ref:d,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:l.surface,border:`1px solid ${l.border}`,borderRadius:10,padding:20,boxShadow:`0 8px 24px ${l.bg}80`,animation:a?"none":"tkxFadeIn 0.2s ease",fontFamily:"inherit"},onKeyDown:S=>{S.key==="Escape"&&(r==null||r())},children:[e.jsx("h3",{className:x.tkx("m-0 mb-2 text-base font-semibold"),style:{color:l.text},children:I}),e.jsx("p",{className:x.tkx("m-0 mb-4 text-sm leading-relaxed"),style:{color:l.textMuted},children:v}),e.jsx("div",{className:x.tkx("flex items-center gap-1 mb-4"),"aria-label":"Tour progress",children:t.map((S,T)=>e.jsx("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",backgroundColor:T===u?l.primary:l.border,transition:a?"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:l.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:l.border,color:l.text},children:"Prev"}),e.jsx("button",{type:"button","aria-label":u===t.length-1?"Finish tour":"Next step",onClick:M,className:x.tkx("rounded-md border-0 px-4 py-1 text-sm cursor-pointer font-medium"),style:{backgroundColor:l.primary,color:"#fff"},children:u===t.length-1?"Finish":"Next"})]})]})]})]});return Le.createPortal($,document.body)}function na(t,n,r,o,s){const l=document.createElement("canvas"),a=l.getContext("2d");if(!a)return"";const c=o*1.5,f=t.length*c,u=Math.max(...t.map(m=>m.length))*o*.6,d=r[0]+u,h=r[1]+f,p=2;return l.width=d*p,l.height=h*p,a.scale(p,p),a.translate(d/2,h/2),a.rotate(n*Math.PI/180),a.font=`${o}px sans-serif`,a.fillStyle=s,a.textAlign="center",a.textBaseline="middle",t.forEach((m,y)=>{const k=(y-(t.length-1)/2)*c;a.fillText(m,0,k)}),l.toDataURL()}function ra({text:t,children:n,rotate:r=-22,gap:o=[100,100],fontSize:s=14,color:l,zIndex:a=10}){const c=_.useTheme(),f=J.useReducedMotion(),u=i.useRef(null),[d,h]=i.useState(""),p=i.useMemo(()=>(Array.isArray(t)?t:[t]).map(k=>A.sanitizeString(k)),[t]),m=l??`${c.textMuted}22`,y=i.useCallback(()=>na(p,r,o,s,m),[p,r,o,s,m]);return i.useEffect(()=>{const k=y();k&&h(`url(${k})`)},[y]),i.useEffect(()=>{var g;const k=(g=u.current)==null?void 0:g.querySelector("[data-watermark]");if(!k)return;const b=new MutationObserver(()=>{const M=y();M&&(k.style.backgroundImage=`url(${M})`)});return b.observe(k,{attributes:!0,attributeFilter:["style"]}),()=>b.disconnect()},[y]),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:a,backgroundImage:d,backgroundRepeat:"repeat",animation:f?"none":"tkxFadeIn 0.3s ease"}})]})}function Fn(t){if(t)try{return t()}catch{return window}return window}function sa(t){if(t instanceof Window)return{top:0,bottom:t.innerHeight};const n=t.getBoundingClientRect();return{top:n.top,bottom:n.bottom}}function oa({children:t,offsetTop:n,offsetBottom:r,onChange:o,target:s}){const l=_.useTheme(),a=J.useReducedMotion(),c=i.useRef(null),f=i.useRef(null),[u,d]=i.useState(!1),[h,p]=i.useState({width:0,height:0}),m=i.useRef(!1),y=i.useMemo(()=>A.sanitizeString("Sticky content"),[]),k=i.useCallback(()=>{const M=c.current;if(!M)return;const j=M.getBoundingClientRect(),w=sa(Fn(s));let I=!1;n!==void 0?I=j.top-w.top<=n:r!==void 0&&(I=w.bottom-j.bottom<=r),I!==m.current&&(m.current=I,d(I),p({width:j.width,height:j.height}),o==null||o(I))},[n,r,o,s]);i.useEffect(()=>{const M=Fn(s);return k(),M.addEventListener("scroll",k,{passive:!0}),window.addEventListener("resize",k),()=>{M.removeEventListener("scroll",k),window.removeEventListener("resize",k)}},[k,s]);const b=u?{position:"fixed",zIndex:100,...n!==void 0?{top:n}:{},...r!==void 0?{bottom:r}:{},width:h.width||void 0,transition:a?"none":"box-shadow 0.2s ease",boxShadow:`0 2px 8px ${l.border}`}:{},g=u?{height:h.height,width:h.width}:{};return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:c,"aria-hidden":u,style:g}),e.jsx("div",{ref:f,role:"region","aria-label":y,className:x.tkx(u?"tkx-affixed":""),style:b,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:l}){const a=t.key===n,c=A.sanitizeString(t.title);return e.jsxs("li",{role:"none",style:{listStyle:"none"},children:[e.jsx("a",{role:"treeitem","aria-current":a?"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:a?s.primary:s.textMuted,fontWeight:a?600:400,borderLeft:`2px solid ${a?s.primary:"transparent"}`,transition:l?"none":"color 0.15s ease, border-color 0.15s ease"},children:c}),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:l},f.key))})]})}function ia({items:t,offsetTop:n=0,getCurrentAnchor:r,onChange:o}){var p;const s=_.useTheme(),l=J.useReducedMotion(),[a,c]=i.useState(((p=t[0])==null?void 0:p.key)??""),f=i.useRef(!1),u=Dr(t),d=i.useCallback(()=>{var y;if(f.current)return;let m=((y=u[0])==null?void 0:y.key)??"";for(const k of u){const b=Hn(k.href),g=document.getElementById(b);g&&g.getBoundingClientRect().top<=n+10&&(m=k.key)}r&&(m=r(m)),m!==a&&(c(m),o==null||o(m))},[u,n,r,a,o]);i.useEffect(()=>(window.addEventListener("scroll",d,{passive:!0}),d(),()=>window.removeEventListener("scroll",d)),[d]);const h=i.useCallback(m=>{const y=Hn(m),k=document.getElementById(y);if(!k)return;f.current=!0;const b=k.getBoundingClientRect().top+window.scrollY-n;window.scrollTo({top:b,behavior:l?"auto":"smooth"});const g=u.find(M=>M.href===m);g&&(c(g.key),o==null||o(g.key)),setTimeout(()=>{f.current=!1},800)},[u,n,l,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:a,depth:0,onClick:h,theme:s,reducedMotion:l},m.key))})})}function la(t,n){var s;const r=[t];let o=t;for(const l of n){const a=o.find(c=>c.value===l);if((s=a==null?void 0:a.children)!=null&&s.length)r.push(a.children),o=a.children;else break}return r}function Wr(t,n){const r=[];let o=t;for(const s of n){const l=o.find(a=>a.value===s);if(l)r.push(l),o=l.children??[];else break}return r}function aa(t,n){return Wr(t,n).map(r=>A.sanitizeString(r.label)).join(" / ")}function ca({options:t,value:n=[],onChange:r,placeholder:o="Select...",label:s,multiple:l=!1}){const a=_.useTheme(),c=J.useReducedMotion(),f=i.useRef(null),u=i.useRef(null),[d,h]=i.useState(!1),[p,m]=i.useState(n),[y,k]=i.useState({top:0,left:0,width:0}),b=s?A.sanitizeString(s):void 0,g=A.sanitizeString(o),M=n.length>0?aa(t,n):"";i.useEffect(()=>{if(!d||!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)})},[d]),i.useEffect(()=>{if(!d)return;const N=$=>{var S,T;!((S=f.current)!=null&&S.contains($.target))&&!((T=u.current)!=null&&T.contains($.target))&&h(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[d]);const j=i.useCallback((N,$)=>{var T;if($.disabled)return;const S=[...p.slice(0,N),$.value];if(m(S),!((T=$.children)!=null&&T.length)){const E=Wr(t,S);r==null||r(S,E),l||h(!1)}},[p,t,r,l]),w=i.useCallback(N=>{var $;N.key==="Escape"?(h(!1),($=f.current)==null||$.focus()):(N.key==="Enter"||N.key===" ")&&(d||(N.preventDefault(),h(!0)))},[d]),I=la(t,p),v=d?Le.createPortal(e.jsx("div",{ref:u,role:"tree","aria-label":b??"Cascader options",className:x.tkx("flex rounded-lg border overflow-hidden"),style:{position:"absolute",zIndex:9999,top:y.top,left:y.left,backgroundColor:a.surface,borderColor:a.border,boxShadow:`0 4px 16px ${a.bg}80`,animation:c?"none":"tkxFadeIn 0.15s ease"},children:I.map((N,$)=>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 ${a.border}`:"none"},children:N.map(S=>{var C;const T=p[$]===S.value,E=A.sanitizeString(S.label);return e.jsxs("li",{role:"treeitem","aria-selected":T,"aria-disabled":S.disabled||void 0,"aria-expanded":(C=S.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?a.surfaceAlt:"transparent",color:S.disabled?a.textMuted:a.text,opacity:S.disabled?.5:1,cursor:S.disabled?"not-allowed":"pointer"},onClick:()=>j($,S),onMouseEnter:()=>{S.disabled||m(H=>[...H.slice(0,$),S.value])},children:[e.jsx("span",{children:E}),S.children&&S.children.length>0&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:a.textMuted,flexShrink:0},children:e.jsx("path",{d:"M10 6l6 6-6 6V6z"})})]},S.value)})},$))}),document.body):null;return e.jsxs("div",{className:x.tkx("relative font-sans"),onKeyDown:w,children:[b&&e.jsx("label",{className:x.tkx("block text-sm font-medium mb-1"),style:{color:a.text},children:b}),e.jsxs("button",{ref:f,type:"button",role:"combobox","aria-expanded":d,"aria-haspopup":"tree","aria-label":b??"Cascader",className:x.tkx("w-full flex items-center justify-between rounded-lg border px-3 py-2 text-sm cursor-pointer"),style:{backgroundColor:a.surface,borderColor:d?a.primary:a.border,color:M?a.text:a.textMuted,outline:"none",minHeight:38,textAlign:"left"},onClick:()=>h(N=>!N),children:[e.jsx("span",{className:x.tkx("truncate"),children:M||g}),e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",style:{color:a.textMuted,transform:d?"rotate(180deg)":"rotate(0deg)",transition:c?"none":"transform 0.2s ease",flexShrink:0},children:e.jsx("path",{d:"M7 10l5 5 5-5H7z"})})]}),v]})}const da={sm:"8px 12px",md:"12px 16px",lg:"16px 20px"};function ua({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 fa({items:t,header:n,footer:r,bordered:o=!0,size:s="md",loading:l=!1,emptyText:a="No data",grid:c}){const f=_.useTheme(),u=J.useReducedMotion(),d=A.sanitizeString(a),h=da[s],p=!!c,m=(c==null?void 0:c.column)??1,y=(c==null?void 0:c.gutter)??16;return e.jsxs("div",{role:"list","aria-label":"List","aria-busy":l,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}),l&&e.jsx("div",{children:Array.from({length:3}).map((k,b)=>e.jsx(ua,{theme:f,reducedMotion:u},b))}),!l&&t.length===0&&e.jsx("div",{role:"status",className:x.tkx("text-center py-12 text-sm"),style:{color:f.textMuted},children:d}),!l&&t.length>0&&e.jsx("div",{style:p?{display:"grid",gridTemplateColumns:`repeat(${m}, 1fr)`,gap:y,padding:y}:void 0,children:t.map((k,b)=>{const g=A.sanitizeString(k.title),M=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&&b<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 ${b*.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}),M&&e.jsx("div",{className:x.tkx("text-xs mt-1 leading-relaxed"),style:{color:f.textMuted},children:M})]}),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 xa({locale:t="en-US",direction:n,strings:r,children:o}){const s=i.useMemo(()=>{const l=nt.LOCALES[t]??nt.enUS,a=r?{...l,...r}:l,c=n??(nt.isRTL(t)?"rtl":"ltr");return{locale:t,direction:c,strings:a}},[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 pa({contentId:t="tkx-main-content",label:n="Skip to main content"}){return e.jsx("a",{href:`#${t}`,className:"tkx-skip-nav",children:n})}function ha({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 ma({active:t,children:n,as:r="div"}){const o=J.useFocusTrap(t);return e.jsx(r,{ref:o,children:n})}function ga({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(),l=n?n.offsetHeight:320,a=n?n.offsetWidth:200,c=window.innerWidth,f=window.innerHeight,u=window.scrollX,d=window.scrollY;let h=0,p=0;switch(r){case"bottom-start":h=s.bottom+d+o,p=s.left+u;break;case"bottom-end":h=s.bottom+d+o,p=s.right+u-a;break;case"top-start":h=s.top+d-o-l,p=s.left+u;break;case"top-end":h=s.top+d-o-l,p=s.right+u-a;break;case"right":h=s.top+d,p=s.right+u+o;break;case"left":h=s.top+d,p=s.left+u-o-a;break;default:h=s.bottom+d+o,p=s.left+u}return r.startsWith("bottom")&&s.bottom+l>f&&(h=s.top+d-o-l),r.startsWith("top")&&s.top-l<0&&(h=s.bottom+d+o),p+a>c+u&&(p=c+u-a-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 ba(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 ya({groups:t,position:n,maxHeight:r,minWidth:o,selectedKeys:s,multiSelect:l,searchable:a,searchPlaceholder:c,onSelect:f,onClose:u,renderItem:d,menuRef:h,isPortal:p,menuId:m}){const y=_.useTheme(),[k,b]=i.useState(""),[g,M]=i.useState(0),[j,w]=i.useState(null),[I,v]=i.useState(0),N=i.useRef(null),$=i.useRef([]),S=i.useRef([]),T=k?t.map(R=>({...R,items:R.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(O=>O.label.toLowerCase().includes(k.toLowerCase())))})})).filter(R=>R.items.length>0):t,E=ba(T,k);i.useEffect(()=>{var R;a&&N.current?N.current.focus():(R=$.current[0])==null||R.focus(),M(0)},[a]),i.useEffect(()=>{var R;(!a||k!=="")&&((R=$.current[g])==null||R.focus())},[g,a,k]);const C=i.useCallback(R=>{var B,V,D;switch(R.key){case"ArrowDown":if(R.preventDefault(),j){const L=(((B=E.find(P=>P.key===j))==null?void 0:B.children)??[]).filter(P=>!P.disabled);v(P=>Math.min(P+1,L.length-1))}else M(O=>Math.min(O+1,E.length-1));break;case"ArrowUp":R.preventDefault(),j?v(O=>Math.max(O-1,0)):M(O=>Math.max(O-1,0));break;case"ArrowRight":{R.preventDefault();const O=E[g];(V=O==null?void 0:O.children)!=null&&V.length&&(w(O.key),v(0));break}case"ArrowLeft":R.preventDefault(),w(null);break;case"Enter":case" ":if(R.preventDefault(),j){const P=(((D=E.find(W=>W.key===j))==null?void 0:D.children)??[]).filter(W=>!W.disabled)[I];P&&f(P.key,P)}else{const O=E[g];O&&f(O.key,O)}break;case"Escape":R.preventDefault(),j?w(null):u();break;case"Tab":u();break}},[E,g,u,f,j,I]);i.useEffect(()=>{var R;j&&((R=S.current[I])==null||R.focus())},[I,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:y.surface,border:`1px solid ${y.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:`
|
|
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
|
-
`}),a&&e.jsx("div",{style:{padding:"8px 8px 4px"},children:e.jsx("input",{ref:N,type:"text",value:k,onChange:R=>{b(R.target.value),M(0)},placeholder:c,"aria-label":"Search items",style:{width:"100%",boxSizing:"border-box",padding:"6px 10px",background:y.surfaceAlt,border:`1px solid ${y.border}`,borderRadius:6,color:y.text,fontSize:13,outline:"none"}})}),T.length===0&&e.jsx("div",{style:{padding:"12px 16px",color:y.textMuted,fontSize:13,textAlign:"center"},children:"No results found"}),T.map((R,B)=>e.jsxs("div",{role:"group","aria-label":R.label,children:[R.label&&e.jsx("div",{style:{padding:"8px 12px 4px",fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:y.textMuted},children:A.sanitizeString(R.label)}),R.items.map(V=>{var ne;const D=z;V.disabled||z++;const O=s.includes(V.key),L=D===g&&!V.disabled,P=!!((ne=V.children)!=null&&ne.length),W=j===V.key,K=d?d(V,O):e.jsx(On,{item:V,isSelected:O,isFocused:L,multiSelect:l,query:k,theme:y,hasSubmenu:P});return e.jsxs("div",{children:[V.divider&&e.jsx("div",{role:"separator",style:{height:1,background:y.border,margin:"4px 0"}}),e.jsxs("div",{ref:Z=>{$.current[D]=Z},role:"menuitem","aria-disabled":V.disabled,"aria-checked":l?O:void 0,"aria-selected":l?void 0:O,"aria-haspopup":P?"menu":void 0,"aria-expanded":P?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||(P?(w(W?null:V.key),v(0)):f(V.key,V))},onMouseEnter:()=>{V.disabled||(M(D),P?(w(V.key),v(0)):w(null))},onFocus:()=>{V.disabled||M(D)},children:[K,P&&W&&e.jsx("div",{role:"menu",style:{position:"absolute",top:0,left:"100%",minWidth:180,background:y.surface,border:`1px solid ${y.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===I;return e.jsx("div",{ref:te=>{S.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:()=>v(ie),children:e.jsx(On,{item:Z,isSelected:fe,isFocused:pe,multiSelect:l,query:k,theme:y,hasSubmenu:!1})},Z.key)})})]})]},V.key)})]},B))]})}function On({item:t,isSelected:n,isFocused:r,multiSelect:o,query:s,theme:l,hasSubmenu:a}){const c=r?t.danger?`${l.danger}20`:`${l.primary}18`:"transparent";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:c,transition:"background 80ms",color:t.danger?l.danger:l.text,fontSize:14,userSelect:"none"},children:[o&&e.jsx("div",{style:{width:16,height:16,border:`2px solid ${n?l.primary:l.border}`,borderRadius:4,background:n?l.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:l.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}),t.icon&&e.jsx("span",{style:{display:"flex",alignItems:"center",flexShrink:0,color:t.danger?l.danger:l.textMuted},children:t.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:n&&!o?600:400},children:Vn(t.label,s)}),t.description&&e.jsx("div",{style:{fontSize:12,color:l.textMuted,marginTop:1},children:Vn(t.description,s)})]}),t.badge!==void 0&&e.jsx("span",{style:{background:l.primary,color:l.bg,fontSize:11,fontWeight:700,borderRadius:10,padding:"1px 7px",flexShrink:0},children:t.badge}),t.shortcut&&!a&&e.jsx("span",{style:{fontSize:12,color:l.textMuted,flexShrink:0},children:t.shortcut}),a&&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:l.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:l.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function ya({trigger:t,items:n,groups:r,placement:o="bottom-start",onSelect:s,selectedKeys:l,multiSelect:a=!1,searchable:c=!1,searchPlaceholder:f="Search…",closeOnSelect:u,disabled:d=!1,maxHeight:h=320,minWidth:p=200,open:m,onOpenChange:y,portal:k=!0,offset:b=6,renderItem:g}){const[M,j]=i.useState(!1),[w,I]=i.useState([]),[v,N]=i.useState({top:0,left:0,minWidth:p}),$=i.useRef(null),S=i.useRef(null),T=i.useId(),E=m!==void 0?m:M,C=l!==void 0?l:w,H=u!==void 0?u:!a,z=r??(n?[{items:n}]:[{items:[]}]),R=i.useCallback(L=>{m===void 0&&j(L),y==null||y(L)},[m,y]),B=i.useCallback((L,P)=>{a&&l===void 0&&I(W=>W.includes(L)?W.filter(K=>K!==L):[...W,L]),s==null||s(L,P),H&&R(!1)},[a,l,s,H,R]),V=i.useCallback(()=>R(!1),[R]);i.useEffect(()=>{if(E&&$.current){const L=Hn($.current,S.current,o,b);N(L)}},[E,o,b]),i.useEffect(()=>{if(E&&$.current&&S.current){const L=Hn($.current,S.current,o,b);N(L)}},[E,o,b]),i.useEffect(()=>{if(!E)return;const L=P=>{const W=P.target;$.current&&!$.current.contains(W)&&S.current&&!S.current.contains(W)&&R(!1)};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[E,R]);const D=()=>{d||R(!E)},O=E?e.jsx(ba,{groups:z,position:v,maxHeight:h,minWidth:p,selectedKeys:C,multiSelect:a,searchable:c,searchPlaceholder:f,onSelect:B,onClose:V,renderItem:g,menuRef:S,isPortal:k,menuId:T}):null;return e.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[e.jsx("div",{ref:$,onClick:D,"aria-haspopup":"menu","aria-expanded":E,"aria-controls":E?T:void 0,"aria-disabled":d,style:{cursor:d?"not-allowed":"pointer",opacity:d?.5:1,display:"inline-block"},children:t}),k&&typeof document<"u"?Le.createPortal(O,document.body):O]})}exports.LRUCache=_.LRUCache;exports.Quantum=_.Quantum;exports.TKX=_.TKX;exports.ThemeContext=_.ThemeContext;exports.ThemeProvider=_.ThemeProvider;exports.WCAGEngine=_.WCAGEngine;exports.auroraLight=_.auroraLight;exports.batchUpdate=_.batchUpdate;exports.breakpoints=_.breakpoints;exports.contrastRatio=_.contrastRatio;exports.createFocusTrap=_.createFocusTrap;exports.createTheme=_.createTheme;exports.css=_.css;exports.cssVar=_.cssVar;exports.extractCSS=_.extractCSS;exports.fnv1aHash=_.fnv1aHash;exports.fromObject=_.fromObject;exports.generatePalette=_.generatePalette;exports.getAccessibleForeground=_.getAccessibleForeground;exports.injectStyles=_.injectStyles;exports.keyframes=_.keyframes;exports.meetsAA=_.meetsAA;exports.meetsAAA=_.meetsAAA;exports.memoize=_.memoize;exports.prefersHighContrast=_.prefersHighContrast;exports.prefersReducedMotion=_.prefersReducedMotion;exports.quantumDark=_.quantumDark;exports.radii=_.radii;exports.responsive=_.responsive;exports.shadows=_.shadows;exports.spacing=_.spacing;exports.typography=_.typography;exports.useTheme=_.useTheme;exports.zIndex=_.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.TkxForm=Q.TkxForm;exports.TkxFormField=Q.TkxFormField;exports.useAnnounce=Q.useAnnounce;exports.useClickOutside=Q.useClickOutside;exports.useEscapeKey=Q.useEscapeKey;exports.useFocusTrap=Q.useFocusTrap;exports.useHighContrast=Q.useHighContrast;exports.useReducedMotion=Q.useReducedMotion;exports.useTkxForm=Q.useTkxForm;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.I18nContext=nt.I18nContext;exports.isRTL=nt.isRTL;exports.useDirection=nt.useDirection;exports.useI18n=nt.useI18n;exports.useLocale=nt.useLocale;exports.FocusTrap=ha;exports.I18nProvider=fa;exports.LiveRegion=pa;exports.SIZE_BORDER_RADIUS=ml;exports.SIZE_FONT=xl;exports.SIZE_HEIGHT=fl;exports.SIZE_ICON=gl;exports.SIZE_PADDING_X=pl;exports.SIZE_PADDING_Y=hl;exports.SkipNav=xa;exports.TkxAccordion=ir;exports.TkxAffix=sa;exports.TkxAlert=ns;exports.TkxAnchor=oa;exports.TkxAppBar=Mi;exports.TkxAutocomplete=oi;exports.TkxAvatar=Qn;exports.TkxBadge=Un;exports.TkxBottomNav=Ii;exports.TkxBreadcrumb=ei;exports.TkxButton=_n;exports.TkxCard=Yn;exports.TkxCardBody=Xr;exports.TkxCardFooter=Zr;exports.TkxCardHeader=Ur;exports.TkxCarousel=wr;exports.TkxCascader=aa;exports.TkxChat=po;exports.TkxChatBubble=ur;exports.TkxCheckbox=tr;exports.TkxClock=hr;exports.TkxCol=Nr;exports.TkxColorPicker=Ho;exports.TkxCommand=vr;exports.TkxConfigProvider=Lr;exports.TkxContent=Ir;exports.TkxCountdown=Fl;exports.TkxDataGrid=Fi;exports.TkxDatePicker=lr;exports.TkxDivider=Jn;exports.TkxDrawer=Ws;exports.TkxDropdown=ya;exports.TkxEmpty=Ll;exports.TkxFileUpload=no;exports.TkxFooter=zr;exports.TkxHeader=Cr;exports.TkxImage=Qs;exports.TkxInput=Kn;exports.TkxLayout=Tr;exports.TkxList=ua;exports.TkxMasonry=_i;exports.TkxMentions=Ol;exports.TkxMenu=pr;exports.TkxModal=os;exports.TkxNumberInput=yr;exports.TkxOTP=kr;exports.TkxPagination=cr;exports.TkxParagraph=Ml;exports.TkxPopover=ni;exports.TkxProgress=Xn;exports.TkxQRCode=Xl;exports.TkxRadio=rr;exports.TkxRadioGroup=js;exports.TkxRating=co;exports.TkxResult=ql;exports.TkxRichTextDisplay=nl;exports.TkxRow=Er;exports.TkxSegmented=Vl;exports.TkxSelect=er;exports.TkxSider=$r;exports.TkxSkeleton=xt;exports.TkxSlider=ar;exports.TkxSnackbar=Ri;exports.TkxSpeedDial=vi;exports.TkxSpin=zl;exports.TkxStatistic=Pl;exports.TkxStepper=gr;exports.TkxTab=as;exports.TkxTabList=ls;exports.TkxTabPanel=ds;exports.TkxTabPanels=cs;exports.TkxTable=ms;exports.TkxTabs=is;exports.TkxTag=fr;exports.TkxTagInput=ko;exports.TkxText=Sl;exports.TkxThinkingIndicator=dr;exports.TkxTimeline=jo;exports.TkxTitle=jl;exports.TkxToastProvider=Es;exports.TkxToggle=Zn;exports.TkxToolbar=ui;exports.TkxTooltip=fs;exports.TkxTour=ea;exports.TkxTransferList=hi;exports.TkxTreeView=ci;exports.TkxVideoPlayer=mr;exports.TkxWatermark=na;exports.VisuallyHidden=ma;exports.getLocaleDisplayName=vl;exports.isRtlLocale=kl;exports.useComponentSize=ul;exports.useConfig=vt;exports.useLogicalSpacing=yl;exports.usePrefixCls=dl;exports.useRtlFlip=bl;exports.useTkxCommand=Xo;exports.useToast=Ts;
|
|
124
|
+
`}),a&&e.jsx("div",{style:{padding:"8px 8px 4px"},children:e.jsx("input",{ref:N,type:"text",value:k,onChange:R=>{b(R.target.value),M(0)},placeholder:c,"aria-label":"Search items",style:{width:"100%",boxSizing:"border-box",padding:"6px 10px",background:y.surfaceAlt,border:`1px solid ${y.border}`,borderRadius:6,color:y.text,fontSize:13,outline:"none"}})}),T.length===0&&e.jsx("div",{style:{padding:"12px 16px",color:y.textMuted,fontSize:13,textAlign:"center"},children:"No results found"}),T.map((R,B)=>e.jsxs("div",{role:"group","aria-label":R.label,children:[R.label&&e.jsx("div",{style:{padding:"8px 12px 4px",fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:y.textMuted},children:A.sanitizeString(R.label)}),R.items.map(V=>{var ne;const D=z;V.disabled||z++;const O=s.includes(V.key),L=D===g&&!V.disabled,P=!!((ne=V.children)!=null&&ne.length),W=j===V.key,K=d?d(V,O):e.jsx(_n,{item:V,isSelected:O,isFocused:L,multiSelect:l,query:k,theme:y,hasSubmenu:P});return e.jsxs("div",{children:[V.divider&&e.jsx("div",{role:"separator",style:{height:1,background:y.border,margin:"4px 0"}}),e.jsxs("div",{ref:Z=>{$.current[D]=Z},role:"menuitem","aria-disabled":V.disabled,"aria-checked":l?O:void 0,"aria-selected":l?void 0:O,"aria-haspopup":P?"menu":void 0,"aria-expanded":P?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||(P?(w(W?null:V.key),v(0)):f(V.key,V))},onMouseEnter:()=>{V.disabled||(M(D),P?(w(V.key),v(0)):w(null))},onFocus:()=>{V.disabled||M(D)},children:[K,P&&W&&e.jsx("div",{role:"menu",style:{position:"absolute",top:0,left:"100%",minWidth:180,background:y.surface,border:`1px solid ${y.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===I;return e.jsx("div",{ref:te=>{S.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:()=>v(ie),children:e.jsx(_n,{item:Z,isSelected:fe,isFocused:pe,multiSelect:l,query:k,theme:y,hasSubmenu:!1})},Z.key)})})]})]},V.key)})]},B))]})}function _n({item:t,isSelected:n,isFocused:r,multiSelect:o,query:s,theme:l,hasSubmenu:a}){const c=r?t.danger?`${l.danger}20`:`${l.primary}18`:"transparent";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:c,transition:"background 80ms",color:t.danger?l.danger:l.text,fontSize:14,userSelect:"none"},children:[o&&e.jsx("div",{style:{width:16,height:16,border:`2px solid ${n?l.primary:l.border}`,borderRadius:4,background:n?l.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:l.bg,strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}),t.icon&&e.jsx("span",{style:{display:"flex",alignItems:"center",flexShrink:0,color:t.danger?l.danger:l.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:l.textMuted,marginTop:1},children:On(t.description,s)})]}),t.badge!==void 0&&e.jsx("span",{style:{background:l.primary,color:l.bg,fontSize:11,fontWeight:700,borderRadius:10,padding:"1px 7px",flexShrink:0},children:t.badge}),t.shortcut&&!a&&e.jsx("span",{style:{fontSize:12,color:l.textMuted,flexShrink:0},children:t.shortcut}),a&&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:l.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:l.primary,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})}function ka({trigger:t,items:n,groups:r,placement:o="bottom-start",onSelect:s,selectedKeys:l,multiSelect:a=!1,searchable:c=!1,searchPlaceholder:f="Search…",closeOnSelect:u,disabled:d=!1,maxHeight:h=320,minWidth:p=200,open:m,onOpenChange:y,portal:k=!0,offset:b=6,renderItem:g}){const[M,j]=i.useState(!1),[w,I]=i.useState([]),[v,N]=i.useState({top:0,left:0,minWidth:p}),$=i.useRef(null),S=i.useRef(null),T=i.useId(),E=m!==void 0?m:M,C=l!==void 0?l:w,H=u!==void 0?u:!a,z=r??(n?[{items:n}]:[{items:[]}]),R=i.useCallback(L=>{m===void 0&&j(L),y==null||y(L)},[m,y]),B=i.useCallback((L,P)=>{a&&l===void 0&&I(W=>W.includes(L)?W.filter(K=>K!==L):[...W,L]),s==null||s(L,P),H&&R(!1)},[a,l,s,H,R]),V=i.useCallback(()=>R(!1),[R]);i.useEffect(()=>{if(E&&$.current){const L=Vn($.current,S.current,o,b);N(L)}},[E,o,b]),i.useEffect(()=>{if(E&&$.current&&S.current){const L=Vn($.current,S.current,o,b);N(L)}},[E,o,b]),i.useEffect(()=>{if(!E)return;const L=P=>{const W=P.target;$.current&&!$.current.contains(W)&&S.current&&!S.current.contains(W)&&R(!1)};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[E,R]);const D=()=>{d||R(!E)},O=E?e.jsx(ya,{groups:z,position:v,maxHeight:h,minWidth:p,selectedKeys:C,multiSelect:a,searchable:c,searchPlaceholder:f,onSelect:B,onClose:V,renderItem:g,menuRef:S,isPortal:k,menuId:T}):null;return e.jsxs("div",{style:{display:"inline-block",position:"relative"},children:[e.jsx("div",{ref:$,onClick:D,"aria-haspopup":"menu","aria-expanded":E,"aria-controls":E?T:void 0,"aria-disabled":d,style:{cursor:d?"not-allowed":"pointer",opacity:d?.5:1,display:"inline-block"},children:t}),k&&typeof document<"u"?Le.createPortal(O,document.body):O]})}exports.LRUCache=_.LRUCache;exports.Quantum=_.Quantum;exports.TKX=_.TKX;exports.ThemeContext=_.ThemeContext;exports.ThemeProvider=_.ThemeProvider;exports.WCAGEngine=_.WCAGEngine;exports.auroraLight=_.auroraLight;exports.batchUpdate=_.batchUpdate;exports.breakpoints=_.breakpoints;exports.contrastRatio=_.contrastRatio;exports.createFocusTrap=_.createFocusTrap;exports.createTheme=_.createTheme;exports.css=_.css;exports.cssVar=_.cssVar;exports.extractCSS=_.extractCSS;exports.fnv1aHash=_.fnv1aHash;exports.fromObject=_.fromObject;exports.generatePalette=_.generatePalette;exports.getAccessibleForeground=_.getAccessibleForeground;exports.injectStyles=_.injectStyles;exports.keyframes=_.keyframes;exports.meetsAA=_.meetsAA;exports.meetsAAA=_.meetsAAA;exports.memoize=_.memoize;exports.prefersHighContrast=_.prefersHighContrast;exports.prefersReducedMotion=_.prefersReducedMotion;exports.quantumDark=_.quantumDark;exports.radii=_.radii;exports.responsive=_.responsive;exports.shadows=_.shadows;exports.spacing=_.spacing;exports.typography=_.typography;exports.useTheme=_.useTheme;exports.zIndex=_.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=ma;exports.I18nProvider=xa;exports.LiveRegion=ha;exports.SIZE_BORDER_RADIUS=gl;exports.SIZE_FONT=pl;exports.SIZE_HEIGHT=xl;exports.SIZE_ICON=bl;exports.SIZE_PADDING_X=hl;exports.SIZE_PADDING_Y=ml;exports.SkipNav=pa;exports.TkxAccordion=lr;exports.TkxAffix=oa;exports.TkxAlert=rs;exports.TkxAnchor=ia;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=ca;exports.TkxChat=ho;exports.TkxChatBubble=fr;exports.TkxCheckbox=nr;exports.TkxClock=mr;exports.TkxCol=Lr;exports.TkxColorPicker=Vo;exports.TkxCommand=wr;exports.TkxConfigProvider=Rr;exports.TkxContent=zr;exports.TkxCountdown=Hl;exports.TkxDataGrid=Hi;exports.TkxDatePicker=ar;exports.TkxDivider=er;exports.TkxDrawer=Ps;exports.TkxDropdown=ka;exports.TkxEmpty=Rl;exports.TkxFileUpload=ro;exports.TkxFooter=Er;exports.TkxHeader=$r;exports.TkxImage=Js;exports.TkxInput=Un;exports.TkxLayout=Cr;exports.TkxList=fa;exports.TkxMasonry=Yi;exports.TkxMentions=_l;exports.TkxMenu=hr;exports.TkxModal=is;exports.TkxNumberInput=kr;exports.TkxOTP=vr;exports.TkxPagination=dr;exports.TkxParagraph=Tl;exports.TkxPopover=ri;exports.TkxProgress=Zn;exports.TkxQRCode=Zl;exports.TkxRadio=sr;exports.TkxRadioGroup=Ss;exports.TkxRating=uo;exports.TkxResult=Ql;exports.TkxRichTextDisplay=rl;exports.TkxRow=Nr;exports.TkxSegmented=Ol;exports.TkxSelect=tr;exports.TkxSider=Ir;exports.TkxSkeleton=xt;exports.TkxSlider=cr;exports.TkxSnackbar=Ai;exports.TkxSpeedDial=wi;exports.TkxSpin=El;exports.TkxStatistic=Fl;exports.TkxStepper=br;exports.TkxTab=cs;exports.TkxTabList=as;exports.TkxTabPanel=us;exports.TkxTabPanels=ds;exports.TkxTable=gs;exports.TkxTabs=ls;exports.TkxTag=xr;exports.TkxTagInput=vo;exports.TkxText=Ml;exports.TkxThinkingIndicator=ur;exports.TkxTimeline=So;exports.TkxTitle=Sl;exports.TkxToastProvider=Ns;exports.TkxToggle=Gn;exports.TkxToolbar=fi;exports.TkxTooltip=xs;exports.TkxTour=ta;exports.TkxTransferList=mi;exports.TkxTreeView=di;exports.TkxVideoPlayer=gr;exports.TkxWatermark=ra;exports.VisuallyHidden=ga;exports.getLocaleDisplayName=wl;exports.isRtlLocale=vl;exports.useComponentSize=fl;exports.useConfig=vt;exports.useLogicalSpacing=kl;exports.usePrefixCls=ul;exports.useRtlFlip=yl;exports.useTkxCommand=Zo;exports.useToast=Cs;
|